diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29b8ac0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +build +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 \ No newline at end of file diff --git a/English.lproj/.svn/all-wcprops b/English.lproj/.svn/all-wcprops new file mode 100644 index 0000000..d4dd167 --- /dev/null +++ b/English.lproj/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/!svn/ver/483/trunk/English.lproj +END +InfoPlist.strings +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/483/trunk/English.lproj/InfoPlist.strings +END diff --git a/English.lproj/.svn/entries b/English.lproj/.svn/entries new file mode 100644 index 0000000..d7aa4af --- /dev/null +++ b/English.lproj/.svn/entries @@ -0,0 +1,69 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/English.lproj +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2008-12-27T08:01:40.325565Z +483 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + + + + + + +0 + +InfoPlist.strings +file + + + + +2009-07-03T20:42:39.000000Z +47eff3f1530a2a5635a1327e8c5330a4 +2008-12-27T08:01:40.325565Z +483 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +202 + diff --git a/English.lproj/.svn/prop-base/InfoPlist.strings.svn-base b/English.lproj/.svn/prop-base/InfoPlist.strings.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/English.lproj/.svn/prop-base/InfoPlist.strings.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/English.lproj/.svn/text-base/InfoPlist.strings.svn-base b/English.lproj/.svn/text-base/InfoPlist.strings.svn-base new file mode 100644 index 0000000..c62f838 Binary files /dev/null and b/English.lproj/.svn/text-base/InfoPlist.strings.svn-base differ diff --git a/English.lproj/InfoPlist.strings b/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..c62f838 Binary files /dev/null and b/English.lproj/InfoPlist.strings differ diff --git a/Info.plist b/Info.plist new file mode 100644 index 0000000..0f226c6 --- /dev/null +++ b/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleName + ${PRODUCT_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.parsekit.ParseKit + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.6b + NSPrincipalClass + + + diff --git a/JSParseKit-Info.plist b/JSParseKit-Info.plist new file mode 100644 index 0000000..4d4add1 --- /dev/null +++ b/JSParseKit-Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + JSParseKit + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/License.txt b/License.txt new file mode 100644 index 0000000..a28d09f --- /dev/null +++ b/License.txt @@ -0,0 +1,175 @@ + + 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. \ No newline at end of file diff --git a/ParseKit.xcodeproj/.svn/all-wcprops b/ParseKit.xcodeproj/.svn/all-wcprops new file mode 100644 index 0000000..ad082e4 --- /dev/null +++ b/ParseKit.xcodeproj/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1402/trunk/ParseKit.xcodeproj +END +project.pbxproj +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1402/trunk/ParseKit.xcodeproj/project.pbxproj +END diff --git a/ParseKit.xcodeproj/.svn/dir-prop-base b/ParseKit.xcodeproj/.svn/dir-prop-base new file mode 100644 index 0000000..e05192c --- /dev/null +++ b/ParseKit.xcodeproj/.svn/dir-prop-base @@ -0,0 +1,12 @@ +K 10 +svn:ignore +V 36 +*.pbxuser +*.mode1v3 +*.perspectivev3 + +K 13 +svn:mergeinfo +V 0 + +END diff --git a/ParseKit.xcodeproj/.svn/entries b/ParseKit.xcodeproj/.svn/entries new file mode 100644 index 0000000..0a758ca --- /dev/null +++ b/ParseKit.xcodeproj/.svn/entries @@ -0,0 +1,69 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/ParseKit.xcodeproj +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-09-26T04:05:15.940742Z +1402 +todd.ditchendorf +has-props + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + + + + + + +0 + +project.pbxproj +file + + + + +2009-09-26T04:04:56.000000Z +a219b667fef5cb9d730c2de94b36d330 +2009-09-26T04:05:15.940742Z +1402 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +309408 + diff --git a/ParseKit.xcodeproj/.svn/text-base/project.pbxproj.svn-base b/ParseKit.xcodeproj/.svn/text-base/project.pbxproj.svn-base new file mode 100644 index 0000000..382638b --- /dev/null +++ b/ParseKit.xcodeproj/.svn/text-base/project.pbxproj.svn-base @@ -0,0 +1,3720 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; + D302C69D0EF044810090E714 /* TDPlistParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36568A60EEF9FE900226554 /* TDPlistParser.m */; }; + D3126D060FFD9BA700CBF4C4 /* PKNegation.m in Sources */ = {isa = PBXBuildFile; fileRef = D3126D040FFD9BA700CBF4C4 /* PKNegation.m */; }; + D3126D0B0FFD9E4B00CBF4C4 /* TDNegationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3126D0A0FFD9E4B00CBF4C4 /* TDNegationTest.m */; }; + D3126DEC0FFDBC1D00CBF4C4 /* PKNegation.m in Sources */ = {isa = PBXBuildFile; fileRef = D3126D040FFD9BA700CBF4C4 /* PKNegation.m */; }; + D315DF720FEF59B600D876C8 /* date.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D315DF710FEF59B600D876C8 /* date.grammar */; }; + D315DF730FEF59B600D876C8 /* date.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D315DF710FEF59B600D876C8 /* date.grammar */; }; + D319E42A106D8A1F008C63DD /* arithmetic.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D319E429106D8A1F008C63DD /* arithmetic.grammar */; }; + D319E42B106D8A1F008C63DD /* arithmetic.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D319E429106D8A1F008C63DD /* arithmetic.grammar */; }; + D319E42E106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */; }; + D319E42F106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */; }; + D31A15260F6DE449002AFDF1 /* javascript.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D31A15250F6DE449002AFDF1 /* javascript.grammar */; }; + D31A15270F6DE449002AFDF1 /* javascript.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D31A15250F6DE449002AFDF1 /* javascript.grammar */; }; + D31A16520F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */; }; + D31A16530F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */; }; + D31FE54C0E60E46100A0803E /* TDTestScaffold.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE54B0E60E46100A0803E /* TDTestScaffold.m */; }; + D31FE5630E60E50800A0803E /* TDAlternationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE54E0E60E50800A0803E /* TDAlternationTest.m */; }; + D31FE5640E60E50800A0803E /* TDLiteralTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5500E60E50800A0803E /* TDLiteralTest.m */; }; + D31FE5650E60E50800A0803E /* TDParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5520E60E50800A0803E /* TDParserTest.m */; }; + D31FE5660E60E50800A0803E /* TDRepetitionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5540E60E50800A0803E /* TDRepetitionTest.m */; }; + D31FE5680E60E50800A0803E /* TDRobotCommandTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5580E60E50800A0803E /* TDRobotCommandTest.m */; }; + D31FE5690E60E50800A0803E /* TDSequenceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE55A0E60E50800A0803E /* TDSequenceTest.m */; }; + D31FE56A0E60E50800A0803E /* TDSymbolTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE55C0E60E50800A0803E /* TDSymbolTest.m */; }; + D31FE56B0E60E50800A0803E /* TDTokenAssemblyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE55E0E60E50800A0803E /* TDTokenAssemblyTest.m */; }; + D31FE56C0E60E50800A0803E /* TDTrackTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5600E60E50800A0803E /* TDTrackTest.m */; }; + D31FE56D0E60E50800A0803E /* TDUppercaseWordTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5620E60E50800A0803E /* TDUppercaseWordTest.m */; }; + D31FE5750E60E55700A0803E /* TDReaderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5720E60E55700A0803E /* TDReaderTest.m */; }; + D31FE5760E60E55700A0803E /* TDTokenizerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5740E60E55700A0803E /* TDTokenizerTest.m */; }; + D31FE5850E60E58C00A0803E /* TDNumberStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5780E60E58C00A0803E /* TDNumberStateTest.m */; }; + D31FE5860E60E58C00A0803E /* TDQuoteStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE57A0E60E58C00A0803E /* TDQuoteStateTest.m */; }; + D31FE5890E60E58C00A0803E /* TDSymbolStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5800E60E58C00A0803E /* TDSymbolStateTest.m */; }; + D31FE58A0E60E58C00A0803E /* TDWhitespaceStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5820E60E58C00A0803E /* TDWhitespaceStateTest.m */; }; + D31FE58B0E60E58C00A0803E /* TDWordStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5840E60E58C00A0803E /* TDWordStateTest.m */; }; + D31FE5960E60E5AC00A0803E /* TDCharacterAssemblyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE58D0E60E5AC00A0803E /* TDCharacterAssemblyTest.m */; }; + D31FE5970E60E5AC00A0803E /* TDCharTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE58F0E60E5AC00A0803E /* TDCharTest.m */; }; + D31FE5980E60E5AC00A0803E /* TDDigitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5910E60E5AC00A0803E /* TDDigitTest.m */; }; + D31FE5990E60E5AC00A0803E /* TDLetterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5930E60E5AC00A0803E /* TDLetterTest.m */; }; + D31FE59A0E60E5AC00A0803E /* TDSpecificCharTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5950E60E5AC00A0803E /* TDSpecificCharTest.m */; }; + D31FE59F0E60E5C000A0803E /* TDRegularParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE59C0E60E5C000A0803E /* TDRegularParser.m */; }; + D31FE5A00E60E5C000A0803E /* TDRegularParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE59E0E60E5C000A0803E /* TDRegularParserTest.m */; }; + D31FE5A90E60E5D500A0803E /* TDFastJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */; }; + D31FE5AA0E60E5D500A0803E /* TDFastJsonParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5A40E60E5D500A0803E /* TDFastJsonParserTest.m */; }; + D31FE5B10E60E64900A0803E /* TDXmlTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5AE0E60E64900A0803E /* TDXmlTokenAssembly.m */; }; + D31FE5B20E60E64900A0803E /* TDXmlTokenizerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5B00E60E64900A0803E /* TDXmlTokenizerTest.m */; }; + D31FE5B70E60E66600A0803E /* TDXmlToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5B40E60E66600A0803E /* TDXmlToken.m */; }; + D31FE5B80E60E66600A0803E /* TDXmlTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5B60E60E66600A0803E /* TDXmlTokenizer.m */; }; + D31FE5DD0E60E69E00A0803E /* TDXmlAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5BA0E60E69E00A0803E /* TDXmlAttribute.m */; }; + D31FE5DE0E60E69E00A0803E /* TDXmlCdata.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5BC0E60E69E00A0803E /* TDXmlCdata.m */; }; + D31FE5DF0E60E69E00A0803E /* TDXmlComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5BE0E60E69E00A0803E /* TDXmlComment.m */; }; + D31FE5E00E60E69E00A0803E /* TDXmlDecl.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C00E60E69E00A0803E /* TDXmlDecl.m */; }; + D31FE5E10E60E69E00A0803E /* TDXmlDoctype.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C20E60E69E00A0803E /* TDXmlDoctype.m */; }; + D31FE5E20E60E69E00A0803E /* TDXmlDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C40E60E69E00A0803E /* TDXmlDocument.m */; }; + D31FE5E30E60E69E00A0803E /* TDXmlEndEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C60E60E69E00A0803E /* TDXmlEndEntity.m */; }; + D31FE5E40E60E69E00A0803E /* TDXmlEndTag.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C80E60E69E00A0803E /* TDXmlEndTag.m */; }; + D31FE5E50E60E69E00A0803E /* TDXmlEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5CA0E60E69E00A0803E /* TDXmlEntity.m */; }; + D31FE5E60E60E69E00A0803E /* TDXmlEntityRef.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5CC0E60E69E00A0803E /* TDXmlEntityRef.m */; }; + D31FE5E70E60E69E00A0803E /* TDXmlFragment.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5CE0E60E69E00A0803E /* TDXmlFragment.m */; }; + D31FE5E80E60E69E00A0803E /* TDXmlNotation.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D00E60E69E00A0803E /* TDXmlNotation.m */; }; + D31FE5E90E60E69E00A0803E /* TDXmlProcessingInstruction.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D20E60E69E00A0803E /* TDXmlProcessingInstruction.m */; }; + D31FE5EA0E60E69E00A0803E /* TDXmlSignificantWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D40E60E69E00A0803E /* TDXmlSignificantWhitespace.m */; }; + D31FE5EB0E60E69E00A0803E /* TDXmlStartTag.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D60E60E69E00A0803E /* TDXmlStartTag.m */; }; + D31FE5EC0E60E69E00A0803E /* TDXmlTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D80E60E69E00A0803E /* TDXmlTerminal.m */; }; + D31FE5ED0E60E69E00A0803E /* TDXmlText.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5DA0E60E69E00A0803E /* TDXmlText.m */; }; + D31FE5EE0E60E69E00A0803E /* TDXmlWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5DC0E60E69E00A0803E /* TDXmlWhitespace.m */; }; + D31FE5FC0E60E6B500A0803E /* TDNCNameState.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F10E60E6B500A0803E /* TDNCNameState.m */; }; + D31FE5FD0E60E6B500A0803E /* TDXmlName.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F30E60E6B500A0803E /* TDXmlName.m */; }; + D31FE5FE0E60E6B500A0803E /* TDXmlNameState.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F50E60E6B500A0803E /* TDXmlNameState.m */; }; + D31FE5FF0E60E6B500A0803E /* TDXmlNameTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F70E60E6B500A0803E /* TDXmlNameTest.m */; }; + D31FE6000E60E6B500A0803E /* TDXmlNmtoken.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F90E60E6B500A0803E /* TDXmlNmtoken.m */; }; + D31FE6010E60E6B500A0803E /* TDXmlNmtokenState.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5FB0E60E6B500A0803E /* TDXmlNmtokenState.m */; }; + D31FE6E00E60EE2500A0803E /* TDNCName.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE6DF0E60EE2500A0803E /* TDNCName.m */; }; + D31FE7300E60F31E00A0803E /* TDFastJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */; }; + D31FE7320E60F33000A0803E /* EBNFParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E78A160E574C99008C7D61 /* EBNFParser.m */; }; + D31FE7330E60F33C00A0803E /* XMLReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D3521F530E5FA1B0009681F9 /* XMLReader.m */; }; + D31FE7340E60F34600A0803E /* XPathParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E95450E578ECC00496BD3 /* XPathParser.m */; }; + D31FE7380E60F36600A0803E /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D36E9F860E5A795400496BD3 /* libxml2.dylib */; }; + D31FE7400E60F40300A0803E /* XPathAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */; }; + D31FE7420E60F40900A0803E /* XPathContext.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98210E58A3A800496BD3 /* XPathContext.m */; }; + D3252F7B0FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3252F790FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m */; }; + D3252F7E0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */; }; + D3252F7F0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */; }; + D3305C4F102F5BAE00DC4F75 /* TDGutterView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3305C4C102F5BAD00DC4F75 /* TDGutterView.m */; }; + D3305C50102F5BAE00DC4F75 /* TDSourceCodeTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3305C4E102F5BAE00DC4F75 /* TDSourceCodeTextView.m */; }; + D33494720E29670B00406085 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D3376D5910093A1600E4602E /* PKGrammarParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3376D5710093A1600E4602E /* PKGrammarParser.h */; }; + D3376D5A10093A1600E4602E /* PKGrammarParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D5810093A1600E4602E /* PKGrammarParser.m */; }; + D3376D8E10096C0700E4602E /* PKAST.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D8D10096C0700E4602E /* PKAST.m */; }; + D3376D8F10096C0700E4602E /* PKAST.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D8D10096C0700E4602E /* PKAST.m */; }; + D3385FD90FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */; }; + D3385FDA0FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */; }; + D3385FDE0FCFB227003BF729 /* TDPredicateEvaluatorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3385FDC0FCFB227003BF729 /* TDPredicateEvaluatorTest.m */; }; + D338E5BB0FF5DDCB003DE6AA /* TDDifferenceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D338E5BA0FF5DDCB003DE6AA /* TDDifferenceTest.m */; }; + D341850C0E520D640081B0DC /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D34BAC230FF87F8600D7773A /* TDParserFactoryTest3.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAC220FF87F8600D7773A /* TDParserFactoryTest3.m */; }; + D34BAC4B0FF892C200D7773A /* XPathParserGrammarTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAC4A0FF892C200D7773A /* XPathParserGrammarTest.m */; }; + D34BAC9A0FF8A9AD00D7773A /* xpath1_0.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741430EF8E96A00559B9F /* xpath1_0.grammar */; }; + D34BAD18100A9B7900996341 /* TDTokenizerStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAD17100A9B7900996341 /* TDTokenizerStateTest.m */; }; + D34BAD640FF9C6AE00D7773A /* ParseKit_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = D34BAD630FF9C6AE00D7773A /* ParseKit_Prefix.pch */; }; + D34BAD9D0FF9C95800D7773A /* PKReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAD9B0FF9C95800D7773A /* PKReader.m */; }; + D34BADA20FF9C9B000D7773A /* PKAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADA00FF9C9B000D7773A /* PKAssembly.m */; }; + D34BADD80FF9CBFB00D7773A /* PKParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADD60FF9CBFB00D7773A /* PKParser.m */; }; + D34BAE030FF9CCAE00D7773A /* PKCollectionParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */; }; + D34BAE1D0FF9CE0E00D7773A /* PKAlternation.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */; }; + D34BAE1F0FF9CE0E00D7773A /* PKEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */; }; + D34BAE210FF9CE0E00D7773A /* PKDifference.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */; }; + D34BAE230FF9CE0E00D7773A /* PKIntersection.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE110FF9CE0E00D7773A /* PKIntersection.m */; }; + D34BAE250FF9CE0E00D7773A /* PKRepetition.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE130FF9CE0E00D7773A /* PKRepetition.m */; }; + D34BAE270FF9CE0E00D7773A /* PKSequence.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE150FF9CE0E00D7773A /* PKSequence.m */; }; + D34BAE290FF9CE0E00D7773A /* PKTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE170FF9CE0E00D7773A /* PKTerminal.m */; }; + D34BAE2B0FF9CE0E00D7773A /* PKTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE190FF9CE0E00D7773A /* PKTrack.m */; }; + D34BAE2D0FF9CE0E00D7773A /* PKTrackException.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */; }; + D34BAE310FF9CE6000D7773A /* PKAny.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE2F0FF9CE6000D7773A /* PKAny.m */; }; + D34BAE8D0FF9D15100D7773A /* PKTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */; }; + D34BAE9D0FF9D20900D7773A /* PKToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE950FF9D20900D7773A /* PKToken.m */; }; + D34BAE9F0FF9D20900D7773A /* PKTokenArraySource.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */; }; + D34BAEA10FF9D20900D7773A /* PKTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE990FF9D20900D7773A /* PKTokenizer.m */; }; + D34BAEA30FF9D20900D7773A /* PKTokenizerState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */; }; + D34BAED80FF9D56400D7773A /* PKCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC40FF9D56400D7773A /* PKCommentState.m */; }; + D34BAEDA0FF9D56400D7773A /* PKDelimitState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC60FF9D56400D7773A /* PKDelimitState.m */; }; + D34BAEDC0FF9D56400D7773A /* PKMultiLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */; }; + D34BAEDE0FF9D56400D7773A /* PKNumberState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECA0FF9D56400D7773A /* PKNumberState.m */; }; + D34BAEE00FF9D56400D7773A /* PKQuoteState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECC0FF9D56400D7773A /* PKQuoteState.m */; }; + D34BAEE20FF9D56400D7773A /* PKSingleLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */; }; + D34BAEE40FF9D56400D7773A /* PKSymbolState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED00FF9D56400D7773A /* PKSymbolState.m */; }; + D34BAEE60FF9D56400D7773A /* PKWhitespaceState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */; }; + D34BAEE80FF9D56400D7773A /* PKWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED40FF9D56400D7773A /* PKWord.m */; }; + D34BAEEA0FF9D56400D7773A /* PKWordState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED60FF9D56400D7773A /* PKWordState.m */; }; + D34BAF280FF9DF9900D7773A /* PKSymbolNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */; }; + D34BAF2A0FF9DF9900D7773A /* PKSymbolRootNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */; }; + D34BAF3A0FF9E18300D7773A /* PKPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF380FF9E18300D7773A /* PKPattern.m */; }; + D34BAF4C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */; }; + D34BAF4E0FF9E19700D7773A /* PKComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3E0FF9E19700D7773A /* PKComment.m */; }; + D34BAF500FF9E19700D7773A /* PKDelimitedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF400FF9E19700D7773A /* PKDelimitedString.m */; }; + D34BAF520FF9E19700D7773A /* PKLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF420FF9E19700D7773A /* PKLiteral.m */; }; + D34BAF540FF9E19700D7773A /* PKNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF440FF9E19700D7773A /* PKNumber.m */; }; + D34BAF560FF9E19700D7773A /* PKQuotedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF460FF9E19700D7773A /* PKQuotedString.m */; }; + D34BAF580FF9E19700D7773A /* PKSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF480FF9E19700D7773A /* PKSymbol.m */; }; + D34BAF5A0FF9E19700D7773A /* PKWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */; }; + D34BAF9D0FF9E6D100D7773A /* PKLowercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */; }; + D34BAF9F0FF9E6D100D7773A /* PKUppercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */; }; + D34BAFB20FF9E7F300D7773A /* PKCharacterAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */; }; + D34BAFBC0FF9E80300D7773A /* PKChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB40FF9E80300D7773A /* PKChar.m */; }; + D34BAFBE0FF9E80300D7773A /* PKDigit.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB60FF9E80300D7773A /* PKDigit.m */; }; + D34BAFC00FF9E80300D7773A /* PKLetter.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB80FF9E80300D7773A /* PKLetter.m */; }; + D34BAFC20FF9E80300D7773A /* PKSpecificChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */; }; + D34BAFDA0FF9E95500D7773A /* NSArray+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */; }; + D34BAFDC0FF9E95500D7773A /* NSString+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */; }; + D34BAFDE0FF9E95500D7773A /* PKParserFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD80FF9E95500D7773A /* PKParserFactory.m */; }; + D34BB0680FF9EDDF00D7773A /* JSParseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0660FF9EDDF00D7773A /* JSParseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0690FF9EDDF00D7773A /* JSParseKit.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0670FF9EDDF00D7773A /* JSParseKit.m */; }; + D34BB0710FF9EE4000D7773A /* PKJSAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06A0FF9EE4000D7773A /* PKJSAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0720FF9EE4000D7773A /* PKJSAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB06B0FF9EE4000D7773A /* PKJSAssembly.m */; }; + D34BB0730FF9EE4000D7773A /* PKJSUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06C0FF9EE4000D7773A /* PKJSUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0740FF9EE4000D7773A /* PKJSUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB06D0FF9EE4000D7773A /* PKJSUtils.m */; }; + D34BB0750FF9EE4000D7773A /* PKJSUtils_macros.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06E0FF9EE4000D7773A /* PKJSUtils_macros.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0760FF9EE4000D7773A /* PKJSValueHolder.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06F0FF9EE4000D7773A /* PKJSValueHolder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0770FF9EE4000D7773A /* PKJSValueHolder.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0700FF9EE4000D7773A /* PKJSValueHolder.m */; }; + D34BB08F0FF9EF9D00D7773A /* PKJSCharacterAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB08D0FF9EF9D00D7773A /* PKJSCharacterAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0900FF9EF9D00D7773A /* PKJSCharacterAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB08E0FF9EF9D00D7773A /* PKJSCharacterAssembly.m */; }; + D34BB0A90FF9F14B00D7773A /* PKJSCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0930FF9F14B00D7773A /* PKJSCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0AA0FF9F14B00D7773A /* PKJSCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0940FF9F14B00D7773A /* PKJSCommentState.m */; }; + D34BB0AB0FF9F14B00D7773A /* PKJSDelimitState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0950FF9F14B00D7773A /* PKJSDelimitState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0AC0FF9F14B00D7773A /* PKJSDelimitState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0960FF9F14B00D7773A /* PKJSDelimitState.m */; }; + D34BB0AD0FF9F14B00D7773A /* PKJSNumberState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0970FF9F14B00D7773A /* PKJSNumberState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0AE0FF9F14B00D7773A /* PKJSNumberState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0980FF9F14B00D7773A /* PKJSNumberState.m */; }; + D34BB0AF0FF9F14B00D7773A /* PKJSQuoteState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0990FF9F14B00D7773A /* PKJSQuoteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B00FF9F14B00D7773A /* PKJSQuoteState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB09A0FF9F14B00D7773A /* PKJSQuoteState.m */; }; + D34BB0B10FF9F14B00D7773A /* PKJSSymbolState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB09B0FF9F14B00D7773A /* PKJSSymbolState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B20FF9F14B00D7773A /* PKJSSymbolState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB09C0FF9F14B00D7773A /* PKJSSymbolState.m */; }; + D34BB0B30FF9F14B00D7773A /* PKJSToken.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB09D0FF9F14B00D7773A /* PKJSToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B40FF9F14B00D7773A /* PKJSToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB09E0FF9F14B00D7773A /* PKJSToken.m */; }; + D34BB0B50FF9F14B00D7773A /* PKJSTokenAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB09F0FF9F14B00D7773A /* PKJSTokenAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B60FF9F14B00D7773A /* PKJSTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A00FF9F14B00D7773A /* PKJSTokenAssembly.m */; }; + D34BB0B70FF9F14B00D7773A /* PKJSTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A10FF9F14B00D7773A /* PKJSTokenizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B80FF9F14B00D7773A /* PKJSTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A20FF9F14B00D7773A /* PKJSTokenizer.m */; }; + D34BB0B90FF9F14B00D7773A /* PKJSTokenizerState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A30FF9F14B00D7773A /* PKJSTokenizerState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0BA0FF9F14B00D7773A /* PKJSTokenizerState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A40FF9F14B00D7773A /* PKJSTokenizerState.m */; }; + D34BB0BB0FF9F14B00D7773A /* PKJSWhitespaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A50FF9F14B00D7773A /* PKJSWhitespaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0BC0FF9F14B00D7773A /* PKJSWhitespaceState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A60FF9F14B00D7773A /* PKJSWhitespaceState.m */; }; + D34BB0BD0FF9F14B00D7773A /* PKJSWordState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A70FF9F14B00D7773A /* PKJSWordState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0BE0FF9F14B00D7773A /* PKJSWordState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A80FF9F14B00D7773A /* PKJSWordState.m */; }; + D34BB0E60FF9F28000D7773A /* PKJSAlternation.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D20FF9F28000D7773A /* PKJSAlternation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0E70FF9F28000D7773A /* PKJSAlternation.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D30FF9F28000D7773A /* PKJSAlternation.m */; }; + D34BB0E80FF9F28000D7773A /* PKJSAny.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D40FF9F28000D7773A /* PKJSAny.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0E90FF9F28000D7773A /* PKJSAny.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D50FF9F28000D7773A /* PKJSAny.m */; }; + D34BB0EA0FF9F28000D7773A /* PKJSAssemblerAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D60FF9F28000D7773A /* PKJSAssemblerAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0EB0FF9F28000D7773A /* PKJSAssemblerAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D70FF9F28000D7773A /* PKJSAssemblerAdapter.m */; }; + D34BB0EC0FF9F28000D7773A /* PKJSCollectionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D80FF9F28000D7773A /* PKJSCollectionParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0ED0FF9F28000D7773A /* PKJSCollectionParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D90FF9F28000D7773A /* PKJSCollectionParser.m */; }; + D34BB0EE0FF9F28000D7773A /* PKJSEmpty.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0DA0FF9F28000D7773A /* PKJSEmpty.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0EF0FF9F28000D7773A /* PKJSEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0DB0FF9F28000D7773A /* PKJSEmpty.m */; }; + D34BB0F00FF9F28000D7773A /* PKJSParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0DC0FF9F28000D7773A /* PKJSParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F10FF9F28000D7773A /* PKJSParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0DD0FF9F28000D7773A /* PKJSParser.m */; }; + D34BB0F20FF9F28000D7773A /* PKJSRepetition.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0DE0FF9F28000D7773A /* PKJSRepetition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F30FF9F28000D7773A /* PKJSRepetition.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0DF0FF9F28000D7773A /* PKJSRepetition.m */; }; + D34BB0F40FF9F28000D7773A /* PKJSSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0E00FF9F28000D7773A /* PKJSSequence.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F50FF9F28000D7773A /* PKJSSequence.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0E10FF9F28000D7773A /* PKJSSequence.m */; }; + D34BB0F60FF9F28000D7773A /* PKJSTerminal.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0E20FF9F28000D7773A /* PKJSTerminal.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F70FF9F28000D7773A /* PKJSTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0E30FF9F28000D7773A /* PKJSTerminal.m */; }; + D34BB0F80FF9F28000D7773A /* PKJSTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0E40FF9F28000D7773A /* PKJSTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F90FF9F28000D7773A /* PKJSTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0E50FF9F28000D7773A /* PKJSTrack.m */; }; + D34BB1140FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0FE0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1150FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0FF0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m */; }; + D34BB1160FF9F36200D7773A /* PKJSComment.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1000FF9F36200D7773A /* PKJSComment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1170FF9F36200D7773A /* PKJSComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1010FF9F36200D7773A /* PKJSComment.m */; }; + D34BB1180FF9F36200D7773A /* PKJSDelimitedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1020FF9F36200D7773A /* PKJSDelimitedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1190FF9F36200D7773A /* PKJSDelimitedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1030FF9F36200D7773A /* PKJSDelimitedString.m */; }; + D34BB11A0FF9F36200D7773A /* PKJSLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1040FF9F36200D7773A /* PKJSLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB11B0FF9F36200D7773A /* PKJSLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1050FF9F36200D7773A /* PKJSLiteral.m */; }; + D34BB11C0FF9F36200D7773A /* PKJSLowercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1060FF9F36200D7773A /* PKJSLowercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB11D0FF9F36200D7773A /* PKJSLowercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1070FF9F36200D7773A /* PKJSLowercaseWord.m */; }; + D34BB11E0FF9F36200D7773A /* PKJSNum.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1080FF9F36200D7773A /* PKJSNum.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB11F0FF9F36200D7773A /* PKJSNum.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1090FF9F36200D7773A /* PKJSNum.m */; }; + D34BB1200FF9F36200D7773A /* PKJSPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB10A0FF9F36200D7773A /* PKJSPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1210FF9F36200D7773A /* PKJSPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB10B0FF9F36200D7773A /* PKJSPattern.m */; }; + D34BB1220FF9F36200D7773A /* PKJSQuotedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB10C0FF9F36200D7773A /* PKJSQuotedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1230FF9F36200D7773A /* PKJSQuotedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB10D0FF9F36200D7773A /* PKJSQuotedString.m */; }; + D34BB1240FF9F36200D7773A /* PKJSSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB10E0FF9F36200D7773A /* PKJSSymbol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1250FF9F36200D7773A /* PKJSSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB10F0FF9F36200D7773A /* PKJSSymbol.m */; }; + D34BB1260FF9F36200D7773A /* PKJSUppercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1100FF9F36200D7773A /* PKJSUppercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1270FF9F36200D7773A /* PKJSUppercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1110FF9F36200D7773A /* PKJSUppercaseWord.m */; }; + D34BB1280FF9F36200D7773A /* PKJSWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1120FF9F36200D7773A /* PKJSWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1290FF9F36200D7773A /* PKJSWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1130FF9F36200D7773A /* PKJSWord.m */; }; + D3521F560E5FA1B0009681F9 /* XMLReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D3521F530E5FA1B0009681F9 /* XMLReader.m */; }; + D3521F570E5FA1B0009681F9 /* XMLReaderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3521F550E5FA1B0009681F9 /* XMLReaderTest.m */; }; + D35384ED0FE9691100926552 /* nspredicate.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D35384EC0FE9691100926552 /* nspredicate.grammar */; }; + D353899C0FEAC94400926552 /* c.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D353899B0FEAC94400926552 /* c.grammar */; }; + D353899E0FEAC96B00926552 /* objc.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D353899D0FEAC96B00926552 /* objc.grammar */; }; + D355C62D0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */; }; + D355C62E0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */; }; + D355C6310FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D355C6300FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m */; }; + D355C6A70FE9F704006A91A4 /* nspredicate.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D35384EC0FE9691100926552 /* nspredicate.grammar */; }; + D355C8810FEB36A1006A91A4 /* xml.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D355C8800FEB36A1006A91A4 /* xml.grammar */; }; + D355C8840FEB4B94006A91A4 /* proto.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D355C8830FEB4B94006A91A4 /* proto.grammar */; }; + D3587EAF0FE83EC900DDD023 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D36568A70EEF9FE900226554 /* TDPlistParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36568A60EEF9FE900226554 /* TDPlistParser.m */; }; + D36568AA0EEFA05300226554 /* TDPlistParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D36568A90EEFA05300226554 /* TDPlistParserTest.m */; }; + D3656DFE0EF2620E00226554 /* TDTokenArraySourceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3656DFD0EF2620E00226554 /* TDTokenArraySourceTest.m */; }; + D3668292101D2BFA0008632C /* erb.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3668291101D2BFA0008632C /* erb.grammar */; }; + D3668293101D2C000008632C /* erb.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3668291101D2BFA0008632C /* erb.grammar */; }; + D3668296101D2C200008632C /* ERBTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3668295101D2C200008632C /* ERBTest.m */; }; + D369345D1038DE5300527AF3 /* PKParseTree.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934561038DE5300527AF3 /* PKParseTree.m */; }; + D369345E1038DE5300527AF3 /* PKParseTreeAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */; }; + D369345F1038DE5300527AF3 /* PKRuleNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345A1038DE5300527AF3 /* PKRuleNode.m */; }; + D36934601038DE5300527AF3 /* PKTokenNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345C1038DE5300527AF3 /* PKTokenNode.m */; }; + D36934721038E28300527AF3 /* PKParseTree.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934561038DE5300527AF3 /* PKParseTree.m */; }; + D36934731038E28700527AF3 /* PKParseTreeAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */; }; + D36934741038E28B00527AF3 /* PKRuleNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345A1038DE5300527AF3 /* PKRuleNode.m */; }; + D36934751038E28F00527AF3 /* PKTokenNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345C1038DE5300527AF3 /* PKTokenNode.m */; }; + D36C53790FD27F1300141CB7 /* TDParserFactoryTest2.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C53780FD27F1300141CB7 /* TDParserFactoryTest2.m */; }; + D36C55FF0FD3617B00141CB7 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */; }; + D36C560C0FD363D500141CB7 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D36C560B0FD363D500141CB7 /* libicucore.dylib */; }; + D36C562B0FD365DB00141CB7 /* TDPatternTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C562A0FD365DB00141CB7 /* TDPatternTest.m */; }; + D36E95460E578ECC00496BD3 /* XPathParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E95450E578ECC00496BD3 /* XPathParser.m */; }; + D36E95D80E57B08400496BD3 /* XPathParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E95D70E57B08400496BD3 /* XPathParserTest.m */; }; + D36E97B00E589DAE00496BD3 /* XPathAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */; }; + D36E98220E58A3A800496BD3 /* XPathContext.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98210E58A3A800496BD3 /* XPathContext.m */; }; + D36E98E00E58C12800496BD3 /* DebugAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98DD0E58C12800496BD3 /* DebugAppDelegate.m */; }; + D36E98E10E58C12800496BD3 /* DebugAppMainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D36E98DE0E58C12800496BD3 /* DebugAppMainMenu.xib */; }; + D36E98E20E58C12800496BD3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98DF0E58C12800496BD3 /* main.m */; }; + D36E98E70E58C14000496BD3 /* DemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98E40E58C14000496BD3 /* DemoAppDelegate.m */; }; + D36E98E80E58C14000496BD3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98E50E58C14000496BD3 /* main.m */; }; + D36E98F80E58C1A000496BD3 /* DemoAppMainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D36E98F70E58C1A000496BD3 /* DemoAppMainMenu.xib */; }; + D36E9F870E5A795400496BD3 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D36E9F860E5A795400496BD3 /* libxml2.dylib */; }; + D36E9FB50E5A944A00496BD3 /* apple-boss.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36E9FB40E5A944A00496BD3 /* apple-boss.xml */; }; + D36E9FE50E5BA0FC00496BD3 /* SRGSGrammar.txt in Resources */ = {isa = PBXBuildFile; fileRef = D36E9FE40E5BA0FC00496BD3 /* SRGSGrammar.txt */; }; + D36EA3B00E5EA67E00496BD3 /* small-xml-file.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */; }; + D37A28671013942300E936B7 /* PKGrammarParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D5810093A1600E4602E /* PKGrammarParser.m */; }; + D37A28681013942A00E936B7 /* PKGrammarParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3376D5710093A1600E4602E /* PKGrammarParser.h */; }; + D37D3A000FE77A71008C2E4D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D37D3A010FE77A72008C2E4D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D37D3A020FE77A77008C2E4D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D380AFBD0F0C54B60009EC13 /* html.css in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBB0F0C54B60009EC13 /* html.css */; }; + D380AFBE0F0C54B60009EC13 /* html.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBC0F0C54B60009EC13 /* html.grammar */; }; + D380AFBF0F0C54B60009EC13 /* html.css in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBB0F0C54B60009EC13 /* html.css */; }; + D380AFC00F0C54B60009EC13 /* html.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBC0F0C54B60009EC13 /* html.grammar */; }; + D380AFC30F0C56000009EC13 /* example.html in Resources */ = {isa = PBXBuildFile; fileRef = D380AFC20F0C56000009EC13 /* example.html */; }; + D380AFC40F0C56000009EC13 /* example.html in Resources */ = {isa = PBXBuildFile; fileRef = D380AFC20F0C56000009EC13 /* example.html */; }; + D380B3230F0CC0800009EC13 /* nyt.html in Resources */ = {isa = PBXBuildFile; fileRef = D38DD9E70EC29F260070BC4D /* nyt.html */; }; + D380B5090F0D71A90009EC13 /* css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380B5080F0D71A90009EC13 /* css.grammar */; }; + D380B50A0F0D71B00009EC13 /* css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380B5080F0D71A90009EC13 /* css.grammar */; }; + D380B5380F0D7DDE0009EC13 /* css.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5370F0D7DDE0009EC13 /* css.css */; }; + D380B5390F0D7DE30009EC13 /* css.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5370F0D7DDE0009EC13 /* css.css */; }; + D380B5940F0D82F60009EC13 /* example.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5930F0D82F60009EC13 /* example.css */; }; + D380B5950F0D82F90009EC13 /* example.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5930F0D82F60009EC13 /* example.css */; }; + D380B9800F0EF3860009EC13 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D380BA620F0F06CD0009EC13 /* TDParserFactoryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D380BA600F0F06CD0009EC13 /* TDParserFactoryTest.m */; }; + D380BAA30F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D380BAA40F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D38205BE0EEE48EE004340DD /* TDTokenTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D38205BD0EEE48EE004340DD /* TDTokenTest.m */; }; + D383498B0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */; }; + D383498C0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */; }; + D38349BC0F0C0D910055E4E0 /* json_with_comments.css in Resources */ = {isa = PBXBuildFile; fileRef = D38349BB0F0C0D910055E4E0 /* json_with_comments.css */; }; + D38349BD0F0C0D910055E4E0 /* json_with_comments.css in Resources */ = {isa = PBXBuildFile; fileRef = D38349BB0F0C0D910055E4E0 /* json_with_comments.css */; }; + D3834A480F0C14B60055E4E0 /* yahoo_with_comments.json in Resources */ = {isa = PBXBuildFile; fileRef = D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */; }; + D3834A490F0C14C00055E4E0 /* yahoo_with_comments.json in Resources */ = {isa = PBXBuildFile; fileRef = D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */; }; + D385F98C0F046FE900DB2946 /* TDGenericAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385F9890F046FE900DB2946 /* TDGenericAssembler.m */; }; + D385F98E0F046FE900DB2946 /* TDGenericAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385F9890F046FE900DB2946 /* TDGenericAssembler.m */; }; + D385FA230F04971400DB2946 /* TDGenericAssemblerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FA220F04971400DB2946 /* TDGenericAssemblerTest.m */; }; + D385FA250F04993500DB2946 /* json.css in Resources */ = {isa = PBXBuildFile; fileRef = D385FA240F04993500DB2946 /* json.css */; }; + D385FA260F04993500DB2946 /* json.css in Resources */ = {isa = PBXBuildFile; fileRef = D385FA240F04993500DB2946 /* json.css */; }; + D385FD440F05A88C00DB2946 /* TDMiniCSSAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */; }; + D385FD460F05A89100DB2946 /* TDMiniCSSAssemblerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FD430F05A88C00DB2946 /* TDMiniCSSAssemblerTest.m */; }; + D385FD490F05A8C900DB2946 /* TDMiniCSSAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */; }; + D385FD6C0F05A99900DB2946 /* mini_css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D385FD6B0F05A99900DB2946 /* mini_css.grammar */; }; + D385FD6D0F05A99900DB2946 /* mini_css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D385FD6B0F05A99900DB2946 /* mini_css.grammar */; }; + D389F1D50F19666500558235 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D389F20B0F196A9200558235 /* JSParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D389F1CE0F1965E600558235 /* JSParseKit.framework */; }; + D389F20C0F196A9200558235 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D389F20E0F196A9200558235 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D389F20D0F196A9200558235 /* WebKit.framework */; }; + D389F2E40F196CAE00558235 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F2E30F196CAE00558235 /* main.m */; }; + D389F3430F197DDC00558235 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D389F34E0F197DF500558235 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D389F37A0F197E8000558235 /* JSDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F2E90F196F5B00558235 /* JSDemoAppDelegate.m */; }; + D389F38F0F19800400558235 /* DefaultValues.plist in Resources */ = {isa = PBXBuildFile; fileRef = D389F38E0F19800400558235 /* DefaultValues.plist */; }; + D389F4620F198A8800558235 /* Test.html in Resources */ = {isa = PBXBuildFile; fileRef = D389F4610F198A8800558235 /* Test.html */; }; + D389F5590F19B7BC00558235 /* JSDemoAppMainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D389F5580F19B7BC00558235 /* JSDemoAppMainMenu.xib */; }; + D389F5B60F19C76A00558235 /* TDJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F5B30F19C76A00558235 /* TDJsonParser.m */; }; + D389F5B70F19C76A00558235 /* TDJsonParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F5B50F19C76A00558235 /* TDJsonParserTest.m */; }; + D389F5B80F19C76A00558235 /* TDJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F5B30F19C76A00558235 /* TDJsonParser.m */; }; + D389FBCD0F1B25E200558235 /* ParserTest.html in Resources */ = {isa = PBXBuildFile; fileRef = D389FBCC0F1B25E200558235 /* ParserTest.html */; }; + D38DD9E80EC29F260070BC4D /* nyt.html in Resources */ = {isa = PBXBuildFile; fileRef = D38DD9E70EC29F260070BC4D /* nyt.html */; }; + D38E97CC1061CF6500739C39 /* TDTokenizerBlocksTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D38E97CB1061CF6500739C39 /* TDTokenizerBlocksTest.m */; }; + D38E98D81062C5BA00739C39 /* TDParserBlocksTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D38E98D71062C5BA00739C39 /* TDParserBlocksTest.m */; }; + D398E20E0E60F86D00A1C877 /* yahoo.json in Resources */ = {isa = PBXBuildFile; fileRef = D3B473840E48C9CF008AFBDD /* yahoo.json */; }; + D39E01340FEF02DA00150FC3 /* TDXMLParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3BBBC970FEC9722007DF30D /* TDXMLParserTest.m */; }; + D3AF49780FDB122E0032F4DC /* TDParserFactoryPatternTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3AF49770FDB122E0032F4DC /* TDParserFactoryPatternTest.m */; }; + D3B43FB80F76E99C0072AF40 /* TDJavaScriptParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3B43FB60F76E99C0072AF40 /* TDJavaScriptParserTest.m */; }; + D3B473850E48C9CF008AFBDD /* yahoo.json in Resources */ = {isa = PBXBuildFile; fileRef = D3B473840E48C9CF008AFBDD /* yahoo.json */; }; + D3B69D320E80249900D70C41 /* nonascii.html in Resources */ = {isa = PBXBuildFile; fileRef = D3B69D310E80249900D70C41 /* nonascii.html */; }; + D3B69D330E80249900D70C41 /* nonascii.html in Resources */ = {isa = PBXBuildFile; fileRef = D3B69D310E80249900D70C41 /* nonascii.html */; }; + D3BBBC9D0FEC9756007DF30D /* TDXMLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */; }; + D3BBBC9E0FEC9756007DF30D /* TDXMLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */; }; + D3BBBCC10FECD477007DF30D /* xml.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D355C8800FEB36A1006A91A4 /* xml.grammar */; }; + D3C031ED0EF38D2D00C5ABEB /* TDLowercaseWordTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C031EC0EF38D2D00C5ABEB /* TDLowercaseWordTest.m */; }; + D3C221920FFE8B8C004514FE /* ParseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221900FFE8B8C004514FE /* ParseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221930FFE8B8C004514FE /* PKTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221910FFE8B8C004514FE /* PKTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221940FFE8B8C004514FE /* ParseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221900FFE8B8C004514FE /* ParseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221950FFE8B8C004514FE /* PKTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221910FFE8B8C004514FE /* PKTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221970FFE8B95004514FE /* PKReader.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221960FFE8B95004514FE /* PKReader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221980FFE8B95004514FE /* PKReader.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221960FFE8B95004514FE /* PKReader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219A0FFE8B9D004514FE /* PKAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221990FFE8B9D004514FE /* PKAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219B0FFE8B9D004514FE /* PKAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221990FFE8B9D004514FE /* PKAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219D0FFE8BA6004514FE /* PKParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219C0FFE8BA6004514FE /* PKParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219E0FFE8BA6004514FE /* PKParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219C0FFE8BA6004514FE /* PKParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A00FFE8BAE004514FE /* PKRepetition.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219F0FFE8BAE004514FE /* PKRepetition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A10FFE8BAE004514FE /* PKRepetition.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219F0FFE8BAE004514FE /* PKRepetition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A30FFE8BBA004514FE /* PKCollectionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A40FFE8BBA004514FE /* PKCollectionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A60FFE8BC1004514FE /* PKAlternation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A50FFE8BC1004514FE /* PKAlternation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A70FFE8BC1004514FE /* PKAlternation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A50FFE8BC1004514FE /* PKAlternation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A90FFE8BC9004514FE /* PKSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A80FFE8BC9004514FE /* PKSequence.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AA0FFE8BC9004514FE /* PKSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A80FFE8BC9004514FE /* PKSequence.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AC0FFE8BCF004514FE /* PKTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AB0FFE8BCF004514FE /* PKTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AD0FFE8BCF004514FE /* PKTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AB0FFE8BCF004514FE /* PKTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AF0FFE8BD4004514FE /* PKTrackException.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AE0FFE8BD4004514FE /* PKTrackException.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B00FFE8BD4004514FE /* PKTrackException.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AE0FFE8BD4004514FE /* PKTrackException.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B20FFE8BDB004514FE /* PKIntersection.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B10FFE8BDB004514FE /* PKIntersection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B30FFE8BDB004514FE /* PKIntersection.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B10FFE8BDB004514FE /* PKIntersection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B50FFE8BE2004514FE /* PKDifference.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B40FFE8BE2004514FE /* PKDifference.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B60FFE8BE2004514FE /* PKDifference.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B40FFE8BE2004514FE /* PKDifference.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B80FFE8BE8004514FE /* PKNegation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B70FFE8BE8004514FE /* PKNegation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B90FFE8BE8004514FE /* PKNegation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B70FFE8BE8004514FE /* PKNegation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BB0FFE8BEF004514FE /* PKTerminal.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BA0FFE8BEF004514FE /* PKTerminal.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BC0FFE8BEF004514FE /* PKTerminal.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BA0FFE8BEF004514FE /* PKTerminal.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BE0FFE8BF7004514FE /* PKEmpty.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BD0FFE8BF7004514FE /* PKEmpty.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BF0FFE8BF7004514FE /* PKEmpty.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BD0FFE8BF7004514FE /* PKEmpty.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C10FFE8BFF004514FE /* PKTokenAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C20FFE8BFF004514FE /* PKTokenAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C40FFE8C07004514FE /* PKToken.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C30FFE8C07004514FE /* PKToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C50FFE8C07004514FE /* PKToken.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C30FFE8C07004514FE /* PKToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C70FFE8C0D004514FE /* PKTokenArraySource.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C80FFE8C0D004514FE /* PKTokenArraySource.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CA0FFE8C15004514FE /* PKTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C90FFE8C15004514FE /* PKTokenizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CB0FFE8C15004514FE /* PKTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C90FFE8C15004514FE /* PKTokenizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CD0FFE8C1B004514FE /* PKTokenizerState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CE0FFE8C1B004514FE /* PKTokenizerState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D00FFE8C24004514FE /* PKNumberState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CF0FFE8C24004514FE /* PKNumberState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D10FFE8C24004514FE /* PKNumberState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CF0FFE8C24004514FE /* PKNumberState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D60FFE8C35004514FE /* PKSymbolState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D50FFE8C35004514FE /* PKSymbolState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D70FFE8C35004514FE /* PKSymbolState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D50FFE8C35004514FE /* PKSymbolState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D90FFE8C3D004514FE /* PKWordState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D80FFE8C3D004514FE /* PKWordState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DA0FFE8C3D004514FE /* PKWordState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D80FFE8C3D004514FE /* PKWordState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DC0FFE8C43004514FE /* PKWhitespaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DD0FFE8C43004514FE /* PKWhitespaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DF0FFE8C49004514FE /* PKDelimitState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DE0FFE8C49004514FE /* PKDelimitState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E00FFE8C49004514FE /* PKDelimitState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DE0FFE8C49004514FE /* PKDelimitState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E20FFE8C4E004514FE /* PKCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E10FFE8C4E004514FE /* PKCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E30FFE8C4E004514FE /* PKCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E10FFE8C4E004514FE /* PKCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E50FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E60FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E80FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E90FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EB0FFE8C69004514FE /* PKSymbolNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EC0FFE8C69004514FE /* PKSymbolNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EE0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EF0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F10FFE8C7A004514FE /* PKPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F00FFE8C7A004514FE /* PKPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F20FFE8C7A004514FE /* PKPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F00FFE8C7A004514FE /* PKPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F40FFE8C87004514FE /* PKWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F30FFE8C87004514FE /* PKWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F50FFE8C87004514FE /* PKWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F30FFE8C87004514FE /* PKWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F70FFE8C8E004514FE /* PKNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F60FFE8C8E004514FE /* PKNumber.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FA0FFE8C97004514FE /* PKQuotedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F90FFE8C97004514FE /* PKQuotedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FB0FFE8C97004514FE /* PKQuotedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F90FFE8C97004514FE /* PKQuotedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FD0FFE8CB2004514FE /* PKSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FC0FFE8CB2004514FE /* PKSymbol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FE0FFE8CB2004514FE /* PKSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FC0FFE8CB2004514FE /* PKSymbol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222000FFE8CB9004514FE /* PKLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FF0FFE8CB9004514FE /* PKLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222010FFE8CB9004514FE /* PKLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FF0FFE8CB9004514FE /* PKLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222030FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222040FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222060FFE8CCA004514FE /* PKWhitespace.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222050FFE8CCA004514FE /* PKWhitespace.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222070FFE8CCA004514FE /* PKWhitespace.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222050FFE8CCA004514FE /* PKWhitespace.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222090FFE8CD1004514FE /* PKComment.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222080FFE8CD1004514FE /* PKComment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220A0FFE8CD1004514FE /* PKComment.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222080FFE8CD1004514FE /* PKComment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220C0FFE8CD8004514FE /* PKDelimitedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220D0FFE8CD8004514FE /* PKDelimitedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220F0FFE8CDF004514FE /* PKAny.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220E0FFE8CDF004514FE /* PKAny.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222100FFE8CDF004514FE /* PKAny.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220E0FFE8CDF004514FE /* PKAny.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222150FFE8D01004514FE /* PKLowercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222140FFE8D01004514FE /* PKLowercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222160FFE8D01004514FE /* PKLowercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222140FFE8D01004514FE /* PKLowercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222180FFE8D11004514FE /* PKUppercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222170FFE8D11004514FE /* PKUppercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222190FFE8D11004514FE /* PKUppercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222170FFE8D11004514FE /* PKUppercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221B0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221C0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221E0FFE8D3B004514FE /* PKChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221D0FFE8D3B004514FE /* PKChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221F0FFE8D3B004514FE /* PKChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221D0FFE8D3B004514FE /* PKChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222210FFE8D42004514FE /* PKDigit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222200FFE8D42004514FE /* PKDigit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222220FFE8D42004514FE /* PKDigit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222200FFE8D42004514FE /* PKDigit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222240FFE8D49004514FE /* PKLetter.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222230FFE8D49004514FE /* PKLetter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222250FFE8D49004514FE /* PKLetter.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222230FFE8D49004514FE /* PKLetter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222270FFE8D6B004514FE /* PKSpecificChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222260FFE8D6B004514FE /* PKSpecificChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222280FFE8D6B004514FE /* PKSpecificChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222260FFE8D6B004514FE /* PKSpecificChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2222A0FFE8DAC004514FE /* PKParserFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222290FFE8DAC004514FE /* PKParserFactory.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2222B0FFE8DAC004514FE /* PKParserFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222290FFE8DAC004514FE /* PKParserFactory.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2222D0FFE8DE9004514FE /* NSArray+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */; }; + D3C2222E0FFE8DEE004514FE /* NSString+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */; }; + D3C2222F0FFE8DEF004514FE /* NSString+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */; }; + D3C222300FFE8DF3004514FE /* NSArray+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */; }; + D3C7D9DA0A412874005DD154 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D3C85C7B0E63B438000445FD /* TDArithmeticParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C85C7A0E63B438000445FD /* TDArithmeticParser.m */; }; + D3C85C800E63B9E9000445FD /* TDArithmeticParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C85C7F0E63B9E9000445FD /* TDArithmeticParserTest.m */; }; + D3C85D450E63D1BF000445FD /* TDScientificNumberStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C85D440E63D1BF000445FD /* TDScientificNumberStateTest.m */; }; + D3D01CAA0EFDB89900C24DDE /* json_with_discards.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */; }; + D3D01CAB0EFDB8A000C24DDE /* json_with_discards.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */; }; + D3D01CAC0EFDB8A100C24DDE /* json_with_discards.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */; }; + D3D1BF2810394420003656E5 /* SAXAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D1BF2710394420003656E5 /* SAXAssembler.m */; }; + D3D1BF2B1039445C003656E5 /* SAXTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D1BF2A1039445C003656E5 /* SAXTest.m */; }; + D3DCB3730EF5E5D600DE5110 /* OCMock.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D3DCB37D0EF5E5E400DE5110 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D3DCB4C30EF6015300DE5110 /* json.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3DCB4C20EF6015300DE5110 /* json.grammar */; }; + D3DCB4C40EF6015C00DE5110 /* json.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3DCB4C20EF6015300DE5110 /* json.grammar */; }; + D3DCB4C50EF6015C00DE5110 /* json.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3DCB4C20EF6015300DE5110 /* json.grammar */; }; + D3DDDA870F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */; }; + D3DDDA880F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */; }; + D3DDDAFE0F083C9700A58000 /* TDCommentStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3DDDAFD0F083C9700A58000 /* TDCommentStateTest.m */; }; + D3DDDCAD0F0880D800A58000 /* example1.srgs in Resources */ = {isa = PBXBuildFile; fileRef = D3DDDCAC0F0880D800A58000 /* example1.srgs */; }; + D3DDDCAE0F0880D800A58000 /* example1.srgs in Resources */ = {isa = PBXBuildFile; fileRef = D3DDDCAC0F0880D800A58000 /* example1.srgs */; }; + D3E27A320E741DD20078CC2C /* small-xml-file.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */; }; + D3E27A330E741DD20078CC2C /* apple-boss.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36E9FB40E5A944A00496BD3 /* apple-boss.xml */; }; + D3E39C3F0FC5FFD10022DAB9 /* TDDelimitStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E39C3E0FC5FFD10022DAB9 /* TDDelimitStateTest.m */; }; + D3E784BD0E53DA28008C7D61 /* apple-boss.json in Resources */ = {isa = PBXBuildFile; fileRef = D3E784BC0E53DA28008C7D61 /* apple-boss.json */; }; + D3E785560E53FB54008C7D61 /* apple-boss.json in Resources */ = {isa = PBXBuildFile; fileRef = D3E784BC0E53DA28008C7D61 /* apple-boss.json */; }; + D3E787A30E5661A9008C7D61 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; + D3E788930E567DFD008C7D61 /* SRGSParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E788920E567DFD008C7D61 /* SRGSParserTest.m */; }; + D3E788960E567E0A008C7D61 /* SRGSParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E788950E567E0A008C7D61 /* SRGSParser.m */; }; + D3E78A190E574C99008C7D61 /* EBNFParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E78A160E574C99008C7D61 /* EBNFParser.m */; }; + D3E78A1A0E574C99008C7D61 /* EBNFParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E78A180E574C99008C7D61 /* EBNFParserTest.m */; }; + D3EAC7EC0F2690620043D6A9 /* OCMock.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D3EADD800E75E9CC00F78584 /* nasty.html in Resources */ = {isa = PBXBuildFile; fileRef = D3EADD7F0E75E9CC00F78584 /* nasty.html */; }; + D3EADD810E75E9CC00F78584 /* nasty.html in Resources */ = {isa = PBXBuildFile; fileRef = D3EADD7F0E75E9CC00F78584 /* nasty.html */; }; + D3EADD8E0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */; }; + D3EADD8F0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */; }; + D3F0E2480FFE8EB900C9DF74 /* PKQuoteState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3F0E2490FFE8EB900C9DF74 /* PKQuoteState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3F0E3CB0FFEB70100C9DF74 /* PKNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F60FFE8C8E004514FE /* PKNumber.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3F0E3CC0FFEB70700C9DF74 /* PKNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF440FF9E19700D7773A /* PKNumber.m */; }; + D3F55F611025737D00DD6DB1 /* TDParseTreeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F55F601025737D00DD6DB1 /* TDParseTreeTest.m */; }; + D3F5629A10266CFC00DD6DB1 /* PKParseTreeView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F5629910266CFC00DD6DB1 /* PKParseTreeView.m */; }; + D3F562A010266DFB00DD6DB1 /* DemoTokensViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F5629F10266DFB00DD6DB1 /* DemoTokensViewController.m */; }; + D3F562A210266E5300DD6DB1 /* TokensView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3F562A110266E5300DD6DB1 /* TokensView.xib */; }; + D3F562A410266E6300DD6DB1 /* TreesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3F562A310266E6300DD6DB1 /* TreesView.xib */; }; + D3F562A710266E8D00DD6DB1 /* DemoTreesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F562A610266E8D00DD6DB1 /* DemoTreesViewController.m */; }; + D3F740B70EF8C38A00559B9F /* JSONAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F740B60EF8C38A00559B9F /* JSONAssembler.m */; }; + D3F741440EF8E96A00559B9F /* xpath1_0.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741430EF8E96A00559B9F /* xpath1_0.grammar */; }; + D3F741BE0EF9F28D00559B9F /* css2_1.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741BD0EF9F28D00559B9F /* css2_1.grammar */; }; + D3F741BF0EF9F29400559B9F /* css2_1.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741BD0EF9F28D00559B9F /* css2_1.grammar */; }; + D3F741C00EF9F29500559B9F /* css2_1.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741BD0EF9F28D00559B9F /* css2_1.grammar */; }; + D3FD79200F4CC86800BAD816 /* rubyhash.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */; }; + D3FD79210F4CC87900BAD816 /* rubyhash.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */; }; + D3FDC4A50FFB3B2A00F1F797 /* RegexKitLite.h in Headers */ = {isa = PBXBuildFile; fileRef = D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */; }; + D3FDC6DA0FFC4C8C00F1F797 /* RegexKitLite.h in Headers */ = {isa = PBXBuildFile; fileRef = D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */; }; + D3FDC6EE0FFC4C9E00F1F797 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */; }; + D3FDC6EF0FFC4C9E00F1F797 /* PKReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAD9B0FF9C95800D7773A /* PKReader.m */; }; + D3FDC6F00FFC4C9E00F1F797 /* PKAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADA00FF9C9B000D7773A /* PKAssembly.m */; }; + D3FDC6F10FFC4C9E00F1F797 /* PKParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADD60FF9CBFB00D7773A /* PKParser.m */; }; + D3FDC6F20FFC4C9E00F1F797 /* PKRepetition.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE130FF9CE0E00D7773A /* PKRepetition.m */; }; + D3FDC6F30FFC4C9E00F1F797 /* PKCollectionParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */; }; + D3FDC6F40FFC4C9E00F1F797 /* PKAlternation.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */; }; + D3FDC6F50FFC4C9E00F1F797 /* PKSequence.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE150FF9CE0E00D7773A /* PKSequence.m */; }; + D3FDC6F60FFC4C9E00F1F797 /* PKTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE190FF9CE0E00D7773A /* PKTrack.m */; }; + D3FDC6F70FFC4C9E00F1F797 /* PKTrackException.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */; }; + D3FDC6F80FFC4C9E00F1F797 /* PKDifference.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */; }; + D3FDC6F90FFC4C9E00F1F797 /* PKIntersection.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE110FF9CE0E00D7773A /* PKIntersection.m */; }; + D3FDC6FA0FFC4C9E00F1F797 /* PKTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE170FF9CE0E00D7773A /* PKTerminal.m */; }; + D3FDC6FB0FFC4C9E00F1F797 /* PKEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */; }; + D3FDC6FC0FFC4C9E00F1F797 /* PKTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */; }; + D3FDC6FD0FFC4C9E00F1F797 /* PKToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE950FF9D20900D7773A /* PKToken.m */; }; + D3FDC6FE0FFC4C9E00F1F797 /* PKTokenArraySource.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */; }; + D3FDC6FF0FFC4C9E00F1F797 /* PKTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE990FF9D20900D7773A /* PKTokenizer.m */; }; + D3FDC7000FFC4C9E00F1F797 /* PKTokenizerState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */; }; + D3FDC7010FFC4C9E00F1F797 /* PKNumberState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECA0FF9D56400D7773A /* PKNumberState.m */; }; + D3FDC7020FFC4C9E00F1F797 /* PKQuoteState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECC0FF9D56400D7773A /* PKQuoteState.m */; }; + D3FDC7030FFC4C9E00F1F797 /* PKSymbolState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED00FF9D56400D7773A /* PKSymbolState.m */; }; + D3FDC7040FFC4C9E00F1F797 /* PKWordState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED60FF9D56400D7773A /* PKWordState.m */; }; + D3FDC7050FFC4C9E00F1F797 /* PKWhitespaceState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */; }; + D3FDC7060FFC4C9E00F1F797 /* PKDelimitState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC60FF9D56400D7773A /* PKDelimitState.m */; }; + D3FDC7070FFC4C9E00F1F797 /* PKCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC40FF9D56400D7773A /* PKCommentState.m */; }; + D3FDC7080FFC4C9E00F1F797 /* PKSingleLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */; }; + D3FDC7090FFC4C9E00F1F797 /* PKMultiLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */; }; + D3FDC70A0FFC4C9E00F1F797 /* PKSymbolNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */; }; + D3FDC70B0FFC4C9E00F1F797 /* PKSymbolRootNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */; }; + D3FDC70C0FFC4C9E00F1F797 /* PKPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF380FF9E18300D7773A /* PKPattern.m */; }; + D3FDC70D0FFC4C9E00F1F797 /* PKWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED40FF9D56400D7773A /* PKWord.m */; }; + D3FDC70F0FFC4C9E00F1F797 /* PKQuotedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF460FF9E19700D7773A /* PKQuotedString.m */; }; + D3FDC7100FFC4C9E00F1F797 /* PKSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF480FF9E19700D7773A /* PKSymbol.m */; }; + D3FDC7110FFC4C9E00F1F797 /* PKLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF420FF9E19700D7773A /* PKLiteral.m */; }; + D3FDC7120FFC4C9E00F1F797 /* PKCaseInsensitiveLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */; }; + D3FDC7130FFC4C9E00F1F797 /* PKWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */; }; + D3FDC7140FFC4C9E00F1F797 /* PKComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3E0FF9E19700D7773A /* PKComment.m */; }; + D3FDC7150FFC4C9E00F1F797 /* PKDelimitedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF400FF9E19700D7773A /* PKDelimitedString.m */; }; + D3FDC7160FFC4C9E00F1F797 /* PKAny.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE2F0FF9CE6000D7773A /* PKAny.m */; }; + D3FDC7180FFC4C9E00F1F797 /* PKLowercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */; }; + D3FDC7190FFC4C9E00F1F797 /* PKUppercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */; }; + D3FDC71A0FFC4C9E00F1F797 /* PKCharacterAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */; }; + D3FDC71B0FFC4C9E00F1F797 /* PKChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB40FF9E80300D7773A /* PKChar.m */; }; + D3FDC71C0FFC4C9E00F1F797 /* PKDigit.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB60FF9E80300D7773A /* PKDigit.m */; }; + D3FDC71D0FFC4C9E00F1F797 /* PKLetter.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB80FF9E80300D7773A /* PKLetter.m */; }; + D3FDC71E0FFC4C9E00F1F797 /* PKSpecificChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */; }; + D3FDC71F0FFC4C9E00F1F797 /* PKParserFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD80FF9E95500D7773A /* PKParserFactory.m */; }; + D3FDC7200FFC4C9E00F1F797 /* NSArray+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */; }; + D3FDC7210FFC4C9E00F1F797 /* NSString+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */; }; + D3FDC7370FFC4D6100F1F797 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3FDC7360FFC4D6100F1F797 /* Foundation.framework */; }; + D3FDC7390FFC4D6100F1F797 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3FDC7380FFC4D6100F1F797 /* libicucore.dylib */; }; + D3FDC74C0FFC4DAC00F1F797 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3FDC74B0FFC4DAC00F1F797 /* CoreGraphics.framework */; }; + D3FDC8DC0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = D3FDC8DB0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + D31FE7170E60F24700A0803E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TDParseKit; + }; + D334949F0E296AA900406085 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TODParseKit; + }; + D341850F0E520D6F0081B0DC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TODParseKit; + }; + D389F1D30F19665C00558235 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TDParseKit; + }; + D389F2090F196A8000558235 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D389F1CD0F1965E600558235; + remoteInfo = TDJSParseKit; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + D380B9A10F0EF3DC0009EC13 /* Copy Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(BUILT_PRODUCTS_DIR)"; + dstSubfolderSpec = 0; + files = ( + D3EAC7EC0F2690620043D6A9 /* OCMock.framework in Copy Frameworks */, + ); + name = "Copy Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + D3DCB3880EF5E65100DE5110 /* Copy Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(BUILT_PRODUCTS_DIR)"; + dstSubfolderSpec = 0; + files = ( + D3DCB3730EF5E5D600DE5110 /* OCMock.framework in Copy Frameworks */, + ); + name = "Copy Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; + 8DC2EF5B0486A6940098B216 /* ParseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ParseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D3126D040FFD9BA700CBF4C4 /* PKNegation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKNegation.m; path = src/PKNegation.m; sourceTree = ""; }; + D3126D090FFD9E4B00CBF4C4 /* TDNegationTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNegationTest.h; path = test/TDNegationTest.h; sourceTree = ""; }; + D3126D0A0FFD9E4B00CBF4C4 /* TDNegationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNegationTest.m; path = test/TDNegationTest.m; sourceTree = ""; }; + D3126D410FFDB4C600CBF4C4 /* TDExclusionTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDExclusionTest.h; path = test/TDExclusionTest.h; sourceTree = ""; }; + D3126D420FFDB4C600CBF4C4 /* TDExclusionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDExclusionTest.m; path = test/TDExclusionTest.m; sourceTree = ""; }; + D31270F80FFE898300CBF4C4 /* PKExclusion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKExclusion.m; path = test/PKExclusion.m; sourceTree = ""; }; + D315DF710FEF59B600D876C8 /* date.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = date.grammar; path = res/date.grammar; sourceTree = ""; }; + D319E429106D8A1F008C63DD /* arithmetic.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = arithmetic.grammar; path = res/arithmetic.grammar; sourceTree = ""; }; + D319E42C106D8A31008C63DD /* TDArithmeticAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDArithmeticAssembler.h; path = test/TDArithmeticAssembler.h; sourceTree = ""; }; + D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDArithmeticAssembler.m; path = test/TDArithmeticAssembler.m; sourceTree = ""; }; + D31A15250F6DE449002AFDF1 /* javascript.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = javascript.grammar; path = res/javascript.grammar; sourceTree = ""; }; + D31A16500F7038C2002AFDF1 /* TDJavaScriptParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJavaScriptParser.h; path = test/TDJavaScriptParser.h; sourceTree = ""; }; + D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJavaScriptParser.m; path = test/TDJavaScriptParser.m; sourceTree = ""; }; + D31FE54A0E60E46100A0803E /* TDTestScaffold.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTestScaffold.h; path = test/TDTestScaffold.h; sourceTree = ""; }; + D31FE54B0E60E46100A0803E /* TDTestScaffold.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTestScaffold.m; path = test/TDTestScaffold.m; sourceTree = ""; }; + D31FE54D0E60E50800A0803E /* TDAlternationTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDAlternationTest.h; path = test/TDAlternationTest.h; sourceTree = ""; }; + D31FE54E0E60E50800A0803E /* TDAlternationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDAlternationTest.m; path = test/TDAlternationTest.m; sourceTree = ""; }; + D31FE54F0E60E50800A0803E /* TDLiteralTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDLiteralTest.h; path = test/TDLiteralTest.h; sourceTree = ""; }; + D31FE5500E60E50800A0803E /* TDLiteralTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDLiteralTest.m; path = test/TDLiteralTest.m; sourceTree = ""; }; + D31FE5510E60E50800A0803E /* TDParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserTest.h; path = test/TDParserTest.h; sourceTree = ""; }; + D31FE5520E60E50800A0803E /* TDParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserTest.m; path = test/TDParserTest.m; sourceTree = ""; }; + D31FE5530E60E50800A0803E /* TDRepetitionTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRepetitionTest.h; path = test/TDRepetitionTest.h; sourceTree = ""; }; + D31FE5540E60E50800A0803E /* TDRepetitionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRepetitionTest.m; path = test/TDRepetitionTest.m; sourceTree = ""; }; + D31FE5550E60E50800A0803E /* TDReservedWordTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDReservedWordTest.h; path = test/TDReservedWordTest.h; sourceTree = ""; }; + D31FE5560E60E50800A0803E /* TDReservedWordTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDReservedWordTest.m; path = test/TDReservedWordTest.m; sourceTree = ""; }; + D31FE5570E60E50800A0803E /* TDRobotCommandTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRobotCommandTest.h; path = test/TDRobotCommandTest.h; sourceTree = ""; }; + D31FE5580E60E50800A0803E /* TDRobotCommandTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRobotCommandTest.m; path = test/TDRobotCommandTest.m; sourceTree = ""; }; + D31FE5590E60E50800A0803E /* TDSequenceTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSequenceTest.h; path = test/TDSequenceTest.h; sourceTree = ""; }; + D31FE55A0E60E50800A0803E /* TDSequenceTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSequenceTest.m; path = test/TDSequenceTest.m; sourceTree = ""; }; + D31FE55B0E60E50800A0803E /* TDSymbolTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSymbolTest.h; path = test/TDSymbolTest.h; sourceTree = ""; }; + D31FE55C0E60E50800A0803E /* TDSymbolTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSymbolTest.m; path = test/TDSymbolTest.m; sourceTree = ""; }; + D31FE55D0E60E50800A0803E /* TDTokenAssemblyTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenAssemblyTest.h; path = test/TDTokenAssemblyTest.h; sourceTree = ""; }; + D31FE55E0E60E50800A0803E /* TDTokenAssemblyTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenAssemblyTest.m; path = test/TDTokenAssemblyTest.m; sourceTree = ""; }; + D31FE55F0E60E50800A0803E /* TDTrackTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTrackTest.h; path = test/TDTrackTest.h; sourceTree = ""; }; + D31FE5600E60E50800A0803E /* TDTrackTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTrackTest.m; path = test/TDTrackTest.m; sourceTree = ""; }; + D31FE5610E60E50800A0803E /* TDUppercaseWordTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDUppercaseWordTest.h; path = test/TDUppercaseWordTest.h; sourceTree = ""; }; + D31FE5620E60E50800A0803E /* TDUppercaseWordTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDUppercaseWordTest.m; path = test/TDUppercaseWordTest.m; sourceTree = ""; }; + D31FE5710E60E55700A0803E /* TDReaderTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDReaderTest.h; path = test/TDReaderTest.h; sourceTree = ""; }; + D31FE5720E60E55700A0803E /* TDReaderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDReaderTest.m; path = test/TDReaderTest.m; sourceTree = ""; }; + D31FE5730E60E55700A0803E /* TDTokenizerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenizerTest.h; path = test/TDTokenizerTest.h; sourceTree = ""; }; + D31FE5740E60E55700A0803E /* TDTokenizerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenizerTest.m; path = test/TDTokenizerTest.m; sourceTree = ""; }; + D31FE5770E60E58C00A0803E /* TDNumberStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNumberStateTest.h; path = test/TDNumberStateTest.h; sourceTree = ""; }; + D31FE5780E60E58C00A0803E /* TDNumberStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNumberStateTest.m; path = test/TDNumberStateTest.m; sourceTree = ""; }; + D31FE5790E60E58C00A0803E /* TDQuoteStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDQuoteStateTest.h; path = test/TDQuoteStateTest.h; sourceTree = ""; }; + D31FE57A0E60E58C00A0803E /* TDQuoteStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDQuoteStateTest.m; path = test/TDQuoteStateTest.m; sourceTree = ""; }; + D31FE57B0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSignificantWhitespaceStateTest.h; path = test/TDSignificantWhitespaceStateTest.h; sourceTree = ""; }; + D31FE57C0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSignificantWhitespaceStateTest.m; path = test/TDSignificantWhitespaceStateTest.m; sourceTree = ""; }; + D31FE57D0E60E58C00A0803E /* TDSlashStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashStateTest.h; path = test/TDSlashStateTest.h; sourceTree = ""; }; + D31FE57E0E60E58C00A0803E /* TDSlashStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashStateTest.m; path = test/TDSlashStateTest.m; sourceTree = ""; }; + D31FE57F0E60E58C00A0803E /* TDSymbolStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSymbolStateTest.h; path = test/TDSymbolStateTest.h; sourceTree = ""; }; + D31FE5800E60E58C00A0803E /* TDSymbolStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSymbolStateTest.m; path = test/TDSymbolStateTest.m; sourceTree = ""; }; + D31FE5810E60E58C00A0803E /* TDWhitespaceStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDWhitespaceStateTest.h; path = test/TDWhitespaceStateTest.h; sourceTree = ""; }; + D31FE5820E60E58C00A0803E /* TDWhitespaceStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDWhitespaceStateTest.m; path = test/TDWhitespaceStateTest.m; sourceTree = ""; }; + D31FE5830E60E58C00A0803E /* TDWordStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDWordStateTest.h; path = test/TDWordStateTest.h; sourceTree = ""; }; + D31FE5840E60E58C00A0803E /* TDWordStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDWordStateTest.m; path = test/TDWordStateTest.m; sourceTree = ""; }; + D31FE58C0E60E5AC00A0803E /* TDCharacterAssemblyTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDCharacterAssemblyTest.h; path = test/TDCharacterAssemblyTest.h; sourceTree = ""; }; + D31FE58D0E60E5AC00A0803E /* TDCharacterAssemblyTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDCharacterAssemblyTest.m; path = test/TDCharacterAssemblyTest.m; sourceTree = ""; }; + D31FE58E0E60E5AC00A0803E /* TDCharTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDCharTest.h; path = test/TDCharTest.h; sourceTree = ""; }; + D31FE58F0E60E5AC00A0803E /* TDCharTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDCharTest.m; path = test/TDCharTest.m; sourceTree = ""; }; + D31FE5900E60E5AC00A0803E /* TDDigitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDDigitTest.h; path = test/TDDigitTest.h; sourceTree = ""; }; + D31FE5910E60E5AC00A0803E /* TDDigitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDDigitTest.m; path = test/TDDigitTest.m; sourceTree = ""; }; + D31FE5920E60E5AC00A0803E /* TDLetterTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDLetterTest.h; path = test/TDLetterTest.h; sourceTree = ""; }; + D31FE5930E60E5AC00A0803E /* TDLetterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDLetterTest.m; path = test/TDLetterTest.m; sourceTree = ""; }; + D31FE5940E60E5AC00A0803E /* TDSpecificCharTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSpecificCharTest.h; path = test/TDSpecificCharTest.h; sourceTree = ""; }; + D31FE5950E60E5AC00A0803E /* TDSpecificCharTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSpecificCharTest.m; path = test/TDSpecificCharTest.m; sourceTree = ""; }; + D31FE59B0E60E5C000A0803E /* TDRegularParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRegularParser.h; path = test/TDRegularParser.h; sourceTree = ""; }; + D31FE59C0E60E5C000A0803E /* TDRegularParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRegularParser.m; path = test/TDRegularParser.m; sourceTree = ""; }; + D31FE59D0E60E5C000A0803E /* TDRegularParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRegularParserTest.h; path = test/TDRegularParserTest.h; sourceTree = ""; }; + D31FE59E0E60E5C000A0803E /* TDRegularParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRegularParserTest.m; path = test/TDRegularParserTest.m; sourceTree = ""; }; + D31FE5A10E60E5D500A0803E /* TDFastJsonParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDFastJsonParser.h; path = test/TDFastJsonParser.h; sourceTree = ""; }; + D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDFastJsonParser.m; path = test/TDFastJsonParser.m; sourceTree = ""; }; + D31FE5A30E60E5D500A0803E /* TDFastJsonParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDFastJsonParserTest.h; path = test/TDFastJsonParserTest.h; sourceTree = ""; }; + D31FE5A40E60E5D500A0803E /* TDFastJsonParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDFastJsonParserTest.m; path = test/TDFastJsonParserTest.m; sourceTree = ""; }; + D31FE5AD0E60E64900A0803E /* TDXmlTokenAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTokenAssembly.h; path = test/TDXmlTokenAssembly.h; sourceTree = ""; }; + D31FE5AE0E60E64900A0803E /* TDXmlTokenAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTokenAssembly.m; path = test/TDXmlTokenAssembly.m; sourceTree = ""; }; + D31FE5AF0E60E64900A0803E /* TDXmlTokenizerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTokenizerTest.h; path = test/TDXmlTokenizerTest.h; sourceTree = ""; }; + D31FE5B00E60E64900A0803E /* TDXmlTokenizerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTokenizerTest.m; path = test/TDXmlTokenizerTest.m; sourceTree = ""; }; + D31FE5B30E60E66600A0803E /* TDXmlToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlToken.h; path = test/TDXmlToken.h; sourceTree = ""; }; + D31FE5B40E60E66600A0803E /* TDXmlToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlToken.m; path = test/TDXmlToken.m; sourceTree = ""; }; + D31FE5B50E60E66600A0803E /* TDXmlTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTokenizer.h; path = test/TDXmlTokenizer.h; sourceTree = ""; }; + D31FE5B60E60E66600A0803E /* TDXmlTokenizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTokenizer.m; path = test/TDXmlTokenizer.m; sourceTree = ""; }; + D31FE5B90E60E69E00A0803E /* TDXmlAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlAttribute.h; path = test/TDXmlAttribute.h; sourceTree = ""; }; + D31FE5BA0E60E69E00A0803E /* TDXmlAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlAttribute.m; path = test/TDXmlAttribute.m; sourceTree = ""; }; + D31FE5BB0E60E69E00A0803E /* TDXmlCdata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlCdata.h; path = test/TDXmlCdata.h; sourceTree = ""; }; + D31FE5BC0E60E69E00A0803E /* TDXmlCdata.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlCdata.m; path = test/TDXmlCdata.m; sourceTree = ""; }; + D31FE5BD0E60E69E00A0803E /* TDXmlComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlComment.h; path = test/TDXmlComment.h; sourceTree = ""; }; + D31FE5BE0E60E69E00A0803E /* TDXmlComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlComment.m; path = test/TDXmlComment.m; sourceTree = ""; }; + D31FE5BF0E60E69E00A0803E /* TDXmlDecl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlDecl.h; path = test/TDXmlDecl.h; sourceTree = ""; }; + D31FE5C00E60E69E00A0803E /* TDXmlDecl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlDecl.m; path = test/TDXmlDecl.m; sourceTree = ""; }; + D31FE5C10E60E69E00A0803E /* TDXmlDoctype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlDoctype.h; path = test/TDXmlDoctype.h; sourceTree = ""; }; + D31FE5C20E60E69E00A0803E /* TDXmlDoctype.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlDoctype.m; path = test/TDXmlDoctype.m; sourceTree = ""; }; + D31FE5C30E60E69E00A0803E /* TDXmlDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlDocument.h; path = test/TDXmlDocument.h; sourceTree = ""; }; + D31FE5C40E60E69E00A0803E /* TDXmlDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlDocument.m; path = test/TDXmlDocument.m; sourceTree = ""; }; + D31FE5C50E60E69E00A0803E /* TDXmlEndEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEndEntity.h; path = test/TDXmlEndEntity.h; sourceTree = ""; }; + D31FE5C60E60E69E00A0803E /* TDXmlEndEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEndEntity.m; path = test/TDXmlEndEntity.m; sourceTree = ""; }; + D31FE5C70E60E69E00A0803E /* TDXmlEndTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEndTag.h; path = test/TDXmlEndTag.h; sourceTree = ""; }; + D31FE5C80E60E69E00A0803E /* TDXmlEndTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEndTag.m; path = test/TDXmlEndTag.m; sourceTree = ""; }; + D31FE5C90E60E69E00A0803E /* TDXmlEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEntity.h; path = test/TDXmlEntity.h; sourceTree = ""; }; + D31FE5CA0E60E69E00A0803E /* TDXmlEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEntity.m; path = test/TDXmlEntity.m; sourceTree = ""; }; + D31FE5CB0E60E69E00A0803E /* TDXmlEntityRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEntityRef.h; path = test/TDXmlEntityRef.h; sourceTree = ""; }; + D31FE5CC0E60E69E00A0803E /* TDXmlEntityRef.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEntityRef.m; path = test/TDXmlEntityRef.m; sourceTree = ""; }; + D31FE5CD0E60E69E00A0803E /* TDXmlFragment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlFragment.h; path = test/TDXmlFragment.h; sourceTree = ""; }; + D31FE5CE0E60E69E00A0803E /* TDXmlFragment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlFragment.m; path = test/TDXmlFragment.m; sourceTree = ""; }; + D31FE5CF0E60E69E00A0803E /* TDXmlNotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNotation.h; path = test/TDXmlNotation.h; sourceTree = ""; }; + D31FE5D00E60E69E00A0803E /* TDXmlNotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNotation.m; path = test/TDXmlNotation.m; sourceTree = ""; }; + D31FE5D10E60E69E00A0803E /* TDXmlProcessingInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlProcessingInstruction.h; path = test/TDXmlProcessingInstruction.h; sourceTree = ""; }; + D31FE5D20E60E69E00A0803E /* TDXmlProcessingInstruction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlProcessingInstruction.m; path = test/TDXmlProcessingInstruction.m; sourceTree = ""; }; + D31FE5D30E60E69E00A0803E /* TDXmlSignificantWhitespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlSignificantWhitespace.h; path = test/TDXmlSignificantWhitespace.h; sourceTree = ""; }; + D31FE5D40E60E69E00A0803E /* TDXmlSignificantWhitespace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlSignificantWhitespace.m; path = test/TDXmlSignificantWhitespace.m; sourceTree = ""; }; + D31FE5D50E60E69E00A0803E /* TDXmlStartTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlStartTag.h; path = test/TDXmlStartTag.h; sourceTree = ""; }; + D31FE5D60E60E69E00A0803E /* TDXmlStartTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlStartTag.m; path = test/TDXmlStartTag.m; sourceTree = ""; }; + D31FE5D70E60E69E00A0803E /* TDXmlTerminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTerminal.h; path = test/TDXmlTerminal.h; sourceTree = ""; }; + D31FE5D80E60E69E00A0803E /* TDXmlTerminal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTerminal.m; path = test/TDXmlTerminal.m; sourceTree = ""; }; + D31FE5D90E60E69E00A0803E /* TDXmlText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlText.h; path = test/TDXmlText.h; sourceTree = ""; }; + D31FE5DA0E60E69E00A0803E /* TDXmlText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlText.m; path = test/TDXmlText.m; sourceTree = ""; }; + D31FE5DB0E60E69E00A0803E /* TDXmlWhitespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlWhitespace.h; path = test/TDXmlWhitespace.h; sourceTree = ""; }; + D31FE5DC0E60E69E00A0803E /* TDXmlWhitespace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlWhitespace.m; path = test/TDXmlWhitespace.m; sourceTree = ""; }; + D31FE5EF0E60E6B500A0803E /* TDNCName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNCName.h; path = test/TDNCName.h; sourceTree = ""; }; + D31FE5F00E60E6B500A0803E /* TDNCNameState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNCNameState.h; path = test/TDNCNameState.h; sourceTree = ""; }; + D31FE5F10E60E6B500A0803E /* TDNCNameState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNCNameState.m; path = test/TDNCNameState.m; sourceTree = ""; }; + D31FE5F20E60E6B500A0803E /* TDXmlName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlName.h; path = test/TDXmlName.h; sourceTree = ""; }; + D31FE5F30E60E6B500A0803E /* TDXmlName.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlName.m; path = test/TDXmlName.m; sourceTree = ""; }; + D31FE5F40E60E6B500A0803E /* TDXmlNameState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNameState.h; path = test/TDXmlNameState.h; sourceTree = ""; }; + D31FE5F50E60E6B500A0803E /* TDXmlNameState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNameState.m; path = test/TDXmlNameState.m; sourceTree = ""; }; + D31FE5F60E60E6B500A0803E /* TDXmlNameTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNameTest.h; path = test/TDXmlNameTest.h; sourceTree = ""; }; + D31FE5F70E60E6B500A0803E /* TDXmlNameTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNameTest.m; path = test/TDXmlNameTest.m; sourceTree = ""; }; + D31FE5F80E60E6B500A0803E /* TDXmlNmtoken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNmtoken.h; path = test/TDXmlNmtoken.h; sourceTree = ""; }; + D31FE5F90E60E6B500A0803E /* TDXmlNmtoken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNmtoken.m; path = test/TDXmlNmtoken.m; sourceTree = ""; }; + D31FE5FA0E60E6B500A0803E /* TDXmlNmtokenState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNmtokenState.h; path = test/TDXmlNmtokenState.h; sourceTree = ""; }; + D31FE5FB0E60E6B500A0803E /* TDXmlNmtokenState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNmtokenState.m; path = test/TDXmlNmtokenState.m; sourceTree = ""; }; + D31FE6DF0E60EE2500A0803E /* TDNCName.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNCName.m; path = test/TDNCName.m; sourceTree = ""; }; + D3252F780FCE1A7E005EF059 /* TDNSPredicateBuilderTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateBuilderTest.h; path = test/TDNSPredicateBuilderTest.h; sourceTree = ""; }; + D3252F790FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateBuilderTest.m; path = test/TDNSPredicateBuilderTest.m; sourceTree = ""; }; + D3252F7C0FCE1A87005EF059 /* TDNSPredicateBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateBuilder.h; path = test/TDNSPredicateBuilder.h; sourceTree = ""; }; + D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateBuilder.m; path = test/TDNSPredicateBuilder.m; sourceTree = ""; }; + D3305C4B102F5BAD00DC4F75 /* TDGutterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDGutterView.h; path = demoapp/TDGutterView.h; sourceTree = ""; }; + D3305C4C102F5BAD00DC4F75 /* TDGutterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDGutterView.m; path = demoapp/TDGutterView.m; sourceTree = ""; }; + D3305C4D102F5BAE00DC4F75 /* TDSourceCodeTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSourceCodeTextView.h; path = demoapp/TDSourceCodeTextView.h; sourceTree = ""; }; + D3305C4E102F5BAE00DC4F75 /* TDSourceCodeTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSourceCodeTextView.m; path = demoapp/TDSourceCodeTextView.m; sourceTree = ""; }; + D33494100E2963FD00406085 /* DemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D3376D5710093A1600E4602E /* PKGrammarParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKGrammarParser.h; path = src/PKGrammarParser.h; sourceTree = ""; }; + D3376D5810093A1600E4602E /* PKGrammarParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKGrammarParser.m; path = src/PKGrammarParser.m; sourceTree = ""; }; + D3376D8C10096C0700E4602E /* PKAST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAST.h; path = test/PKAST.h; sourceTree = ""; }; + D3376D8D10096C0700E4602E /* PKAST.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAST.m; path = test/PKAST.m; sourceTree = ""; }; + D3385FD70FCFB1FF003BF729 /* TDPredicateEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPredicateEvaluator.h; path = test/TDPredicateEvaluator.h; sourceTree = ""; }; + D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPredicateEvaluator.m; path = test/TDPredicateEvaluator.m; sourceTree = ""; }; + D3385FDB0FCFB227003BF729 /* TDPredicateEvaluatorTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPredicateEvaluatorTest.h; path = test/TDPredicateEvaluatorTest.h; sourceTree = ""; }; + D3385FDC0FCFB227003BF729 /* TDPredicateEvaluatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPredicateEvaluatorTest.m; path = test/TDPredicateEvaluatorTest.m; sourceTree = ""; }; + D338E5B90FF5DDCB003DE6AA /* TDDifferenceTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDDifferenceTest.h; path = test/TDDifferenceTest.h; sourceTree = ""; }; + D338E5BA0FF5DDCB003DE6AA /* TDDifferenceTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDDifferenceTest.m; path = test/TDDifferenceTest.m; sourceTree = ""; }; + D34185040E520D3F0081B0DC /* DebugApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DebugApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D34BAC210FF87F8600D7773A /* TDParserFactoryTest3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryTest3.h; path = test/TDParserFactoryTest3.h; sourceTree = ""; }; + D34BAC220FF87F8600D7773A /* TDParserFactoryTest3.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryTest3.m; path = test/TDParserFactoryTest3.m; sourceTree = ""; }; + D34BAC490FF892C200D7773A /* XPathParserGrammarTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathParserGrammarTest.h; path = test/XPathParserGrammarTest.h; sourceTree = ""; }; + D34BAC4A0FF892C200D7773A /* XPathParserGrammarTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathParserGrammarTest.m; path = test/XPathParserGrammarTest.m; sourceTree = ""; }; + D34BAD16100A9B7900996341 /* TDTokenizerStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenizerStateTest.h; path = test/TDTokenizerStateTest.h; sourceTree = ""; }; + D34BAD17100A9B7900996341 /* TDTokenizerStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenizerStateTest.m; path = test/TDTokenizerStateTest.m; sourceTree = ""; }; + D34BAD630FF9C6AE00D7773A /* ParseKit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseKit_Prefix.pch; sourceTree = ""; }; + D34BAD9B0FF9C95800D7773A /* PKReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKReader.m; path = src/PKReader.m; sourceTree = ""; }; + D34BADA00FF9C9B000D7773A /* PKAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAssembly.m; path = src/PKAssembly.m; sourceTree = ""; }; + D34BADD60FF9CBFB00D7773A /* PKParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParser.m; path = src/PKParser.m; sourceTree = ""; }; + D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCollectionParser.m; path = src/PKCollectionParser.m; sourceTree = ""; }; + D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAlternation.m; path = src/PKAlternation.m; sourceTree = ""; }; + D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKEmpty.m; path = src/PKEmpty.m; sourceTree = ""; }; + D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDifference.m; path = src/PKDifference.m; sourceTree = ""; }; + D34BAE110FF9CE0E00D7773A /* PKIntersection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKIntersection.m; path = src/PKIntersection.m; sourceTree = ""; }; + D34BAE130FF9CE0E00D7773A /* PKRepetition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKRepetition.m; path = src/PKRepetition.m; sourceTree = ""; }; + D34BAE150FF9CE0E00D7773A /* PKSequence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSequence.m; path = src/PKSequence.m; sourceTree = ""; }; + D34BAE170FF9CE0E00D7773A /* PKTerminal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTerminal.m; path = src/PKTerminal.m; sourceTree = ""; }; + D34BAE190FF9CE0E00D7773A /* PKTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTrack.m; path = src/PKTrack.m; sourceTree = ""; }; + D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTrackException.m; path = src/PKTrackException.m; sourceTree = ""; }; + D34BAE2F0FF9CE6000D7773A /* PKAny.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAny.m; path = src/PKAny.m; sourceTree = ""; }; + D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenAssembly.m; path = src/PKTokenAssembly.m; sourceTree = ""; }; + D34BAE950FF9D20900D7773A /* PKToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKToken.m; path = src/PKToken.m; sourceTree = ""; }; + D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenArraySource.m; path = src/PKTokenArraySource.m; sourceTree = ""; }; + D34BAE990FF9D20900D7773A /* PKTokenizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenizer.m; path = src/PKTokenizer.m; sourceTree = ""; }; + D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenizerState.m; path = src/PKTokenizerState.m; sourceTree = ""; }; + D34BAEC40FF9D56400D7773A /* PKCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCommentState.m; path = src/PKCommentState.m; sourceTree = ""; }; + D34BAEC60FF9D56400D7773A /* PKDelimitState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDelimitState.m; path = src/PKDelimitState.m; sourceTree = ""; }; + D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKMultiLineCommentState.m; path = src/PKMultiLineCommentState.m; sourceTree = ""; }; + D34BAECA0FF9D56400D7773A /* PKNumberState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKNumberState.m; path = src/PKNumberState.m; sourceTree = ""; }; + D34BAECC0FF9D56400D7773A /* PKQuoteState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKQuoteState.m; path = src/PKQuoteState.m; sourceTree = ""; }; + D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSingleLineCommentState.m; path = src/PKSingleLineCommentState.m; sourceTree = ""; }; + D34BAED00FF9D56400D7773A /* PKSymbolState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbolState.m; path = src/PKSymbolState.m; sourceTree = ""; }; + D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWhitespaceState.m; path = src/PKWhitespaceState.m; sourceTree = ""; }; + D34BAED40FF9D56400D7773A /* PKWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWord.m; path = src/PKWord.m; sourceTree = ""; }; + D34BAED60FF9D56400D7773A /* PKWordState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWordState.m; path = src/PKWordState.m; sourceTree = ""; }; + D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbolNode.m; path = src/PKSymbolNode.m; sourceTree = ""; }; + D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbolRootNode.m; path = src/PKSymbolRootNode.m; sourceTree = ""; }; + D34BAF380FF9E18300D7773A /* PKPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKPattern.m; path = src/PKPattern.m; sourceTree = ""; }; + D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCaseInsensitiveLiteral.m; path = src/PKCaseInsensitiveLiteral.m; sourceTree = ""; }; + D34BAF3E0FF9E19700D7773A /* PKComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKComment.m; path = src/PKComment.m; sourceTree = ""; }; + D34BAF400FF9E19700D7773A /* PKDelimitedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDelimitedString.m; path = src/PKDelimitedString.m; sourceTree = ""; }; + D34BAF420FF9E19700D7773A /* PKLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKLiteral.m; path = src/PKLiteral.m; sourceTree = ""; }; + D34BAF440FF9E19700D7773A /* PKNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKNumber.m; path = src/PKNumber.m; sourceTree = ""; }; + D34BAF460FF9E19700D7773A /* PKQuotedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKQuotedString.m; path = src/PKQuotedString.m; sourceTree = ""; }; + D34BAF480FF9E19700D7773A /* PKSymbol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbol.m; path = src/PKSymbol.m; sourceTree = ""; }; + D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWhitespace.m; path = src/PKWhitespace.m; sourceTree = ""; }; + D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKLowercaseWord.m; path = src/PKLowercaseWord.m; sourceTree = ""; }; + D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKUppercaseWord.m; path = src/PKUppercaseWord.m; sourceTree = ""; }; + D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCharacterAssembly.m; path = src/PKCharacterAssembly.m; sourceTree = ""; }; + D34BAFB40FF9E80300D7773A /* PKChar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKChar.m; path = src/PKChar.m; sourceTree = ""; }; + D34BAFB60FF9E80300D7773A /* PKDigit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDigit.m; path = src/PKDigit.m; sourceTree = ""; }; + D34BAFB80FF9E80300D7773A /* PKLetter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKLetter.m; path = src/PKLetter.m; sourceTree = ""; }; + D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSpecificChar.m; path = src/PKSpecificChar.m; sourceTree = ""; }; + D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSArray+ParseKitAdditions.h"; path = "src/NSArray+ParseKitAdditions.h"; sourceTree = ""; }; + D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSArray+ParseKitAdditions.m"; path = "src/NSArray+ParseKitAdditions.m"; sourceTree = ""; }; + D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+ParseKitAdditions.h"; path = "src/NSString+ParseKitAdditions.h"; sourceTree = ""; }; + D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+ParseKitAdditions.m"; path = "src/NSString+ParseKitAdditions.m"; sourceTree = ""; }; + D34BAFD80FF9E95500D7773A /* PKParserFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParserFactory.m; path = src/PKParserFactory.m; sourceTree = ""; }; + D34BB04E0FF9EC4E00D7773A /* JSParseKit-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "JSParseKit-Info.plist"; sourceTree = ""; }; + D34BB0660FF9EDDF00D7773A /* JSParseKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSParseKit.h; path = jssrc/JSParseKit.h; sourceTree = ""; }; + D34BB0670FF9EDDF00D7773A /* JSParseKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSParseKit.m; path = jssrc/JSParseKit.m; sourceTree = ""; }; + D34BB06A0FF9EE4000D7773A /* PKJSAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAssembly.h; path = jssrc/PKJSAssembly.h; sourceTree = ""; }; + D34BB06B0FF9EE4000D7773A /* PKJSAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAssembly.m; path = jssrc/PKJSAssembly.m; sourceTree = ""; }; + D34BB06C0FF9EE4000D7773A /* PKJSUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSUtils.h; path = jssrc/PKJSUtils.h; sourceTree = ""; }; + D34BB06D0FF9EE4000D7773A /* PKJSUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSUtils.m; path = jssrc/PKJSUtils.m; sourceTree = ""; }; + D34BB06E0FF9EE4000D7773A /* PKJSUtils_macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSUtils_macros.h; path = jssrc/PKJSUtils_macros.h; sourceTree = ""; }; + D34BB06F0FF9EE4000D7773A /* PKJSValueHolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSValueHolder.h; path = jssrc/PKJSValueHolder.h; sourceTree = ""; }; + D34BB0700FF9EE4000D7773A /* PKJSValueHolder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSValueHolder.m; path = jssrc/PKJSValueHolder.m; sourceTree = ""; }; + D34BB08D0FF9EF9D00D7773A /* PKJSCharacterAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCharacterAssembly.h; path = jssrc/PKJSCharacterAssembly.h; sourceTree = ""; }; + D34BB08E0FF9EF9D00D7773A /* PKJSCharacterAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCharacterAssembly.m; path = jssrc/PKJSCharacterAssembly.m; sourceTree = ""; }; + D34BB0930FF9F14B00D7773A /* PKJSCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCommentState.h; path = jssrc/PKJSCommentState.h; sourceTree = ""; }; + D34BB0940FF9F14B00D7773A /* PKJSCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCommentState.m; path = jssrc/PKJSCommentState.m; sourceTree = ""; }; + D34BB0950FF9F14B00D7773A /* PKJSDelimitState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSDelimitState.h; path = jssrc/PKJSDelimitState.h; sourceTree = ""; }; + D34BB0960FF9F14B00D7773A /* PKJSDelimitState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSDelimitState.m; path = jssrc/PKJSDelimitState.m; sourceTree = ""; }; + D34BB0970FF9F14B00D7773A /* PKJSNumberState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSNumberState.h; path = jssrc/PKJSNumberState.h; sourceTree = ""; }; + D34BB0980FF9F14B00D7773A /* PKJSNumberState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSNumberState.m; path = jssrc/PKJSNumberState.m; sourceTree = ""; }; + D34BB0990FF9F14B00D7773A /* PKJSQuoteState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSQuoteState.h; path = jssrc/PKJSQuoteState.h; sourceTree = ""; }; + D34BB09A0FF9F14B00D7773A /* PKJSQuoteState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSQuoteState.m; path = jssrc/PKJSQuoteState.m; sourceTree = ""; }; + D34BB09B0FF9F14B00D7773A /* PKJSSymbolState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSSymbolState.h; path = jssrc/PKJSSymbolState.h; sourceTree = ""; }; + D34BB09C0FF9F14B00D7773A /* PKJSSymbolState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSSymbolState.m; path = jssrc/PKJSSymbolState.m; sourceTree = ""; }; + D34BB09D0FF9F14B00D7773A /* PKJSToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSToken.h; path = jssrc/PKJSToken.h; sourceTree = ""; }; + D34BB09E0FF9F14B00D7773A /* PKJSToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSToken.m; path = jssrc/PKJSToken.m; sourceTree = ""; }; + D34BB09F0FF9F14B00D7773A /* PKJSTokenAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTokenAssembly.h; path = jssrc/PKJSTokenAssembly.h; sourceTree = ""; }; + D34BB0A00FF9F14B00D7773A /* PKJSTokenAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTokenAssembly.m; path = jssrc/PKJSTokenAssembly.m; sourceTree = ""; }; + D34BB0A10FF9F14B00D7773A /* PKJSTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTokenizer.h; path = jssrc/PKJSTokenizer.h; sourceTree = ""; }; + D34BB0A20FF9F14B00D7773A /* PKJSTokenizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTokenizer.m; path = jssrc/PKJSTokenizer.m; sourceTree = ""; }; + D34BB0A30FF9F14B00D7773A /* PKJSTokenizerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTokenizerState.h; path = jssrc/PKJSTokenizerState.h; sourceTree = ""; }; + D34BB0A40FF9F14B00D7773A /* PKJSTokenizerState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTokenizerState.m; path = jssrc/PKJSTokenizerState.m; sourceTree = ""; }; + D34BB0A50FF9F14B00D7773A /* PKJSWhitespaceState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSWhitespaceState.h; path = jssrc/PKJSWhitespaceState.h; sourceTree = ""; }; + D34BB0A60FF9F14B00D7773A /* PKJSWhitespaceState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSWhitespaceState.m; path = jssrc/PKJSWhitespaceState.m; sourceTree = ""; }; + D34BB0A70FF9F14B00D7773A /* PKJSWordState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSWordState.h; path = jssrc/PKJSWordState.h; sourceTree = ""; }; + D34BB0A80FF9F14B00D7773A /* PKJSWordState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSWordState.m; path = jssrc/PKJSWordState.m; sourceTree = ""; }; + D34BB0D20FF9F28000D7773A /* PKJSAlternation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAlternation.h; path = jssrc/PKJSAlternation.h; sourceTree = ""; }; + D34BB0D30FF9F28000D7773A /* PKJSAlternation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAlternation.m; path = jssrc/PKJSAlternation.m; sourceTree = ""; }; + D34BB0D40FF9F28000D7773A /* PKJSAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAny.h; path = jssrc/PKJSAny.h; sourceTree = ""; }; + D34BB0D50FF9F28000D7773A /* PKJSAny.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAny.m; path = jssrc/PKJSAny.m; sourceTree = ""; }; + D34BB0D60FF9F28000D7773A /* PKJSAssemblerAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAssemblerAdapter.h; path = jssrc/PKJSAssemblerAdapter.h; sourceTree = ""; }; + D34BB0D70FF9F28000D7773A /* PKJSAssemblerAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAssemblerAdapter.m; path = jssrc/PKJSAssemblerAdapter.m; sourceTree = ""; }; + D34BB0D80FF9F28000D7773A /* PKJSCollectionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCollectionParser.h; path = jssrc/PKJSCollectionParser.h; sourceTree = ""; }; + D34BB0D90FF9F28000D7773A /* PKJSCollectionParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCollectionParser.m; path = jssrc/PKJSCollectionParser.m; sourceTree = ""; }; + D34BB0DA0FF9F28000D7773A /* PKJSEmpty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSEmpty.h; path = jssrc/PKJSEmpty.h; sourceTree = ""; }; + D34BB0DB0FF9F28000D7773A /* PKJSEmpty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSEmpty.m; path = jssrc/PKJSEmpty.m; sourceTree = ""; }; + D34BB0DC0FF9F28000D7773A /* PKJSParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSParser.h; path = jssrc/PKJSParser.h; sourceTree = ""; }; + D34BB0DD0FF9F28000D7773A /* PKJSParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSParser.m; path = jssrc/PKJSParser.m; sourceTree = ""; }; + D34BB0DE0FF9F28000D7773A /* PKJSRepetition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSRepetition.h; path = jssrc/PKJSRepetition.h; sourceTree = ""; }; + D34BB0DF0FF9F28000D7773A /* PKJSRepetition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSRepetition.m; path = jssrc/PKJSRepetition.m; sourceTree = ""; }; + D34BB0E00FF9F28000D7773A /* PKJSSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSSequence.h; path = jssrc/PKJSSequence.h; sourceTree = ""; }; + D34BB0E10FF9F28000D7773A /* PKJSSequence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSSequence.m; path = jssrc/PKJSSequence.m; sourceTree = ""; }; + D34BB0E20FF9F28000D7773A /* PKJSTerminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTerminal.h; path = jssrc/PKJSTerminal.h; sourceTree = ""; }; + D34BB0E30FF9F28000D7773A /* PKJSTerminal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTerminal.m; path = jssrc/PKJSTerminal.m; sourceTree = ""; }; + D34BB0E40FF9F28000D7773A /* PKJSTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTrack.h; path = jssrc/PKJSTrack.h; sourceTree = ""; }; + D34BB0E50FF9F28000D7773A /* PKJSTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTrack.m; path = jssrc/PKJSTrack.m; sourceTree = ""; }; + D34BB0FE0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCaseInsensitiveLiteral.h; path = jssrc/PKJSCaseInsensitiveLiteral.h; sourceTree = ""; }; + D34BB0FF0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCaseInsensitiveLiteral.m; path = jssrc/PKJSCaseInsensitiveLiteral.m; sourceTree = ""; }; + D34BB1000FF9F36200D7773A /* PKJSComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSComment.h; path = jssrc/PKJSComment.h; sourceTree = ""; }; + D34BB1010FF9F36200D7773A /* PKJSComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSComment.m; path = jssrc/PKJSComment.m; sourceTree = ""; }; + D34BB1020FF9F36200D7773A /* PKJSDelimitedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSDelimitedString.h; path = jssrc/PKJSDelimitedString.h; sourceTree = ""; }; + D34BB1030FF9F36200D7773A /* PKJSDelimitedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSDelimitedString.m; path = jssrc/PKJSDelimitedString.m; sourceTree = ""; }; + D34BB1040FF9F36200D7773A /* PKJSLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSLiteral.h; path = jssrc/PKJSLiteral.h; sourceTree = ""; }; + D34BB1050FF9F36200D7773A /* PKJSLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSLiteral.m; path = jssrc/PKJSLiteral.m; sourceTree = ""; }; + D34BB1060FF9F36200D7773A /* PKJSLowercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSLowercaseWord.h; path = jssrc/PKJSLowercaseWord.h; sourceTree = ""; }; + D34BB1070FF9F36200D7773A /* PKJSLowercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSLowercaseWord.m; path = jssrc/PKJSLowercaseWord.m; sourceTree = ""; }; + D34BB1080FF9F36200D7773A /* PKJSNum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSNum.h; path = jssrc/PKJSNum.h; sourceTree = ""; }; + D34BB1090FF9F36200D7773A /* PKJSNum.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSNum.m; path = jssrc/PKJSNum.m; sourceTree = ""; }; + D34BB10A0FF9F36200D7773A /* PKJSPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSPattern.h; path = jssrc/PKJSPattern.h; sourceTree = ""; }; + D34BB10B0FF9F36200D7773A /* PKJSPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSPattern.m; path = jssrc/PKJSPattern.m; sourceTree = ""; }; + D34BB10C0FF9F36200D7773A /* PKJSQuotedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSQuotedString.h; path = jssrc/PKJSQuotedString.h; sourceTree = ""; }; + D34BB10D0FF9F36200D7773A /* PKJSQuotedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSQuotedString.m; path = jssrc/PKJSQuotedString.m; sourceTree = ""; }; + D34BB10E0FF9F36200D7773A /* PKJSSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSSymbol.h; path = jssrc/PKJSSymbol.h; sourceTree = ""; }; + D34BB10F0FF9F36200D7773A /* PKJSSymbol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSSymbol.m; path = jssrc/PKJSSymbol.m; sourceTree = ""; }; + D34BB1100FF9F36200D7773A /* PKJSUppercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSUppercaseWord.h; path = jssrc/PKJSUppercaseWord.h; sourceTree = ""; }; + D34BB1110FF9F36200D7773A /* PKJSUppercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSUppercaseWord.m; path = jssrc/PKJSUppercaseWord.m; sourceTree = ""; }; + D34BB1120FF9F36200D7773A /* PKJSWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSWord.h; path = jssrc/PKJSWord.h; sourceTree = ""; }; + D34BB1130FF9F36200D7773A /* PKJSWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSWord.m; path = jssrc/PKJSWord.m; sourceTree = ""; }; + D3521F520E5FA1B0009681F9 /* XMLReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMLReader.h; path = test/XMLReader.h; sourceTree = ""; }; + D3521F530E5FA1B0009681F9 /* XMLReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMLReader.m; path = test/XMLReader.m; sourceTree = ""; }; + D3521F540E5FA1B0009681F9 /* XMLReaderTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMLReaderTest.h; path = test/XMLReaderTest.h; sourceTree = ""; }; + D3521F550E5FA1B0009681F9 /* XMLReaderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMLReaderTest.m; path = test/XMLReaderTest.m; sourceTree = ""; }; + D35384EC0FE9691100926552 /* nspredicate.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = nspredicate.grammar; path = res/nspredicate.grammar; sourceTree = ""; }; + D353899B0FEAC94400926552 /* c.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = c.grammar; path = res/c.grammar; sourceTree = ""; }; + D353899D0FEAC96B00926552 /* objc.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = objc.grammar; path = res/objc.grammar; sourceTree = ""; }; + D355C62B0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateEvaluator.h; path = test/TDNSPredicateEvaluator.h; sourceTree = ""; }; + D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateEvaluator.m; path = test/TDNSPredicateEvaluator.m; sourceTree = ""; }; + D355C62F0FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateEvaluatorTest.h; path = test/TDNSPredicateEvaluatorTest.h; sourceTree = ""; }; + D355C6300FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateEvaluatorTest.m; path = test/TDNSPredicateEvaluatorTest.m; sourceTree = ""; }; + D355C8800FEB36A1006A91A4 /* xml.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = xml.grammar; path = res/xml.grammar; sourceTree = ""; }; + D355C8830FEB4B94006A91A4 /* proto.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = proto.grammar; path = res/proto.grammar; sourceTree = ""; }; + D36568A50EEF9FE900226554 /* TDPlistParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPlistParser.h; path = test/TDPlistParser.h; sourceTree = ""; }; + D36568A60EEF9FE900226554 /* TDPlistParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPlistParser.m; path = test/TDPlistParser.m; sourceTree = ""; }; + D36568A80EEFA05300226554 /* TDPlistParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPlistParserTest.h; path = test/TDPlistParserTest.h; sourceTree = ""; }; + D36568A90EEFA05300226554 /* TDPlistParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPlistParserTest.m; path = test/TDPlistParserTest.m; sourceTree = ""; }; + D3656DFC0EF2620E00226554 /* TDTokenArraySourceTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenArraySourceTest.h; path = test/TDTokenArraySourceTest.h; sourceTree = ""; }; + D3656DFD0EF2620E00226554 /* TDTokenArraySourceTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenArraySourceTest.m; path = test/TDTokenArraySourceTest.m; sourceTree = ""; }; + D3668291101D2BFA0008632C /* erb.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = erb.grammar; path = res/erb.grammar; sourceTree = ""; }; + D3668294101D2C200008632C /* ERBTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ERBTest.h; path = test/ERBTest.h; sourceTree = ""; }; + D3668295101D2C200008632C /* ERBTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ERBTest.m; path = test/ERBTest.m; sourceTree = ""; }; + D36934551038DE5300527AF3 /* PKParseTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParseTree.h; path = test/PKParseTree.h; sourceTree = ""; }; + D36934561038DE5300527AF3 /* PKParseTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParseTree.m; path = test/PKParseTree.m; sourceTree = ""; }; + D36934571038DE5300527AF3 /* PKParseTreeAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParseTreeAssembler.h; path = test/PKParseTreeAssembler.h; sourceTree = ""; }; + D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParseTreeAssembler.m; path = test/PKParseTreeAssembler.m; sourceTree = ""; }; + D36934591038DE5300527AF3 /* PKRuleNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKRuleNode.h; path = test/PKRuleNode.h; sourceTree = ""; }; + D369345A1038DE5300527AF3 /* PKRuleNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKRuleNode.m; path = test/PKRuleNode.m; sourceTree = ""; }; + D369345B1038DE5300527AF3 /* PKTokenNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenNode.h; path = test/PKTokenNode.h; sourceTree = ""; }; + D369345C1038DE5300527AF3 /* PKTokenNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenNode.m; path = test/PKTokenNode.m; sourceTree = ""; }; + D36C53770FD27F1300141CB7 /* TDParserFactoryTest2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryTest2.h; path = test/TDParserFactoryTest2.h; sourceTree = ""; }; + D36C53780FD27F1300141CB7 /* TDParserFactoryTest2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryTest2.m; path = test/TDParserFactoryTest2.m; sourceTree = ""; }; + D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexKitLite.h; path = src/RegexKitLite.h; sourceTree = ""; }; + D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RegexKitLite.m; path = src/RegexKitLite.m; sourceTree = ""; }; + D36C560B0FD363D500141CB7 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = ""; }; + D36C56290FD365DB00141CB7 /* TDPatternTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPatternTest.h; path = test/TDPatternTest.h; sourceTree = ""; }; + D36C562A0FD365DB00141CB7 /* TDPatternTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPatternTest.m; path = test/TDPatternTest.m; sourceTree = ""; }; + D36E95440E578ECC00496BD3 /* XPathParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathParser.h; path = test/XPathParser.h; sourceTree = ""; }; + D36E95450E578ECC00496BD3 /* XPathParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathParser.m; path = test/XPathParser.m; sourceTree = ""; }; + D36E95D60E57B08400496BD3 /* XPathParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathParserTest.h; path = test/XPathParserTest.h; sourceTree = ""; }; + D36E95D70E57B08400496BD3 /* XPathParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathParserTest.m; path = test/XPathParserTest.m; sourceTree = ""; }; + D36E97AE0E589DAE00496BD3 /* XPathAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathAssembler.h; path = test/XPathAssembler.h; sourceTree = ""; }; + D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathAssembler.m; path = test/XPathAssembler.m; sourceTree = ""; }; + D36E98200E58A3A800496BD3 /* XPathContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathContext.h; path = test/XPathContext.h; sourceTree = ""; }; + D36E98210E58A3A800496BD3 /* XPathContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathContext.m; path = test/XPathContext.m; sourceTree = ""; }; + D36E98DC0E58C12800496BD3 /* DebugAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugAppDelegate.h; sourceTree = ""; }; + D36E98DD0E58C12800496BD3 /* DebugAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugAppDelegate.m; sourceTree = ""; }; + D36E98DE0E58C12800496BD3 /* DebugAppMainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DebugAppMainMenu.xib; sourceTree = ""; }; + D36E98DF0E58C12800496BD3 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + D36E98E30E58C14000496BD3 /* DemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DemoAppDelegate.h; path = demoapp/DemoAppDelegate.h; sourceTree = ""; }; + D36E98E40E58C14000496BD3 /* DemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DemoAppDelegate.m; path = demoapp/DemoAppDelegate.m; sourceTree = ""; }; + D36E98E50E58C14000496BD3 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = demoapp/main.m; sourceTree = ""; }; + D36E98F70E58C1A000496BD3 /* DemoAppMainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DemoAppMainMenu.xib; path = demoapp/DemoAppMainMenu.xib; sourceTree = ""; }; + D36E9F860E5A795400496BD3 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = ""; }; + D36E9FB40E5A944A00496BD3 /* apple-boss.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "apple-boss.xml"; path = "res/apple-boss.xml"; sourceTree = ""; }; + D36E9FE40E5BA0FC00496BD3 /* SRGSGrammar.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SRGSGrammar.txt; path = res/SRGSGrammar.txt; sourceTree = ""; }; + D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "small-xml-file.xml"; path = "res/small-xml-file.xml"; sourceTree = ""; }; + D380AFBB0F0C54B60009EC13 /* html.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = html.css; path = res/html.css; sourceTree = ""; }; + D380AFBC0F0C54B60009EC13 /* html.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = html.grammar; path = res/html.grammar; sourceTree = ""; }; + D380AFC20F0C56000009EC13 /* example.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = example.html; path = res/example.html; sourceTree = ""; }; + D380B5080F0D71A90009EC13 /* css.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = css.grammar; path = res/css.grammar; sourceTree = ""; }; + D380B5370F0D7DDE0009EC13 /* css.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = css.css; path = res/css.css; sourceTree = ""; }; + D380B5930F0D82F60009EC13 /* example.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = example.css; path = res/example.css; sourceTree = ""; }; + D380BA5F0F0F06CD0009EC13 /* TDParserFactoryTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryTest.h; path = test/TDParserFactoryTest.h; sourceTree = ""; }; + D380BA600F0F06CD0009EC13 /* TDParserFactoryTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryTest.m; path = test/TDParserFactoryTest.m; sourceTree = ""; }; + D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + D38205BC0EEE48EE004340DD /* TDTokenTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenTest.h; path = test/TDTokenTest.h; sourceTree = ""; }; + D38205BD0EEE48EE004340DD /* TDTokenTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenTest.m; path = test/TDTokenTest.m; sourceTree = ""; }; + D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json_with_comments.grammar; path = res/json_with_comments.grammar; sourceTree = ""; }; + D38349BB0F0C0D910055E4E0 /* json_with_comments.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = json_with_comments.css; path = res/json_with_comments.css; sourceTree = ""; }; + D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = yahoo_with_comments.json; path = res/yahoo_with_comments.json; sourceTree = ""; }; + D385F9880F046FE900DB2946 /* TDGenericAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDGenericAssembler.h; path = test/TDGenericAssembler.h; sourceTree = ""; }; + D385F9890F046FE900DB2946 /* TDGenericAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDGenericAssembler.m; path = test/TDGenericAssembler.m; sourceTree = ""; }; + D385FA210F04971400DB2946 /* TDGenericAssemblerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDGenericAssemblerTest.h; path = test/TDGenericAssemblerTest.h; sourceTree = ""; }; + D385FA220F04971400DB2946 /* TDGenericAssemblerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDGenericAssemblerTest.m; path = test/TDGenericAssemblerTest.m; sourceTree = ""; }; + D385FA240F04993500DB2946 /* json.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = json.css; path = res/json.css; sourceTree = ""; }; + D385FD400F05A88C00DB2946 /* TDMiniCSSAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDMiniCSSAssembler.h; path = test/TDMiniCSSAssembler.h; sourceTree = ""; }; + D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDMiniCSSAssembler.m; path = test/TDMiniCSSAssembler.m; sourceTree = ""; }; + D385FD420F05A88C00DB2946 /* TDMiniCSSAssemblerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDMiniCSSAssemblerTest.h; path = test/TDMiniCSSAssemblerTest.h; sourceTree = ""; }; + D385FD430F05A88C00DB2946 /* TDMiniCSSAssemblerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDMiniCSSAssemblerTest.m; path = test/TDMiniCSSAssemblerTest.m; sourceTree = ""; }; + D385FD6B0F05A99900DB2946 /* mini_css.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = mini_css.grammar; path = res/mini_css.grammar; sourceTree = ""; }; + D389A0B00F1FCC99003B43BD /* RelaxParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RelaxParser.h; path = test/RelaxParser.h; sourceTree = ""; }; + D389A0B10F1FCC99003B43BD /* RelaxParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RelaxParser.m; path = test/RelaxParser.m; sourceTree = ""; }; + D389F1CE0F1965E600558235 /* JSParseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JSParseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D389F2030F196A7500558235 /* JSDemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSDemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D389F20D0F196A9200558235 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + D389F2E30F196CAE00558235 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = jsdemoapp/main.m; sourceTree = ""; }; + D389F2E80F196F5B00558235 /* JSDemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDemoAppDelegate.h; path = jsdemoapp/JSDemoAppDelegate.h; sourceTree = ""; }; + D389F2E90F196F5B00558235 /* JSDemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSDemoAppDelegate.m; path = jsdemoapp/JSDemoAppDelegate.m; sourceTree = ""; }; + D389F38E0F19800400558235 /* DefaultValues.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = DefaultValues.plist; path = jsdemoapp/DefaultValues.plist; sourceTree = ""; }; + D389F4610F198A8800558235 /* Test.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = Test.html; path = jsdemoapp/Test.html; sourceTree = ""; }; + D389F5580F19B7BC00558235 /* JSDemoAppMainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = JSDemoAppMainMenu.xib; path = jsdemoapp/JSDemoAppMainMenu.xib; sourceTree = ""; }; + D389F5B20F19C76A00558235 /* TDJsonParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJsonParser.h; path = test/TDJsonParser.h; sourceTree = ""; }; + D389F5B30F19C76A00558235 /* TDJsonParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJsonParser.m; path = test/TDJsonParser.m; sourceTree = ""; }; + D389F5B40F19C76A00558235 /* TDJsonParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJsonParserTest.h; path = test/TDJsonParserTest.h; sourceTree = ""; }; + D389F5B50F19C76A00558235 /* TDJsonParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJsonParserTest.m; path = test/TDJsonParserTest.m; sourceTree = ""; }; + D389FBCC0F1B25E200558235 /* ParserTest.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = ParserTest.html; path = jsdemoapp/ParserTest.html; sourceTree = ""; }; + D38DD9E70EC29F260070BC4D /* nyt.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = nyt.html; path = res/nyt.html; sourceTree = ""; }; + D38E97CA1061CF6500739C39 /* TDTokenizerBlocksTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenizerBlocksTest.h; path = test/TDTokenizerBlocksTest.h; sourceTree = ""; }; + D38E97CB1061CF6500739C39 /* TDTokenizerBlocksTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenizerBlocksTest.m; path = test/TDTokenizerBlocksTest.m; sourceTree = ""; }; + D38E98D61062C5BA00739C39 /* TDParserBlocksTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserBlocksTest.h; path = test/TDParserBlocksTest.h; sourceTree = ""; }; + D38E98D71062C5BA00739C39 /* TDParserBlocksTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserBlocksTest.m; path = test/TDParserBlocksTest.m; sourceTree = ""; }; + D3AF49760FDB122E0032F4DC /* TDParserFactoryPatternTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryPatternTest.h; path = test/TDParserFactoryPatternTest.h; sourceTree = ""; }; + D3AF49770FDB122E0032F4DC /* TDParserFactoryPatternTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryPatternTest.m; path = test/TDParserFactoryPatternTest.m; sourceTree = ""; }; + D3AF4BE80FDC3DD50032F4DC /* TDBlob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDBlob.h; path = test/TDBlob.h; sourceTree = ""; }; + D3AF4BE90FDC3DD50032F4DC /* TDBlob.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDBlob.m; path = test/TDBlob.m; sourceTree = ""; }; + D3AF4BF50FDC40050032F4DC /* TDToken+Blob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "TDToken+Blob.h"; path = "test/TDToken+Blob.h"; sourceTree = ""; }; + D3AF4BF60FDC40050032F4DC /* TDToken+Blob.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "TDToken+Blob.m"; path = "test/TDToken+Blob.m"; sourceTree = ""; }; + D3AF4BFB0FDC41190032F4DC /* TDTokenizer+BlobState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "TDTokenizer+BlobState.h"; path = "test/TDTokenizer+BlobState.h"; sourceTree = ""; }; + D3AF4BFC0FDC41190032F4DC /* TDTokenizer+BlobState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "TDTokenizer+BlobState.m"; path = "test/TDTokenizer+BlobState.m"; sourceTree = ""; }; + D3AF4C190FDC568F0032F4DC /* TDBlobState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDBlobState.h; path = test/TDBlobState.h; sourceTree = ""; }; + D3AF4C1A0FDC568F0032F4DC /* TDBlobState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDBlobState.m; path = test/TDBlobState.m; sourceTree = ""; }; + D3AF4CBF0FDC740A0032F4DC /* TDNonReservedWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNonReservedWord.h; path = test/TDNonReservedWord.h; sourceTree = ""; }; + D3AF4CC00FDC740A0032F4DC /* TDNonReservedWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNonReservedWord.m; path = test/TDNonReservedWord.m; sourceTree = ""; }; + D3AF4CC10FDC740A0032F4DC /* TDReservedWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDReservedWord.h; path = test/TDReservedWord.h; sourceTree = ""; }; + D3AF4CC20FDC740A0032F4DC /* TDReservedWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDReservedWord.m; path = test/TDReservedWord.m; sourceTree = ""; }; + D3AF4CC30FDC740A0032F4DC /* TDSignificantWhitespaceState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSignificantWhitespaceState.h; path = test/TDSignificantWhitespaceState.h; sourceTree = ""; }; + D3AF4CC40FDC740A0032F4DC /* TDSignificantWhitespaceState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSignificantWhitespaceState.m; path = test/TDSignificantWhitespaceState.m; sourceTree = ""; }; + D3AF4CC50FDC740A0032F4DC /* TDWordOrReservedState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDWordOrReservedState.h; path = test/TDWordOrReservedState.h; sourceTree = ""; }; + D3AF4CC60FDC740A0032F4DC /* TDWordOrReservedState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDWordOrReservedState.m; path = test/TDWordOrReservedState.m; sourceTree = ""; }; + D3B43FB50F76E99C0072AF40 /* TDJavaScriptParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJavaScriptParserTest.h; path = test/TDJavaScriptParserTest.h; sourceTree = ""; }; + D3B43FB60F76E99C0072AF40 /* TDJavaScriptParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJavaScriptParserTest.m; path = test/TDJavaScriptParserTest.m; sourceTree = ""; }; + D3B473840E48C9CF008AFBDD /* yahoo.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = yahoo.json; path = res/yahoo.json; sourceTree = ""; }; + D3B69D310E80249900D70C41 /* nonascii.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = nonascii.html; path = res/nonascii.html; sourceTree = ""; }; + D3BBBC960FEC9722007DF30D /* TDXMLParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXMLParserTest.h; path = test/TDXMLParserTest.h; sourceTree = ""; }; + D3BBBC970FEC9722007DF30D /* TDXMLParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXMLParserTest.m; path = test/TDXMLParserTest.m; sourceTree = ""; }; + D3BBBC9B0FEC9756007DF30D /* TDXMLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXMLParser.h; path = test/TDXMLParser.h; sourceTree = ""; }; + D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXMLParser.m; path = test/TDXMLParser.m; sourceTree = ""; }; + D3C031EB0EF38D2D00C5ABEB /* TDLowercaseWordTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDLowercaseWordTest.h; path = test/TDLowercaseWordTest.h; sourceTree = ""; }; + D3C031EC0EF38D2D00C5ABEB /* TDLowercaseWordTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDLowercaseWordTest.m; path = test/TDLowercaseWordTest.m; sourceTree = ""; }; + D3C2216D0FFE8A86004514FE /* PKExclusion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKExclusion.h; path = test/PKExclusion.h; sourceTree = ""; }; + D3C221900FFE8B8C004514FE /* ParseKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ParseKit.h; path = include/ParseKit/ParseKit.h; sourceTree = ""; }; + D3C221910FFE8B8C004514FE /* PKTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTypes.h; path = include/ParseKit/PKTypes.h; sourceTree = ""; }; + D3C221960FFE8B95004514FE /* PKReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKReader.h; path = include/ParseKit/PKReader.h; sourceTree = ""; }; + D3C221990FFE8B9D004514FE /* PKAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAssembly.h; path = include/ParseKit/PKAssembly.h; sourceTree = ""; }; + D3C2219C0FFE8BA6004514FE /* PKParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParser.h; path = include/ParseKit/PKParser.h; sourceTree = ""; }; + D3C2219F0FFE8BAE004514FE /* PKRepetition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKRepetition.h; path = include/ParseKit/PKRepetition.h; sourceTree = ""; }; + D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCollectionParser.h; path = include/ParseKit/PKCollectionParser.h; sourceTree = ""; }; + D3C221A50FFE8BC1004514FE /* PKAlternation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAlternation.h; path = include/ParseKit/PKAlternation.h; sourceTree = ""; }; + D3C221A80FFE8BC9004514FE /* PKSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSequence.h; path = include/ParseKit/PKSequence.h; sourceTree = ""; }; + D3C221AB0FFE8BCF004514FE /* PKTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTrack.h; path = include/ParseKit/PKTrack.h; sourceTree = ""; }; + D3C221AE0FFE8BD4004514FE /* PKTrackException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTrackException.h; path = include/ParseKit/PKTrackException.h; sourceTree = ""; }; + D3C221B10FFE8BDB004514FE /* PKIntersection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKIntersection.h; path = include/ParseKit/PKIntersection.h; sourceTree = ""; }; + D3C221B40FFE8BE2004514FE /* PKDifference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDifference.h; path = include/ParseKit/PKDifference.h; sourceTree = ""; }; + D3C221B70FFE8BE8004514FE /* PKNegation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKNegation.h; path = include/ParseKit/PKNegation.h; sourceTree = ""; }; + D3C221BA0FFE8BEF004514FE /* PKTerminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTerminal.h; path = include/ParseKit/PKTerminal.h; sourceTree = ""; }; + D3C221BD0FFE8BF7004514FE /* PKEmpty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKEmpty.h; path = include/ParseKit/PKEmpty.h; sourceTree = ""; }; + D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenAssembly.h; path = include/ParseKit/PKTokenAssembly.h; sourceTree = ""; }; + D3C221C30FFE8C07004514FE /* PKToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKToken.h; path = include/ParseKit/PKToken.h; sourceTree = ""; }; + D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenArraySource.h; path = include/ParseKit/PKTokenArraySource.h; sourceTree = ""; }; + D3C221C90FFE8C15004514FE /* PKTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenizer.h; path = include/ParseKit/PKTokenizer.h; sourceTree = ""; }; + D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenizerState.h; path = include/ParseKit/PKTokenizerState.h; sourceTree = ""; }; + D3C221CF0FFE8C24004514FE /* PKNumberState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKNumberState.h; path = include/ParseKit/PKNumberState.h; sourceTree = ""; }; + D3C221D50FFE8C35004514FE /* PKSymbolState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbolState.h; path = include/ParseKit/PKSymbolState.h; sourceTree = ""; }; + D3C221D80FFE8C3D004514FE /* PKWordState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWordState.h; path = include/ParseKit/PKWordState.h; sourceTree = ""; }; + D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWhitespaceState.h; path = include/ParseKit/PKWhitespaceState.h; sourceTree = ""; }; + D3C221DE0FFE8C49004514FE /* PKDelimitState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDelimitState.h; path = include/ParseKit/PKDelimitState.h; sourceTree = ""; }; + D3C221E10FFE8C4E004514FE /* PKCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCommentState.h; path = include/ParseKit/PKCommentState.h; sourceTree = ""; }; + D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSingleLineCommentState.h; path = include/ParseKit/PKSingleLineCommentState.h; sourceTree = ""; }; + D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKMultiLineCommentState.h; path = include/ParseKit/PKMultiLineCommentState.h; sourceTree = ""; }; + D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbolNode.h; path = include/ParseKit/PKSymbolNode.h; sourceTree = ""; }; + D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbolRootNode.h; path = include/ParseKit/PKSymbolRootNode.h; sourceTree = ""; }; + D3C221F00FFE8C7A004514FE /* PKPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKPattern.h; path = include/ParseKit/PKPattern.h; sourceTree = ""; }; + D3C221F30FFE8C87004514FE /* PKWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWord.h; path = include/ParseKit/PKWord.h; sourceTree = ""; }; + D3C221F60FFE8C8E004514FE /* PKNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKNumber.h; path = include/ParseKit/PKNumber.h; sourceTree = ""; }; + D3C221F90FFE8C97004514FE /* PKQuotedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKQuotedString.h; path = include/ParseKit/PKQuotedString.h; sourceTree = ""; }; + D3C221FC0FFE8CB2004514FE /* PKSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbol.h; path = include/ParseKit/PKSymbol.h; sourceTree = ""; }; + D3C221FF0FFE8CB9004514FE /* PKLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKLiteral.h; path = include/ParseKit/PKLiteral.h; sourceTree = ""; }; + D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCaseInsensitiveLiteral.h; path = include/ParseKit/PKCaseInsensitiveLiteral.h; sourceTree = ""; }; + D3C222050FFE8CCA004514FE /* PKWhitespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWhitespace.h; path = include/ParseKit/PKWhitespace.h; sourceTree = ""; }; + D3C222080FFE8CD1004514FE /* PKComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKComment.h; path = include/ParseKit/PKComment.h; sourceTree = ""; }; + D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDelimitedString.h; path = include/ParseKit/PKDelimitedString.h; sourceTree = ""; }; + D3C2220E0FFE8CDF004514FE /* PKAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAny.h; path = include/ParseKit/PKAny.h; sourceTree = ""; }; + D3C222140FFE8D01004514FE /* PKLowercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKLowercaseWord.h; path = include/ParseKit/PKLowercaseWord.h; sourceTree = ""; }; + D3C222170FFE8D11004514FE /* PKUppercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKUppercaseWord.h; path = include/ParseKit/PKUppercaseWord.h; sourceTree = ""; }; + D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCharacterAssembly.h; path = include/ParseKit/PKCharacterAssembly.h; sourceTree = ""; }; + D3C2221D0FFE8D3B004514FE /* PKChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKChar.h; path = include/ParseKit/PKChar.h; sourceTree = ""; }; + D3C222200FFE8D42004514FE /* PKDigit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDigit.h; path = include/ParseKit/PKDigit.h; sourceTree = ""; }; + D3C222230FFE8D49004514FE /* PKLetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKLetter.h; path = include/ParseKit/PKLetter.h; sourceTree = ""; }; + D3C222260FFE8D6B004514FE /* PKSpecificChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSpecificChar.h; path = include/ParseKit/PKSpecificChar.h; sourceTree = ""; }; + D3C222290FFE8DAC004514FE /* PKParserFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParserFactory.h; path = include/ParseKit/PKParserFactory.h; sourceTree = ""; }; + D3C7D87A0A411FBF005DD154 /* Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + D3C85C790E63B438000445FD /* TDArithmeticParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDArithmeticParser.h; path = test/TDArithmeticParser.h; sourceTree = ""; }; + D3C85C7A0E63B438000445FD /* TDArithmeticParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDArithmeticParser.m; path = test/TDArithmeticParser.m; sourceTree = ""; }; + D3C85C7E0E63B9E9000445FD /* TDArithmeticParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDArithmeticParserTest.h; path = test/TDArithmeticParserTest.h; sourceTree = ""; }; + D3C85C7F0E63B9E9000445FD /* TDArithmeticParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDArithmeticParserTest.m; path = test/TDArithmeticParserTest.m; sourceTree = ""; }; + D3C85D430E63D1BF000445FD /* TDScientificNumberStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDScientificNumberStateTest.h; path = test/TDScientificNumberStateTest.h; sourceTree = ""; }; + D3C85D440E63D1BF000445FD /* TDScientificNumberStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDScientificNumberStateTest.m; path = test/TDScientificNumberStateTest.m; sourceTree = ""; }; + D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json_with_discards.grammar; path = res/json_with_discards.grammar; sourceTree = ""; }; + D3D1BF2610394420003656E5 /* SAXAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SAXAssembler.h; path = test/SAXAssembler.h; sourceTree = ""; }; + D3D1BF2710394420003656E5 /* SAXAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SAXAssembler.m; path = test/SAXAssembler.m; sourceTree = ""; }; + D3D1BF291039445C003656E5 /* SAXTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SAXTest.h; path = test/SAXTest.h; sourceTree = ""; }; + D3D1BF2A1039445C003656E5 /* SAXTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SAXTest.m; path = test/SAXTest.m; sourceTree = ""; }; + D3DCB35C0EF5E52500DE5110 /* OCMock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OCMock.framework; path = frameworks/OCMock.framework; sourceTree = ""; }; + D3DCB4C20EF6015300DE5110 /* json.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json.grammar; path = res/json.grammar; sourceTree = ""; }; + D3DDDA850F0779FD00A58000 /* TDSyntaxHighlighter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSyntaxHighlighter.h; path = test/TDSyntaxHighlighter.h; sourceTree = ""; }; + D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSyntaxHighlighter.m; path = test/TDSyntaxHighlighter.m; sourceTree = ""; }; + D3DDDAFC0F083C9700A58000 /* TDCommentStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDCommentStateTest.h; path = test/TDCommentStateTest.h; sourceTree = ""; }; + D3DDDAFD0F083C9700A58000 /* TDCommentStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDCommentStateTest.m; path = test/TDCommentStateTest.m; sourceTree = ""; }; + D3DDDC230F085C5400A58000 /* TDSlashSlashState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashSlashState.h; path = test/TDSlashSlashState.h; sourceTree = ""; }; + D3DDDC240F085C5400A58000 /* TDSlashSlashState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashSlashState.m; path = test/TDSlashSlashState.m; sourceTree = ""; }; + D3DDDC250F085C5400A58000 /* TDSlashStarState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashStarState.h; path = test/TDSlashStarState.h; sourceTree = ""; }; + D3DDDC260F085C5400A58000 /* TDSlashStarState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashStarState.m; path = test/TDSlashStarState.m; sourceTree = ""; }; + D3DDDC270F085C5400A58000 /* TDSlashState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashState.h; path = test/TDSlashState.h; sourceTree = ""; }; + D3DDDC280F085C5400A58000 /* TDSlashState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashState.m; path = test/TDSlashState.m; sourceTree = ""; }; + D3DDDCAC0F0880D800A58000 /* example1.srgs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = example1.srgs; path = res/example1.srgs; sourceTree = ""; }; + D3E39C3D0FC5FFD10022DAB9 /* TDDelimitStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDDelimitStateTest.h; path = test/TDDelimitStateTest.h; sourceTree = ""; }; + D3E39C3E0FC5FFD10022DAB9 /* TDDelimitStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDDelimitStateTest.m; path = test/TDDelimitStateTest.m; sourceTree = ""; }; + D3E784BC0E53DA28008C7D61 /* apple-boss.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "apple-boss.json"; path = "res/apple-boss.json"; sourceTree = ""; }; + D3E788910E567DFD008C7D61 /* SRGSParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SRGSParserTest.h; path = test/SRGSParserTest.h; sourceTree = ""; }; + D3E788920E567DFD008C7D61 /* SRGSParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SRGSParserTest.m; path = test/SRGSParserTest.m; sourceTree = ""; }; + D3E788940E567E0A008C7D61 /* SRGSParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SRGSParser.h; path = test/SRGSParser.h; sourceTree = ""; }; + D3E788950E567E0A008C7D61 /* SRGSParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SRGSParser.m; path = test/SRGSParser.m; sourceTree = ""; }; + D3E78A150E574C99008C7D61 /* EBNFParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EBNFParser.h; path = test/EBNFParser.h; sourceTree = ""; }; + D3E78A160E574C99008C7D61 /* EBNFParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EBNFParser.m; path = test/EBNFParser.m; sourceTree = ""; }; + D3E78A170E574C99008C7D61 /* EBNFParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EBNFParserTest.h; path = test/EBNFParserTest.h; sourceTree = ""; }; + D3E78A180E574C99008C7D61 /* EBNFParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EBNFParserTest.m; path = test/EBNFParserTest.m; sourceTree = ""; }; + D3EADD7F0E75E9CC00F78584 /* nasty.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = nasty.html; path = res/nasty.html; sourceTree = ""; }; + D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDHtmlSyntaxHighlighter.m; path = test/TDHtmlSyntaxHighlighter.m; sourceTree = ""; }; + D3EADD8D0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDHtmlSyntaxHighlighter.h; path = test/TDHtmlSyntaxHighlighter.h; sourceTree = ""; }; + D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKQuoteState.h; path = include/ParseKit/PKQuoteState.h; sourceTree = ""; }; + D3F0E3290FFEA1E200C9DF74 /* DebugApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "DebugApp-Info.plist"; sourceTree = ""; }; + D3F0E3600FFEA2B500C9DF74 /* DemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "DemoApp-Info.plist"; path = "demoapp/DemoApp-Info.plist"; sourceTree = ""; }; + D3F0E36C0FFEA33700C9DF74 /* Tests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Tests-Info.plist"; path = "test/Tests-Info.plist"; sourceTree = ""; }; + D3F0E37A0FFEA39000C9DF74 /* JSDemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "JSDemoApp-Info.plist"; path = "jsdemoapp/JSDemoApp-Info.plist"; sourceTree = ""; }; + D3F55F5F1025737D00DD6DB1 /* TDParseTreeTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParseTreeTest.h; path = test/TDParseTreeTest.h; sourceTree = ""; }; + D3F55F601025737D00DD6DB1 /* TDParseTreeTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParseTreeTest.m; path = test/TDParseTreeTest.m; sourceTree = ""; }; + D3F5629810266CFC00DD6DB1 /* PKParseTreeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParseTreeView.h; path = demoapp/PKParseTreeView.h; sourceTree = ""; }; + D3F5629910266CFC00DD6DB1 /* PKParseTreeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParseTreeView.m; path = demoapp/PKParseTreeView.m; sourceTree = ""; }; + D3F5629E10266DFB00DD6DB1 /* DemoTokensViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DemoTokensViewController.h; path = demoapp/DemoTokensViewController.h; sourceTree = ""; }; + D3F5629F10266DFB00DD6DB1 /* DemoTokensViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DemoTokensViewController.m; path = demoapp/DemoTokensViewController.m; sourceTree = ""; }; + D3F562A110266E5300DD6DB1 /* TokensView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = TokensView.xib; path = demoapp/TokensView.xib; sourceTree = ""; }; + D3F562A310266E6300DD6DB1 /* TreesView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = TreesView.xib; path = demoapp/TreesView.xib; sourceTree = ""; }; + D3F562A510266E8D00DD6DB1 /* DemoTreesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DemoTreesViewController.h; path = demoapp/DemoTreesViewController.h; sourceTree = ""; }; + D3F562A610266E8D00DD6DB1 /* DemoTreesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DemoTreesViewController.m; path = demoapp/DemoTreesViewController.m; sourceTree = ""; }; + D3F740B50EF8C38A00559B9F /* JSONAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONAssembler.h; sourceTree = ""; }; + D3F740B60EF8C38A00559B9F /* JSONAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONAssembler.m; sourceTree = ""; }; + D3F741430EF8E96A00559B9F /* xpath1_0.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = xpath1_0.grammar; path = res/xpath1_0.grammar; sourceTree = ""; }; + D3F741BD0EF9F28D00559B9F /* css2_1.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = css2_1.grammar; path = res/css2_1.grammar; sourceTree = ""; }; + D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rubyhash.grammar; path = res/rubyhash.grammar; sourceTree = ""; }; + D3FDC5830FFC4BFC00F1F797 /* libparsekit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libparsekit.a; sourceTree = BUILT_PRODUCTS_DIR; }; + D3FDC7360FFC4D6100F1F797 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D3FDC7380FFC4D6100F1F797 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; }; + D3FDC74B0FFC4DAC00F1F797 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + D3FDC8DB0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseKitMobile_Prefix.pch; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DC2EF560486A6940098B216 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3E787A30E5661A9008C7D61 /* Foundation.framework in Frameworks */, + D36C560C0FD363D500141CB7 /* libicucore.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D334940E0E2963FD00406085 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D33494720E29670B00406085 /* ParseKit.framework in Frameworks */, + D37D3A000FE77A71008C2E4D /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D34185020E520D3F0081B0DC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D31FE7380E60F36600A0803E /* libxml2.dylib in Frameworks */, + D341850C0E520D640081B0DC /* ParseKit.framework in Frameworks */, + D380B9800F0EF3860009EC13 /* OCMock.framework in Frameworks */, + D380BAA30F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */, + D37D3A010FE77A72008C2E4D /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1CC0F1965E600558235 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F34E0F197DF500558235 /* JavaScriptCore.framework in Frameworks */, + D389F1D50F19666500558235 /* ParseKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F2010F196A7500558235 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F3430F197DDC00558235 /* JavaScriptCore.framework in Frameworks */, + D389F20E0F196A9200558235 /* WebKit.framework in Frameworks */, + D389F20C0F196A9200558235 /* ParseKit.framework in Frameworks */, + D389F20B0F196A9200558235 /* JSParseKit.framework in Frameworks */, + D37D3A020FE77A77008C2E4D /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3C7D8770A411FBF005DD154 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3DCB37D0EF5E5E400DE5110 /* OCMock.framework in Frameworks */, + D3C7D9DA0A412874005DD154 /* ParseKit.framework in Frameworks */, + D36E9F870E5A795400496BD3 /* libxml2.dylib in Frameworks */, + D380BAA40F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */, + D3587EAF0FE83EC900DDD023 /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3FDC5810FFC4BFC00F1F797 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3FDC7370FFC4D6100F1F797 /* Foundation.framework in Frameworks */, + D3FDC7390FFC4D6100F1F797 /* libicucore.dylib in Frameworks */, + D3FDC74C0FFC4DAC00F1F797 /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 034768DFFF38A50411DB9C8B /* Products */ = { + isa = PBXGroup; + children = ( + 8DC2EF5B0486A6940098B216 /* ParseKit.framework */, + D389F1CE0F1965E600558235 /* JSParseKit.framework */, + D3C7D87A0A411FBF005DD154 /* Tests.octest */, + D33494100E2963FD00406085 /* DemoApp.app */, + D34185040E520D3F0081B0DC /* DebugApp.app */, + D389F2030F196A7500558235 /* JSDemoApp.app */, + D3FDC5830FFC4BFC00F1F797 /* libparsekit.a */, + ); + name = Products; + sourceTree = ""; + }; + 0867D691FE84028FC02AAC07 /* TODParseKit */ = { + isa = PBXGroup; + children = ( + 08FB77AEFE84172EC02AAC07 /* ParseKit Framework */, + D3C7D8220A411F31005DD154 /* ParseKit Tests */, + D36E98CB0E58C08F00496BD3 /* DebugApp */, + D334941B0E29641300406085 /* DemoApp */, + D380BA950F0F1C450009EC13 /* JSParseKit Framework */, + D389F2CA0F196ACF00558235 /* JSDemoApp */, + D3AF4C8E0FDC738B0032F4DC /* Other Sources */, + 32C88DFF0371C24200C91783 /* Other Sources (not used) */, + 089C1665FE841158C02AAC07 /* Resources */, + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, + 034768DFFF38A50411DB9C8B /* Products */, + ); + name = TODParseKit; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + D3FDC8EF0FFC52CD00F1F797 /* Mobile Frameworks */, + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + 8DC2EF5A0486A6940098B216 /* Info.plist */, + 089C1666FE841158C02AAC07 /* InfoPlist.strings */, + ); + name = Resources; + sourceTree = ""; + }; + 08FB77AEFE84172EC02AAC07 /* ParseKit Framework */ = { + isa = PBXGroup; + children = ( + D3C221900FFE8B8C004514FE /* ParseKit.h */, + D3C221910FFE8B8C004514FE /* PKTypes.h */, + D3C7D8710A411F6B005DD154 /* io */, + D3C7D8720A411F81005DD154 /* parse */, + D3C7D8740A411F8E005DD154 /* tokens */, + D3E785F10E550F63008C7D61 /* chars */, + D34BAC0F0FF87ED200D7773A /* grammar */, + ); + name = "ParseKit Framework"; + sourceTree = ""; + }; + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + D389F20D0F196A9200558235 /* WebKit.framework */, + D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */, + D3DCB35C0EF5E52500DE5110 /* OCMock.framework */, + D36E9F860E5A795400496BD3 /* libxml2.dylib */, + D36C560B0FD363D500141CB7 /* libicucore.dylib */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 0867D6A5FE840307C02AAC07 /* AppKit.framework */, + 0867D69BFE84028FC02AAC07 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 32C88DFF0371C24200C91783 /* Other Sources (not used) */ = { + isa = PBXGroup; + children = ( + D3C2216D0FFE8A86004514FE /* PKExclusion.h */, + D31270F80FFE898300CBF4C4 /* PKExclusion.m */, + D3AF4CCB0FDC74540032F4DC /* Whitespace */, + D3AF4CCA0FDC74490032F4DC /* Slash */, + D3AF4CC90FDC743C0032F4DC /* ReservedWord */, + D3AF4CC80FDC74320032F4DC /* Blob */, + ); + name = "Other Sources (not used)"; + sourceTree = ""; + }; + D318EAE30E2FD5B6009F47DF /* json */ = { + isa = PBXGroup; + children = ( + D3E784BC0E53DA28008C7D61 /* apple-boss.json */, + D3B473840E48C9CF008AFBDD /* yahoo.json */, + D389F5B20F19C76A00558235 /* TDJsonParser.h */, + D389F5B30F19C76A00558235 /* TDJsonParser.m */, + D389F5B40F19C76A00558235 /* TDJsonParserTest.h */, + D389F5B50F19C76A00558235 /* TDJsonParserTest.m */, + D31FE5A10E60E5D500A0803E /* TDFastJsonParser.h */, + D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */, + D31FE5A30E60E5D500A0803E /* TDFastJsonParserTest.h */, + D31FE5A40E60E5D500A0803E /* TDFastJsonParserTest.m */, + ); + name = json; + sourceTree = ""; + }; + D31A164F0F703899002AFDF1 /* javascript */ = { + isa = PBXGroup; + children = ( + D31A16500F7038C2002AFDF1 /* TDJavaScriptParser.h */, + D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */, + D3B43FB50F76E99C0072AF40 /* TDJavaScriptParserTest.h */, + D3B43FB60F76E99C0072AF40 /* TDJavaScriptParserTest.m */, + ); + name = javascript; + sourceTree = ""; + }; + D3252F670FCE171D005EF059 /* predicate */ = { + isa = PBXGroup; + children = ( + D355C62B0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.h */, + D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */, + D355C62F0FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.h */, + D355C6300FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m */, + D35384EC0FE9691100926552 /* nspredicate.grammar */, + D3252F7C0FCE1A87005EF059 /* TDNSPredicateBuilder.h */, + D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */, + D3252F780FCE1A7E005EF059 /* TDNSPredicateBuilderTest.h */, + D3252F790FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m */, + D3385FD70FCFB1FF003BF729 /* TDPredicateEvaluator.h */, + D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */, + D3385FDB0FCFB227003BF729 /* TDPredicateEvaluatorTest.h */, + D3385FDC0FCFB227003BF729 /* TDPredicateEvaluatorTest.m */, + ); + name = predicate; + sourceTree = ""; + }; + D3305C52102F5BB300DC4F75 /* Trees */ = { + isa = PBXGroup; + children = ( + D3F562A310266E6300DD6DB1 /* TreesView.xib */, + D3F562A510266E8D00DD6DB1 /* DemoTreesViewController.h */, + D3F562A610266E8D00DD6DB1 /* DemoTreesViewController.m */, + D3F5629810266CFC00DD6DB1 /* PKParseTreeView.h */, + D3F5629910266CFC00DD6DB1 /* PKParseTreeView.m */, + D3305C53102F5BC500DC4F75 /* SourceCodeView */, + ); + name = Trees; + sourceTree = ""; + }; + D3305C53102F5BC500DC4F75 /* SourceCodeView */ = { + isa = PBXGroup; + children = ( + D3305C4B102F5BAD00DC4F75 /* TDGutterView.h */, + D3305C4C102F5BAD00DC4F75 /* TDGutterView.m */, + D3305C4D102F5BAE00DC4F75 /* TDSourceCodeTextView.h */, + D3305C4E102F5BAE00DC4F75 /* TDSourceCodeTextView.m */, + ); + name = SourceCodeView; + sourceTree = ""; + }; + D3305C54102F5BE500DC4F75 /* Tokens */ = { + isa = PBXGroup; + children = ( + D3F562A110266E5300DD6DB1 /* TokensView.xib */, + D3F5629E10266DFB00DD6DB1 /* DemoTokensViewController.h */, + D3F5629F10266DFB00DD6DB1 /* DemoTokensViewController.m */, + ); + name = Tokens; + sourceTree = ""; + }; + D334941B0E29641300406085 /* DemoApp */ = { + isa = PBXGroup; + children = ( + D3F0E3600FFEA2B500C9DF74 /* DemoApp-Info.plist */, + D36E98F70E58C1A000496BD3 /* DemoAppMainMenu.xib */, + D36E98E50E58C14000496BD3 /* main.m */, + D36E98E30E58C14000496BD3 /* DemoAppDelegate.h */, + D36E98E40E58C14000496BD3 /* DemoAppDelegate.m */, + D3305C54102F5BE500DC4F75 /* Tokens */, + D3305C52102F5BB300DC4F75 /* Trees */, + ); + name = DemoApp; + sourceTree = ""; + }; + D3376D1110091C6C00E4602E /* ParseTree */ = { + isa = PBXGroup; + children = ( + D3F55F5F1025737D00DD6DB1 /* TDParseTreeTest.h */, + D3F55F601025737D00DD6DB1 /* TDParseTreeTest.m */, + ); + name = ParseTree; + sourceTree = ""; + }; + D3376D7710096BDE00E4602E /* IR */ = { + isa = PBXGroup; + children = ( + D3F5619C1026374400DD6DB1 /* ir */, + D3376D1110091C6C00E4602E /* ParseTree */, + D3376D8B10096BEF00E4602E /* Homo */, + ); + name = IR; + sourceTree = ""; + }; + D3376D8B10096BEF00E4602E /* Homo */ = { + isa = PBXGroup; + children = ( + D3376D8C10096C0700E4602E /* PKAST.h */, + D3376D8D10096C0700E4602E /* PKAST.m */, + ); + name = Homo; + sourceTree = ""; + }; + D341846A0E5209A60081B0DC /* tokenizer */ = { + isa = PBXGroup; + children = ( + D3C221C30FFE8C07004514FE /* PKToken.h */, + D34BAE950FF9D20900D7773A /* PKToken.m */, + D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */, + D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */, + D3C221C90FFE8C15004514FE /* PKTokenizer.h */, + D34BAE990FF9D20900D7773A /* PKTokenizer.m */, + D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */, + D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */, + ); + name = tokenizer; + sourceTree = ""; + }; + D34A20080E55FD5F00A4A0BF /* chars */ = { + isa = PBXGroup; + children = ( + D31FE58C0E60E5AC00A0803E /* TDCharacterAssemblyTest.h */, + D31FE58D0E60E5AC00A0803E /* TDCharacterAssemblyTest.m */, + D31FE58E0E60E5AC00A0803E /* TDCharTest.h */, + D31FE58F0E60E5AC00A0803E /* TDCharTest.m */, + D31FE5900E60E5AC00A0803E /* TDDigitTest.h */, + D31FE5910E60E5AC00A0803E /* TDDigitTest.m */, + D31FE5920E60E5AC00A0803E /* TDLetterTest.h */, + D31FE5930E60E5AC00A0803E /* TDLetterTest.m */, + D31FE5940E60E5AC00A0803E /* TDSpecificCharTest.h */, + D31FE5950E60E5AC00A0803E /* TDSpecificCharTest.m */, + ); + name = chars; + sourceTree = ""; + }; + D34BAC0F0FF87ED200D7773A /* grammar */ = { + isa = PBXGroup; + children = ( + D3C222290FFE8DAC004514FE /* PKParserFactory.h */, + D34BAFD80FF9E95500D7773A /* PKParserFactory.m */, + D3376D5710093A1600E4602E /* PKGrammarParser.h */, + D3376D5810093A1600E4602E /* PKGrammarParser.m */, + D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */, + D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */, + D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */, + D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */, + ); + name = grammar; + sourceTree = ""; + }; + D3541F870DFB105900429B4F /* states */ = { + isa = PBXGroup; + children = ( + D3C221CF0FFE8C24004514FE /* PKNumberState.h */, + D34BAECA0FF9D56400D7773A /* PKNumberState.m */, + D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */, + D34BAECC0FF9D56400D7773A /* PKQuoteState.m */, + D3C221D50FFE8C35004514FE /* PKSymbolState.h */, + D34BAED00FF9D56400D7773A /* PKSymbolState.m */, + D3C221D80FFE8C3D004514FE /* PKWordState.h */, + D34BAED60FF9D56400D7773A /* PKWordState.m */, + D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */, + D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */, + D3C221DE0FFE8C49004514FE /* PKDelimitState.h */, + D34BAEC60FF9D56400D7773A /* PKDelimitState.m */, + D3C221E10FFE8C4E004514FE /* PKCommentState.h */, + D34BAEC40FF9D56400D7773A /* PKCommentState.m */, + D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */, + D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */, + D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */, + D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */, + D3541F890DFB108300429B4F /* symbol */, + ); + name = states; + sourceTree = ""; + }; + D3541F890DFB108300429B4F /* symbol */ = { + isa = PBXGroup; + children = ( + D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */, + D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */, + D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */, + D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */, + ); + name = symbol; + sourceTree = ""; + }; + D35420EC0DFB275400429B4F /* tokenizer states */ = { + isa = PBXGroup; + children = ( + D34BAD16100A9B7900996341 /* TDTokenizerStateTest.h */, + D34BAD17100A9B7900996341 /* TDTokenizerStateTest.m */, + D31FE5770E60E58C00A0803E /* TDNumberStateTest.h */, + D31FE5780E60E58C00A0803E /* TDNumberStateTest.m */, + D31FE5790E60E58C00A0803E /* TDQuoteStateTest.h */, + D31FE57A0E60E58C00A0803E /* TDQuoteStateTest.m */, + D31FE57F0E60E58C00A0803E /* TDSymbolStateTest.h */, + D31FE5800E60E58C00A0803E /* TDSymbolStateTest.m */, + D31FE5810E60E58C00A0803E /* TDWhitespaceStateTest.h */, + D31FE5820E60E58C00A0803E /* TDWhitespaceStateTest.m */, + D31FE5830E60E58C00A0803E /* TDWordStateTest.h */, + D31FE5840E60E58C00A0803E /* TDWordStateTest.m */, + D3C85D430E63D1BF000445FD /* TDScientificNumberStateTest.h */, + D3C85D440E63D1BF000445FD /* TDScientificNumberStateTest.m */, + D3DDDAFC0F083C9700A58000 /* TDCommentStateTest.h */, + D3DDDAFD0F083C9700A58000 /* TDCommentStateTest.m */, + D3E39C3D0FC5FFD10022DAB9 /* TDDelimitStateTest.h */, + D3E39C3E0FC5FFD10022DAB9 /* TDDelimitStateTest.m */, + ); + name = "tokenizer states"; + sourceTree = ""; + }; + D36568A40EEF9FB600226554 /* plist */ = { + isa = PBXGroup; + children = ( + D36568A50EEF9FE900226554 /* TDPlistParser.h */, + D36568A60EEF9FE900226554 /* TDPlistParser.m */, + D36568A80EEFA05300226554 /* TDPlistParserTest.h */, + D36568A90EEFA05300226554 /* TDPlistParserTest.m */, + ); + name = plist; + sourceTree = ""; + }; + D3668290101D2BAC0008632C /* erb */ = { + isa = PBXGroup; + children = ( + D3668291101D2BFA0008632C /* erb.grammar */, + D3668294101D2C200008632C /* ERBTest.h */, + D3668295101D2C200008632C /* ERBTest.m */, + ); + name = erb; + sourceTree = ""; + }; + D36C55FB0FD3616200141CB7 /* regex */ = { + isa = PBXGroup; + children = ( + D3C221F00FFE8C7A004514FE /* PKPattern.h */, + D34BAF380FF9E18300D7773A /* PKPattern.m */, + D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */, + D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */, + ); + name = regex; + sourceTree = ""; + }; + D36E94F40E57865500496BD3 /* xpath */ = { + isa = PBXGroup; + children = ( + D34BAC490FF892C200D7773A /* XPathParserGrammarTest.h */, + D34BAC4A0FF892C200D7773A /* XPathParserGrammarTest.m */, + D31FE5EF0E60E6B500A0803E /* TDNCName.h */, + D31FE6DF0E60EE2500A0803E /* TDNCName.m */, + D31FE5F00E60E6B500A0803E /* TDNCNameState.h */, + D31FE5F10E60E6B500A0803E /* TDNCNameState.m */, + D36E95440E578ECC00496BD3 /* XPathParser.h */, + D36E95450E578ECC00496BD3 /* XPathParser.m */, + D36E97AE0E589DAE00496BD3 /* XPathAssembler.h */, + D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */, + D36E98200E58A3A800496BD3 /* XPathContext.h */, + D36E98210E58A3A800496BD3 /* XPathContext.m */, + D36E95D60E57B08400496BD3 /* XPathParserTest.h */, + D36E95D70E57B08400496BD3 /* XPathParserTest.m */, + ); + name = xpath; + sourceTree = ""; + }; + D36E98CB0E58C08F00496BD3 /* DebugApp */ = { + isa = PBXGroup; + children = ( + D3F0E3290FFEA1E200C9DF74 /* DebugApp-Info.plist */, + D36E98DF0E58C12800496BD3 /* main.m */, + D36E98DC0E58C12800496BD3 /* DebugAppDelegate.h */, + D36E98DD0E58C12800496BD3 /* DebugAppDelegate.m */, + D3F740B50EF8C38A00559B9F /* JSONAssembler.h */, + D3F740B60EF8C38A00559B9F /* JSONAssembler.m */, + D36E98DE0E58C12800496BD3 /* DebugAppMainMenu.xib */, + ); + name = DebugApp; + path = debugapp; + sourceTree = ""; + }; + D36EA1400E5CF19F00496BD3 /* xml token terminals */ = { + isa = PBXGroup; + children = ( + D31FE5B90E60E69E00A0803E /* TDXmlAttribute.h */, + D31FE5BA0E60E69E00A0803E /* TDXmlAttribute.m */, + D31FE5BB0E60E69E00A0803E /* TDXmlCdata.h */, + D31FE5BC0E60E69E00A0803E /* TDXmlCdata.m */, + D31FE5BD0E60E69E00A0803E /* TDXmlComment.h */, + D31FE5BE0E60E69E00A0803E /* TDXmlComment.m */, + D31FE5BF0E60E69E00A0803E /* TDXmlDecl.h */, + D31FE5C00E60E69E00A0803E /* TDXmlDecl.m */, + D31FE5C10E60E69E00A0803E /* TDXmlDoctype.h */, + D31FE5C20E60E69E00A0803E /* TDXmlDoctype.m */, + D31FE5C30E60E69E00A0803E /* TDXmlDocument.h */, + D31FE5C40E60E69E00A0803E /* TDXmlDocument.m */, + D31FE5C50E60E69E00A0803E /* TDXmlEndEntity.h */, + D31FE5C60E60E69E00A0803E /* TDXmlEndEntity.m */, + D31FE5C70E60E69E00A0803E /* TDXmlEndTag.h */, + D31FE5C80E60E69E00A0803E /* TDXmlEndTag.m */, + D31FE5C90E60E69E00A0803E /* TDXmlEntity.h */, + D31FE5CA0E60E69E00A0803E /* TDXmlEntity.m */, + D31FE5CB0E60E69E00A0803E /* TDXmlEntityRef.h */, + D31FE5CC0E60E69E00A0803E /* TDXmlEntityRef.m */, + D31FE5CD0E60E69E00A0803E /* TDXmlFragment.h */, + D31FE5CE0E60E69E00A0803E /* TDXmlFragment.m */, + D31FE5CF0E60E69E00A0803E /* TDXmlNotation.h */, + D31FE5D00E60E69E00A0803E /* TDXmlNotation.m */, + D31FE5D10E60E69E00A0803E /* TDXmlProcessingInstruction.h */, + D31FE5D20E60E69E00A0803E /* TDXmlProcessingInstruction.m */, + D31FE5D30E60E69E00A0803E /* TDXmlSignificantWhitespace.h */, + D31FE5D40E60E69E00A0803E /* TDXmlSignificantWhitespace.m */, + D31FE5D50E60E69E00A0803E /* TDXmlStartTag.h */, + D31FE5D60E60E69E00A0803E /* TDXmlStartTag.m */, + D31FE5D70E60E69E00A0803E /* TDXmlTerminal.h */, + D31FE5D80E60E69E00A0803E /* TDXmlTerminal.m */, + D31FE5D90E60E69E00A0803E /* TDXmlText.h */, + D31FE5DA0E60E69E00A0803E /* TDXmlText.m */, + D31FE5DB0E60E69E00A0803E /* TDXmlWhitespace.h */, + D31FE5DC0E60E69E00A0803E /* TDXmlWhitespace.m */, + ); + name = "xml token terminals"; + sourceTree = ""; + }; + D36EA1440E5CF38100496BD3 /* tokenizer */ = { + isa = PBXGroup; + children = ( + D31FE5B30E60E66600A0803E /* TDXmlToken.h */, + D31FE5B40E60E66600A0803E /* TDXmlToken.m */, + D31FE5B50E60E66600A0803E /* TDXmlTokenizer.h */, + D31FE5B60E60E66600A0803E /* TDXmlTokenizer.m */, + ); + name = tokenizer; + sourceTree = ""; + }; + D380BA950F0F1C450009EC13 /* JSParseKit Framework */ = { + isa = PBXGroup; + children = ( + D34BB04E0FF9EC4E00D7773A /* JSParseKit-Info.plist */, + D34BB0660FF9EDDF00D7773A /* JSParseKit.h */, + D34BB0670FF9EDDF00D7773A /* JSParseKit.m */, + D34BB06C0FF9EE4000D7773A /* PKJSUtils.h */, + D34BB06D0FF9EE4000D7773A /* PKJSUtils.m */, + D34BB06E0FF9EE4000D7773A /* PKJSUtils_macros.h */, + D34BB06F0FF9EE4000D7773A /* PKJSValueHolder.h */, + D34BB0700FF9EE4000D7773A /* PKJSValueHolder.m */, + D34BB06A0FF9EE4000D7773A /* PKJSAssembly.h */, + D34BB06B0FF9EE4000D7773A /* PKJSAssembly.m */, + D389F8C40F1AC89A00558235 /* Chars */, + D389F59A0F19BBAE00558235 /* Tokens */, + D389F59B0F19BBD300558235 /* Parse */, + ); + name = "JSParseKit Framework"; + sourceTree = ""; + }; + D389A0AE0F1FCC7A003B43BD /* relaxng */ = { + isa = PBXGroup; + children = ( + D389A0B00F1FCC99003B43BD /* RelaxParser.h */, + D389A0B10F1FCC99003B43BD /* RelaxParser.m */, + ); + name = relaxng; + sourceTree = ""; + }; + D389F2CA0F196ACF00558235 /* JSDemoApp */ = { + isa = PBXGroup; + children = ( + D3F0E37A0FFEA39000C9DF74 /* JSDemoApp-Info.plist */, + D389F2E30F196CAE00558235 /* main.m */, + D389F2E80F196F5B00558235 /* JSDemoAppDelegate.h */, + D389F2E90F196F5B00558235 /* JSDemoAppDelegate.m */, + D389F38E0F19800400558235 /* DefaultValues.plist */, + D389F4610F198A8800558235 /* Test.html */, + D389FBCC0F1B25E200558235 /* ParserTest.html */, + D389F5580F19B7BC00558235 /* JSDemoAppMainMenu.xib */, + ); + name = JSDemoApp; + sourceTree = ""; + }; + D389F59A0F19BBAE00558235 /* Tokens */ = { + isa = PBXGroup; + children = ( + D34BB0930FF9F14B00D7773A /* PKJSCommentState.h */, + D34BB0940FF9F14B00D7773A /* PKJSCommentState.m */, + D34BB0950FF9F14B00D7773A /* PKJSDelimitState.h */, + D34BB0960FF9F14B00D7773A /* PKJSDelimitState.m */, + D34BB0970FF9F14B00D7773A /* PKJSNumberState.h */, + D34BB0980FF9F14B00D7773A /* PKJSNumberState.m */, + D34BB0990FF9F14B00D7773A /* PKJSQuoteState.h */, + D34BB09A0FF9F14B00D7773A /* PKJSQuoteState.m */, + D34BB09B0FF9F14B00D7773A /* PKJSSymbolState.h */, + D34BB09C0FF9F14B00D7773A /* PKJSSymbolState.m */, + D34BB09D0FF9F14B00D7773A /* PKJSToken.h */, + D34BB09E0FF9F14B00D7773A /* PKJSToken.m */, + D34BB09F0FF9F14B00D7773A /* PKJSTokenAssembly.h */, + D34BB0A00FF9F14B00D7773A /* PKJSTokenAssembly.m */, + D34BB0A10FF9F14B00D7773A /* PKJSTokenizer.h */, + D34BB0A20FF9F14B00D7773A /* PKJSTokenizer.m */, + D34BB0A30FF9F14B00D7773A /* PKJSTokenizerState.h */, + D34BB0A40FF9F14B00D7773A /* PKJSTokenizerState.m */, + D34BB0A50FF9F14B00D7773A /* PKJSWhitespaceState.h */, + D34BB0A60FF9F14B00D7773A /* PKJSWhitespaceState.m */, + D34BB0A70FF9F14B00D7773A /* PKJSWordState.h */, + D34BB0A80FF9F14B00D7773A /* PKJSWordState.m */, + ); + name = Tokens; + sourceTree = ""; + }; + D389F59B0F19BBD300558235 /* Parse */ = { + isa = PBXGroup; + children = ( + D34BB0D20FF9F28000D7773A /* PKJSAlternation.h */, + D34BB0D30FF9F28000D7773A /* PKJSAlternation.m */, + D34BB0D40FF9F28000D7773A /* PKJSAny.h */, + D34BB0D50FF9F28000D7773A /* PKJSAny.m */, + D34BB0D60FF9F28000D7773A /* PKJSAssemblerAdapter.h */, + D34BB0D70FF9F28000D7773A /* PKJSAssemblerAdapter.m */, + D34BB0D80FF9F28000D7773A /* PKJSCollectionParser.h */, + D34BB0D90FF9F28000D7773A /* PKJSCollectionParser.m */, + D34BB0DA0FF9F28000D7773A /* PKJSEmpty.h */, + D34BB0DB0FF9F28000D7773A /* PKJSEmpty.m */, + D34BB0DC0FF9F28000D7773A /* PKJSParser.h */, + D34BB0DD0FF9F28000D7773A /* PKJSParser.m */, + D34BB0DE0FF9F28000D7773A /* PKJSRepetition.h */, + D34BB0DF0FF9F28000D7773A /* PKJSRepetition.m */, + D34BB0E00FF9F28000D7773A /* PKJSSequence.h */, + D34BB0E10FF9F28000D7773A /* PKJSSequence.m */, + D34BB0E20FF9F28000D7773A /* PKJSTerminal.h */, + D34BB0E30FF9F28000D7773A /* PKJSTerminal.m */, + D34BB0E40FF9F28000D7773A /* PKJSTrack.h */, + D34BB0E50FF9F28000D7773A /* PKJSTrack.m */, + D389FAE30F1B1B8F00558235 /* Char Terminals */, + D389FAE20F1B1B7200558235 /* Token Terminals */, + ); + name = Parse; + sourceTree = ""; + }; + D389F8C40F1AC89A00558235 /* Chars */ = { + isa = PBXGroup; + children = ( + D34BB08D0FF9EF9D00D7773A /* PKJSCharacterAssembly.h */, + D34BB08E0FF9EF9D00D7773A /* PKJSCharacterAssembly.m */, + ); + name = Chars; + sourceTree = ""; + }; + D389FAE20F1B1B7200558235 /* Token Terminals */ = { + isa = PBXGroup; + children = ( + D34BB0FE0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h */, + D34BB0FF0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m */, + D34BB1000FF9F36200D7773A /* PKJSComment.h */, + D34BB1010FF9F36200D7773A /* PKJSComment.m */, + D34BB1020FF9F36200D7773A /* PKJSDelimitedString.h */, + D34BB1030FF9F36200D7773A /* PKJSDelimitedString.m */, + D34BB1040FF9F36200D7773A /* PKJSLiteral.h */, + D34BB1050FF9F36200D7773A /* PKJSLiteral.m */, + D34BB1060FF9F36200D7773A /* PKJSLowercaseWord.h */, + D34BB1070FF9F36200D7773A /* PKJSLowercaseWord.m */, + D34BB1080FF9F36200D7773A /* PKJSNum.h */, + D34BB1090FF9F36200D7773A /* PKJSNum.m */, + D34BB10A0FF9F36200D7773A /* PKJSPattern.h */, + D34BB10B0FF9F36200D7773A /* PKJSPattern.m */, + D34BB10C0FF9F36200D7773A /* PKJSQuotedString.h */, + D34BB10D0FF9F36200D7773A /* PKJSQuotedString.m */, + D34BB10E0FF9F36200D7773A /* PKJSSymbol.h */, + D34BB10F0FF9F36200D7773A /* PKJSSymbol.m */, + D34BB1100FF9F36200D7773A /* PKJSUppercaseWord.h */, + D34BB1110FF9F36200D7773A /* PKJSUppercaseWord.m */, + D34BB1120FF9F36200D7773A /* PKJSWord.h */, + D34BB1130FF9F36200D7773A /* PKJSWord.m */, + ); + name = "Token Terminals"; + sourceTree = ""; + }; + D389FAE30F1B1B8F00558235 /* Char Terminals */ = { + isa = PBXGroup; + children = ( + ); + name = "Char Terminals"; + sourceTree = ""; + }; + D3AF4C8E0FDC738B0032F4DC /* Other Sources */ = { + isa = PBXGroup; + children = ( + D34BAD630FF9C6AE00D7773A /* ParseKit_Prefix.pch */, + D3FDC8DB0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + D3AF4CC80FDC74320032F4DC /* Blob */ = { + isa = PBXGroup; + children = ( + D3AF4BF50FDC40050032F4DC /* TDToken+Blob.h */, + D3AF4BF60FDC40050032F4DC /* TDToken+Blob.m */, + D3AF4BFB0FDC41190032F4DC /* TDTokenizer+BlobState.h */, + D3AF4BFC0FDC41190032F4DC /* TDTokenizer+BlobState.m */, + D3AF4C190FDC568F0032F4DC /* TDBlobState.h */, + D3AF4C1A0FDC568F0032F4DC /* TDBlobState.m */, + D3AF4BE80FDC3DD50032F4DC /* TDBlob.h */, + D3AF4BE90FDC3DD50032F4DC /* TDBlob.m */, + ); + name = Blob; + sourceTree = ""; + }; + D3AF4CC90FDC743C0032F4DC /* ReservedWord */ = { + isa = PBXGroup; + children = ( + D3AF4CC50FDC740A0032F4DC /* TDWordOrReservedState.h */, + D3AF4CC60FDC740A0032F4DC /* TDWordOrReservedState.m */, + D3AF4CBF0FDC740A0032F4DC /* TDNonReservedWord.h */, + D3AF4CC00FDC740A0032F4DC /* TDNonReservedWord.m */, + D3AF4CC10FDC740A0032F4DC /* TDReservedWord.h */, + D3AF4CC20FDC740A0032F4DC /* TDReservedWord.m */, + ); + name = ReservedWord; + sourceTree = ""; + }; + D3AF4CCA0FDC74490032F4DC /* Slash */ = { + isa = PBXGroup; + children = ( + D3DDDC230F085C5400A58000 /* TDSlashSlashState.h */, + D3DDDC240F085C5400A58000 /* TDSlashSlashState.m */, + D3DDDC250F085C5400A58000 /* TDSlashStarState.h */, + D3DDDC260F085C5400A58000 /* TDSlashStarState.m */, + D3DDDC270F085C5400A58000 /* TDSlashState.h */, + D3DDDC280F085C5400A58000 /* TDSlashState.m */, + D31FE57D0E60E58C00A0803E /* TDSlashStateTest.h */, + D31FE57E0E60E58C00A0803E /* TDSlashStateTest.m */, + ); + name = Slash; + sourceTree = ""; + }; + D3AF4CCB0FDC74540032F4DC /* Whitespace */ = { + isa = PBXGroup; + children = ( + D3AF4CC30FDC740A0032F4DC /* TDSignificantWhitespaceState.h */, + D3AF4CC40FDC740A0032F4DC /* TDSignificantWhitespaceState.m */, + D31FE57B0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.h */, + D31FE57C0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.m */, + ); + name = Whitespace; + sourceTree = ""; + }; + D3BBBC9A0FEC9739007DF30D /* old */ = { + isa = PBXGroup; + children = ( + D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */, + D36E9FB40E5A944A00496BD3 /* apple-boss.xml */, + D31FE5AD0E60E64900A0803E /* TDXmlTokenAssembly.h */, + D31FE5AE0E60E64900A0803E /* TDXmlTokenAssembly.m */, + D31FE5AF0E60E64900A0803E /* TDXmlTokenizerTest.h */, + D31FE5B00E60E64900A0803E /* TDXmlTokenizerTest.m */, + D36EA1440E5CF38100496BD3 /* tokenizer */, + D36EA1400E5CF19F00496BD3 /* xml token terminals */, + D3521F520E5FA1B0009681F9 /* XMLReader.h */, + D3521F530E5FA1B0009681F9 /* XMLReader.m */, + D3521F540E5FA1B0009681F9 /* XMLReaderTest.h */, + D3521F550E5FA1B0009681F9 /* XMLReaderTest.m */, + D31FE5F20E60E6B500A0803E /* TDXmlName.h */, + D31FE5F30E60E6B500A0803E /* TDXmlName.m */, + D31FE5F40E60E6B500A0803E /* TDXmlNameState.h */, + D31FE5F50E60E6B500A0803E /* TDXmlNameState.m */, + D31FE5F60E60E6B500A0803E /* TDXmlNameTest.h */, + D31FE5F70E60E6B500A0803E /* TDXmlNameTest.m */, + D31FE5F80E60E6B500A0803E /* TDXmlNmtoken.h */, + D31FE5F90E60E6B500A0803E /* TDXmlNmtoken.m */, + D31FE5FA0E60E6B500A0803E /* TDXmlNmtokenState.h */, + D31FE5FB0E60E6B500A0803E /* TDXmlNmtokenState.m */, + ); + name = old; + sourceTree = ""; + }; + D3C0309C0EF34DD200C5ABEB /* grammar */ = { + isa = PBXGroup; + children = ( + D380B5370F0D7DDE0009EC13 /* css.css */, + D380B5080F0D71A90009EC13 /* css.grammar */, + D380B5930F0D82F60009EC13 /* example.css */, + D380AFBB0F0C54B60009EC13 /* html.css */, + D380AFBC0F0C54B60009EC13 /* html.grammar */, + D385FD6B0F05A99900DB2946 /* mini_css.grammar */, + D3DCB4C20EF6015300DE5110 /* json.grammar */, + D385FA240F04993500DB2946 /* json.css */, + D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */, + D38349BB0F0C0D910055E4E0 /* json_with_comments.css */, + D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */, + D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */, + D380AFC20F0C56000009EC13 /* example.html */, + D3F741BD0EF9F28D00559B9F /* css2_1.grammar */, + D3F741430EF8E96A00559B9F /* xpath1_0.grammar */, + D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */, + D31A15250F6DE449002AFDF1 /* javascript.grammar */, + D385FD400F05A88C00DB2946 /* TDMiniCSSAssembler.h */, + D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */, + D385FD420F05A88C00DB2946 /* TDMiniCSSAssemblerTest.h */, + D385FD430F05A88C00DB2946 /* TDMiniCSSAssemblerTest.m */, + D385F9880F046FE900DB2946 /* TDGenericAssembler.h */, + D385F9890F046FE900DB2946 /* TDGenericAssembler.m */, + D385FA210F04971400DB2946 /* TDGenericAssemblerTest.h */, + D385FA220F04971400DB2946 /* TDGenericAssemblerTest.m */, + D3DDDA850F0779FD00A58000 /* TDSyntaxHighlighter.h */, + D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */, + D353899B0FEAC94400926552 /* c.grammar */, + D353899D0FEAC96B00926552 /* objc.grammar */, + D355C8830FEB4B94006A91A4 /* proto.grammar */, + ); + name = grammar; + sourceTree = ""; + }; + D3C7D8220A411F31005DD154 /* ParseKit Tests */ = { + isa = PBXGroup; + children = ( + D3F0E36C0FFEA33700C9DF74 /* Tests-Info.plist */, + D31FE54A0E60E46100A0803E /* TDTestScaffold.h */, + D31FE54B0E60E46100A0803E /* TDTestScaffold.m */, + D3376D7710096BDE00E4602E /* IR */, + D3F823560F57859900B7DC48 /* factory */, + D3C0309C0EF34DD200C5ABEB /* grammar */, + D3252F670FCE171D005EF059 /* predicate */, + D31A164F0F703899002AFDF1 /* javascript */, + D3D63F570E2A8548009BF5CD /* parse */, + D3D63F560E2A8538009BF5CD /* tokens */, + D34A20080E55FD5F00A4A0BF /* chars */, + D3C85C770E63B400000445FD /* arithmetic */, + D3E786030E5510AE008C7D61 /* regex */, + D3E788890E567B6D008C7D61 /* ebnf */, + D36568A40EEF9FB600226554 /* plist */, + D318EAE30E2FD5B6009F47DF /* json */, + D3D647CE0E2C7569009BF5CD /* xml */, + D36E94F40E57865500496BD3 /* xpath */, + D3E788900E567DDA008C7D61 /* srgs */, + D389A0AE0F1FCC7A003B43BD /* relaxng */, + D3C863240E67C249000445FD /* syntax highlight */, + D3668290101D2BAC0008632C /* erb */, + ); + name = "ParseKit Tests"; + sourceTree = ""; + }; + D3C7D8710A411F6B005DD154 /* io */ = { + isa = PBXGroup; + children = ( + D3C221960FFE8B95004514FE /* PKReader.h */, + D34BAD9B0FF9C95800D7773A /* PKReader.m */, + ); + name = io; + sourceTree = ""; + }; + D3C7D8720A411F81005DD154 /* parse */ = { + isa = PBXGroup; + children = ( + D3C221990FFE8B9D004514FE /* PKAssembly.h */, + D34BADA00FF9C9B000D7773A /* PKAssembly.m */, + D3D63EA90E2A7A5C009BF5CD /* parsers */, + ); + name = parse; + sourceTree = ""; + }; + D3C7D8740A411F8E005DD154 /* tokens */ = { + isa = PBXGroup; + children = ( + D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */, + D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */, + D341846A0E5209A60081B0DC /* tokenizer */, + D3541F870DFB105900429B4F /* states */, + D3D642270E2AC426009BF5CD /* token terminals */, + ); + name = tokens; + sourceTree = ""; + }; + D3C85C770E63B400000445FD /* arithmetic */ = { + isa = PBXGroup; + children = ( + D319E429106D8A1F008C63DD /* arithmetic.grammar */, + D319E42C106D8A31008C63DD /* TDArithmeticAssembler.h */, + D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */, + D3C85C790E63B438000445FD /* TDArithmeticParser.h */, + D3C85C7A0E63B438000445FD /* TDArithmeticParser.m */, + D3C85C7E0E63B9E9000445FD /* TDArithmeticParserTest.h */, + D3C85C7F0E63B9E9000445FD /* TDArithmeticParserTest.m */, + ); + name = arithmetic; + sourceTree = ""; + }; + D3C863240E67C249000445FD /* syntax highlight */ = { + isa = PBXGroup; + children = ( + D3C863250E67C255000445FD /* html */, + ); + name = "syntax highlight"; + sourceTree = ""; + }; + D3C863250E67C255000445FD /* html */ = { + isa = PBXGroup; + children = ( + D38DD9E70EC29F260070BC4D /* nyt.html */, + D3B69D310E80249900D70C41 /* nonascii.html */, + D3EADD7F0E75E9CC00F78584 /* nasty.html */, + D3EADD8D0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.h */, + D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */, + ); + name = html; + sourceTree = ""; + }; + D3D63EA90E2A7A5C009BF5CD /* parsers */ = { + isa = PBXGroup; + children = ( + D3C2219C0FFE8BA6004514FE /* PKParser.h */, + D34BADD60FF9CBFB00D7773A /* PKParser.m */, + D3C2219F0FFE8BAE004514FE /* PKRepetition.h */, + D34BAE130FF9CE0E00D7773A /* PKRepetition.m */, + D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */, + D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */, + D3C221A50FFE8BC1004514FE /* PKAlternation.h */, + D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */, + D3C221A80FFE8BC9004514FE /* PKSequence.h */, + D34BAE150FF9CE0E00D7773A /* PKSequence.m */, + D3C221AB0FFE8BCF004514FE /* PKTrack.h */, + D34BAE190FF9CE0E00D7773A /* PKTrack.m */, + D3C221AE0FFE8BD4004514FE /* PKTrackException.h */, + D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */, + D3C221B10FFE8BDB004514FE /* PKIntersection.h */, + D34BAE110FF9CE0E00D7773A /* PKIntersection.m */, + D3C221B40FFE8BE2004514FE /* PKDifference.h */, + D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */, + D3C221B70FFE8BE8004514FE /* PKNegation.h */, + D3126D040FFD9BA700CBF4C4 /* PKNegation.m */, + D3C221BA0FFE8BEF004514FE /* PKTerminal.h */, + D34BAE170FF9CE0E00D7773A /* PKTerminal.m */, + D3C221BD0FFE8BF7004514FE /* PKEmpty.h */, + D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */, + ); + name = parsers; + sourceTree = ""; + }; + D3D63F560E2A8538009BF5CD /* tokens */ = { + isa = PBXGroup; + children = ( + D31FE5710E60E55700A0803E /* TDReaderTest.h */, + D31FE5720E60E55700A0803E /* TDReaderTest.m */, + D31FE5730E60E55700A0803E /* TDTokenizerTest.h */, + D31FE5740E60E55700A0803E /* TDTokenizerTest.m */, + D38E97CA1061CF6500739C39 /* TDTokenizerBlocksTest.h */, + D38E97CB1061CF6500739C39 /* TDTokenizerBlocksTest.m */, + D38205BC0EEE48EE004340DD /* TDTokenTest.h */, + D38205BD0EEE48EE004340DD /* TDTokenTest.m */, + D3656DFC0EF2620E00226554 /* TDTokenArraySourceTest.h */, + D3656DFD0EF2620E00226554 /* TDTokenArraySourceTest.m */, + D35420EC0DFB275400429B4F /* tokenizer states */, + ); + name = tokens; + sourceTree = ""; + }; + D3D63F570E2A8548009BF5CD /* parse */ = { + isa = PBXGroup; + children = ( + D31FE54D0E60E50800A0803E /* TDAlternationTest.h */, + D31FE54E0E60E50800A0803E /* TDAlternationTest.m */, + D31FE54F0E60E50800A0803E /* TDLiteralTest.h */, + D31FE5500E60E50800A0803E /* TDLiteralTest.m */, + D31FE5510E60E50800A0803E /* TDParserTest.h */, + D31FE5520E60E50800A0803E /* TDParserTest.m */, + D38E98D61062C5BA00739C39 /* TDParserBlocksTest.h */, + D38E98D71062C5BA00739C39 /* TDParserBlocksTest.m */, + D31FE5530E60E50800A0803E /* TDRepetitionTest.h */, + D31FE5540E60E50800A0803E /* TDRepetitionTest.m */, + D31FE5550E60E50800A0803E /* TDReservedWordTest.h */, + D31FE5560E60E50800A0803E /* TDReservedWordTest.m */, + D31FE5570E60E50800A0803E /* TDRobotCommandTest.h */, + D31FE5580E60E50800A0803E /* TDRobotCommandTest.m */, + D31FE5590E60E50800A0803E /* TDSequenceTest.h */, + D31FE55A0E60E50800A0803E /* TDSequenceTest.m */, + D31FE55B0E60E50800A0803E /* TDSymbolTest.h */, + D31FE55C0E60E50800A0803E /* TDSymbolTest.m */, + D31FE55D0E60E50800A0803E /* TDTokenAssemblyTest.h */, + D31FE55E0E60E50800A0803E /* TDTokenAssemblyTest.m */, + D31FE55F0E60E50800A0803E /* TDTrackTest.h */, + D31FE5600E60E50800A0803E /* TDTrackTest.m */, + D31FE5610E60E50800A0803E /* TDUppercaseWordTest.h */, + D31FE5620E60E50800A0803E /* TDUppercaseWordTest.m */, + D3C031EB0EF38D2D00C5ABEB /* TDLowercaseWordTest.h */, + D3C031EC0EF38D2D00C5ABEB /* TDLowercaseWordTest.m */, + D3126D410FFDB4C600CBF4C4 /* TDExclusionTest.h */, + D3126D420FFDB4C600CBF4C4 /* TDExclusionTest.m */, + D36C56290FD365DB00141CB7 /* TDPatternTest.h */, + D36C562A0FD365DB00141CB7 /* TDPatternTest.m */, + D338E5B90FF5DDCB003DE6AA /* TDDifferenceTest.h */, + D338E5BA0FF5DDCB003DE6AA /* TDDifferenceTest.m */, + D3126D090FFD9E4B00CBF4C4 /* TDNegationTest.h */, + D3126D0A0FFD9E4B00CBF4C4 /* TDNegationTest.m */, + ); + name = parse; + sourceTree = ""; + }; + D3D642270E2AC426009BF5CD /* token terminals */ = { + isa = PBXGroup; + children = ( + D36C55FB0FD3616200141CB7 /* regex */, + D3C221F30FFE8C87004514FE /* PKWord.h */, + D34BAED40FF9D56400D7773A /* PKWord.m */, + D3C222140FFE8D01004514FE /* PKLowercaseWord.h */, + D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */, + D3C222170FFE8D11004514FE /* PKUppercaseWord.h */, + D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */, + D3C221F60FFE8C8E004514FE /* PKNumber.h */, + D34BAF440FF9E19700D7773A /* PKNumber.m */, + D3C221F90FFE8C97004514FE /* PKQuotedString.h */, + D34BAF460FF9E19700D7773A /* PKQuotedString.m */, + D3C221FC0FFE8CB2004514FE /* PKSymbol.h */, + D34BAF480FF9E19700D7773A /* PKSymbol.m */, + D3C221FF0FFE8CB9004514FE /* PKLiteral.h */, + D34BAF420FF9E19700D7773A /* PKLiteral.m */, + D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */, + D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */, + D3C222050FFE8CCA004514FE /* PKWhitespace.h */, + D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */, + D3C222080FFE8CD1004514FE /* PKComment.h */, + D34BAF3E0FF9E19700D7773A /* PKComment.m */, + D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */, + D34BAF400FF9E19700D7773A /* PKDelimitedString.m */, + D3C2220E0FFE8CDF004514FE /* PKAny.h */, + D34BAE2F0FF9CE6000D7773A /* PKAny.m */, + ); + name = "token terminals"; + sourceTree = ""; + }; + D3D647CE0E2C7569009BF5CD /* xml */ = { + isa = PBXGroup; + children = ( + D3D1BF291039445C003656E5 /* SAXTest.h */, + D3D1BF2A1039445C003656E5 /* SAXTest.m */, + D3D1BF2610394420003656E5 /* SAXAssembler.h */, + D3D1BF2710394420003656E5 /* SAXAssembler.m */, + D3BBBC960FEC9722007DF30D /* TDXMLParserTest.h */, + D3BBBC970FEC9722007DF30D /* TDXMLParserTest.m */, + D3BBBC9B0FEC9756007DF30D /* TDXMLParser.h */, + D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */, + D355C8800FEB36A1006A91A4 /* xml.grammar */, + D315DF710FEF59B600D876C8 /* date.grammar */, + D3BBBC9A0FEC9739007DF30D /* old */, + ); + name = xml; + sourceTree = ""; + }; + D3E785F10E550F63008C7D61 /* chars */ = { + isa = PBXGroup; + children = ( + D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */, + D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */, + D3E7861F0E55363F008C7D61 /* char terminals */, + ); + name = chars; + sourceTree = ""; + }; + D3E786030E5510AE008C7D61 /* regex */ = { + isa = PBXGroup; + children = ( + D31FE59B0E60E5C000A0803E /* TDRegularParser.h */, + D31FE59C0E60E5C000A0803E /* TDRegularParser.m */, + D31FE59D0E60E5C000A0803E /* TDRegularParserTest.h */, + D31FE59E0E60E5C000A0803E /* TDRegularParserTest.m */, + ); + name = regex; + sourceTree = ""; + }; + D3E7861F0E55363F008C7D61 /* char terminals */ = { + isa = PBXGroup; + children = ( + D3C2221D0FFE8D3B004514FE /* PKChar.h */, + D34BAFB40FF9E80300D7773A /* PKChar.m */, + D3C222200FFE8D42004514FE /* PKDigit.h */, + D34BAFB60FF9E80300D7773A /* PKDigit.m */, + D3C222230FFE8D49004514FE /* PKLetter.h */, + D34BAFB80FF9E80300D7773A /* PKLetter.m */, + D3C222260FFE8D6B004514FE /* PKSpecificChar.h */, + D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */, + ); + name = "char terminals"; + sourceTree = ""; + }; + D3E788890E567B6D008C7D61 /* ebnf */ = { + isa = PBXGroup; + children = ( + D3E78A150E574C99008C7D61 /* EBNFParser.h */, + D3E78A160E574C99008C7D61 /* EBNFParser.m */, + D3E78A170E574C99008C7D61 /* EBNFParserTest.h */, + D3E78A180E574C99008C7D61 /* EBNFParserTest.m */, + ); + name = ebnf; + sourceTree = ""; + }; + D3E788900E567DDA008C7D61 /* srgs */ = { + isa = PBXGroup; + children = ( + D3DDDCAC0F0880D800A58000 /* example1.srgs */, + D3E788940E567E0A008C7D61 /* SRGSParser.h */, + D3E788950E567E0A008C7D61 /* SRGSParser.m */, + D3E788910E567DFD008C7D61 /* SRGSParserTest.h */, + D3E788920E567DFD008C7D61 /* SRGSParserTest.m */, + D36E9FE40E5BA0FC00496BD3 /* SRGSGrammar.txt */, + ); + name = srgs; + sourceTree = ""; + }; + D3F5619C1026374400DD6DB1 /* ir */ = { + isa = PBXGroup; + children = ( + D3F5619D1026375100DD6DB1 /* syntax tree */, + D3F561B61026379700DD6DB1 /* ast */, + ); + name = ir; + sourceTree = ""; + }; + D3F5619D1026375100DD6DB1 /* syntax tree */ = { + isa = PBXGroup; + children = ( + D36934551038DE5300527AF3 /* PKParseTree.h */, + D36934561038DE5300527AF3 /* PKParseTree.m */, + D36934571038DE5300527AF3 /* PKParseTreeAssembler.h */, + D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */, + D36934591038DE5300527AF3 /* PKRuleNode.h */, + D369345A1038DE5300527AF3 /* PKRuleNode.m */, + D369345B1038DE5300527AF3 /* PKTokenNode.h */, + D369345C1038DE5300527AF3 /* PKTokenNode.m */, + ); + name = "syntax tree"; + sourceTree = ""; + }; + D3F561B61026379700DD6DB1 /* ast */ = { + isa = PBXGroup; + children = ( + ); + name = ast; + sourceTree = ""; + }; + D3F823560F57859900B7DC48 /* factory */ = { + isa = PBXGroup; + children = ( + D34BAC210FF87F8600D7773A /* TDParserFactoryTest3.h */, + D34BAC220FF87F8600D7773A /* TDParserFactoryTest3.m */, + D380BA5F0F0F06CD0009EC13 /* TDParserFactoryTest.h */, + D380BA600F0F06CD0009EC13 /* TDParserFactoryTest.m */, + D36C53770FD27F1300141CB7 /* TDParserFactoryTest2.h */, + D36C53780FD27F1300141CB7 /* TDParserFactoryTest2.m */, + D3AF49760FDB122E0032F4DC /* TDParserFactoryPatternTest.h */, + D3AF49770FDB122E0032F4DC /* TDParserFactoryPatternTest.m */, + ); + name = factory; + sourceTree = ""; + }; + D3FDC8EF0FFC52CD00F1F797 /* Mobile Frameworks */ = { + isa = PBXGroup; + children = ( + D3FDC74B0FFC4DAC00F1F797 /* CoreGraphics.framework */, + D3FDC7380FFC4D6100F1F797 /* libicucore.dylib */, + D3FDC7360FFC4D6100F1F797 /* Foundation.framework */, + ); + name = "Mobile Frameworks"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 8DC2EF500486A6940098B216 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D34BAD640FF9C6AE00D7773A /* ParseKit_Prefix.pch in Headers */, + D3FDC4A50FFB3B2A00F1F797 /* RegexKitLite.h in Headers */, + D3C221920FFE8B8C004514FE /* ParseKit.h in Headers */, + D3C221930FFE8B8C004514FE /* PKTypes.h in Headers */, + D3C221970FFE8B95004514FE /* PKReader.h in Headers */, + D3C2219A0FFE8B9D004514FE /* PKAssembly.h in Headers */, + D3C2219D0FFE8BA6004514FE /* PKParser.h in Headers */, + D3C221A00FFE8BAE004514FE /* PKRepetition.h in Headers */, + D3C221A30FFE8BBA004514FE /* PKCollectionParser.h in Headers */, + D3C221A60FFE8BC1004514FE /* PKAlternation.h in Headers */, + D3C221A90FFE8BC9004514FE /* PKSequence.h in Headers */, + D3C221AC0FFE8BCF004514FE /* PKTrack.h in Headers */, + D3C221AF0FFE8BD4004514FE /* PKTrackException.h in Headers */, + D3C221B20FFE8BDB004514FE /* PKIntersection.h in Headers */, + D3C221B50FFE8BE2004514FE /* PKDifference.h in Headers */, + D3C221B80FFE8BE8004514FE /* PKNegation.h in Headers */, + D3C221BB0FFE8BEF004514FE /* PKTerminal.h in Headers */, + D3C221BE0FFE8BF7004514FE /* PKEmpty.h in Headers */, + D3C221C10FFE8BFF004514FE /* PKTokenAssembly.h in Headers */, + D3C221C40FFE8C07004514FE /* PKToken.h in Headers */, + D3C221C70FFE8C0D004514FE /* PKTokenArraySource.h in Headers */, + D3C221CA0FFE8C15004514FE /* PKTokenizer.h in Headers */, + D3C221CD0FFE8C1B004514FE /* PKTokenizerState.h in Headers */, + D3C221D00FFE8C24004514FE /* PKNumberState.h in Headers */, + D3C221D60FFE8C35004514FE /* PKSymbolState.h in Headers */, + D3C221D90FFE8C3D004514FE /* PKWordState.h in Headers */, + D3C221DC0FFE8C43004514FE /* PKWhitespaceState.h in Headers */, + D3C221DF0FFE8C49004514FE /* PKDelimitState.h in Headers */, + D3C221E20FFE8C4E004514FE /* PKCommentState.h in Headers */, + D3C221E50FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */, + D3C221E80FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */, + D3C221EB0FFE8C69004514FE /* PKSymbolNode.h in Headers */, + D3C221EE0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */, + D3C221F10FFE8C7A004514FE /* PKPattern.h in Headers */, + D3C221F40FFE8C87004514FE /* PKWord.h in Headers */, + D3C221F70FFE8C8E004514FE /* PKNumber.h in Headers */, + D3C221FA0FFE8C97004514FE /* PKQuotedString.h in Headers */, + D3C221FD0FFE8CB2004514FE /* PKSymbol.h in Headers */, + D3C222000FFE8CB9004514FE /* PKLiteral.h in Headers */, + D3C222030FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */, + D3C222060FFE8CCA004514FE /* PKWhitespace.h in Headers */, + D3C222090FFE8CD1004514FE /* PKComment.h in Headers */, + D3C2220C0FFE8CD8004514FE /* PKDelimitedString.h in Headers */, + D3C2220F0FFE8CDF004514FE /* PKAny.h in Headers */, + D3C222150FFE8D01004514FE /* PKLowercaseWord.h in Headers */, + D3C222180FFE8D11004514FE /* PKUppercaseWord.h in Headers */, + D3C2221B0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */, + D3C2221E0FFE8D3B004514FE /* PKChar.h in Headers */, + D3C222210FFE8D42004514FE /* PKDigit.h in Headers */, + D3C222240FFE8D49004514FE /* PKLetter.h in Headers */, + D3C222270FFE8D6B004514FE /* PKSpecificChar.h in Headers */, + D3C2222A0FFE8DAC004514FE /* PKParserFactory.h in Headers */, + D3C2222D0FFE8DE9004514FE /* NSArray+ParseKitAdditions.h in Headers */, + D3C2222E0FFE8DEE004514FE /* NSString+ParseKitAdditions.h in Headers */, + D3F0E2480FFE8EB900C9DF74 /* PKQuoteState.h in Headers */, + D3376D5910093A1600E4602E /* PKGrammarParser.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1C90F1965E600558235 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D34BB0680FF9EDDF00D7773A /* JSParseKit.h in Headers */, + D34BB0710FF9EE4000D7773A /* PKJSAssembly.h in Headers */, + D34BB0730FF9EE4000D7773A /* PKJSUtils.h in Headers */, + D34BB0750FF9EE4000D7773A /* PKJSUtils_macros.h in Headers */, + D34BB0760FF9EE4000D7773A /* PKJSValueHolder.h in Headers */, + D34BB08F0FF9EF9D00D7773A /* PKJSCharacterAssembly.h in Headers */, + D34BB0A90FF9F14B00D7773A /* PKJSCommentState.h in Headers */, + D34BB0AB0FF9F14B00D7773A /* PKJSDelimitState.h in Headers */, + D34BB0AD0FF9F14B00D7773A /* PKJSNumberState.h in Headers */, + D34BB0AF0FF9F14B00D7773A /* PKJSQuoteState.h in Headers */, + D34BB0B10FF9F14B00D7773A /* PKJSSymbolState.h in Headers */, + D34BB0B30FF9F14B00D7773A /* PKJSToken.h in Headers */, + D34BB0B50FF9F14B00D7773A /* PKJSTokenAssembly.h in Headers */, + D34BB0B70FF9F14B00D7773A /* PKJSTokenizer.h in Headers */, + D34BB0B90FF9F14B00D7773A /* PKJSTokenizerState.h in Headers */, + D34BB0BB0FF9F14B00D7773A /* PKJSWhitespaceState.h in Headers */, + D34BB0BD0FF9F14B00D7773A /* PKJSWordState.h in Headers */, + D34BB0E60FF9F28000D7773A /* PKJSAlternation.h in Headers */, + D34BB0E80FF9F28000D7773A /* PKJSAny.h in Headers */, + D34BB0EA0FF9F28000D7773A /* PKJSAssemblerAdapter.h in Headers */, + D34BB0EC0FF9F28000D7773A /* PKJSCollectionParser.h in Headers */, + D34BB0EE0FF9F28000D7773A /* PKJSEmpty.h in Headers */, + D34BB0F00FF9F28000D7773A /* PKJSParser.h in Headers */, + D34BB0F20FF9F28000D7773A /* PKJSRepetition.h in Headers */, + D34BB0F40FF9F28000D7773A /* PKJSSequence.h in Headers */, + D34BB0F60FF9F28000D7773A /* PKJSTerminal.h in Headers */, + D34BB0F80FF9F28000D7773A /* PKJSTrack.h in Headers */, + D34BB1140FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h in Headers */, + D34BB1160FF9F36200D7773A /* PKJSComment.h in Headers */, + D34BB1180FF9F36200D7773A /* PKJSDelimitedString.h in Headers */, + D34BB11A0FF9F36200D7773A /* PKJSLiteral.h in Headers */, + D34BB11C0FF9F36200D7773A /* PKJSLowercaseWord.h in Headers */, + D34BB11E0FF9F36200D7773A /* PKJSNum.h in Headers */, + D34BB1200FF9F36200D7773A /* PKJSPattern.h in Headers */, + D34BB1220FF9F36200D7773A /* PKJSQuotedString.h in Headers */, + D34BB1240FF9F36200D7773A /* PKJSSymbol.h in Headers */, + D34BB1260FF9F36200D7773A /* PKJSUppercaseWord.h in Headers */, + D34BB1280FF9F36200D7773A /* PKJSWord.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3FDC57F0FFC4BFC00F1F797 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D3FDC6DA0FFC4C8C00F1F797 /* RegexKitLite.h in Headers */, + D3FDC8DC0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch in Headers */, + D3C221940FFE8B8C004514FE /* ParseKit.h in Headers */, + D3C221950FFE8B8C004514FE /* PKTypes.h in Headers */, + D3C221980FFE8B95004514FE /* PKReader.h in Headers */, + D3C2219B0FFE8B9D004514FE /* PKAssembly.h in Headers */, + D3C2219E0FFE8BA6004514FE /* PKParser.h in Headers */, + D3C221A10FFE8BAE004514FE /* PKRepetition.h in Headers */, + D3C221A40FFE8BBA004514FE /* PKCollectionParser.h in Headers */, + D3C221A70FFE8BC1004514FE /* PKAlternation.h in Headers */, + D3C221AA0FFE8BC9004514FE /* PKSequence.h in Headers */, + D3C221AD0FFE8BCF004514FE /* PKTrack.h in Headers */, + D3C221B00FFE8BD4004514FE /* PKTrackException.h in Headers */, + D3C221B30FFE8BDB004514FE /* PKIntersection.h in Headers */, + D3C221B60FFE8BE2004514FE /* PKDifference.h in Headers */, + D3C221B90FFE8BE8004514FE /* PKNegation.h in Headers */, + D3C221BC0FFE8BEF004514FE /* PKTerminal.h in Headers */, + D3C221BF0FFE8BF7004514FE /* PKEmpty.h in Headers */, + D3C221C20FFE8BFF004514FE /* PKTokenAssembly.h in Headers */, + D3C221C50FFE8C07004514FE /* PKToken.h in Headers */, + D3C221C80FFE8C0D004514FE /* PKTokenArraySource.h in Headers */, + D3C221CB0FFE8C15004514FE /* PKTokenizer.h in Headers */, + D3C221CE0FFE8C1B004514FE /* PKTokenizerState.h in Headers */, + D3C221D10FFE8C24004514FE /* PKNumberState.h in Headers */, + D3C221D70FFE8C35004514FE /* PKSymbolState.h in Headers */, + D3C221DA0FFE8C3D004514FE /* PKWordState.h in Headers */, + D3C221DD0FFE8C43004514FE /* PKWhitespaceState.h in Headers */, + D3C221E00FFE8C49004514FE /* PKDelimitState.h in Headers */, + D3C221E30FFE8C4E004514FE /* PKCommentState.h in Headers */, + D3C221E60FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */, + D3C221E90FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */, + D3C221EC0FFE8C69004514FE /* PKSymbolNode.h in Headers */, + D3C221EF0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */, + D3C221F20FFE8C7A004514FE /* PKPattern.h in Headers */, + D3C221F50FFE8C87004514FE /* PKWord.h in Headers */, + D3C221FB0FFE8C97004514FE /* PKQuotedString.h in Headers */, + D3C221FE0FFE8CB2004514FE /* PKSymbol.h in Headers */, + D3C222010FFE8CB9004514FE /* PKLiteral.h in Headers */, + D3C222040FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */, + D3C222070FFE8CCA004514FE /* PKWhitespace.h in Headers */, + D3C2220A0FFE8CD1004514FE /* PKComment.h in Headers */, + D3C2220D0FFE8CD8004514FE /* PKDelimitedString.h in Headers */, + D3C222100FFE8CDF004514FE /* PKAny.h in Headers */, + D3C222160FFE8D01004514FE /* PKLowercaseWord.h in Headers */, + D3C222190FFE8D11004514FE /* PKUppercaseWord.h in Headers */, + D3C2221C0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */, + D3C2221F0FFE8D3B004514FE /* PKChar.h in Headers */, + D3C222220FFE8D42004514FE /* PKDigit.h in Headers */, + D3C222250FFE8D49004514FE /* PKLetter.h in Headers */, + D3C222280FFE8D6B004514FE /* PKSpecificChar.h in Headers */, + D3C2222B0FFE8DAC004514FE /* PKParserFactory.h in Headers */, + D3C2222F0FFE8DEF004514FE /* NSString+ParseKitAdditions.h in Headers */, + D3C222300FFE8DF3004514FE /* NSArray+ParseKitAdditions.h in Headers */, + D3F0E2490FFE8EB900C9DF74 /* PKQuoteState.h in Headers */, + D3F0E3CB0FFEB70100C9DF74 /* PKNumber.h in Headers */, + D37A28681013942A00E936B7 /* PKGrammarParser.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 8DC2EF4F0486A6940098B216 /* ParseKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "ParseKit" */; + buildPhases = ( + 8DC2EF500486A6940098B216 /* Headers */, + 8DC2EF540486A6940098B216 /* Sources */, + 8DC2EF520486A6940098B216 /* Resources */, + 8DC2EF560486A6940098B216 /* Frameworks */, + D36C65E7100ED81B000361A0 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ParseKit; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = TODParseKit; + productReference = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; + productType = "com.apple.product-type.framework"; + }; + D334940F0E2963FD00406085 /* DemoApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = D33494150E2963FE00406085 /* Build configuration list for PBXNativeTarget "DemoApp" */; + buildPhases = ( + D334940D0E2963FD00406085 /* Sources */, + D334940C0E2963FD00406085 /* Resources */, + D334940E0E2963FD00406085 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D33494A00E296AA900406085 /* PBXTargetDependency */, + ); + name = DemoApp; + productName = DemoApp; + productReference = D33494100E2963FD00406085 /* DemoApp.app */; + productType = "com.apple.product-type.application"; + }; + D34185030E520D3F0081B0DC /* DebugApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = D34185090E520D410081B0DC /* Build configuration list for PBXNativeTarget "DebugApp" */; + buildPhases = ( + D34185010E520D3F0081B0DC /* Sources */, + D34185000E520D3F0081B0DC /* Resources */, + D380B9A10F0EF3DC0009EC13 /* Copy Frameworks */, + D34185020E520D3F0081B0DC /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D34185100E520D6F0081B0DC /* PBXTargetDependency */, + ); + name = DebugApp; + productName = TestApp; + productReference = D34185040E520D3F0081B0DC /* DebugApp.app */; + productType = "com.apple.product-type.application"; + }; + D389F1CD0F1965E600558235 /* JSParseKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = D389F1D20F1965E800558235 /* Build configuration list for PBXNativeTarget "JSParseKit" */; + buildPhases = ( + D389F1C90F1965E600558235 /* Headers */, + D389F1CB0F1965E600558235 /* Sources */, + D389F1CA0F1965E600558235 /* Resources */, + D389F1CC0F1965E600558235 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D389F1D40F19665C00558235 /* PBXTargetDependency */, + ); + name = JSParseKit; + productName = TDJSParseKit; + productReference = D389F1CE0F1965E600558235 /* JSParseKit.framework */; + productType = "com.apple.product-type.framework"; + }; + D389F2020F196A7500558235 /* JSDemoApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = D389F2080F196A7600558235 /* Build configuration list for PBXNativeTarget "JSDemoApp" */; + buildPhases = ( + D389F2000F196A7500558235 /* Sources */, + D389F1FF0F196A7500558235 /* Resources */, + D389F2010F196A7500558235 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D389F20A0F196A8000558235 /* PBXTargetDependency */, + ); + name = JSDemoApp; + productName = JSDemoApp; + productReference = D389F2030F196A7500558235 /* JSDemoApp.app */; + productType = "com.apple.product-type.application"; + }; + D3C7D8790A411FBF005DD154 /* Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3C7D87C0A411FC0005DD154 /* Build configuration list for PBXNativeTarget "Tests" */; + buildPhases = ( + D3C7D8760A411FBF005DD154 /* Sources */, + D3C7D8750A411FBF005DD154 /* Resources */, + D3DCB3880EF5E65100DE5110 /* Copy Frameworks */, + D3C7D8770A411FBF005DD154 /* Frameworks */, + D3C7D8780A411FBF005DD154 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + D31FE7180E60F24700A0803E /* PBXTargetDependency */, + ); + name = Tests; + productName = Tests; + productReference = D3C7D87A0A411FBF005DD154 /* Tests.octest */; + productType = "com.apple.product-type.bundle"; + }; + D3FDC5820FFC4BFC00F1F797 /* ParseKitMobile */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3FDC62F0FFC4C2000F1F797 /* Build configuration list for PBXNativeTarget "ParseKitMobile" */; + buildPhases = ( + D3FDC57F0FFC4BFC00F1F797 /* Headers */, + D3FDC5800FFC4BFC00F1F797 /* Sources */, + D3FDC5810FFC4BFC00F1F797 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ParseKitMobile; + productName = ParseKitMobile; + productReference = D3FDC5830FFC4BFC00F1F797 /* libparsekit.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0867D690FE84028FC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ParseKit" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 1; + mainGroup = 0867D691FE84028FC02AAC07 /* TODParseKit */; + productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DC2EF4F0486A6940098B216 /* ParseKit */, + D389F1CD0F1965E600558235 /* JSParseKit */, + D3FDC5820FFC4BFC00F1F797 /* ParseKitMobile */, + D3C7D8790A411FBF005DD154 /* Tests */, + D334940F0E2963FD00406085 /* DemoApp */, + D34185030E520D3F0081B0DC /* DebugApp */, + D389F2020F196A7500558235 /* JSDemoApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8DC2EF520486A6940098B216 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D334940C0E2963FD00406085 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36E98F80E58C1A000496BD3 /* DemoAppMainMenu.xib in Resources */, + D3DCB4C40EF6015C00DE5110 /* json.grammar in Resources */, + D3F741BF0EF9F29400559B9F /* css2_1.grammar in Resources */, + D3D01CAB0EFDB8A000C24DDE /* json_with_discards.grammar in Resources */, + D3F562A210266E5300DD6DB1 /* TokensView.xib in Resources */, + D3F562A410266E6300DD6DB1 /* TreesView.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D34185000E520D3F0081B0DC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3E27A320E741DD20078CC2C /* small-xml-file.xml in Resources */, + D3E27A330E741DD20078CC2C /* apple-boss.xml in Resources */, + D398E20E0E60F86D00A1C877 /* yahoo.json in Resources */, + D3E785560E53FB54008C7D61 /* apple-boss.json in Resources */, + D36E98E10E58C12800496BD3 /* DebugAppMainMenu.xib in Resources */, + D3EADD810E75E9CC00F78584 /* nasty.html in Resources */, + D3B69D320E80249900D70C41 /* nonascii.html in Resources */, + D3DCB4C50EF6015C00DE5110 /* json.grammar in Resources */, + D3F741C00EF9F29500559B9F /* css2_1.grammar in Resources */, + D3D01CAC0EFDB8A100C24DDE /* json_with_discards.grammar in Resources */, + D385FA260F04993500DB2946 /* json.css in Resources */, + D385FD6C0F05A99900DB2946 /* mini_css.grammar in Resources */, + D3DDDCAE0F0880D800A58000 /* example1.srgs in Resources */, + D383498C0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */, + D38349BD0F0C0D910055E4E0 /* json_with_comments.css in Resources */, + D3834A490F0C14C00055E4E0 /* yahoo_with_comments.json in Resources */, + D380AFBF0F0C54B60009EC13 /* html.css in Resources */, + D380AFC00F0C54B60009EC13 /* html.grammar in Resources */, + D380AFC30F0C56000009EC13 /* example.html in Resources */, + D380B3230F0CC0800009EC13 /* nyt.html in Resources */, + D380B50A0F0D71B00009EC13 /* css.grammar in Resources */, + D380B5390F0D7DE30009EC13 /* css.css in Resources */, + D380B5950F0D82F90009EC13 /* example.css in Resources */, + D3FD79210F4CC87900BAD816 /* rubyhash.grammar in Resources */, + D31A15270F6DE449002AFDF1 /* javascript.grammar in Resources */, + D355C6A70FE9F704006A91A4 /* nspredicate.grammar in Resources */, + D3BBBCC10FECD477007DF30D /* xml.grammar in Resources */, + D315DF730FEF59B600D876C8 /* date.grammar in Resources */, + D34BAC9A0FF8A9AD00D7773A /* xpath1_0.grammar in Resources */, + D3668293101D2C000008632C /* erb.grammar in Resources */, + D319E42B106D8A1F008C63DD /* arithmetic.grammar in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1CA0F1965E600558235 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1FF0F196A7500558235 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F38F0F19800400558235 /* DefaultValues.plist in Resources */, + D389F4620F198A8800558235 /* Test.html in Resources */, + D389F5590F19B7BC00558235 /* JSDemoAppMainMenu.xib in Resources */, + D389FBCD0F1B25E200558235 /* ParserTest.html in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3C7D8750A411FBF005DD154 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3B473850E48C9CF008AFBDD /* yahoo.json in Resources */, + D3E784BD0E53DA28008C7D61 /* apple-boss.json in Resources */, + D36E9FB50E5A944A00496BD3 /* apple-boss.xml in Resources */, + D36E9FE50E5BA0FC00496BD3 /* SRGSGrammar.txt in Resources */, + D36EA3B00E5EA67E00496BD3 /* small-xml-file.xml in Resources */, + D3EADD800E75E9CC00F78584 /* nasty.html in Resources */, + D3B69D330E80249900D70C41 /* nonascii.html in Resources */, + D38DD9E80EC29F260070BC4D /* nyt.html in Resources */, + D3DCB4C30EF6015300DE5110 /* json.grammar in Resources */, + D3F741440EF8E96A00559B9F /* xpath1_0.grammar in Resources */, + D3F741BE0EF9F28D00559B9F /* css2_1.grammar in Resources */, + D3D01CAA0EFDB89900C24DDE /* json_with_discards.grammar in Resources */, + D385FA250F04993500DB2946 /* json.css in Resources */, + D385FD6D0F05A99900DB2946 /* mini_css.grammar in Resources */, + D3DDDCAD0F0880D800A58000 /* example1.srgs in Resources */, + D383498B0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */, + D38349BC0F0C0D910055E4E0 /* json_with_comments.css in Resources */, + D3834A480F0C14B60055E4E0 /* yahoo_with_comments.json in Resources */, + D380AFBD0F0C54B60009EC13 /* html.css in Resources */, + D380AFBE0F0C54B60009EC13 /* html.grammar in Resources */, + D380AFC40F0C56000009EC13 /* example.html in Resources */, + D380B5090F0D71A90009EC13 /* css.grammar in Resources */, + D380B5380F0D7DDE0009EC13 /* css.css in Resources */, + D380B5940F0D82F60009EC13 /* example.css in Resources */, + D3FD79200F4CC86800BAD816 /* rubyhash.grammar in Resources */, + D31A15260F6DE449002AFDF1 /* javascript.grammar in Resources */, + D35384ED0FE9691100926552 /* nspredicate.grammar in Resources */, + D353899C0FEAC94400926552 /* c.grammar in Resources */, + D353899E0FEAC96B00926552 /* objc.grammar in Resources */, + D355C8810FEB36A1006A91A4 /* xml.grammar in Resources */, + D355C8840FEB4B94006A91A4 /* proto.grammar in Resources */, + D315DF720FEF59B600D876C8 /* date.grammar in Resources */, + D3668292101D2BFA0008632C /* erb.grammar in Resources */, + D319E42A106D8A1F008C63DD /* arithmetic.grammar in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + D36C65E7100ED81B000361A0 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#cp -R -f \"${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}\" ${HOME}/Library/Frameworks"; + }; + D3C7D8780A411FBF005DD154 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DC2EF540486A6940098B216 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36C55FF0FD3617B00141CB7 /* RegexKitLite.m in Sources */, + D34BAD9D0FF9C95800D7773A /* PKReader.m in Sources */, + D34BADA20FF9C9B000D7773A /* PKAssembly.m in Sources */, + D34BADD80FF9CBFB00D7773A /* PKParser.m in Sources */, + D34BAE030FF9CCAE00D7773A /* PKCollectionParser.m in Sources */, + D34BAE1D0FF9CE0E00D7773A /* PKAlternation.m in Sources */, + D34BAE1F0FF9CE0E00D7773A /* PKEmpty.m in Sources */, + D34BAE210FF9CE0E00D7773A /* PKDifference.m in Sources */, + D34BAE230FF9CE0E00D7773A /* PKIntersection.m in Sources */, + D34BAE250FF9CE0E00D7773A /* PKRepetition.m in Sources */, + D34BAE270FF9CE0E00D7773A /* PKSequence.m in Sources */, + D34BAE290FF9CE0E00D7773A /* PKTerminal.m in Sources */, + D34BAE2B0FF9CE0E00D7773A /* PKTrack.m in Sources */, + D34BAE2D0FF9CE0E00D7773A /* PKTrackException.m in Sources */, + D34BAE310FF9CE6000D7773A /* PKAny.m in Sources */, + D34BAE8D0FF9D15100D7773A /* PKTokenAssembly.m in Sources */, + D34BAE9D0FF9D20900D7773A /* PKToken.m in Sources */, + D34BAE9F0FF9D20900D7773A /* PKTokenArraySource.m in Sources */, + D34BAEA10FF9D20900D7773A /* PKTokenizer.m in Sources */, + D34BAEA30FF9D20900D7773A /* PKTokenizerState.m in Sources */, + D34BAED80FF9D56400D7773A /* PKCommentState.m in Sources */, + D34BAEDA0FF9D56400D7773A /* PKDelimitState.m in Sources */, + D34BAEDC0FF9D56400D7773A /* PKMultiLineCommentState.m in Sources */, + D34BAEDE0FF9D56400D7773A /* PKNumberState.m in Sources */, + D34BAEE00FF9D56400D7773A /* PKQuoteState.m in Sources */, + D34BAEE20FF9D56400D7773A /* PKSingleLineCommentState.m in Sources */, + D34BAEE40FF9D56400D7773A /* PKSymbolState.m in Sources */, + D34BAEE60FF9D56400D7773A /* PKWhitespaceState.m in Sources */, + D34BAEE80FF9D56400D7773A /* PKWord.m in Sources */, + D34BAEEA0FF9D56400D7773A /* PKWordState.m in Sources */, + D34BAF280FF9DF9900D7773A /* PKSymbolNode.m in Sources */, + D34BAF2A0FF9DF9900D7773A /* PKSymbolRootNode.m in Sources */, + D34BAF3A0FF9E18300D7773A /* PKPattern.m in Sources */, + D34BAF4C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m in Sources */, + D34BAF4E0FF9E19700D7773A /* PKComment.m in Sources */, + D34BAF500FF9E19700D7773A /* PKDelimitedString.m in Sources */, + D34BAF520FF9E19700D7773A /* PKLiteral.m in Sources */, + D34BAF540FF9E19700D7773A /* PKNumber.m in Sources */, + D34BAF560FF9E19700D7773A /* PKQuotedString.m in Sources */, + D34BAF580FF9E19700D7773A /* PKSymbol.m in Sources */, + D34BAF5A0FF9E19700D7773A /* PKWhitespace.m in Sources */, + D34BAF9D0FF9E6D100D7773A /* PKLowercaseWord.m in Sources */, + D34BAF9F0FF9E6D100D7773A /* PKUppercaseWord.m in Sources */, + D34BAFB20FF9E7F300D7773A /* PKCharacterAssembly.m in Sources */, + D34BAFBC0FF9E80300D7773A /* PKChar.m in Sources */, + D34BAFBE0FF9E80300D7773A /* PKDigit.m in Sources */, + D34BAFC00FF9E80300D7773A /* PKLetter.m in Sources */, + D34BAFC20FF9E80300D7773A /* PKSpecificChar.m in Sources */, + D34BAFDA0FF9E95500D7773A /* NSArray+ParseKitAdditions.m in Sources */, + D34BAFDC0FF9E95500D7773A /* NSString+ParseKitAdditions.m in Sources */, + D34BAFDE0FF9E95500D7773A /* PKParserFactory.m in Sources */, + D3126D060FFD9BA700CBF4C4 /* PKNegation.m in Sources */, + D3376D5A10093A1600E4602E /* PKGrammarParser.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D334940D0E2963FD00406085 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36E98E70E58C14000496BD3 /* DemoAppDelegate.m in Sources */, + D36E98E80E58C14000496BD3 /* main.m in Sources */, + D3F5629A10266CFC00DD6DB1 /* PKParseTreeView.m in Sources */, + D3F562A010266DFB00DD6DB1 /* DemoTokensViewController.m in Sources */, + D3F562A710266E8D00DD6DB1 /* DemoTreesViewController.m in Sources */, + D3305C4F102F5BAE00DC4F75 /* TDGutterView.m in Sources */, + D3305C50102F5BAE00DC4F75 /* TDSourceCodeTextView.m in Sources */, + D36934721038E28300527AF3 /* PKParseTree.m in Sources */, + D36934731038E28700527AF3 /* PKParseTreeAssembler.m in Sources */, + D36934741038E28B00527AF3 /* PKRuleNode.m in Sources */, + D36934751038E28F00527AF3 /* PKTokenNode.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D34185010E520D3F0081B0DC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36E98E20E58C12800496BD3 /* main.m in Sources */, + D36E98E00E58C12800496BD3 /* DebugAppDelegate.m in Sources */, + D3EADD8F0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */, + D31FE7420E60F40900A0803E /* XPathContext.m in Sources */, + D31FE7400E60F40300A0803E /* XPathAssembler.m in Sources */, + D31FE7340E60F34600A0803E /* XPathParser.m in Sources */, + D31FE7330E60F33C00A0803E /* XMLReader.m in Sources */, + D31FE7320E60F33000A0803E /* EBNFParser.m in Sources */, + D31FE7300E60F31E00A0803E /* TDFastJsonParser.m in Sources */, + D302C69D0EF044810090E714 /* TDPlistParser.m in Sources */, + D3F740B70EF8C38A00559B9F /* JSONAssembler.m in Sources */, + D385F98C0F046FE900DB2946 /* TDGenericAssembler.m in Sources */, + D385FD440F05A88C00DB2946 /* TDMiniCSSAssembler.m in Sources */, + D3DDDA870F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */, + D389F5B80F19C76A00558235 /* TDJsonParser.m in Sources */, + D31A16530F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */, + D3252F7E0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */, + D3385FDA0FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */, + D355C62E0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */, + D3BBBC9D0FEC9756007DF30D /* TDXMLParser.m in Sources */, + D3376D8F10096C0700E4602E /* PKAST.m in Sources */, + D319E42F106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1CB0F1965E600558235 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D34BB0690FF9EDDF00D7773A /* JSParseKit.m in Sources */, + D34BB0720FF9EE4000D7773A /* PKJSAssembly.m in Sources */, + D34BB0740FF9EE4000D7773A /* PKJSUtils.m in Sources */, + D34BB0770FF9EE4000D7773A /* PKJSValueHolder.m in Sources */, + D34BB0900FF9EF9D00D7773A /* PKJSCharacterAssembly.m in Sources */, + D34BB0AA0FF9F14B00D7773A /* PKJSCommentState.m in Sources */, + D34BB0AC0FF9F14B00D7773A /* PKJSDelimitState.m in Sources */, + D34BB0AE0FF9F14B00D7773A /* PKJSNumberState.m in Sources */, + D34BB0B00FF9F14B00D7773A /* PKJSQuoteState.m in Sources */, + D34BB0B20FF9F14B00D7773A /* PKJSSymbolState.m in Sources */, + D34BB0B40FF9F14B00D7773A /* PKJSToken.m in Sources */, + D34BB0B60FF9F14B00D7773A /* PKJSTokenAssembly.m in Sources */, + D34BB0B80FF9F14B00D7773A /* PKJSTokenizer.m in Sources */, + D34BB0BA0FF9F14B00D7773A /* PKJSTokenizerState.m in Sources */, + D34BB0BC0FF9F14B00D7773A /* PKJSWhitespaceState.m in Sources */, + D34BB0BE0FF9F14B00D7773A /* PKJSWordState.m in Sources */, + D34BB0E70FF9F28000D7773A /* PKJSAlternation.m in Sources */, + D34BB0E90FF9F28000D7773A /* PKJSAny.m in Sources */, + D34BB0EB0FF9F28000D7773A /* PKJSAssemblerAdapter.m in Sources */, + D34BB0ED0FF9F28000D7773A /* PKJSCollectionParser.m in Sources */, + D34BB0EF0FF9F28000D7773A /* PKJSEmpty.m in Sources */, + D34BB0F10FF9F28000D7773A /* PKJSParser.m in Sources */, + D34BB0F30FF9F28000D7773A /* PKJSRepetition.m in Sources */, + D34BB0F50FF9F28000D7773A /* PKJSSequence.m in Sources */, + D34BB0F70FF9F28000D7773A /* PKJSTerminal.m in Sources */, + D34BB0F90FF9F28000D7773A /* PKJSTrack.m in Sources */, + D34BB1150FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m in Sources */, + D34BB1170FF9F36200D7773A /* PKJSComment.m in Sources */, + D34BB1190FF9F36200D7773A /* PKJSDelimitedString.m in Sources */, + D34BB11B0FF9F36200D7773A /* PKJSLiteral.m in Sources */, + D34BB11D0FF9F36200D7773A /* PKJSLowercaseWord.m in Sources */, + D34BB11F0FF9F36200D7773A /* PKJSNum.m in Sources */, + D34BB1210FF9F36200D7773A /* PKJSPattern.m in Sources */, + D34BB1230FF9F36200D7773A /* PKJSQuotedString.m in Sources */, + D34BB1250FF9F36200D7773A /* PKJSSymbol.m in Sources */, + D34BB1270FF9F36200D7773A /* PKJSUppercaseWord.m in Sources */, + D34BB1290FF9F36200D7773A /* PKJSWord.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F2000F196A7500558235 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F2E40F196CAE00558235 /* main.m in Sources */, + D389F37A0F197E8000558235 /* JSDemoAppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3C7D8760A411FBF005DD154 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3E788930E567DFD008C7D61 /* SRGSParserTest.m in Sources */, + D3E788960E567E0A008C7D61 /* SRGSParser.m in Sources */, + D3E78A190E574C99008C7D61 /* EBNFParser.m in Sources */, + D3E78A1A0E574C99008C7D61 /* EBNFParserTest.m in Sources */, + D36E95460E578ECC00496BD3 /* XPathParser.m in Sources */, + D36E95D80E57B08400496BD3 /* XPathParserTest.m in Sources */, + D36E97B00E589DAE00496BD3 /* XPathAssembler.m in Sources */, + D36E98220E58A3A800496BD3 /* XPathContext.m in Sources */, + D3521F560E5FA1B0009681F9 /* XMLReader.m in Sources */, + D3521F570E5FA1B0009681F9 /* XMLReaderTest.m in Sources */, + D31FE54C0E60E46100A0803E /* TDTestScaffold.m in Sources */, + D31FE5630E60E50800A0803E /* TDAlternationTest.m in Sources */, + D31FE5640E60E50800A0803E /* TDLiteralTest.m in Sources */, + D31FE5650E60E50800A0803E /* TDParserTest.m in Sources */, + D31FE5660E60E50800A0803E /* TDRepetitionTest.m in Sources */, + D31FE5680E60E50800A0803E /* TDRobotCommandTest.m in Sources */, + D31FE5690E60E50800A0803E /* TDSequenceTest.m in Sources */, + D31FE56A0E60E50800A0803E /* TDSymbolTest.m in Sources */, + D31FE56B0E60E50800A0803E /* TDTokenAssemblyTest.m in Sources */, + D31FE56C0E60E50800A0803E /* TDTrackTest.m in Sources */, + D31FE56D0E60E50800A0803E /* TDUppercaseWordTest.m in Sources */, + D31FE5750E60E55700A0803E /* TDReaderTest.m in Sources */, + D31FE5760E60E55700A0803E /* TDTokenizerTest.m in Sources */, + D31FE5850E60E58C00A0803E /* TDNumberStateTest.m in Sources */, + D31FE5860E60E58C00A0803E /* TDQuoteStateTest.m in Sources */, + D31FE5890E60E58C00A0803E /* TDSymbolStateTest.m in Sources */, + D31FE58A0E60E58C00A0803E /* TDWhitespaceStateTest.m in Sources */, + D31FE58B0E60E58C00A0803E /* TDWordStateTest.m in Sources */, + D31FE5960E60E5AC00A0803E /* TDCharacterAssemblyTest.m in Sources */, + D31FE5970E60E5AC00A0803E /* TDCharTest.m in Sources */, + D31FE5980E60E5AC00A0803E /* TDDigitTest.m in Sources */, + D31FE5990E60E5AC00A0803E /* TDLetterTest.m in Sources */, + D31FE59A0E60E5AC00A0803E /* TDSpecificCharTest.m in Sources */, + D31FE59F0E60E5C000A0803E /* TDRegularParser.m in Sources */, + D31FE5A00E60E5C000A0803E /* TDRegularParserTest.m in Sources */, + D31FE5A90E60E5D500A0803E /* TDFastJsonParser.m in Sources */, + D31FE5AA0E60E5D500A0803E /* TDFastJsonParserTest.m in Sources */, + D31FE5B10E60E64900A0803E /* TDXmlTokenAssembly.m in Sources */, + D31FE5B20E60E64900A0803E /* TDXmlTokenizerTest.m in Sources */, + D31FE5B70E60E66600A0803E /* TDXmlToken.m in Sources */, + D31FE5B80E60E66600A0803E /* TDXmlTokenizer.m in Sources */, + D31FE5DD0E60E69E00A0803E /* TDXmlAttribute.m in Sources */, + D31FE5DE0E60E69E00A0803E /* TDXmlCdata.m in Sources */, + D31FE5DF0E60E69E00A0803E /* TDXmlComment.m in Sources */, + D31FE5E00E60E69E00A0803E /* TDXmlDecl.m in Sources */, + D31FE5E10E60E69E00A0803E /* TDXmlDoctype.m in Sources */, + D31FE5E20E60E69E00A0803E /* TDXmlDocument.m in Sources */, + D31FE5E30E60E69E00A0803E /* TDXmlEndEntity.m in Sources */, + D31FE5E40E60E69E00A0803E /* TDXmlEndTag.m in Sources */, + D31FE5E50E60E69E00A0803E /* TDXmlEntity.m in Sources */, + D31FE5E60E60E69E00A0803E /* TDXmlEntityRef.m in Sources */, + D31FE5E70E60E69E00A0803E /* TDXmlFragment.m in Sources */, + D31FE5E80E60E69E00A0803E /* TDXmlNotation.m in Sources */, + D31FE5E90E60E69E00A0803E /* TDXmlProcessingInstruction.m in Sources */, + D31FE5EA0E60E69E00A0803E /* TDXmlSignificantWhitespace.m in Sources */, + D31FE5EB0E60E69E00A0803E /* TDXmlStartTag.m in Sources */, + D31FE5EC0E60E69E00A0803E /* TDXmlTerminal.m in Sources */, + D31FE5ED0E60E69E00A0803E /* TDXmlText.m in Sources */, + D31FE5EE0E60E69E00A0803E /* TDXmlWhitespace.m in Sources */, + D31FE5FC0E60E6B500A0803E /* TDNCNameState.m in Sources */, + D31FE5FD0E60E6B500A0803E /* TDXmlName.m in Sources */, + D31FE5FE0E60E6B500A0803E /* TDXmlNameState.m in Sources */, + D31FE5FF0E60E6B500A0803E /* TDXmlNameTest.m in Sources */, + D31FE6000E60E6B500A0803E /* TDXmlNmtoken.m in Sources */, + D31FE6010E60E6B500A0803E /* TDXmlNmtokenState.m in Sources */, + D31FE6E00E60EE2500A0803E /* TDNCName.m in Sources */, + D3C85C7B0E63B438000445FD /* TDArithmeticParser.m in Sources */, + D3C85C800E63B9E9000445FD /* TDArithmeticParserTest.m in Sources */, + D3C85D450E63D1BF000445FD /* TDScientificNumberStateTest.m in Sources */, + D3EADD8E0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */, + D38205BE0EEE48EE004340DD /* TDTokenTest.m in Sources */, + D36568A70EEF9FE900226554 /* TDPlistParser.m in Sources */, + D36568AA0EEFA05300226554 /* TDPlistParserTest.m in Sources */, + D3656DFE0EF2620E00226554 /* TDTokenArraySourceTest.m in Sources */, + D3C031ED0EF38D2D00C5ABEB /* TDLowercaseWordTest.m in Sources */, + D385F98E0F046FE900DB2946 /* TDGenericAssembler.m in Sources */, + D385FA230F04971400DB2946 /* TDGenericAssemblerTest.m in Sources */, + D385FD460F05A89100DB2946 /* TDMiniCSSAssemblerTest.m in Sources */, + D385FD490F05A8C900DB2946 /* TDMiniCSSAssembler.m in Sources */, + D3DDDA880F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */, + D3DDDAFE0F083C9700A58000 /* TDCommentStateTest.m in Sources */, + D380BA620F0F06CD0009EC13 /* TDParserFactoryTest.m in Sources */, + D389F5B60F19C76A00558235 /* TDJsonParser.m in Sources */, + D389F5B70F19C76A00558235 /* TDJsonParserTest.m in Sources */, + D31A16520F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */, + D3B43FB80F76E99C0072AF40 /* TDJavaScriptParserTest.m in Sources */, + D3E39C3F0FC5FFD10022DAB9 /* TDDelimitStateTest.m in Sources */, + D3252F7B0FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m in Sources */, + D3252F7F0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */, + D3385FD90FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */, + D3385FDE0FCFB227003BF729 /* TDPredicateEvaluatorTest.m in Sources */, + D36C53790FD27F1300141CB7 /* TDParserFactoryTest2.m in Sources */, + D36C562B0FD365DB00141CB7 /* TDPatternTest.m in Sources */, + D3AF49780FDB122E0032F4DC /* TDParserFactoryPatternTest.m in Sources */, + D355C62D0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */, + D355C6310FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m in Sources */, + D3BBBC9E0FEC9756007DF30D /* TDXMLParser.m in Sources */, + D39E01340FEF02DA00150FC3 /* TDXMLParserTest.m in Sources */, + D338E5BB0FF5DDCB003DE6AA /* TDDifferenceTest.m in Sources */, + D34BAC230FF87F8600D7773A /* TDParserFactoryTest3.m in Sources */, + D34BAC4B0FF892C200D7773A /* XPathParserGrammarTest.m in Sources */, + D3126D0B0FFD9E4B00CBF4C4 /* TDNegationTest.m in Sources */, + D3376D8E10096C0700E4602E /* PKAST.m in Sources */, + D34BAD18100A9B7900996341 /* TDTokenizerStateTest.m in Sources */, + D3668296101D2C200008632C /* ERBTest.m in Sources */, + D3F55F611025737D00DD6DB1 /* TDParseTreeTest.m in Sources */, + D369345D1038DE5300527AF3 /* PKParseTree.m in Sources */, + D369345E1038DE5300527AF3 /* PKParseTreeAssembler.m in Sources */, + D369345F1038DE5300527AF3 /* PKRuleNode.m in Sources */, + D36934601038DE5300527AF3 /* PKTokenNode.m in Sources */, + D3D1BF2810394420003656E5 /* SAXAssembler.m in Sources */, + D3D1BF2B1039445C003656E5 /* SAXTest.m in Sources */, + D38E97CC1061CF6500739C39 /* TDTokenizerBlocksTest.m in Sources */, + D38E98D81062C5BA00739C39 /* TDParserBlocksTest.m in Sources */, + D319E42E106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3FDC5800FFC4BFC00F1F797 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3FDC6EE0FFC4C9E00F1F797 /* RegexKitLite.m in Sources */, + D3FDC6EF0FFC4C9E00F1F797 /* PKReader.m in Sources */, + D3FDC6F00FFC4C9E00F1F797 /* PKAssembly.m in Sources */, + D3FDC6F10FFC4C9E00F1F797 /* PKParser.m in Sources */, + D3FDC6F20FFC4C9E00F1F797 /* PKRepetition.m in Sources */, + D3FDC6F30FFC4C9E00F1F797 /* PKCollectionParser.m in Sources */, + D3FDC6F40FFC4C9E00F1F797 /* PKAlternation.m in Sources */, + D3FDC6F50FFC4C9E00F1F797 /* PKSequence.m in Sources */, + D3FDC6F60FFC4C9E00F1F797 /* PKTrack.m in Sources */, + D3FDC6F70FFC4C9E00F1F797 /* PKTrackException.m in Sources */, + D3FDC6F80FFC4C9E00F1F797 /* PKDifference.m in Sources */, + D3FDC6F90FFC4C9E00F1F797 /* PKIntersection.m in Sources */, + D3FDC6FA0FFC4C9E00F1F797 /* PKTerminal.m in Sources */, + D3FDC6FB0FFC4C9E00F1F797 /* PKEmpty.m in Sources */, + D3FDC6FC0FFC4C9E00F1F797 /* PKTokenAssembly.m in Sources */, + D3FDC6FD0FFC4C9E00F1F797 /* PKToken.m in Sources */, + D3FDC6FE0FFC4C9E00F1F797 /* PKTokenArraySource.m in Sources */, + D3FDC6FF0FFC4C9E00F1F797 /* PKTokenizer.m in Sources */, + D3FDC7000FFC4C9E00F1F797 /* PKTokenizerState.m in Sources */, + D3FDC7010FFC4C9E00F1F797 /* PKNumberState.m in Sources */, + D3FDC7020FFC4C9E00F1F797 /* PKQuoteState.m in Sources */, + D3FDC7030FFC4C9E00F1F797 /* PKSymbolState.m in Sources */, + D3FDC7040FFC4C9E00F1F797 /* PKWordState.m in Sources */, + D3FDC7050FFC4C9E00F1F797 /* PKWhitespaceState.m in Sources */, + D3FDC7060FFC4C9E00F1F797 /* PKDelimitState.m in Sources */, + D3FDC7070FFC4C9E00F1F797 /* PKCommentState.m in Sources */, + D3FDC7080FFC4C9E00F1F797 /* PKSingleLineCommentState.m in Sources */, + D3FDC7090FFC4C9E00F1F797 /* PKMultiLineCommentState.m in Sources */, + D3FDC70A0FFC4C9E00F1F797 /* PKSymbolNode.m in Sources */, + D3FDC70B0FFC4C9E00F1F797 /* PKSymbolRootNode.m in Sources */, + D3FDC70C0FFC4C9E00F1F797 /* PKPattern.m in Sources */, + D3FDC70D0FFC4C9E00F1F797 /* PKWord.m in Sources */, + D3FDC70F0FFC4C9E00F1F797 /* PKQuotedString.m in Sources */, + D3FDC7100FFC4C9E00F1F797 /* PKSymbol.m in Sources */, + D3FDC7110FFC4C9E00F1F797 /* PKLiteral.m in Sources */, + D3FDC7120FFC4C9E00F1F797 /* PKCaseInsensitiveLiteral.m in Sources */, + D3FDC7130FFC4C9E00F1F797 /* PKWhitespace.m in Sources */, + D3FDC7140FFC4C9E00F1F797 /* PKComment.m in Sources */, + D3FDC7150FFC4C9E00F1F797 /* PKDelimitedString.m in Sources */, + D3FDC7160FFC4C9E00F1F797 /* PKAny.m in Sources */, + D3FDC7180FFC4C9E00F1F797 /* PKLowercaseWord.m in Sources */, + D3FDC7190FFC4C9E00F1F797 /* PKUppercaseWord.m in Sources */, + D3FDC71A0FFC4C9E00F1F797 /* PKCharacterAssembly.m in Sources */, + D3FDC71B0FFC4C9E00F1F797 /* PKChar.m in Sources */, + D3FDC71C0FFC4C9E00F1F797 /* PKDigit.m in Sources */, + D3FDC71D0FFC4C9E00F1F797 /* PKLetter.m in Sources */, + D3FDC71E0FFC4C9E00F1F797 /* PKSpecificChar.m in Sources */, + D3FDC71F0FFC4C9E00F1F797 /* PKParserFactory.m in Sources */, + D3FDC7200FFC4C9E00F1F797 /* NSArray+ParseKitAdditions.m in Sources */, + D3FDC7210FFC4C9E00F1F797 /* NSString+ParseKitAdditions.m in Sources */, + D3126DEC0FFDBC1D00CBF4C4 /* PKNegation.m in Sources */, + D3F0E3CC0FFEB70700C9DF74 /* PKNumber.m in Sources */, + D37A28671013942300E936B7 /* PKGrammarParser.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + D31FE7180E60F24700A0803E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D31FE7170E60F24700A0803E /* PBXContainerItemProxy */; + }; + D33494A00E296AA900406085 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D334949F0E296AA900406085 /* PBXContainerItemProxy */; + }; + D34185100E520D6F0081B0DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D341850F0E520D6F0081B0DC /* PBXContainerItemProxy */; + }; + D389F1D40F19665C00558235 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D389F1D30F19665C00558235 /* PBXContainerItemProxy */; + }; + D389F20A0F196A8000558235 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D389F1CD0F1965E600558235 /* JSParseKit */; + targetProxy = D389F2090F196A8000558235 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C1667FE841158C02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1DEB91AE08733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_TEST_COVERAGE_FILES = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKit_Prefix.pch; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GENERATE_PROFILING_CODE = YES; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(TARGET_BUILD_DIR)"; + LLVM_LTO = NO; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + ); + PRODUCT_NAME = ParseKit; + SDKROOT = ""; + WARNING_CFLAGS = "-Wundeclared-selector"; + WRAPPER_EXTENSION = framework; + ZERO_LINK = YES; + }; + name = Debug; + }; + 1DEB91AF08733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "$(TDPARSEKIT_FRAMEWORK_TARGET_PATH)"; + FRAMEWORK_VERSION = A; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKit_Prefix.pch; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvmgcc42; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(TARGET_BUILD_DIR)"; + LLVM_LTO = YES; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + ); + PRODUCT_NAME = ParseKit; + SDKROOT = ""; + TDPARSEKIT_FRAMEWORK_TARGET_PATH = "@executable_path/../Frameworks"; + WARNING_CFLAGS = "-Wundeclared-selector"; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; + 1DEB91B208733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; + }; + name = Debug; + }; + 1DEB91B308733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; + }; + name = Release; + }; + D33494130E2963FE00406085 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = "demoapp/DemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DemoApp; + SDKROOT = ""; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + D33494140E2963FE00406085 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "demoapp/DemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DemoApp; + SDKROOT = ""; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + D34185070E520D410081B0DC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/frameworks\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_WARN_UNUSED_VARIABLE = NO; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "debugapp/DebugApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DebugApp; + SDKROOT = ""; + }; + name = Debug; + }; + D34185080E520D410081B0DC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/frameworks\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "debugapp/DebugApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DebugApp; + SDKROOT = ""; + ZERO_LINK = NO; + }; + name = Release; + }; + D389F1D00F1965E800558235 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + INFOPLIST_FILE = "JSParseKit-Info.plist"; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSParseKit; + SDKROOT = ""; + }; + name = Debug; + }; + D389F1D10F1965E800558235 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_GC = YES; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + INFOPLIST_FILE = "JSParseKit-Info.plist"; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSParseKit; + SDKROOT = ""; + ZERO_LINK = NO; + }; + name = Release; + }; + D389F2060F196A7600558235 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = required; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "jsdemoapp/JSDemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSDemoApp; + SDKROOT = ""; + }; + name = Debug; + }; + D389F2070F196A7600558235 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_GC = required; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "jsdemoapp/JSDemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSDemoApp; + SDKROOT = ""; + ZERO_LINK = NO; + }; + name = Release; + }; + D3C7D87D0A411FC0005DD154 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + "$(DEVELOPER_FRAMEWORKS_DIR_QUOTED)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/frameworks\""; + FRAMEWORK_SEARCH_PATH_DEBUG_BUILD = "\"$(SRCROOT)/build/Debug\""; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "test/Tests-Info.plist"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + LIBRARY_SEARCH_PATHS = ""; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + MACOSX_DEPLOYMENT_TARGET = 10.5; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + SenTestingKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Tests; + SDKROOT = ""; + USER_HEADER_SEARCH_PATHS = ""; + WARNING_CFLAGS = ""; + WRAPPER_EXTENSION = octest; + ZERO_LINK = YES; + }; + name = Debug; + }; + D3C7D87E0A411FC0005DD154 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + "$(DEVELOPER_FRAMEWORKS_DIR_QUOTED)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"/Library/Frameworks\""; + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/frameworks\""; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "test/Tests-Info.plist"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + SenTestingKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Tests; + SDKROOT = ""; + WARNING_CFLAGS = ""; + WRAPPER_EXTENSION = octest; + ZERO_LINK = NO; + }; + name = Release; + }; + D3FDC5840FFC4BFC00F1F797 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKitMobile_Prefix.pch; + HEADER_SEARCH_PATHS = ""; + ONLY_ACTIVE_ARCH = YES; + PREBINDING = NO; + PRODUCT_NAME = parsekit; + SDKROOT = iphoneos3.0; + }; + name = Debug; + }; + D3FDC5850FFC4BFC00F1F797 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = ""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKitMobile_Prefix.pch; + HEADER_SEARCH_PATHS = ""; + OTHER_LDFLAGS = ""; + PREBINDING = NO; + PRODUCT_NAME = parsekit; + SDKROOT = iphoneos3.0; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "ParseKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91AE08733DA50010E9CD /* Debug */, + 1DEB91AF08733DA50010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ParseKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91B208733DA50010E9CD /* Debug */, + 1DEB91B308733DA50010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D33494150E2963FE00406085 /* Build configuration list for PBXNativeTarget "DemoApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D33494130E2963FE00406085 /* Debug */, + D33494140E2963FE00406085 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D34185090E520D410081B0DC /* Build configuration list for PBXNativeTarget "DebugApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D34185070E520D410081B0DC /* Debug */, + D34185080E520D410081B0DC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D389F1D20F1965E800558235 /* Build configuration list for PBXNativeTarget "JSParseKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D389F1D00F1965E800558235 /* Debug */, + D389F1D10F1965E800558235 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D389F2080F196A7600558235 /* Build configuration list for PBXNativeTarget "JSDemoApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D389F2060F196A7600558235 /* Debug */, + D389F2070F196A7600558235 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D3C7D87C0A411FC0005DD154 /* Build configuration list for PBXNativeTarget "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3C7D87D0A411FC0005DD154 /* Debug */, + D3C7D87E0A411FC0005DD154 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D3FDC62F0FFC4C2000F1F797 /* Build configuration list for PBXNativeTarget "ParseKitMobile" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3FDC5840FFC4BFC00F1F797 /* Debug */, + D3FDC5850FFC4BFC00F1F797 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0867D690FE84028FC02AAC07 /* Project object */; +} diff --git a/ParseKit.xcodeproj/.svn/tmp/project.pbxproj.tmp b/ParseKit.xcodeproj/.svn/tmp/project.pbxproj.tmp new file mode 100644 index 0000000..382638b --- /dev/null +++ b/ParseKit.xcodeproj/.svn/tmp/project.pbxproj.tmp @@ -0,0 +1,3720 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; + D302C69D0EF044810090E714 /* TDPlistParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36568A60EEF9FE900226554 /* TDPlistParser.m */; }; + D3126D060FFD9BA700CBF4C4 /* PKNegation.m in Sources */ = {isa = PBXBuildFile; fileRef = D3126D040FFD9BA700CBF4C4 /* PKNegation.m */; }; + D3126D0B0FFD9E4B00CBF4C4 /* TDNegationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3126D0A0FFD9E4B00CBF4C4 /* TDNegationTest.m */; }; + D3126DEC0FFDBC1D00CBF4C4 /* PKNegation.m in Sources */ = {isa = PBXBuildFile; fileRef = D3126D040FFD9BA700CBF4C4 /* PKNegation.m */; }; + D315DF720FEF59B600D876C8 /* date.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D315DF710FEF59B600D876C8 /* date.grammar */; }; + D315DF730FEF59B600D876C8 /* date.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D315DF710FEF59B600D876C8 /* date.grammar */; }; + D319E42A106D8A1F008C63DD /* arithmetic.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D319E429106D8A1F008C63DD /* arithmetic.grammar */; }; + D319E42B106D8A1F008C63DD /* arithmetic.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D319E429106D8A1F008C63DD /* arithmetic.grammar */; }; + D319E42E106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */; }; + D319E42F106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */; }; + D31A15260F6DE449002AFDF1 /* javascript.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D31A15250F6DE449002AFDF1 /* javascript.grammar */; }; + D31A15270F6DE449002AFDF1 /* javascript.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D31A15250F6DE449002AFDF1 /* javascript.grammar */; }; + D31A16520F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */; }; + D31A16530F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */; }; + D31FE54C0E60E46100A0803E /* TDTestScaffold.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE54B0E60E46100A0803E /* TDTestScaffold.m */; }; + D31FE5630E60E50800A0803E /* TDAlternationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE54E0E60E50800A0803E /* TDAlternationTest.m */; }; + D31FE5640E60E50800A0803E /* TDLiteralTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5500E60E50800A0803E /* TDLiteralTest.m */; }; + D31FE5650E60E50800A0803E /* TDParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5520E60E50800A0803E /* TDParserTest.m */; }; + D31FE5660E60E50800A0803E /* TDRepetitionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5540E60E50800A0803E /* TDRepetitionTest.m */; }; + D31FE5680E60E50800A0803E /* TDRobotCommandTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5580E60E50800A0803E /* TDRobotCommandTest.m */; }; + D31FE5690E60E50800A0803E /* TDSequenceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE55A0E60E50800A0803E /* TDSequenceTest.m */; }; + D31FE56A0E60E50800A0803E /* TDSymbolTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE55C0E60E50800A0803E /* TDSymbolTest.m */; }; + D31FE56B0E60E50800A0803E /* TDTokenAssemblyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE55E0E60E50800A0803E /* TDTokenAssemblyTest.m */; }; + D31FE56C0E60E50800A0803E /* TDTrackTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5600E60E50800A0803E /* TDTrackTest.m */; }; + D31FE56D0E60E50800A0803E /* TDUppercaseWordTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5620E60E50800A0803E /* TDUppercaseWordTest.m */; }; + D31FE5750E60E55700A0803E /* TDReaderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5720E60E55700A0803E /* TDReaderTest.m */; }; + D31FE5760E60E55700A0803E /* TDTokenizerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5740E60E55700A0803E /* TDTokenizerTest.m */; }; + D31FE5850E60E58C00A0803E /* TDNumberStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5780E60E58C00A0803E /* TDNumberStateTest.m */; }; + D31FE5860E60E58C00A0803E /* TDQuoteStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE57A0E60E58C00A0803E /* TDQuoteStateTest.m */; }; + D31FE5890E60E58C00A0803E /* TDSymbolStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5800E60E58C00A0803E /* TDSymbolStateTest.m */; }; + D31FE58A0E60E58C00A0803E /* TDWhitespaceStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5820E60E58C00A0803E /* TDWhitespaceStateTest.m */; }; + D31FE58B0E60E58C00A0803E /* TDWordStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5840E60E58C00A0803E /* TDWordStateTest.m */; }; + D31FE5960E60E5AC00A0803E /* TDCharacterAssemblyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE58D0E60E5AC00A0803E /* TDCharacterAssemblyTest.m */; }; + D31FE5970E60E5AC00A0803E /* TDCharTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE58F0E60E5AC00A0803E /* TDCharTest.m */; }; + D31FE5980E60E5AC00A0803E /* TDDigitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5910E60E5AC00A0803E /* TDDigitTest.m */; }; + D31FE5990E60E5AC00A0803E /* TDLetterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5930E60E5AC00A0803E /* TDLetterTest.m */; }; + D31FE59A0E60E5AC00A0803E /* TDSpecificCharTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5950E60E5AC00A0803E /* TDSpecificCharTest.m */; }; + D31FE59F0E60E5C000A0803E /* TDRegularParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE59C0E60E5C000A0803E /* TDRegularParser.m */; }; + D31FE5A00E60E5C000A0803E /* TDRegularParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE59E0E60E5C000A0803E /* TDRegularParserTest.m */; }; + D31FE5A90E60E5D500A0803E /* TDFastJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */; }; + D31FE5AA0E60E5D500A0803E /* TDFastJsonParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5A40E60E5D500A0803E /* TDFastJsonParserTest.m */; }; + D31FE5B10E60E64900A0803E /* TDXmlTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5AE0E60E64900A0803E /* TDXmlTokenAssembly.m */; }; + D31FE5B20E60E64900A0803E /* TDXmlTokenizerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5B00E60E64900A0803E /* TDXmlTokenizerTest.m */; }; + D31FE5B70E60E66600A0803E /* TDXmlToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5B40E60E66600A0803E /* TDXmlToken.m */; }; + D31FE5B80E60E66600A0803E /* TDXmlTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5B60E60E66600A0803E /* TDXmlTokenizer.m */; }; + D31FE5DD0E60E69E00A0803E /* TDXmlAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5BA0E60E69E00A0803E /* TDXmlAttribute.m */; }; + D31FE5DE0E60E69E00A0803E /* TDXmlCdata.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5BC0E60E69E00A0803E /* TDXmlCdata.m */; }; + D31FE5DF0E60E69E00A0803E /* TDXmlComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5BE0E60E69E00A0803E /* TDXmlComment.m */; }; + D31FE5E00E60E69E00A0803E /* TDXmlDecl.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C00E60E69E00A0803E /* TDXmlDecl.m */; }; + D31FE5E10E60E69E00A0803E /* TDXmlDoctype.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C20E60E69E00A0803E /* TDXmlDoctype.m */; }; + D31FE5E20E60E69E00A0803E /* TDXmlDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C40E60E69E00A0803E /* TDXmlDocument.m */; }; + D31FE5E30E60E69E00A0803E /* TDXmlEndEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C60E60E69E00A0803E /* TDXmlEndEntity.m */; }; + D31FE5E40E60E69E00A0803E /* TDXmlEndTag.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C80E60E69E00A0803E /* TDXmlEndTag.m */; }; + D31FE5E50E60E69E00A0803E /* TDXmlEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5CA0E60E69E00A0803E /* TDXmlEntity.m */; }; + D31FE5E60E60E69E00A0803E /* TDXmlEntityRef.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5CC0E60E69E00A0803E /* TDXmlEntityRef.m */; }; + D31FE5E70E60E69E00A0803E /* TDXmlFragment.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5CE0E60E69E00A0803E /* TDXmlFragment.m */; }; + D31FE5E80E60E69E00A0803E /* TDXmlNotation.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D00E60E69E00A0803E /* TDXmlNotation.m */; }; + D31FE5E90E60E69E00A0803E /* TDXmlProcessingInstruction.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D20E60E69E00A0803E /* TDXmlProcessingInstruction.m */; }; + D31FE5EA0E60E69E00A0803E /* TDXmlSignificantWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D40E60E69E00A0803E /* TDXmlSignificantWhitespace.m */; }; + D31FE5EB0E60E69E00A0803E /* TDXmlStartTag.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D60E60E69E00A0803E /* TDXmlStartTag.m */; }; + D31FE5EC0E60E69E00A0803E /* TDXmlTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D80E60E69E00A0803E /* TDXmlTerminal.m */; }; + D31FE5ED0E60E69E00A0803E /* TDXmlText.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5DA0E60E69E00A0803E /* TDXmlText.m */; }; + D31FE5EE0E60E69E00A0803E /* TDXmlWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5DC0E60E69E00A0803E /* TDXmlWhitespace.m */; }; + D31FE5FC0E60E6B500A0803E /* TDNCNameState.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F10E60E6B500A0803E /* TDNCNameState.m */; }; + D31FE5FD0E60E6B500A0803E /* TDXmlName.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F30E60E6B500A0803E /* TDXmlName.m */; }; + D31FE5FE0E60E6B500A0803E /* TDXmlNameState.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F50E60E6B500A0803E /* TDXmlNameState.m */; }; + D31FE5FF0E60E6B500A0803E /* TDXmlNameTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F70E60E6B500A0803E /* TDXmlNameTest.m */; }; + D31FE6000E60E6B500A0803E /* TDXmlNmtoken.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F90E60E6B500A0803E /* TDXmlNmtoken.m */; }; + D31FE6010E60E6B500A0803E /* TDXmlNmtokenState.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5FB0E60E6B500A0803E /* TDXmlNmtokenState.m */; }; + D31FE6E00E60EE2500A0803E /* TDNCName.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE6DF0E60EE2500A0803E /* TDNCName.m */; }; + D31FE7300E60F31E00A0803E /* TDFastJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */; }; + D31FE7320E60F33000A0803E /* EBNFParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E78A160E574C99008C7D61 /* EBNFParser.m */; }; + D31FE7330E60F33C00A0803E /* XMLReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D3521F530E5FA1B0009681F9 /* XMLReader.m */; }; + D31FE7340E60F34600A0803E /* XPathParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E95450E578ECC00496BD3 /* XPathParser.m */; }; + D31FE7380E60F36600A0803E /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D36E9F860E5A795400496BD3 /* libxml2.dylib */; }; + D31FE7400E60F40300A0803E /* XPathAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */; }; + D31FE7420E60F40900A0803E /* XPathContext.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98210E58A3A800496BD3 /* XPathContext.m */; }; + D3252F7B0FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3252F790FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m */; }; + D3252F7E0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */; }; + D3252F7F0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */; }; + D3305C4F102F5BAE00DC4F75 /* TDGutterView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3305C4C102F5BAD00DC4F75 /* TDGutterView.m */; }; + D3305C50102F5BAE00DC4F75 /* TDSourceCodeTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3305C4E102F5BAE00DC4F75 /* TDSourceCodeTextView.m */; }; + D33494720E29670B00406085 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D3376D5910093A1600E4602E /* PKGrammarParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3376D5710093A1600E4602E /* PKGrammarParser.h */; }; + D3376D5A10093A1600E4602E /* PKGrammarParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D5810093A1600E4602E /* PKGrammarParser.m */; }; + D3376D8E10096C0700E4602E /* PKAST.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D8D10096C0700E4602E /* PKAST.m */; }; + D3376D8F10096C0700E4602E /* PKAST.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D8D10096C0700E4602E /* PKAST.m */; }; + D3385FD90FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */; }; + D3385FDA0FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */; }; + D3385FDE0FCFB227003BF729 /* TDPredicateEvaluatorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3385FDC0FCFB227003BF729 /* TDPredicateEvaluatorTest.m */; }; + D338E5BB0FF5DDCB003DE6AA /* TDDifferenceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D338E5BA0FF5DDCB003DE6AA /* TDDifferenceTest.m */; }; + D341850C0E520D640081B0DC /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D34BAC230FF87F8600D7773A /* TDParserFactoryTest3.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAC220FF87F8600D7773A /* TDParserFactoryTest3.m */; }; + D34BAC4B0FF892C200D7773A /* XPathParserGrammarTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAC4A0FF892C200D7773A /* XPathParserGrammarTest.m */; }; + D34BAC9A0FF8A9AD00D7773A /* xpath1_0.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741430EF8E96A00559B9F /* xpath1_0.grammar */; }; + D34BAD18100A9B7900996341 /* TDTokenizerStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAD17100A9B7900996341 /* TDTokenizerStateTest.m */; }; + D34BAD640FF9C6AE00D7773A /* ParseKit_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = D34BAD630FF9C6AE00D7773A /* ParseKit_Prefix.pch */; }; + D34BAD9D0FF9C95800D7773A /* PKReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAD9B0FF9C95800D7773A /* PKReader.m */; }; + D34BADA20FF9C9B000D7773A /* PKAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADA00FF9C9B000D7773A /* PKAssembly.m */; }; + D34BADD80FF9CBFB00D7773A /* PKParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADD60FF9CBFB00D7773A /* PKParser.m */; }; + D34BAE030FF9CCAE00D7773A /* PKCollectionParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */; }; + D34BAE1D0FF9CE0E00D7773A /* PKAlternation.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */; }; + D34BAE1F0FF9CE0E00D7773A /* PKEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */; }; + D34BAE210FF9CE0E00D7773A /* PKDifference.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */; }; + D34BAE230FF9CE0E00D7773A /* PKIntersection.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE110FF9CE0E00D7773A /* PKIntersection.m */; }; + D34BAE250FF9CE0E00D7773A /* PKRepetition.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE130FF9CE0E00D7773A /* PKRepetition.m */; }; + D34BAE270FF9CE0E00D7773A /* PKSequence.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE150FF9CE0E00D7773A /* PKSequence.m */; }; + D34BAE290FF9CE0E00D7773A /* PKTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE170FF9CE0E00D7773A /* PKTerminal.m */; }; + D34BAE2B0FF9CE0E00D7773A /* PKTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE190FF9CE0E00D7773A /* PKTrack.m */; }; + D34BAE2D0FF9CE0E00D7773A /* PKTrackException.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */; }; + D34BAE310FF9CE6000D7773A /* PKAny.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE2F0FF9CE6000D7773A /* PKAny.m */; }; + D34BAE8D0FF9D15100D7773A /* PKTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */; }; + D34BAE9D0FF9D20900D7773A /* PKToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE950FF9D20900D7773A /* PKToken.m */; }; + D34BAE9F0FF9D20900D7773A /* PKTokenArraySource.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */; }; + D34BAEA10FF9D20900D7773A /* PKTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE990FF9D20900D7773A /* PKTokenizer.m */; }; + D34BAEA30FF9D20900D7773A /* PKTokenizerState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */; }; + D34BAED80FF9D56400D7773A /* PKCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC40FF9D56400D7773A /* PKCommentState.m */; }; + D34BAEDA0FF9D56400D7773A /* PKDelimitState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC60FF9D56400D7773A /* PKDelimitState.m */; }; + D34BAEDC0FF9D56400D7773A /* PKMultiLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */; }; + D34BAEDE0FF9D56400D7773A /* PKNumberState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECA0FF9D56400D7773A /* PKNumberState.m */; }; + D34BAEE00FF9D56400D7773A /* PKQuoteState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECC0FF9D56400D7773A /* PKQuoteState.m */; }; + D34BAEE20FF9D56400D7773A /* PKSingleLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */; }; + D34BAEE40FF9D56400D7773A /* PKSymbolState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED00FF9D56400D7773A /* PKSymbolState.m */; }; + D34BAEE60FF9D56400D7773A /* PKWhitespaceState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */; }; + D34BAEE80FF9D56400D7773A /* PKWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED40FF9D56400D7773A /* PKWord.m */; }; + D34BAEEA0FF9D56400D7773A /* PKWordState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED60FF9D56400D7773A /* PKWordState.m */; }; + D34BAF280FF9DF9900D7773A /* PKSymbolNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */; }; + D34BAF2A0FF9DF9900D7773A /* PKSymbolRootNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */; }; + D34BAF3A0FF9E18300D7773A /* PKPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF380FF9E18300D7773A /* PKPattern.m */; }; + D34BAF4C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */; }; + D34BAF4E0FF9E19700D7773A /* PKComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3E0FF9E19700D7773A /* PKComment.m */; }; + D34BAF500FF9E19700D7773A /* PKDelimitedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF400FF9E19700D7773A /* PKDelimitedString.m */; }; + D34BAF520FF9E19700D7773A /* PKLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF420FF9E19700D7773A /* PKLiteral.m */; }; + D34BAF540FF9E19700D7773A /* PKNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF440FF9E19700D7773A /* PKNumber.m */; }; + D34BAF560FF9E19700D7773A /* PKQuotedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF460FF9E19700D7773A /* PKQuotedString.m */; }; + D34BAF580FF9E19700D7773A /* PKSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF480FF9E19700D7773A /* PKSymbol.m */; }; + D34BAF5A0FF9E19700D7773A /* PKWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */; }; + D34BAF9D0FF9E6D100D7773A /* PKLowercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */; }; + D34BAF9F0FF9E6D100D7773A /* PKUppercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */; }; + D34BAFB20FF9E7F300D7773A /* PKCharacterAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */; }; + D34BAFBC0FF9E80300D7773A /* PKChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB40FF9E80300D7773A /* PKChar.m */; }; + D34BAFBE0FF9E80300D7773A /* PKDigit.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB60FF9E80300D7773A /* PKDigit.m */; }; + D34BAFC00FF9E80300D7773A /* PKLetter.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB80FF9E80300D7773A /* PKLetter.m */; }; + D34BAFC20FF9E80300D7773A /* PKSpecificChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */; }; + D34BAFDA0FF9E95500D7773A /* NSArray+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */; }; + D34BAFDC0FF9E95500D7773A /* NSString+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */; }; + D34BAFDE0FF9E95500D7773A /* PKParserFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD80FF9E95500D7773A /* PKParserFactory.m */; }; + D34BB0680FF9EDDF00D7773A /* JSParseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0660FF9EDDF00D7773A /* JSParseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0690FF9EDDF00D7773A /* JSParseKit.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0670FF9EDDF00D7773A /* JSParseKit.m */; }; + D34BB0710FF9EE4000D7773A /* PKJSAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06A0FF9EE4000D7773A /* PKJSAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0720FF9EE4000D7773A /* PKJSAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB06B0FF9EE4000D7773A /* PKJSAssembly.m */; }; + D34BB0730FF9EE4000D7773A /* PKJSUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06C0FF9EE4000D7773A /* PKJSUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0740FF9EE4000D7773A /* PKJSUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB06D0FF9EE4000D7773A /* PKJSUtils.m */; }; + D34BB0750FF9EE4000D7773A /* PKJSUtils_macros.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06E0FF9EE4000D7773A /* PKJSUtils_macros.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0760FF9EE4000D7773A /* PKJSValueHolder.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06F0FF9EE4000D7773A /* PKJSValueHolder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0770FF9EE4000D7773A /* PKJSValueHolder.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0700FF9EE4000D7773A /* PKJSValueHolder.m */; }; + D34BB08F0FF9EF9D00D7773A /* PKJSCharacterAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB08D0FF9EF9D00D7773A /* PKJSCharacterAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0900FF9EF9D00D7773A /* PKJSCharacterAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB08E0FF9EF9D00D7773A /* PKJSCharacterAssembly.m */; }; + D34BB0A90FF9F14B00D7773A /* PKJSCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0930FF9F14B00D7773A /* PKJSCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0AA0FF9F14B00D7773A /* PKJSCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0940FF9F14B00D7773A /* PKJSCommentState.m */; }; + D34BB0AB0FF9F14B00D7773A /* PKJSDelimitState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0950FF9F14B00D7773A /* PKJSDelimitState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0AC0FF9F14B00D7773A /* PKJSDelimitState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0960FF9F14B00D7773A /* PKJSDelimitState.m */; }; + D34BB0AD0FF9F14B00D7773A /* PKJSNumberState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0970FF9F14B00D7773A /* PKJSNumberState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0AE0FF9F14B00D7773A /* PKJSNumberState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0980FF9F14B00D7773A /* PKJSNumberState.m */; }; + D34BB0AF0FF9F14B00D7773A /* PKJSQuoteState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0990FF9F14B00D7773A /* PKJSQuoteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B00FF9F14B00D7773A /* PKJSQuoteState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB09A0FF9F14B00D7773A /* PKJSQuoteState.m */; }; + D34BB0B10FF9F14B00D7773A /* PKJSSymbolState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB09B0FF9F14B00D7773A /* PKJSSymbolState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B20FF9F14B00D7773A /* PKJSSymbolState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB09C0FF9F14B00D7773A /* PKJSSymbolState.m */; }; + D34BB0B30FF9F14B00D7773A /* PKJSToken.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB09D0FF9F14B00D7773A /* PKJSToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B40FF9F14B00D7773A /* PKJSToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB09E0FF9F14B00D7773A /* PKJSToken.m */; }; + D34BB0B50FF9F14B00D7773A /* PKJSTokenAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB09F0FF9F14B00D7773A /* PKJSTokenAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B60FF9F14B00D7773A /* PKJSTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A00FF9F14B00D7773A /* PKJSTokenAssembly.m */; }; + D34BB0B70FF9F14B00D7773A /* PKJSTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A10FF9F14B00D7773A /* PKJSTokenizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B80FF9F14B00D7773A /* PKJSTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A20FF9F14B00D7773A /* PKJSTokenizer.m */; }; + D34BB0B90FF9F14B00D7773A /* PKJSTokenizerState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A30FF9F14B00D7773A /* PKJSTokenizerState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0BA0FF9F14B00D7773A /* PKJSTokenizerState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A40FF9F14B00D7773A /* PKJSTokenizerState.m */; }; + D34BB0BB0FF9F14B00D7773A /* PKJSWhitespaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A50FF9F14B00D7773A /* PKJSWhitespaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0BC0FF9F14B00D7773A /* PKJSWhitespaceState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A60FF9F14B00D7773A /* PKJSWhitespaceState.m */; }; + D34BB0BD0FF9F14B00D7773A /* PKJSWordState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A70FF9F14B00D7773A /* PKJSWordState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0BE0FF9F14B00D7773A /* PKJSWordState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A80FF9F14B00D7773A /* PKJSWordState.m */; }; + D34BB0E60FF9F28000D7773A /* PKJSAlternation.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D20FF9F28000D7773A /* PKJSAlternation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0E70FF9F28000D7773A /* PKJSAlternation.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D30FF9F28000D7773A /* PKJSAlternation.m */; }; + D34BB0E80FF9F28000D7773A /* PKJSAny.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D40FF9F28000D7773A /* PKJSAny.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0E90FF9F28000D7773A /* PKJSAny.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D50FF9F28000D7773A /* PKJSAny.m */; }; + D34BB0EA0FF9F28000D7773A /* PKJSAssemblerAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D60FF9F28000D7773A /* PKJSAssemblerAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0EB0FF9F28000D7773A /* PKJSAssemblerAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D70FF9F28000D7773A /* PKJSAssemblerAdapter.m */; }; + D34BB0EC0FF9F28000D7773A /* PKJSCollectionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D80FF9F28000D7773A /* PKJSCollectionParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0ED0FF9F28000D7773A /* PKJSCollectionParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D90FF9F28000D7773A /* PKJSCollectionParser.m */; }; + D34BB0EE0FF9F28000D7773A /* PKJSEmpty.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0DA0FF9F28000D7773A /* PKJSEmpty.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0EF0FF9F28000D7773A /* PKJSEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0DB0FF9F28000D7773A /* PKJSEmpty.m */; }; + D34BB0F00FF9F28000D7773A /* PKJSParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0DC0FF9F28000D7773A /* PKJSParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F10FF9F28000D7773A /* PKJSParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0DD0FF9F28000D7773A /* PKJSParser.m */; }; + D34BB0F20FF9F28000D7773A /* PKJSRepetition.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0DE0FF9F28000D7773A /* PKJSRepetition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F30FF9F28000D7773A /* PKJSRepetition.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0DF0FF9F28000D7773A /* PKJSRepetition.m */; }; + D34BB0F40FF9F28000D7773A /* PKJSSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0E00FF9F28000D7773A /* PKJSSequence.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F50FF9F28000D7773A /* PKJSSequence.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0E10FF9F28000D7773A /* PKJSSequence.m */; }; + D34BB0F60FF9F28000D7773A /* PKJSTerminal.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0E20FF9F28000D7773A /* PKJSTerminal.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F70FF9F28000D7773A /* PKJSTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0E30FF9F28000D7773A /* PKJSTerminal.m */; }; + D34BB0F80FF9F28000D7773A /* PKJSTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0E40FF9F28000D7773A /* PKJSTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F90FF9F28000D7773A /* PKJSTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0E50FF9F28000D7773A /* PKJSTrack.m */; }; + D34BB1140FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0FE0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1150FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0FF0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m */; }; + D34BB1160FF9F36200D7773A /* PKJSComment.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1000FF9F36200D7773A /* PKJSComment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1170FF9F36200D7773A /* PKJSComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1010FF9F36200D7773A /* PKJSComment.m */; }; + D34BB1180FF9F36200D7773A /* PKJSDelimitedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1020FF9F36200D7773A /* PKJSDelimitedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1190FF9F36200D7773A /* PKJSDelimitedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1030FF9F36200D7773A /* PKJSDelimitedString.m */; }; + D34BB11A0FF9F36200D7773A /* PKJSLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1040FF9F36200D7773A /* PKJSLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB11B0FF9F36200D7773A /* PKJSLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1050FF9F36200D7773A /* PKJSLiteral.m */; }; + D34BB11C0FF9F36200D7773A /* PKJSLowercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1060FF9F36200D7773A /* PKJSLowercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB11D0FF9F36200D7773A /* PKJSLowercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1070FF9F36200D7773A /* PKJSLowercaseWord.m */; }; + D34BB11E0FF9F36200D7773A /* PKJSNum.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1080FF9F36200D7773A /* PKJSNum.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB11F0FF9F36200D7773A /* PKJSNum.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1090FF9F36200D7773A /* PKJSNum.m */; }; + D34BB1200FF9F36200D7773A /* PKJSPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB10A0FF9F36200D7773A /* PKJSPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1210FF9F36200D7773A /* PKJSPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB10B0FF9F36200D7773A /* PKJSPattern.m */; }; + D34BB1220FF9F36200D7773A /* PKJSQuotedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB10C0FF9F36200D7773A /* PKJSQuotedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1230FF9F36200D7773A /* PKJSQuotedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB10D0FF9F36200D7773A /* PKJSQuotedString.m */; }; + D34BB1240FF9F36200D7773A /* PKJSSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB10E0FF9F36200D7773A /* PKJSSymbol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1250FF9F36200D7773A /* PKJSSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB10F0FF9F36200D7773A /* PKJSSymbol.m */; }; + D34BB1260FF9F36200D7773A /* PKJSUppercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1100FF9F36200D7773A /* PKJSUppercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1270FF9F36200D7773A /* PKJSUppercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1110FF9F36200D7773A /* PKJSUppercaseWord.m */; }; + D34BB1280FF9F36200D7773A /* PKJSWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1120FF9F36200D7773A /* PKJSWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1290FF9F36200D7773A /* PKJSWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1130FF9F36200D7773A /* PKJSWord.m */; }; + D3521F560E5FA1B0009681F9 /* XMLReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D3521F530E5FA1B0009681F9 /* XMLReader.m */; }; + D3521F570E5FA1B0009681F9 /* XMLReaderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3521F550E5FA1B0009681F9 /* XMLReaderTest.m */; }; + D35384ED0FE9691100926552 /* nspredicate.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D35384EC0FE9691100926552 /* nspredicate.grammar */; }; + D353899C0FEAC94400926552 /* c.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D353899B0FEAC94400926552 /* c.grammar */; }; + D353899E0FEAC96B00926552 /* objc.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D353899D0FEAC96B00926552 /* objc.grammar */; }; + D355C62D0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */; }; + D355C62E0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */; }; + D355C6310FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D355C6300FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m */; }; + D355C6A70FE9F704006A91A4 /* nspredicate.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D35384EC0FE9691100926552 /* nspredicate.grammar */; }; + D355C8810FEB36A1006A91A4 /* xml.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D355C8800FEB36A1006A91A4 /* xml.grammar */; }; + D355C8840FEB4B94006A91A4 /* proto.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D355C8830FEB4B94006A91A4 /* proto.grammar */; }; + D3587EAF0FE83EC900DDD023 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D36568A70EEF9FE900226554 /* TDPlistParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36568A60EEF9FE900226554 /* TDPlistParser.m */; }; + D36568AA0EEFA05300226554 /* TDPlistParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D36568A90EEFA05300226554 /* TDPlistParserTest.m */; }; + D3656DFE0EF2620E00226554 /* TDTokenArraySourceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3656DFD0EF2620E00226554 /* TDTokenArraySourceTest.m */; }; + D3668292101D2BFA0008632C /* erb.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3668291101D2BFA0008632C /* erb.grammar */; }; + D3668293101D2C000008632C /* erb.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3668291101D2BFA0008632C /* erb.grammar */; }; + D3668296101D2C200008632C /* ERBTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3668295101D2C200008632C /* ERBTest.m */; }; + D369345D1038DE5300527AF3 /* PKParseTree.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934561038DE5300527AF3 /* PKParseTree.m */; }; + D369345E1038DE5300527AF3 /* PKParseTreeAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */; }; + D369345F1038DE5300527AF3 /* PKRuleNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345A1038DE5300527AF3 /* PKRuleNode.m */; }; + D36934601038DE5300527AF3 /* PKTokenNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345C1038DE5300527AF3 /* PKTokenNode.m */; }; + D36934721038E28300527AF3 /* PKParseTree.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934561038DE5300527AF3 /* PKParseTree.m */; }; + D36934731038E28700527AF3 /* PKParseTreeAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */; }; + D36934741038E28B00527AF3 /* PKRuleNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345A1038DE5300527AF3 /* PKRuleNode.m */; }; + D36934751038E28F00527AF3 /* PKTokenNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345C1038DE5300527AF3 /* PKTokenNode.m */; }; + D36C53790FD27F1300141CB7 /* TDParserFactoryTest2.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C53780FD27F1300141CB7 /* TDParserFactoryTest2.m */; }; + D36C55FF0FD3617B00141CB7 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */; }; + D36C560C0FD363D500141CB7 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D36C560B0FD363D500141CB7 /* libicucore.dylib */; }; + D36C562B0FD365DB00141CB7 /* TDPatternTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C562A0FD365DB00141CB7 /* TDPatternTest.m */; }; + D36E95460E578ECC00496BD3 /* XPathParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E95450E578ECC00496BD3 /* XPathParser.m */; }; + D36E95D80E57B08400496BD3 /* XPathParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E95D70E57B08400496BD3 /* XPathParserTest.m */; }; + D36E97B00E589DAE00496BD3 /* XPathAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */; }; + D36E98220E58A3A800496BD3 /* XPathContext.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98210E58A3A800496BD3 /* XPathContext.m */; }; + D36E98E00E58C12800496BD3 /* DebugAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98DD0E58C12800496BD3 /* DebugAppDelegate.m */; }; + D36E98E10E58C12800496BD3 /* DebugAppMainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D36E98DE0E58C12800496BD3 /* DebugAppMainMenu.xib */; }; + D36E98E20E58C12800496BD3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98DF0E58C12800496BD3 /* main.m */; }; + D36E98E70E58C14000496BD3 /* DemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98E40E58C14000496BD3 /* DemoAppDelegate.m */; }; + D36E98E80E58C14000496BD3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98E50E58C14000496BD3 /* main.m */; }; + D36E98F80E58C1A000496BD3 /* DemoAppMainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D36E98F70E58C1A000496BD3 /* DemoAppMainMenu.xib */; }; + D36E9F870E5A795400496BD3 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D36E9F860E5A795400496BD3 /* libxml2.dylib */; }; + D36E9FB50E5A944A00496BD3 /* apple-boss.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36E9FB40E5A944A00496BD3 /* apple-boss.xml */; }; + D36E9FE50E5BA0FC00496BD3 /* SRGSGrammar.txt in Resources */ = {isa = PBXBuildFile; fileRef = D36E9FE40E5BA0FC00496BD3 /* SRGSGrammar.txt */; }; + D36EA3B00E5EA67E00496BD3 /* small-xml-file.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */; }; + D37A28671013942300E936B7 /* PKGrammarParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D5810093A1600E4602E /* PKGrammarParser.m */; }; + D37A28681013942A00E936B7 /* PKGrammarParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3376D5710093A1600E4602E /* PKGrammarParser.h */; }; + D37D3A000FE77A71008C2E4D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D37D3A010FE77A72008C2E4D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D37D3A020FE77A77008C2E4D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D380AFBD0F0C54B60009EC13 /* html.css in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBB0F0C54B60009EC13 /* html.css */; }; + D380AFBE0F0C54B60009EC13 /* html.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBC0F0C54B60009EC13 /* html.grammar */; }; + D380AFBF0F0C54B60009EC13 /* html.css in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBB0F0C54B60009EC13 /* html.css */; }; + D380AFC00F0C54B60009EC13 /* html.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBC0F0C54B60009EC13 /* html.grammar */; }; + D380AFC30F0C56000009EC13 /* example.html in Resources */ = {isa = PBXBuildFile; fileRef = D380AFC20F0C56000009EC13 /* example.html */; }; + D380AFC40F0C56000009EC13 /* example.html in Resources */ = {isa = PBXBuildFile; fileRef = D380AFC20F0C56000009EC13 /* example.html */; }; + D380B3230F0CC0800009EC13 /* nyt.html in Resources */ = {isa = PBXBuildFile; fileRef = D38DD9E70EC29F260070BC4D /* nyt.html */; }; + D380B5090F0D71A90009EC13 /* css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380B5080F0D71A90009EC13 /* css.grammar */; }; + D380B50A0F0D71B00009EC13 /* css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380B5080F0D71A90009EC13 /* css.grammar */; }; + D380B5380F0D7DDE0009EC13 /* css.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5370F0D7DDE0009EC13 /* css.css */; }; + D380B5390F0D7DE30009EC13 /* css.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5370F0D7DDE0009EC13 /* css.css */; }; + D380B5940F0D82F60009EC13 /* example.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5930F0D82F60009EC13 /* example.css */; }; + D380B5950F0D82F90009EC13 /* example.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5930F0D82F60009EC13 /* example.css */; }; + D380B9800F0EF3860009EC13 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D380BA620F0F06CD0009EC13 /* TDParserFactoryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D380BA600F0F06CD0009EC13 /* TDParserFactoryTest.m */; }; + D380BAA30F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D380BAA40F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D38205BE0EEE48EE004340DD /* TDTokenTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D38205BD0EEE48EE004340DD /* TDTokenTest.m */; }; + D383498B0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */; }; + D383498C0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */; }; + D38349BC0F0C0D910055E4E0 /* json_with_comments.css in Resources */ = {isa = PBXBuildFile; fileRef = D38349BB0F0C0D910055E4E0 /* json_with_comments.css */; }; + D38349BD0F0C0D910055E4E0 /* json_with_comments.css in Resources */ = {isa = PBXBuildFile; fileRef = D38349BB0F0C0D910055E4E0 /* json_with_comments.css */; }; + D3834A480F0C14B60055E4E0 /* yahoo_with_comments.json in Resources */ = {isa = PBXBuildFile; fileRef = D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */; }; + D3834A490F0C14C00055E4E0 /* yahoo_with_comments.json in Resources */ = {isa = PBXBuildFile; fileRef = D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */; }; + D385F98C0F046FE900DB2946 /* TDGenericAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385F9890F046FE900DB2946 /* TDGenericAssembler.m */; }; + D385F98E0F046FE900DB2946 /* TDGenericAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385F9890F046FE900DB2946 /* TDGenericAssembler.m */; }; + D385FA230F04971400DB2946 /* TDGenericAssemblerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FA220F04971400DB2946 /* TDGenericAssemblerTest.m */; }; + D385FA250F04993500DB2946 /* json.css in Resources */ = {isa = PBXBuildFile; fileRef = D385FA240F04993500DB2946 /* json.css */; }; + D385FA260F04993500DB2946 /* json.css in Resources */ = {isa = PBXBuildFile; fileRef = D385FA240F04993500DB2946 /* json.css */; }; + D385FD440F05A88C00DB2946 /* TDMiniCSSAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */; }; + D385FD460F05A89100DB2946 /* TDMiniCSSAssemblerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FD430F05A88C00DB2946 /* TDMiniCSSAssemblerTest.m */; }; + D385FD490F05A8C900DB2946 /* TDMiniCSSAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */; }; + D385FD6C0F05A99900DB2946 /* mini_css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D385FD6B0F05A99900DB2946 /* mini_css.grammar */; }; + D385FD6D0F05A99900DB2946 /* mini_css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D385FD6B0F05A99900DB2946 /* mini_css.grammar */; }; + D389F1D50F19666500558235 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D389F20B0F196A9200558235 /* JSParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D389F1CE0F1965E600558235 /* JSParseKit.framework */; }; + D389F20C0F196A9200558235 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D389F20E0F196A9200558235 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D389F20D0F196A9200558235 /* WebKit.framework */; }; + D389F2E40F196CAE00558235 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F2E30F196CAE00558235 /* main.m */; }; + D389F3430F197DDC00558235 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D389F34E0F197DF500558235 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D389F37A0F197E8000558235 /* JSDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F2E90F196F5B00558235 /* JSDemoAppDelegate.m */; }; + D389F38F0F19800400558235 /* DefaultValues.plist in Resources */ = {isa = PBXBuildFile; fileRef = D389F38E0F19800400558235 /* DefaultValues.plist */; }; + D389F4620F198A8800558235 /* Test.html in Resources */ = {isa = PBXBuildFile; fileRef = D389F4610F198A8800558235 /* Test.html */; }; + D389F5590F19B7BC00558235 /* JSDemoAppMainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D389F5580F19B7BC00558235 /* JSDemoAppMainMenu.xib */; }; + D389F5B60F19C76A00558235 /* TDJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F5B30F19C76A00558235 /* TDJsonParser.m */; }; + D389F5B70F19C76A00558235 /* TDJsonParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F5B50F19C76A00558235 /* TDJsonParserTest.m */; }; + D389F5B80F19C76A00558235 /* TDJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F5B30F19C76A00558235 /* TDJsonParser.m */; }; + D389FBCD0F1B25E200558235 /* ParserTest.html in Resources */ = {isa = PBXBuildFile; fileRef = D389FBCC0F1B25E200558235 /* ParserTest.html */; }; + D38DD9E80EC29F260070BC4D /* nyt.html in Resources */ = {isa = PBXBuildFile; fileRef = D38DD9E70EC29F260070BC4D /* nyt.html */; }; + D38E97CC1061CF6500739C39 /* TDTokenizerBlocksTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D38E97CB1061CF6500739C39 /* TDTokenizerBlocksTest.m */; }; + D38E98D81062C5BA00739C39 /* TDParserBlocksTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D38E98D71062C5BA00739C39 /* TDParserBlocksTest.m */; }; + D398E20E0E60F86D00A1C877 /* yahoo.json in Resources */ = {isa = PBXBuildFile; fileRef = D3B473840E48C9CF008AFBDD /* yahoo.json */; }; + D39E01340FEF02DA00150FC3 /* TDXMLParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3BBBC970FEC9722007DF30D /* TDXMLParserTest.m */; }; + D3AF49780FDB122E0032F4DC /* TDParserFactoryPatternTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3AF49770FDB122E0032F4DC /* TDParserFactoryPatternTest.m */; }; + D3B43FB80F76E99C0072AF40 /* TDJavaScriptParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3B43FB60F76E99C0072AF40 /* TDJavaScriptParserTest.m */; }; + D3B473850E48C9CF008AFBDD /* yahoo.json in Resources */ = {isa = PBXBuildFile; fileRef = D3B473840E48C9CF008AFBDD /* yahoo.json */; }; + D3B69D320E80249900D70C41 /* nonascii.html in Resources */ = {isa = PBXBuildFile; fileRef = D3B69D310E80249900D70C41 /* nonascii.html */; }; + D3B69D330E80249900D70C41 /* nonascii.html in Resources */ = {isa = PBXBuildFile; fileRef = D3B69D310E80249900D70C41 /* nonascii.html */; }; + D3BBBC9D0FEC9756007DF30D /* TDXMLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */; }; + D3BBBC9E0FEC9756007DF30D /* TDXMLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */; }; + D3BBBCC10FECD477007DF30D /* xml.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D355C8800FEB36A1006A91A4 /* xml.grammar */; }; + D3C031ED0EF38D2D00C5ABEB /* TDLowercaseWordTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C031EC0EF38D2D00C5ABEB /* TDLowercaseWordTest.m */; }; + D3C221920FFE8B8C004514FE /* ParseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221900FFE8B8C004514FE /* ParseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221930FFE8B8C004514FE /* PKTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221910FFE8B8C004514FE /* PKTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221940FFE8B8C004514FE /* ParseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221900FFE8B8C004514FE /* ParseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221950FFE8B8C004514FE /* PKTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221910FFE8B8C004514FE /* PKTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221970FFE8B95004514FE /* PKReader.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221960FFE8B95004514FE /* PKReader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221980FFE8B95004514FE /* PKReader.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221960FFE8B95004514FE /* PKReader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219A0FFE8B9D004514FE /* PKAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221990FFE8B9D004514FE /* PKAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219B0FFE8B9D004514FE /* PKAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221990FFE8B9D004514FE /* PKAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219D0FFE8BA6004514FE /* PKParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219C0FFE8BA6004514FE /* PKParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219E0FFE8BA6004514FE /* PKParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219C0FFE8BA6004514FE /* PKParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A00FFE8BAE004514FE /* PKRepetition.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219F0FFE8BAE004514FE /* PKRepetition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A10FFE8BAE004514FE /* PKRepetition.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219F0FFE8BAE004514FE /* PKRepetition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A30FFE8BBA004514FE /* PKCollectionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A40FFE8BBA004514FE /* PKCollectionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A60FFE8BC1004514FE /* PKAlternation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A50FFE8BC1004514FE /* PKAlternation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A70FFE8BC1004514FE /* PKAlternation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A50FFE8BC1004514FE /* PKAlternation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A90FFE8BC9004514FE /* PKSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A80FFE8BC9004514FE /* PKSequence.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AA0FFE8BC9004514FE /* PKSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A80FFE8BC9004514FE /* PKSequence.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AC0FFE8BCF004514FE /* PKTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AB0FFE8BCF004514FE /* PKTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AD0FFE8BCF004514FE /* PKTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AB0FFE8BCF004514FE /* PKTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AF0FFE8BD4004514FE /* PKTrackException.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AE0FFE8BD4004514FE /* PKTrackException.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B00FFE8BD4004514FE /* PKTrackException.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AE0FFE8BD4004514FE /* PKTrackException.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B20FFE8BDB004514FE /* PKIntersection.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B10FFE8BDB004514FE /* PKIntersection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B30FFE8BDB004514FE /* PKIntersection.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B10FFE8BDB004514FE /* PKIntersection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B50FFE8BE2004514FE /* PKDifference.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B40FFE8BE2004514FE /* PKDifference.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B60FFE8BE2004514FE /* PKDifference.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B40FFE8BE2004514FE /* PKDifference.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B80FFE8BE8004514FE /* PKNegation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B70FFE8BE8004514FE /* PKNegation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B90FFE8BE8004514FE /* PKNegation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B70FFE8BE8004514FE /* PKNegation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BB0FFE8BEF004514FE /* PKTerminal.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BA0FFE8BEF004514FE /* PKTerminal.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BC0FFE8BEF004514FE /* PKTerminal.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BA0FFE8BEF004514FE /* PKTerminal.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BE0FFE8BF7004514FE /* PKEmpty.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BD0FFE8BF7004514FE /* PKEmpty.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BF0FFE8BF7004514FE /* PKEmpty.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BD0FFE8BF7004514FE /* PKEmpty.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C10FFE8BFF004514FE /* PKTokenAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C20FFE8BFF004514FE /* PKTokenAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C40FFE8C07004514FE /* PKToken.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C30FFE8C07004514FE /* PKToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C50FFE8C07004514FE /* PKToken.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C30FFE8C07004514FE /* PKToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C70FFE8C0D004514FE /* PKTokenArraySource.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C80FFE8C0D004514FE /* PKTokenArraySource.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CA0FFE8C15004514FE /* PKTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C90FFE8C15004514FE /* PKTokenizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CB0FFE8C15004514FE /* PKTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C90FFE8C15004514FE /* PKTokenizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CD0FFE8C1B004514FE /* PKTokenizerState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CE0FFE8C1B004514FE /* PKTokenizerState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D00FFE8C24004514FE /* PKNumberState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CF0FFE8C24004514FE /* PKNumberState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D10FFE8C24004514FE /* PKNumberState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CF0FFE8C24004514FE /* PKNumberState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D60FFE8C35004514FE /* PKSymbolState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D50FFE8C35004514FE /* PKSymbolState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D70FFE8C35004514FE /* PKSymbolState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D50FFE8C35004514FE /* PKSymbolState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D90FFE8C3D004514FE /* PKWordState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D80FFE8C3D004514FE /* PKWordState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DA0FFE8C3D004514FE /* PKWordState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D80FFE8C3D004514FE /* PKWordState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DC0FFE8C43004514FE /* PKWhitespaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DD0FFE8C43004514FE /* PKWhitespaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DF0FFE8C49004514FE /* PKDelimitState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DE0FFE8C49004514FE /* PKDelimitState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E00FFE8C49004514FE /* PKDelimitState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DE0FFE8C49004514FE /* PKDelimitState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E20FFE8C4E004514FE /* PKCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E10FFE8C4E004514FE /* PKCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E30FFE8C4E004514FE /* PKCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E10FFE8C4E004514FE /* PKCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E50FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E60FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E80FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E90FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EB0FFE8C69004514FE /* PKSymbolNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EC0FFE8C69004514FE /* PKSymbolNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EE0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EF0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F10FFE8C7A004514FE /* PKPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F00FFE8C7A004514FE /* PKPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F20FFE8C7A004514FE /* PKPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F00FFE8C7A004514FE /* PKPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F40FFE8C87004514FE /* PKWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F30FFE8C87004514FE /* PKWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F50FFE8C87004514FE /* PKWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F30FFE8C87004514FE /* PKWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F70FFE8C8E004514FE /* PKNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F60FFE8C8E004514FE /* PKNumber.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FA0FFE8C97004514FE /* PKQuotedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F90FFE8C97004514FE /* PKQuotedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FB0FFE8C97004514FE /* PKQuotedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F90FFE8C97004514FE /* PKQuotedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FD0FFE8CB2004514FE /* PKSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FC0FFE8CB2004514FE /* PKSymbol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FE0FFE8CB2004514FE /* PKSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FC0FFE8CB2004514FE /* PKSymbol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222000FFE8CB9004514FE /* PKLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FF0FFE8CB9004514FE /* PKLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222010FFE8CB9004514FE /* PKLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FF0FFE8CB9004514FE /* PKLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222030FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222040FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222060FFE8CCA004514FE /* PKWhitespace.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222050FFE8CCA004514FE /* PKWhitespace.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222070FFE8CCA004514FE /* PKWhitespace.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222050FFE8CCA004514FE /* PKWhitespace.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222090FFE8CD1004514FE /* PKComment.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222080FFE8CD1004514FE /* PKComment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220A0FFE8CD1004514FE /* PKComment.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222080FFE8CD1004514FE /* PKComment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220C0FFE8CD8004514FE /* PKDelimitedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220D0FFE8CD8004514FE /* PKDelimitedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220F0FFE8CDF004514FE /* PKAny.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220E0FFE8CDF004514FE /* PKAny.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222100FFE8CDF004514FE /* PKAny.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220E0FFE8CDF004514FE /* PKAny.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222150FFE8D01004514FE /* PKLowercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222140FFE8D01004514FE /* PKLowercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222160FFE8D01004514FE /* PKLowercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222140FFE8D01004514FE /* PKLowercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222180FFE8D11004514FE /* PKUppercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222170FFE8D11004514FE /* PKUppercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222190FFE8D11004514FE /* PKUppercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222170FFE8D11004514FE /* PKUppercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221B0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221C0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221E0FFE8D3B004514FE /* PKChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221D0FFE8D3B004514FE /* PKChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221F0FFE8D3B004514FE /* PKChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221D0FFE8D3B004514FE /* PKChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222210FFE8D42004514FE /* PKDigit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222200FFE8D42004514FE /* PKDigit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222220FFE8D42004514FE /* PKDigit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222200FFE8D42004514FE /* PKDigit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222240FFE8D49004514FE /* PKLetter.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222230FFE8D49004514FE /* PKLetter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222250FFE8D49004514FE /* PKLetter.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222230FFE8D49004514FE /* PKLetter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222270FFE8D6B004514FE /* PKSpecificChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222260FFE8D6B004514FE /* PKSpecificChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222280FFE8D6B004514FE /* PKSpecificChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222260FFE8D6B004514FE /* PKSpecificChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2222A0FFE8DAC004514FE /* PKParserFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222290FFE8DAC004514FE /* PKParserFactory.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2222B0FFE8DAC004514FE /* PKParserFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222290FFE8DAC004514FE /* PKParserFactory.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2222D0FFE8DE9004514FE /* NSArray+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */; }; + D3C2222E0FFE8DEE004514FE /* NSString+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */; }; + D3C2222F0FFE8DEF004514FE /* NSString+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */; }; + D3C222300FFE8DF3004514FE /* NSArray+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */; }; + D3C7D9DA0A412874005DD154 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D3C85C7B0E63B438000445FD /* TDArithmeticParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C85C7A0E63B438000445FD /* TDArithmeticParser.m */; }; + D3C85C800E63B9E9000445FD /* TDArithmeticParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C85C7F0E63B9E9000445FD /* TDArithmeticParserTest.m */; }; + D3C85D450E63D1BF000445FD /* TDScientificNumberStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C85D440E63D1BF000445FD /* TDScientificNumberStateTest.m */; }; + D3D01CAA0EFDB89900C24DDE /* json_with_discards.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */; }; + D3D01CAB0EFDB8A000C24DDE /* json_with_discards.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */; }; + D3D01CAC0EFDB8A100C24DDE /* json_with_discards.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */; }; + D3D1BF2810394420003656E5 /* SAXAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D1BF2710394420003656E5 /* SAXAssembler.m */; }; + D3D1BF2B1039445C003656E5 /* SAXTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D1BF2A1039445C003656E5 /* SAXTest.m */; }; + D3DCB3730EF5E5D600DE5110 /* OCMock.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D3DCB37D0EF5E5E400DE5110 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D3DCB4C30EF6015300DE5110 /* json.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3DCB4C20EF6015300DE5110 /* json.grammar */; }; + D3DCB4C40EF6015C00DE5110 /* json.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3DCB4C20EF6015300DE5110 /* json.grammar */; }; + D3DCB4C50EF6015C00DE5110 /* json.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3DCB4C20EF6015300DE5110 /* json.grammar */; }; + D3DDDA870F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */; }; + D3DDDA880F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */; }; + D3DDDAFE0F083C9700A58000 /* TDCommentStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3DDDAFD0F083C9700A58000 /* TDCommentStateTest.m */; }; + D3DDDCAD0F0880D800A58000 /* example1.srgs in Resources */ = {isa = PBXBuildFile; fileRef = D3DDDCAC0F0880D800A58000 /* example1.srgs */; }; + D3DDDCAE0F0880D800A58000 /* example1.srgs in Resources */ = {isa = PBXBuildFile; fileRef = D3DDDCAC0F0880D800A58000 /* example1.srgs */; }; + D3E27A320E741DD20078CC2C /* small-xml-file.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */; }; + D3E27A330E741DD20078CC2C /* apple-boss.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36E9FB40E5A944A00496BD3 /* apple-boss.xml */; }; + D3E39C3F0FC5FFD10022DAB9 /* TDDelimitStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E39C3E0FC5FFD10022DAB9 /* TDDelimitStateTest.m */; }; + D3E784BD0E53DA28008C7D61 /* apple-boss.json in Resources */ = {isa = PBXBuildFile; fileRef = D3E784BC0E53DA28008C7D61 /* apple-boss.json */; }; + D3E785560E53FB54008C7D61 /* apple-boss.json in Resources */ = {isa = PBXBuildFile; fileRef = D3E784BC0E53DA28008C7D61 /* apple-boss.json */; }; + D3E787A30E5661A9008C7D61 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; + D3E788930E567DFD008C7D61 /* SRGSParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E788920E567DFD008C7D61 /* SRGSParserTest.m */; }; + D3E788960E567E0A008C7D61 /* SRGSParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E788950E567E0A008C7D61 /* SRGSParser.m */; }; + D3E78A190E574C99008C7D61 /* EBNFParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E78A160E574C99008C7D61 /* EBNFParser.m */; }; + D3E78A1A0E574C99008C7D61 /* EBNFParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E78A180E574C99008C7D61 /* EBNFParserTest.m */; }; + D3EAC7EC0F2690620043D6A9 /* OCMock.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D3EADD800E75E9CC00F78584 /* nasty.html in Resources */ = {isa = PBXBuildFile; fileRef = D3EADD7F0E75E9CC00F78584 /* nasty.html */; }; + D3EADD810E75E9CC00F78584 /* nasty.html in Resources */ = {isa = PBXBuildFile; fileRef = D3EADD7F0E75E9CC00F78584 /* nasty.html */; }; + D3EADD8E0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */; }; + D3EADD8F0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */; }; + D3F0E2480FFE8EB900C9DF74 /* PKQuoteState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3F0E2490FFE8EB900C9DF74 /* PKQuoteState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3F0E3CB0FFEB70100C9DF74 /* PKNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F60FFE8C8E004514FE /* PKNumber.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3F0E3CC0FFEB70700C9DF74 /* PKNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF440FF9E19700D7773A /* PKNumber.m */; }; + D3F55F611025737D00DD6DB1 /* TDParseTreeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F55F601025737D00DD6DB1 /* TDParseTreeTest.m */; }; + D3F5629A10266CFC00DD6DB1 /* PKParseTreeView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F5629910266CFC00DD6DB1 /* PKParseTreeView.m */; }; + D3F562A010266DFB00DD6DB1 /* DemoTokensViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F5629F10266DFB00DD6DB1 /* DemoTokensViewController.m */; }; + D3F562A210266E5300DD6DB1 /* TokensView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3F562A110266E5300DD6DB1 /* TokensView.xib */; }; + D3F562A410266E6300DD6DB1 /* TreesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3F562A310266E6300DD6DB1 /* TreesView.xib */; }; + D3F562A710266E8D00DD6DB1 /* DemoTreesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F562A610266E8D00DD6DB1 /* DemoTreesViewController.m */; }; + D3F740B70EF8C38A00559B9F /* JSONAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F740B60EF8C38A00559B9F /* JSONAssembler.m */; }; + D3F741440EF8E96A00559B9F /* xpath1_0.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741430EF8E96A00559B9F /* xpath1_0.grammar */; }; + D3F741BE0EF9F28D00559B9F /* css2_1.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741BD0EF9F28D00559B9F /* css2_1.grammar */; }; + D3F741BF0EF9F29400559B9F /* css2_1.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741BD0EF9F28D00559B9F /* css2_1.grammar */; }; + D3F741C00EF9F29500559B9F /* css2_1.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741BD0EF9F28D00559B9F /* css2_1.grammar */; }; + D3FD79200F4CC86800BAD816 /* rubyhash.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */; }; + D3FD79210F4CC87900BAD816 /* rubyhash.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */; }; + D3FDC4A50FFB3B2A00F1F797 /* RegexKitLite.h in Headers */ = {isa = PBXBuildFile; fileRef = D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */; }; + D3FDC6DA0FFC4C8C00F1F797 /* RegexKitLite.h in Headers */ = {isa = PBXBuildFile; fileRef = D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */; }; + D3FDC6EE0FFC4C9E00F1F797 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */; }; + D3FDC6EF0FFC4C9E00F1F797 /* PKReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAD9B0FF9C95800D7773A /* PKReader.m */; }; + D3FDC6F00FFC4C9E00F1F797 /* PKAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADA00FF9C9B000D7773A /* PKAssembly.m */; }; + D3FDC6F10FFC4C9E00F1F797 /* PKParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADD60FF9CBFB00D7773A /* PKParser.m */; }; + D3FDC6F20FFC4C9E00F1F797 /* PKRepetition.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE130FF9CE0E00D7773A /* PKRepetition.m */; }; + D3FDC6F30FFC4C9E00F1F797 /* PKCollectionParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */; }; + D3FDC6F40FFC4C9E00F1F797 /* PKAlternation.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */; }; + D3FDC6F50FFC4C9E00F1F797 /* PKSequence.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE150FF9CE0E00D7773A /* PKSequence.m */; }; + D3FDC6F60FFC4C9E00F1F797 /* PKTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE190FF9CE0E00D7773A /* PKTrack.m */; }; + D3FDC6F70FFC4C9E00F1F797 /* PKTrackException.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */; }; + D3FDC6F80FFC4C9E00F1F797 /* PKDifference.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */; }; + D3FDC6F90FFC4C9E00F1F797 /* PKIntersection.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE110FF9CE0E00D7773A /* PKIntersection.m */; }; + D3FDC6FA0FFC4C9E00F1F797 /* PKTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE170FF9CE0E00D7773A /* PKTerminal.m */; }; + D3FDC6FB0FFC4C9E00F1F797 /* PKEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */; }; + D3FDC6FC0FFC4C9E00F1F797 /* PKTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */; }; + D3FDC6FD0FFC4C9E00F1F797 /* PKToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE950FF9D20900D7773A /* PKToken.m */; }; + D3FDC6FE0FFC4C9E00F1F797 /* PKTokenArraySource.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */; }; + D3FDC6FF0FFC4C9E00F1F797 /* PKTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE990FF9D20900D7773A /* PKTokenizer.m */; }; + D3FDC7000FFC4C9E00F1F797 /* PKTokenizerState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */; }; + D3FDC7010FFC4C9E00F1F797 /* PKNumberState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECA0FF9D56400D7773A /* PKNumberState.m */; }; + D3FDC7020FFC4C9E00F1F797 /* PKQuoteState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECC0FF9D56400D7773A /* PKQuoteState.m */; }; + D3FDC7030FFC4C9E00F1F797 /* PKSymbolState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED00FF9D56400D7773A /* PKSymbolState.m */; }; + D3FDC7040FFC4C9E00F1F797 /* PKWordState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED60FF9D56400D7773A /* PKWordState.m */; }; + D3FDC7050FFC4C9E00F1F797 /* PKWhitespaceState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */; }; + D3FDC7060FFC4C9E00F1F797 /* PKDelimitState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC60FF9D56400D7773A /* PKDelimitState.m */; }; + D3FDC7070FFC4C9E00F1F797 /* PKCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC40FF9D56400D7773A /* PKCommentState.m */; }; + D3FDC7080FFC4C9E00F1F797 /* PKSingleLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */; }; + D3FDC7090FFC4C9E00F1F797 /* PKMultiLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */; }; + D3FDC70A0FFC4C9E00F1F797 /* PKSymbolNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */; }; + D3FDC70B0FFC4C9E00F1F797 /* PKSymbolRootNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */; }; + D3FDC70C0FFC4C9E00F1F797 /* PKPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF380FF9E18300D7773A /* PKPattern.m */; }; + D3FDC70D0FFC4C9E00F1F797 /* PKWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED40FF9D56400D7773A /* PKWord.m */; }; + D3FDC70F0FFC4C9E00F1F797 /* PKQuotedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF460FF9E19700D7773A /* PKQuotedString.m */; }; + D3FDC7100FFC4C9E00F1F797 /* PKSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF480FF9E19700D7773A /* PKSymbol.m */; }; + D3FDC7110FFC4C9E00F1F797 /* PKLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF420FF9E19700D7773A /* PKLiteral.m */; }; + D3FDC7120FFC4C9E00F1F797 /* PKCaseInsensitiveLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */; }; + D3FDC7130FFC4C9E00F1F797 /* PKWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */; }; + D3FDC7140FFC4C9E00F1F797 /* PKComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3E0FF9E19700D7773A /* PKComment.m */; }; + D3FDC7150FFC4C9E00F1F797 /* PKDelimitedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF400FF9E19700D7773A /* PKDelimitedString.m */; }; + D3FDC7160FFC4C9E00F1F797 /* PKAny.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE2F0FF9CE6000D7773A /* PKAny.m */; }; + D3FDC7180FFC4C9E00F1F797 /* PKLowercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */; }; + D3FDC7190FFC4C9E00F1F797 /* PKUppercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */; }; + D3FDC71A0FFC4C9E00F1F797 /* PKCharacterAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */; }; + D3FDC71B0FFC4C9E00F1F797 /* PKChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB40FF9E80300D7773A /* PKChar.m */; }; + D3FDC71C0FFC4C9E00F1F797 /* PKDigit.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB60FF9E80300D7773A /* PKDigit.m */; }; + D3FDC71D0FFC4C9E00F1F797 /* PKLetter.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB80FF9E80300D7773A /* PKLetter.m */; }; + D3FDC71E0FFC4C9E00F1F797 /* PKSpecificChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */; }; + D3FDC71F0FFC4C9E00F1F797 /* PKParserFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD80FF9E95500D7773A /* PKParserFactory.m */; }; + D3FDC7200FFC4C9E00F1F797 /* NSArray+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */; }; + D3FDC7210FFC4C9E00F1F797 /* NSString+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */; }; + D3FDC7370FFC4D6100F1F797 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3FDC7360FFC4D6100F1F797 /* Foundation.framework */; }; + D3FDC7390FFC4D6100F1F797 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3FDC7380FFC4D6100F1F797 /* libicucore.dylib */; }; + D3FDC74C0FFC4DAC00F1F797 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3FDC74B0FFC4DAC00F1F797 /* CoreGraphics.framework */; }; + D3FDC8DC0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = D3FDC8DB0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + D31FE7170E60F24700A0803E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TDParseKit; + }; + D334949F0E296AA900406085 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TODParseKit; + }; + D341850F0E520D6F0081B0DC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TODParseKit; + }; + D389F1D30F19665C00558235 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TDParseKit; + }; + D389F2090F196A8000558235 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D389F1CD0F1965E600558235; + remoteInfo = TDJSParseKit; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + D380B9A10F0EF3DC0009EC13 /* Copy Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(BUILT_PRODUCTS_DIR)"; + dstSubfolderSpec = 0; + files = ( + D3EAC7EC0F2690620043D6A9 /* OCMock.framework in Copy Frameworks */, + ); + name = "Copy Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + D3DCB3880EF5E65100DE5110 /* Copy Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(BUILT_PRODUCTS_DIR)"; + dstSubfolderSpec = 0; + files = ( + D3DCB3730EF5E5D600DE5110 /* OCMock.framework in Copy Frameworks */, + ); + name = "Copy Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; + 8DC2EF5B0486A6940098B216 /* ParseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ParseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D3126D040FFD9BA700CBF4C4 /* PKNegation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKNegation.m; path = src/PKNegation.m; sourceTree = ""; }; + D3126D090FFD9E4B00CBF4C4 /* TDNegationTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNegationTest.h; path = test/TDNegationTest.h; sourceTree = ""; }; + D3126D0A0FFD9E4B00CBF4C4 /* TDNegationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNegationTest.m; path = test/TDNegationTest.m; sourceTree = ""; }; + D3126D410FFDB4C600CBF4C4 /* TDExclusionTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDExclusionTest.h; path = test/TDExclusionTest.h; sourceTree = ""; }; + D3126D420FFDB4C600CBF4C4 /* TDExclusionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDExclusionTest.m; path = test/TDExclusionTest.m; sourceTree = ""; }; + D31270F80FFE898300CBF4C4 /* PKExclusion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKExclusion.m; path = test/PKExclusion.m; sourceTree = ""; }; + D315DF710FEF59B600D876C8 /* date.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = date.grammar; path = res/date.grammar; sourceTree = ""; }; + D319E429106D8A1F008C63DD /* arithmetic.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = arithmetic.grammar; path = res/arithmetic.grammar; sourceTree = ""; }; + D319E42C106D8A31008C63DD /* TDArithmeticAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDArithmeticAssembler.h; path = test/TDArithmeticAssembler.h; sourceTree = ""; }; + D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDArithmeticAssembler.m; path = test/TDArithmeticAssembler.m; sourceTree = ""; }; + D31A15250F6DE449002AFDF1 /* javascript.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = javascript.grammar; path = res/javascript.grammar; sourceTree = ""; }; + D31A16500F7038C2002AFDF1 /* TDJavaScriptParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJavaScriptParser.h; path = test/TDJavaScriptParser.h; sourceTree = ""; }; + D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJavaScriptParser.m; path = test/TDJavaScriptParser.m; sourceTree = ""; }; + D31FE54A0E60E46100A0803E /* TDTestScaffold.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTestScaffold.h; path = test/TDTestScaffold.h; sourceTree = ""; }; + D31FE54B0E60E46100A0803E /* TDTestScaffold.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTestScaffold.m; path = test/TDTestScaffold.m; sourceTree = ""; }; + D31FE54D0E60E50800A0803E /* TDAlternationTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDAlternationTest.h; path = test/TDAlternationTest.h; sourceTree = ""; }; + D31FE54E0E60E50800A0803E /* TDAlternationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDAlternationTest.m; path = test/TDAlternationTest.m; sourceTree = ""; }; + D31FE54F0E60E50800A0803E /* TDLiteralTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDLiteralTest.h; path = test/TDLiteralTest.h; sourceTree = ""; }; + D31FE5500E60E50800A0803E /* TDLiteralTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDLiteralTest.m; path = test/TDLiteralTest.m; sourceTree = ""; }; + D31FE5510E60E50800A0803E /* TDParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserTest.h; path = test/TDParserTest.h; sourceTree = ""; }; + D31FE5520E60E50800A0803E /* TDParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserTest.m; path = test/TDParserTest.m; sourceTree = ""; }; + D31FE5530E60E50800A0803E /* TDRepetitionTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRepetitionTest.h; path = test/TDRepetitionTest.h; sourceTree = ""; }; + D31FE5540E60E50800A0803E /* TDRepetitionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRepetitionTest.m; path = test/TDRepetitionTest.m; sourceTree = ""; }; + D31FE5550E60E50800A0803E /* TDReservedWordTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDReservedWordTest.h; path = test/TDReservedWordTest.h; sourceTree = ""; }; + D31FE5560E60E50800A0803E /* TDReservedWordTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDReservedWordTest.m; path = test/TDReservedWordTest.m; sourceTree = ""; }; + D31FE5570E60E50800A0803E /* TDRobotCommandTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRobotCommandTest.h; path = test/TDRobotCommandTest.h; sourceTree = ""; }; + D31FE5580E60E50800A0803E /* TDRobotCommandTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRobotCommandTest.m; path = test/TDRobotCommandTest.m; sourceTree = ""; }; + D31FE5590E60E50800A0803E /* TDSequenceTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSequenceTest.h; path = test/TDSequenceTest.h; sourceTree = ""; }; + D31FE55A0E60E50800A0803E /* TDSequenceTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSequenceTest.m; path = test/TDSequenceTest.m; sourceTree = ""; }; + D31FE55B0E60E50800A0803E /* TDSymbolTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSymbolTest.h; path = test/TDSymbolTest.h; sourceTree = ""; }; + D31FE55C0E60E50800A0803E /* TDSymbolTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSymbolTest.m; path = test/TDSymbolTest.m; sourceTree = ""; }; + D31FE55D0E60E50800A0803E /* TDTokenAssemblyTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenAssemblyTest.h; path = test/TDTokenAssemblyTest.h; sourceTree = ""; }; + D31FE55E0E60E50800A0803E /* TDTokenAssemblyTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenAssemblyTest.m; path = test/TDTokenAssemblyTest.m; sourceTree = ""; }; + D31FE55F0E60E50800A0803E /* TDTrackTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTrackTest.h; path = test/TDTrackTest.h; sourceTree = ""; }; + D31FE5600E60E50800A0803E /* TDTrackTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTrackTest.m; path = test/TDTrackTest.m; sourceTree = ""; }; + D31FE5610E60E50800A0803E /* TDUppercaseWordTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDUppercaseWordTest.h; path = test/TDUppercaseWordTest.h; sourceTree = ""; }; + D31FE5620E60E50800A0803E /* TDUppercaseWordTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDUppercaseWordTest.m; path = test/TDUppercaseWordTest.m; sourceTree = ""; }; + D31FE5710E60E55700A0803E /* TDReaderTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDReaderTest.h; path = test/TDReaderTest.h; sourceTree = ""; }; + D31FE5720E60E55700A0803E /* TDReaderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDReaderTest.m; path = test/TDReaderTest.m; sourceTree = ""; }; + D31FE5730E60E55700A0803E /* TDTokenizerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenizerTest.h; path = test/TDTokenizerTest.h; sourceTree = ""; }; + D31FE5740E60E55700A0803E /* TDTokenizerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenizerTest.m; path = test/TDTokenizerTest.m; sourceTree = ""; }; + D31FE5770E60E58C00A0803E /* TDNumberStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNumberStateTest.h; path = test/TDNumberStateTest.h; sourceTree = ""; }; + D31FE5780E60E58C00A0803E /* TDNumberStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNumberStateTest.m; path = test/TDNumberStateTest.m; sourceTree = ""; }; + D31FE5790E60E58C00A0803E /* TDQuoteStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDQuoteStateTest.h; path = test/TDQuoteStateTest.h; sourceTree = ""; }; + D31FE57A0E60E58C00A0803E /* TDQuoteStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDQuoteStateTest.m; path = test/TDQuoteStateTest.m; sourceTree = ""; }; + D31FE57B0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSignificantWhitespaceStateTest.h; path = test/TDSignificantWhitespaceStateTest.h; sourceTree = ""; }; + D31FE57C0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSignificantWhitespaceStateTest.m; path = test/TDSignificantWhitespaceStateTest.m; sourceTree = ""; }; + D31FE57D0E60E58C00A0803E /* TDSlashStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashStateTest.h; path = test/TDSlashStateTest.h; sourceTree = ""; }; + D31FE57E0E60E58C00A0803E /* TDSlashStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashStateTest.m; path = test/TDSlashStateTest.m; sourceTree = ""; }; + D31FE57F0E60E58C00A0803E /* TDSymbolStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSymbolStateTest.h; path = test/TDSymbolStateTest.h; sourceTree = ""; }; + D31FE5800E60E58C00A0803E /* TDSymbolStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSymbolStateTest.m; path = test/TDSymbolStateTest.m; sourceTree = ""; }; + D31FE5810E60E58C00A0803E /* TDWhitespaceStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDWhitespaceStateTest.h; path = test/TDWhitespaceStateTest.h; sourceTree = ""; }; + D31FE5820E60E58C00A0803E /* TDWhitespaceStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDWhitespaceStateTest.m; path = test/TDWhitespaceStateTest.m; sourceTree = ""; }; + D31FE5830E60E58C00A0803E /* TDWordStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDWordStateTest.h; path = test/TDWordStateTest.h; sourceTree = ""; }; + D31FE5840E60E58C00A0803E /* TDWordStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDWordStateTest.m; path = test/TDWordStateTest.m; sourceTree = ""; }; + D31FE58C0E60E5AC00A0803E /* TDCharacterAssemblyTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDCharacterAssemblyTest.h; path = test/TDCharacterAssemblyTest.h; sourceTree = ""; }; + D31FE58D0E60E5AC00A0803E /* TDCharacterAssemblyTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDCharacterAssemblyTest.m; path = test/TDCharacterAssemblyTest.m; sourceTree = ""; }; + D31FE58E0E60E5AC00A0803E /* TDCharTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDCharTest.h; path = test/TDCharTest.h; sourceTree = ""; }; + D31FE58F0E60E5AC00A0803E /* TDCharTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDCharTest.m; path = test/TDCharTest.m; sourceTree = ""; }; + D31FE5900E60E5AC00A0803E /* TDDigitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDDigitTest.h; path = test/TDDigitTest.h; sourceTree = ""; }; + D31FE5910E60E5AC00A0803E /* TDDigitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDDigitTest.m; path = test/TDDigitTest.m; sourceTree = ""; }; + D31FE5920E60E5AC00A0803E /* TDLetterTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDLetterTest.h; path = test/TDLetterTest.h; sourceTree = ""; }; + D31FE5930E60E5AC00A0803E /* TDLetterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDLetterTest.m; path = test/TDLetterTest.m; sourceTree = ""; }; + D31FE5940E60E5AC00A0803E /* TDSpecificCharTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSpecificCharTest.h; path = test/TDSpecificCharTest.h; sourceTree = ""; }; + D31FE5950E60E5AC00A0803E /* TDSpecificCharTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSpecificCharTest.m; path = test/TDSpecificCharTest.m; sourceTree = ""; }; + D31FE59B0E60E5C000A0803E /* TDRegularParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRegularParser.h; path = test/TDRegularParser.h; sourceTree = ""; }; + D31FE59C0E60E5C000A0803E /* TDRegularParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRegularParser.m; path = test/TDRegularParser.m; sourceTree = ""; }; + D31FE59D0E60E5C000A0803E /* TDRegularParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRegularParserTest.h; path = test/TDRegularParserTest.h; sourceTree = ""; }; + D31FE59E0E60E5C000A0803E /* TDRegularParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRegularParserTest.m; path = test/TDRegularParserTest.m; sourceTree = ""; }; + D31FE5A10E60E5D500A0803E /* TDFastJsonParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDFastJsonParser.h; path = test/TDFastJsonParser.h; sourceTree = ""; }; + D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDFastJsonParser.m; path = test/TDFastJsonParser.m; sourceTree = ""; }; + D31FE5A30E60E5D500A0803E /* TDFastJsonParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDFastJsonParserTest.h; path = test/TDFastJsonParserTest.h; sourceTree = ""; }; + D31FE5A40E60E5D500A0803E /* TDFastJsonParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDFastJsonParserTest.m; path = test/TDFastJsonParserTest.m; sourceTree = ""; }; + D31FE5AD0E60E64900A0803E /* TDXmlTokenAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTokenAssembly.h; path = test/TDXmlTokenAssembly.h; sourceTree = ""; }; + D31FE5AE0E60E64900A0803E /* TDXmlTokenAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTokenAssembly.m; path = test/TDXmlTokenAssembly.m; sourceTree = ""; }; + D31FE5AF0E60E64900A0803E /* TDXmlTokenizerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTokenizerTest.h; path = test/TDXmlTokenizerTest.h; sourceTree = ""; }; + D31FE5B00E60E64900A0803E /* TDXmlTokenizerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTokenizerTest.m; path = test/TDXmlTokenizerTest.m; sourceTree = ""; }; + D31FE5B30E60E66600A0803E /* TDXmlToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlToken.h; path = test/TDXmlToken.h; sourceTree = ""; }; + D31FE5B40E60E66600A0803E /* TDXmlToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlToken.m; path = test/TDXmlToken.m; sourceTree = ""; }; + D31FE5B50E60E66600A0803E /* TDXmlTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTokenizer.h; path = test/TDXmlTokenizer.h; sourceTree = ""; }; + D31FE5B60E60E66600A0803E /* TDXmlTokenizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTokenizer.m; path = test/TDXmlTokenizer.m; sourceTree = ""; }; + D31FE5B90E60E69E00A0803E /* TDXmlAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlAttribute.h; path = test/TDXmlAttribute.h; sourceTree = ""; }; + D31FE5BA0E60E69E00A0803E /* TDXmlAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlAttribute.m; path = test/TDXmlAttribute.m; sourceTree = ""; }; + D31FE5BB0E60E69E00A0803E /* TDXmlCdata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlCdata.h; path = test/TDXmlCdata.h; sourceTree = ""; }; + D31FE5BC0E60E69E00A0803E /* TDXmlCdata.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlCdata.m; path = test/TDXmlCdata.m; sourceTree = ""; }; + D31FE5BD0E60E69E00A0803E /* TDXmlComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlComment.h; path = test/TDXmlComment.h; sourceTree = ""; }; + D31FE5BE0E60E69E00A0803E /* TDXmlComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlComment.m; path = test/TDXmlComment.m; sourceTree = ""; }; + D31FE5BF0E60E69E00A0803E /* TDXmlDecl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlDecl.h; path = test/TDXmlDecl.h; sourceTree = ""; }; + D31FE5C00E60E69E00A0803E /* TDXmlDecl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlDecl.m; path = test/TDXmlDecl.m; sourceTree = ""; }; + D31FE5C10E60E69E00A0803E /* TDXmlDoctype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlDoctype.h; path = test/TDXmlDoctype.h; sourceTree = ""; }; + D31FE5C20E60E69E00A0803E /* TDXmlDoctype.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlDoctype.m; path = test/TDXmlDoctype.m; sourceTree = ""; }; + D31FE5C30E60E69E00A0803E /* TDXmlDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlDocument.h; path = test/TDXmlDocument.h; sourceTree = ""; }; + D31FE5C40E60E69E00A0803E /* TDXmlDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlDocument.m; path = test/TDXmlDocument.m; sourceTree = ""; }; + D31FE5C50E60E69E00A0803E /* TDXmlEndEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEndEntity.h; path = test/TDXmlEndEntity.h; sourceTree = ""; }; + D31FE5C60E60E69E00A0803E /* TDXmlEndEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEndEntity.m; path = test/TDXmlEndEntity.m; sourceTree = ""; }; + D31FE5C70E60E69E00A0803E /* TDXmlEndTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEndTag.h; path = test/TDXmlEndTag.h; sourceTree = ""; }; + D31FE5C80E60E69E00A0803E /* TDXmlEndTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEndTag.m; path = test/TDXmlEndTag.m; sourceTree = ""; }; + D31FE5C90E60E69E00A0803E /* TDXmlEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEntity.h; path = test/TDXmlEntity.h; sourceTree = ""; }; + D31FE5CA0E60E69E00A0803E /* TDXmlEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEntity.m; path = test/TDXmlEntity.m; sourceTree = ""; }; + D31FE5CB0E60E69E00A0803E /* TDXmlEntityRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEntityRef.h; path = test/TDXmlEntityRef.h; sourceTree = ""; }; + D31FE5CC0E60E69E00A0803E /* TDXmlEntityRef.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEntityRef.m; path = test/TDXmlEntityRef.m; sourceTree = ""; }; + D31FE5CD0E60E69E00A0803E /* TDXmlFragment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlFragment.h; path = test/TDXmlFragment.h; sourceTree = ""; }; + D31FE5CE0E60E69E00A0803E /* TDXmlFragment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlFragment.m; path = test/TDXmlFragment.m; sourceTree = ""; }; + D31FE5CF0E60E69E00A0803E /* TDXmlNotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNotation.h; path = test/TDXmlNotation.h; sourceTree = ""; }; + D31FE5D00E60E69E00A0803E /* TDXmlNotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNotation.m; path = test/TDXmlNotation.m; sourceTree = ""; }; + D31FE5D10E60E69E00A0803E /* TDXmlProcessingInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlProcessingInstruction.h; path = test/TDXmlProcessingInstruction.h; sourceTree = ""; }; + D31FE5D20E60E69E00A0803E /* TDXmlProcessingInstruction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlProcessingInstruction.m; path = test/TDXmlProcessingInstruction.m; sourceTree = ""; }; + D31FE5D30E60E69E00A0803E /* TDXmlSignificantWhitespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlSignificantWhitespace.h; path = test/TDXmlSignificantWhitespace.h; sourceTree = ""; }; + D31FE5D40E60E69E00A0803E /* TDXmlSignificantWhitespace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlSignificantWhitespace.m; path = test/TDXmlSignificantWhitespace.m; sourceTree = ""; }; + D31FE5D50E60E69E00A0803E /* TDXmlStartTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlStartTag.h; path = test/TDXmlStartTag.h; sourceTree = ""; }; + D31FE5D60E60E69E00A0803E /* TDXmlStartTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlStartTag.m; path = test/TDXmlStartTag.m; sourceTree = ""; }; + D31FE5D70E60E69E00A0803E /* TDXmlTerminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTerminal.h; path = test/TDXmlTerminal.h; sourceTree = ""; }; + D31FE5D80E60E69E00A0803E /* TDXmlTerminal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTerminal.m; path = test/TDXmlTerminal.m; sourceTree = ""; }; + D31FE5D90E60E69E00A0803E /* TDXmlText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlText.h; path = test/TDXmlText.h; sourceTree = ""; }; + D31FE5DA0E60E69E00A0803E /* TDXmlText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlText.m; path = test/TDXmlText.m; sourceTree = ""; }; + D31FE5DB0E60E69E00A0803E /* TDXmlWhitespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlWhitespace.h; path = test/TDXmlWhitespace.h; sourceTree = ""; }; + D31FE5DC0E60E69E00A0803E /* TDXmlWhitespace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlWhitespace.m; path = test/TDXmlWhitespace.m; sourceTree = ""; }; + D31FE5EF0E60E6B500A0803E /* TDNCName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNCName.h; path = test/TDNCName.h; sourceTree = ""; }; + D31FE5F00E60E6B500A0803E /* TDNCNameState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNCNameState.h; path = test/TDNCNameState.h; sourceTree = ""; }; + D31FE5F10E60E6B500A0803E /* TDNCNameState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNCNameState.m; path = test/TDNCNameState.m; sourceTree = ""; }; + D31FE5F20E60E6B500A0803E /* TDXmlName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlName.h; path = test/TDXmlName.h; sourceTree = ""; }; + D31FE5F30E60E6B500A0803E /* TDXmlName.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlName.m; path = test/TDXmlName.m; sourceTree = ""; }; + D31FE5F40E60E6B500A0803E /* TDXmlNameState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNameState.h; path = test/TDXmlNameState.h; sourceTree = ""; }; + D31FE5F50E60E6B500A0803E /* TDXmlNameState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNameState.m; path = test/TDXmlNameState.m; sourceTree = ""; }; + D31FE5F60E60E6B500A0803E /* TDXmlNameTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNameTest.h; path = test/TDXmlNameTest.h; sourceTree = ""; }; + D31FE5F70E60E6B500A0803E /* TDXmlNameTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNameTest.m; path = test/TDXmlNameTest.m; sourceTree = ""; }; + D31FE5F80E60E6B500A0803E /* TDXmlNmtoken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNmtoken.h; path = test/TDXmlNmtoken.h; sourceTree = ""; }; + D31FE5F90E60E6B500A0803E /* TDXmlNmtoken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNmtoken.m; path = test/TDXmlNmtoken.m; sourceTree = ""; }; + D31FE5FA0E60E6B500A0803E /* TDXmlNmtokenState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNmtokenState.h; path = test/TDXmlNmtokenState.h; sourceTree = ""; }; + D31FE5FB0E60E6B500A0803E /* TDXmlNmtokenState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNmtokenState.m; path = test/TDXmlNmtokenState.m; sourceTree = ""; }; + D31FE6DF0E60EE2500A0803E /* TDNCName.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNCName.m; path = test/TDNCName.m; sourceTree = ""; }; + D3252F780FCE1A7E005EF059 /* TDNSPredicateBuilderTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateBuilderTest.h; path = test/TDNSPredicateBuilderTest.h; sourceTree = ""; }; + D3252F790FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateBuilderTest.m; path = test/TDNSPredicateBuilderTest.m; sourceTree = ""; }; + D3252F7C0FCE1A87005EF059 /* TDNSPredicateBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateBuilder.h; path = test/TDNSPredicateBuilder.h; sourceTree = ""; }; + D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateBuilder.m; path = test/TDNSPredicateBuilder.m; sourceTree = ""; }; + D3305C4B102F5BAD00DC4F75 /* TDGutterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDGutterView.h; path = demoapp/TDGutterView.h; sourceTree = ""; }; + D3305C4C102F5BAD00DC4F75 /* TDGutterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDGutterView.m; path = demoapp/TDGutterView.m; sourceTree = ""; }; + D3305C4D102F5BAE00DC4F75 /* TDSourceCodeTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSourceCodeTextView.h; path = demoapp/TDSourceCodeTextView.h; sourceTree = ""; }; + D3305C4E102F5BAE00DC4F75 /* TDSourceCodeTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSourceCodeTextView.m; path = demoapp/TDSourceCodeTextView.m; sourceTree = ""; }; + D33494100E2963FD00406085 /* DemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D3376D5710093A1600E4602E /* PKGrammarParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKGrammarParser.h; path = src/PKGrammarParser.h; sourceTree = ""; }; + D3376D5810093A1600E4602E /* PKGrammarParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKGrammarParser.m; path = src/PKGrammarParser.m; sourceTree = ""; }; + D3376D8C10096C0700E4602E /* PKAST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAST.h; path = test/PKAST.h; sourceTree = ""; }; + D3376D8D10096C0700E4602E /* PKAST.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAST.m; path = test/PKAST.m; sourceTree = ""; }; + D3385FD70FCFB1FF003BF729 /* TDPredicateEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPredicateEvaluator.h; path = test/TDPredicateEvaluator.h; sourceTree = ""; }; + D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPredicateEvaluator.m; path = test/TDPredicateEvaluator.m; sourceTree = ""; }; + D3385FDB0FCFB227003BF729 /* TDPredicateEvaluatorTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPredicateEvaluatorTest.h; path = test/TDPredicateEvaluatorTest.h; sourceTree = ""; }; + D3385FDC0FCFB227003BF729 /* TDPredicateEvaluatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPredicateEvaluatorTest.m; path = test/TDPredicateEvaluatorTest.m; sourceTree = ""; }; + D338E5B90FF5DDCB003DE6AA /* TDDifferenceTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDDifferenceTest.h; path = test/TDDifferenceTest.h; sourceTree = ""; }; + D338E5BA0FF5DDCB003DE6AA /* TDDifferenceTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDDifferenceTest.m; path = test/TDDifferenceTest.m; sourceTree = ""; }; + D34185040E520D3F0081B0DC /* DebugApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DebugApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D34BAC210FF87F8600D7773A /* TDParserFactoryTest3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryTest3.h; path = test/TDParserFactoryTest3.h; sourceTree = ""; }; + D34BAC220FF87F8600D7773A /* TDParserFactoryTest3.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryTest3.m; path = test/TDParserFactoryTest3.m; sourceTree = ""; }; + D34BAC490FF892C200D7773A /* XPathParserGrammarTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathParserGrammarTest.h; path = test/XPathParserGrammarTest.h; sourceTree = ""; }; + D34BAC4A0FF892C200D7773A /* XPathParserGrammarTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathParserGrammarTest.m; path = test/XPathParserGrammarTest.m; sourceTree = ""; }; + D34BAD16100A9B7900996341 /* TDTokenizerStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenizerStateTest.h; path = test/TDTokenizerStateTest.h; sourceTree = ""; }; + D34BAD17100A9B7900996341 /* TDTokenizerStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenizerStateTest.m; path = test/TDTokenizerStateTest.m; sourceTree = ""; }; + D34BAD630FF9C6AE00D7773A /* ParseKit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseKit_Prefix.pch; sourceTree = ""; }; + D34BAD9B0FF9C95800D7773A /* PKReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKReader.m; path = src/PKReader.m; sourceTree = ""; }; + D34BADA00FF9C9B000D7773A /* PKAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAssembly.m; path = src/PKAssembly.m; sourceTree = ""; }; + D34BADD60FF9CBFB00D7773A /* PKParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParser.m; path = src/PKParser.m; sourceTree = ""; }; + D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCollectionParser.m; path = src/PKCollectionParser.m; sourceTree = ""; }; + D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAlternation.m; path = src/PKAlternation.m; sourceTree = ""; }; + D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKEmpty.m; path = src/PKEmpty.m; sourceTree = ""; }; + D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDifference.m; path = src/PKDifference.m; sourceTree = ""; }; + D34BAE110FF9CE0E00D7773A /* PKIntersection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKIntersection.m; path = src/PKIntersection.m; sourceTree = ""; }; + D34BAE130FF9CE0E00D7773A /* PKRepetition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKRepetition.m; path = src/PKRepetition.m; sourceTree = ""; }; + D34BAE150FF9CE0E00D7773A /* PKSequence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSequence.m; path = src/PKSequence.m; sourceTree = ""; }; + D34BAE170FF9CE0E00D7773A /* PKTerminal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTerminal.m; path = src/PKTerminal.m; sourceTree = ""; }; + D34BAE190FF9CE0E00D7773A /* PKTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTrack.m; path = src/PKTrack.m; sourceTree = ""; }; + D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTrackException.m; path = src/PKTrackException.m; sourceTree = ""; }; + D34BAE2F0FF9CE6000D7773A /* PKAny.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAny.m; path = src/PKAny.m; sourceTree = ""; }; + D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenAssembly.m; path = src/PKTokenAssembly.m; sourceTree = ""; }; + D34BAE950FF9D20900D7773A /* PKToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKToken.m; path = src/PKToken.m; sourceTree = ""; }; + D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenArraySource.m; path = src/PKTokenArraySource.m; sourceTree = ""; }; + D34BAE990FF9D20900D7773A /* PKTokenizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenizer.m; path = src/PKTokenizer.m; sourceTree = ""; }; + D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenizerState.m; path = src/PKTokenizerState.m; sourceTree = ""; }; + D34BAEC40FF9D56400D7773A /* PKCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCommentState.m; path = src/PKCommentState.m; sourceTree = ""; }; + D34BAEC60FF9D56400D7773A /* PKDelimitState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDelimitState.m; path = src/PKDelimitState.m; sourceTree = ""; }; + D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKMultiLineCommentState.m; path = src/PKMultiLineCommentState.m; sourceTree = ""; }; + D34BAECA0FF9D56400D7773A /* PKNumberState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKNumberState.m; path = src/PKNumberState.m; sourceTree = ""; }; + D34BAECC0FF9D56400D7773A /* PKQuoteState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKQuoteState.m; path = src/PKQuoteState.m; sourceTree = ""; }; + D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSingleLineCommentState.m; path = src/PKSingleLineCommentState.m; sourceTree = ""; }; + D34BAED00FF9D56400D7773A /* PKSymbolState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbolState.m; path = src/PKSymbolState.m; sourceTree = ""; }; + D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWhitespaceState.m; path = src/PKWhitespaceState.m; sourceTree = ""; }; + D34BAED40FF9D56400D7773A /* PKWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWord.m; path = src/PKWord.m; sourceTree = ""; }; + D34BAED60FF9D56400D7773A /* PKWordState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWordState.m; path = src/PKWordState.m; sourceTree = ""; }; + D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbolNode.m; path = src/PKSymbolNode.m; sourceTree = ""; }; + D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbolRootNode.m; path = src/PKSymbolRootNode.m; sourceTree = ""; }; + D34BAF380FF9E18300D7773A /* PKPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKPattern.m; path = src/PKPattern.m; sourceTree = ""; }; + D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCaseInsensitiveLiteral.m; path = src/PKCaseInsensitiveLiteral.m; sourceTree = ""; }; + D34BAF3E0FF9E19700D7773A /* PKComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKComment.m; path = src/PKComment.m; sourceTree = ""; }; + D34BAF400FF9E19700D7773A /* PKDelimitedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDelimitedString.m; path = src/PKDelimitedString.m; sourceTree = ""; }; + D34BAF420FF9E19700D7773A /* PKLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKLiteral.m; path = src/PKLiteral.m; sourceTree = ""; }; + D34BAF440FF9E19700D7773A /* PKNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKNumber.m; path = src/PKNumber.m; sourceTree = ""; }; + D34BAF460FF9E19700D7773A /* PKQuotedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKQuotedString.m; path = src/PKQuotedString.m; sourceTree = ""; }; + D34BAF480FF9E19700D7773A /* PKSymbol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbol.m; path = src/PKSymbol.m; sourceTree = ""; }; + D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWhitespace.m; path = src/PKWhitespace.m; sourceTree = ""; }; + D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKLowercaseWord.m; path = src/PKLowercaseWord.m; sourceTree = ""; }; + D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKUppercaseWord.m; path = src/PKUppercaseWord.m; sourceTree = ""; }; + D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCharacterAssembly.m; path = src/PKCharacterAssembly.m; sourceTree = ""; }; + D34BAFB40FF9E80300D7773A /* PKChar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKChar.m; path = src/PKChar.m; sourceTree = ""; }; + D34BAFB60FF9E80300D7773A /* PKDigit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDigit.m; path = src/PKDigit.m; sourceTree = ""; }; + D34BAFB80FF9E80300D7773A /* PKLetter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKLetter.m; path = src/PKLetter.m; sourceTree = ""; }; + D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSpecificChar.m; path = src/PKSpecificChar.m; sourceTree = ""; }; + D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSArray+ParseKitAdditions.h"; path = "src/NSArray+ParseKitAdditions.h"; sourceTree = ""; }; + D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSArray+ParseKitAdditions.m"; path = "src/NSArray+ParseKitAdditions.m"; sourceTree = ""; }; + D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+ParseKitAdditions.h"; path = "src/NSString+ParseKitAdditions.h"; sourceTree = ""; }; + D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+ParseKitAdditions.m"; path = "src/NSString+ParseKitAdditions.m"; sourceTree = ""; }; + D34BAFD80FF9E95500D7773A /* PKParserFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParserFactory.m; path = src/PKParserFactory.m; sourceTree = ""; }; + D34BB04E0FF9EC4E00D7773A /* JSParseKit-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "JSParseKit-Info.plist"; sourceTree = ""; }; + D34BB0660FF9EDDF00D7773A /* JSParseKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSParseKit.h; path = jssrc/JSParseKit.h; sourceTree = ""; }; + D34BB0670FF9EDDF00D7773A /* JSParseKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSParseKit.m; path = jssrc/JSParseKit.m; sourceTree = ""; }; + D34BB06A0FF9EE4000D7773A /* PKJSAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAssembly.h; path = jssrc/PKJSAssembly.h; sourceTree = ""; }; + D34BB06B0FF9EE4000D7773A /* PKJSAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAssembly.m; path = jssrc/PKJSAssembly.m; sourceTree = ""; }; + D34BB06C0FF9EE4000D7773A /* PKJSUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSUtils.h; path = jssrc/PKJSUtils.h; sourceTree = ""; }; + D34BB06D0FF9EE4000D7773A /* PKJSUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSUtils.m; path = jssrc/PKJSUtils.m; sourceTree = ""; }; + D34BB06E0FF9EE4000D7773A /* PKJSUtils_macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSUtils_macros.h; path = jssrc/PKJSUtils_macros.h; sourceTree = ""; }; + D34BB06F0FF9EE4000D7773A /* PKJSValueHolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSValueHolder.h; path = jssrc/PKJSValueHolder.h; sourceTree = ""; }; + D34BB0700FF9EE4000D7773A /* PKJSValueHolder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSValueHolder.m; path = jssrc/PKJSValueHolder.m; sourceTree = ""; }; + D34BB08D0FF9EF9D00D7773A /* PKJSCharacterAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCharacterAssembly.h; path = jssrc/PKJSCharacterAssembly.h; sourceTree = ""; }; + D34BB08E0FF9EF9D00D7773A /* PKJSCharacterAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCharacterAssembly.m; path = jssrc/PKJSCharacterAssembly.m; sourceTree = ""; }; + D34BB0930FF9F14B00D7773A /* PKJSCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCommentState.h; path = jssrc/PKJSCommentState.h; sourceTree = ""; }; + D34BB0940FF9F14B00D7773A /* PKJSCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCommentState.m; path = jssrc/PKJSCommentState.m; sourceTree = ""; }; + D34BB0950FF9F14B00D7773A /* PKJSDelimitState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSDelimitState.h; path = jssrc/PKJSDelimitState.h; sourceTree = ""; }; + D34BB0960FF9F14B00D7773A /* PKJSDelimitState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSDelimitState.m; path = jssrc/PKJSDelimitState.m; sourceTree = ""; }; + D34BB0970FF9F14B00D7773A /* PKJSNumberState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSNumberState.h; path = jssrc/PKJSNumberState.h; sourceTree = ""; }; + D34BB0980FF9F14B00D7773A /* PKJSNumberState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSNumberState.m; path = jssrc/PKJSNumberState.m; sourceTree = ""; }; + D34BB0990FF9F14B00D7773A /* PKJSQuoteState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSQuoteState.h; path = jssrc/PKJSQuoteState.h; sourceTree = ""; }; + D34BB09A0FF9F14B00D7773A /* PKJSQuoteState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSQuoteState.m; path = jssrc/PKJSQuoteState.m; sourceTree = ""; }; + D34BB09B0FF9F14B00D7773A /* PKJSSymbolState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSSymbolState.h; path = jssrc/PKJSSymbolState.h; sourceTree = ""; }; + D34BB09C0FF9F14B00D7773A /* PKJSSymbolState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSSymbolState.m; path = jssrc/PKJSSymbolState.m; sourceTree = ""; }; + D34BB09D0FF9F14B00D7773A /* PKJSToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSToken.h; path = jssrc/PKJSToken.h; sourceTree = ""; }; + D34BB09E0FF9F14B00D7773A /* PKJSToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSToken.m; path = jssrc/PKJSToken.m; sourceTree = ""; }; + D34BB09F0FF9F14B00D7773A /* PKJSTokenAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTokenAssembly.h; path = jssrc/PKJSTokenAssembly.h; sourceTree = ""; }; + D34BB0A00FF9F14B00D7773A /* PKJSTokenAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTokenAssembly.m; path = jssrc/PKJSTokenAssembly.m; sourceTree = ""; }; + D34BB0A10FF9F14B00D7773A /* PKJSTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTokenizer.h; path = jssrc/PKJSTokenizer.h; sourceTree = ""; }; + D34BB0A20FF9F14B00D7773A /* PKJSTokenizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTokenizer.m; path = jssrc/PKJSTokenizer.m; sourceTree = ""; }; + D34BB0A30FF9F14B00D7773A /* PKJSTokenizerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTokenizerState.h; path = jssrc/PKJSTokenizerState.h; sourceTree = ""; }; + D34BB0A40FF9F14B00D7773A /* PKJSTokenizerState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTokenizerState.m; path = jssrc/PKJSTokenizerState.m; sourceTree = ""; }; + D34BB0A50FF9F14B00D7773A /* PKJSWhitespaceState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSWhitespaceState.h; path = jssrc/PKJSWhitespaceState.h; sourceTree = ""; }; + D34BB0A60FF9F14B00D7773A /* PKJSWhitespaceState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSWhitespaceState.m; path = jssrc/PKJSWhitespaceState.m; sourceTree = ""; }; + D34BB0A70FF9F14B00D7773A /* PKJSWordState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSWordState.h; path = jssrc/PKJSWordState.h; sourceTree = ""; }; + D34BB0A80FF9F14B00D7773A /* PKJSWordState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSWordState.m; path = jssrc/PKJSWordState.m; sourceTree = ""; }; + D34BB0D20FF9F28000D7773A /* PKJSAlternation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAlternation.h; path = jssrc/PKJSAlternation.h; sourceTree = ""; }; + D34BB0D30FF9F28000D7773A /* PKJSAlternation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAlternation.m; path = jssrc/PKJSAlternation.m; sourceTree = ""; }; + D34BB0D40FF9F28000D7773A /* PKJSAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAny.h; path = jssrc/PKJSAny.h; sourceTree = ""; }; + D34BB0D50FF9F28000D7773A /* PKJSAny.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAny.m; path = jssrc/PKJSAny.m; sourceTree = ""; }; + D34BB0D60FF9F28000D7773A /* PKJSAssemblerAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAssemblerAdapter.h; path = jssrc/PKJSAssemblerAdapter.h; sourceTree = ""; }; + D34BB0D70FF9F28000D7773A /* PKJSAssemblerAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAssemblerAdapter.m; path = jssrc/PKJSAssemblerAdapter.m; sourceTree = ""; }; + D34BB0D80FF9F28000D7773A /* PKJSCollectionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCollectionParser.h; path = jssrc/PKJSCollectionParser.h; sourceTree = ""; }; + D34BB0D90FF9F28000D7773A /* PKJSCollectionParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCollectionParser.m; path = jssrc/PKJSCollectionParser.m; sourceTree = ""; }; + D34BB0DA0FF9F28000D7773A /* PKJSEmpty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSEmpty.h; path = jssrc/PKJSEmpty.h; sourceTree = ""; }; + D34BB0DB0FF9F28000D7773A /* PKJSEmpty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSEmpty.m; path = jssrc/PKJSEmpty.m; sourceTree = ""; }; + D34BB0DC0FF9F28000D7773A /* PKJSParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSParser.h; path = jssrc/PKJSParser.h; sourceTree = ""; }; + D34BB0DD0FF9F28000D7773A /* PKJSParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSParser.m; path = jssrc/PKJSParser.m; sourceTree = ""; }; + D34BB0DE0FF9F28000D7773A /* PKJSRepetition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSRepetition.h; path = jssrc/PKJSRepetition.h; sourceTree = ""; }; + D34BB0DF0FF9F28000D7773A /* PKJSRepetition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSRepetition.m; path = jssrc/PKJSRepetition.m; sourceTree = ""; }; + D34BB0E00FF9F28000D7773A /* PKJSSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSSequence.h; path = jssrc/PKJSSequence.h; sourceTree = ""; }; + D34BB0E10FF9F28000D7773A /* PKJSSequence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSSequence.m; path = jssrc/PKJSSequence.m; sourceTree = ""; }; + D34BB0E20FF9F28000D7773A /* PKJSTerminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTerminal.h; path = jssrc/PKJSTerminal.h; sourceTree = ""; }; + D34BB0E30FF9F28000D7773A /* PKJSTerminal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTerminal.m; path = jssrc/PKJSTerminal.m; sourceTree = ""; }; + D34BB0E40FF9F28000D7773A /* PKJSTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTrack.h; path = jssrc/PKJSTrack.h; sourceTree = ""; }; + D34BB0E50FF9F28000D7773A /* PKJSTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTrack.m; path = jssrc/PKJSTrack.m; sourceTree = ""; }; + D34BB0FE0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCaseInsensitiveLiteral.h; path = jssrc/PKJSCaseInsensitiveLiteral.h; sourceTree = ""; }; + D34BB0FF0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCaseInsensitiveLiteral.m; path = jssrc/PKJSCaseInsensitiveLiteral.m; sourceTree = ""; }; + D34BB1000FF9F36200D7773A /* PKJSComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSComment.h; path = jssrc/PKJSComment.h; sourceTree = ""; }; + D34BB1010FF9F36200D7773A /* PKJSComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSComment.m; path = jssrc/PKJSComment.m; sourceTree = ""; }; + D34BB1020FF9F36200D7773A /* PKJSDelimitedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSDelimitedString.h; path = jssrc/PKJSDelimitedString.h; sourceTree = ""; }; + D34BB1030FF9F36200D7773A /* PKJSDelimitedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSDelimitedString.m; path = jssrc/PKJSDelimitedString.m; sourceTree = ""; }; + D34BB1040FF9F36200D7773A /* PKJSLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSLiteral.h; path = jssrc/PKJSLiteral.h; sourceTree = ""; }; + D34BB1050FF9F36200D7773A /* PKJSLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSLiteral.m; path = jssrc/PKJSLiteral.m; sourceTree = ""; }; + D34BB1060FF9F36200D7773A /* PKJSLowercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSLowercaseWord.h; path = jssrc/PKJSLowercaseWord.h; sourceTree = ""; }; + D34BB1070FF9F36200D7773A /* PKJSLowercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSLowercaseWord.m; path = jssrc/PKJSLowercaseWord.m; sourceTree = ""; }; + D34BB1080FF9F36200D7773A /* PKJSNum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSNum.h; path = jssrc/PKJSNum.h; sourceTree = ""; }; + D34BB1090FF9F36200D7773A /* PKJSNum.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSNum.m; path = jssrc/PKJSNum.m; sourceTree = ""; }; + D34BB10A0FF9F36200D7773A /* PKJSPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSPattern.h; path = jssrc/PKJSPattern.h; sourceTree = ""; }; + D34BB10B0FF9F36200D7773A /* PKJSPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSPattern.m; path = jssrc/PKJSPattern.m; sourceTree = ""; }; + D34BB10C0FF9F36200D7773A /* PKJSQuotedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSQuotedString.h; path = jssrc/PKJSQuotedString.h; sourceTree = ""; }; + D34BB10D0FF9F36200D7773A /* PKJSQuotedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSQuotedString.m; path = jssrc/PKJSQuotedString.m; sourceTree = ""; }; + D34BB10E0FF9F36200D7773A /* PKJSSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSSymbol.h; path = jssrc/PKJSSymbol.h; sourceTree = ""; }; + D34BB10F0FF9F36200D7773A /* PKJSSymbol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSSymbol.m; path = jssrc/PKJSSymbol.m; sourceTree = ""; }; + D34BB1100FF9F36200D7773A /* PKJSUppercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSUppercaseWord.h; path = jssrc/PKJSUppercaseWord.h; sourceTree = ""; }; + D34BB1110FF9F36200D7773A /* PKJSUppercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSUppercaseWord.m; path = jssrc/PKJSUppercaseWord.m; sourceTree = ""; }; + D34BB1120FF9F36200D7773A /* PKJSWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSWord.h; path = jssrc/PKJSWord.h; sourceTree = ""; }; + D34BB1130FF9F36200D7773A /* PKJSWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSWord.m; path = jssrc/PKJSWord.m; sourceTree = ""; }; + D3521F520E5FA1B0009681F9 /* XMLReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMLReader.h; path = test/XMLReader.h; sourceTree = ""; }; + D3521F530E5FA1B0009681F9 /* XMLReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMLReader.m; path = test/XMLReader.m; sourceTree = ""; }; + D3521F540E5FA1B0009681F9 /* XMLReaderTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMLReaderTest.h; path = test/XMLReaderTest.h; sourceTree = ""; }; + D3521F550E5FA1B0009681F9 /* XMLReaderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMLReaderTest.m; path = test/XMLReaderTest.m; sourceTree = ""; }; + D35384EC0FE9691100926552 /* nspredicate.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = nspredicate.grammar; path = res/nspredicate.grammar; sourceTree = ""; }; + D353899B0FEAC94400926552 /* c.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = c.grammar; path = res/c.grammar; sourceTree = ""; }; + D353899D0FEAC96B00926552 /* objc.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = objc.grammar; path = res/objc.grammar; sourceTree = ""; }; + D355C62B0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateEvaluator.h; path = test/TDNSPredicateEvaluator.h; sourceTree = ""; }; + D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateEvaluator.m; path = test/TDNSPredicateEvaluator.m; sourceTree = ""; }; + D355C62F0FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateEvaluatorTest.h; path = test/TDNSPredicateEvaluatorTest.h; sourceTree = ""; }; + D355C6300FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateEvaluatorTest.m; path = test/TDNSPredicateEvaluatorTest.m; sourceTree = ""; }; + D355C8800FEB36A1006A91A4 /* xml.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = xml.grammar; path = res/xml.grammar; sourceTree = ""; }; + D355C8830FEB4B94006A91A4 /* proto.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = proto.grammar; path = res/proto.grammar; sourceTree = ""; }; + D36568A50EEF9FE900226554 /* TDPlistParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPlistParser.h; path = test/TDPlistParser.h; sourceTree = ""; }; + D36568A60EEF9FE900226554 /* TDPlistParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPlistParser.m; path = test/TDPlistParser.m; sourceTree = ""; }; + D36568A80EEFA05300226554 /* TDPlistParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPlistParserTest.h; path = test/TDPlistParserTest.h; sourceTree = ""; }; + D36568A90EEFA05300226554 /* TDPlistParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPlistParserTest.m; path = test/TDPlistParserTest.m; sourceTree = ""; }; + D3656DFC0EF2620E00226554 /* TDTokenArraySourceTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenArraySourceTest.h; path = test/TDTokenArraySourceTest.h; sourceTree = ""; }; + D3656DFD0EF2620E00226554 /* TDTokenArraySourceTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenArraySourceTest.m; path = test/TDTokenArraySourceTest.m; sourceTree = ""; }; + D3668291101D2BFA0008632C /* erb.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = erb.grammar; path = res/erb.grammar; sourceTree = ""; }; + D3668294101D2C200008632C /* ERBTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ERBTest.h; path = test/ERBTest.h; sourceTree = ""; }; + D3668295101D2C200008632C /* ERBTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ERBTest.m; path = test/ERBTest.m; sourceTree = ""; }; + D36934551038DE5300527AF3 /* PKParseTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParseTree.h; path = test/PKParseTree.h; sourceTree = ""; }; + D36934561038DE5300527AF3 /* PKParseTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParseTree.m; path = test/PKParseTree.m; sourceTree = ""; }; + D36934571038DE5300527AF3 /* PKParseTreeAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParseTreeAssembler.h; path = test/PKParseTreeAssembler.h; sourceTree = ""; }; + D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParseTreeAssembler.m; path = test/PKParseTreeAssembler.m; sourceTree = ""; }; + D36934591038DE5300527AF3 /* PKRuleNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKRuleNode.h; path = test/PKRuleNode.h; sourceTree = ""; }; + D369345A1038DE5300527AF3 /* PKRuleNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKRuleNode.m; path = test/PKRuleNode.m; sourceTree = ""; }; + D369345B1038DE5300527AF3 /* PKTokenNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenNode.h; path = test/PKTokenNode.h; sourceTree = ""; }; + D369345C1038DE5300527AF3 /* PKTokenNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenNode.m; path = test/PKTokenNode.m; sourceTree = ""; }; + D36C53770FD27F1300141CB7 /* TDParserFactoryTest2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryTest2.h; path = test/TDParserFactoryTest2.h; sourceTree = ""; }; + D36C53780FD27F1300141CB7 /* TDParserFactoryTest2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryTest2.m; path = test/TDParserFactoryTest2.m; sourceTree = ""; }; + D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexKitLite.h; path = src/RegexKitLite.h; sourceTree = ""; }; + D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RegexKitLite.m; path = src/RegexKitLite.m; sourceTree = ""; }; + D36C560B0FD363D500141CB7 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = ""; }; + D36C56290FD365DB00141CB7 /* TDPatternTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPatternTest.h; path = test/TDPatternTest.h; sourceTree = ""; }; + D36C562A0FD365DB00141CB7 /* TDPatternTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPatternTest.m; path = test/TDPatternTest.m; sourceTree = ""; }; + D36E95440E578ECC00496BD3 /* XPathParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathParser.h; path = test/XPathParser.h; sourceTree = ""; }; + D36E95450E578ECC00496BD3 /* XPathParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathParser.m; path = test/XPathParser.m; sourceTree = ""; }; + D36E95D60E57B08400496BD3 /* XPathParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathParserTest.h; path = test/XPathParserTest.h; sourceTree = ""; }; + D36E95D70E57B08400496BD3 /* XPathParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathParserTest.m; path = test/XPathParserTest.m; sourceTree = ""; }; + D36E97AE0E589DAE00496BD3 /* XPathAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathAssembler.h; path = test/XPathAssembler.h; sourceTree = ""; }; + D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathAssembler.m; path = test/XPathAssembler.m; sourceTree = ""; }; + D36E98200E58A3A800496BD3 /* XPathContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathContext.h; path = test/XPathContext.h; sourceTree = ""; }; + D36E98210E58A3A800496BD3 /* XPathContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathContext.m; path = test/XPathContext.m; sourceTree = ""; }; + D36E98DC0E58C12800496BD3 /* DebugAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugAppDelegate.h; sourceTree = ""; }; + D36E98DD0E58C12800496BD3 /* DebugAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugAppDelegate.m; sourceTree = ""; }; + D36E98DE0E58C12800496BD3 /* DebugAppMainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DebugAppMainMenu.xib; sourceTree = ""; }; + D36E98DF0E58C12800496BD3 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + D36E98E30E58C14000496BD3 /* DemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DemoAppDelegate.h; path = demoapp/DemoAppDelegate.h; sourceTree = ""; }; + D36E98E40E58C14000496BD3 /* DemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DemoAppDelegate.m; path = demoapp/DemoAppDelegate.m; sourceTree = ""; }; + D36E98E50E58C14000496BD3 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = demoapp/main.m; sourceTree = ""; }; + D36E98F70E58C1A000496BD3 /* DemoAppMainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DemoAppMainMenu.xib; path = demoapp/DemoAppMainMenu.xib; sourceTree = ""; }; + D36E9F860E5A795400496BD3 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = ""; }; + D36E9FB40E5A944A00496BD3 /* apple-boss.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "apple-boss.xml"; path = "res/apple-boss.xml"; sourceTree = ""; }; + D36E9FE40E5BA0FC00496BD3 /* SRGSGrammar.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SRGSGrammar.txt; path = res/SRGSGrammar.txt; sourceTree = ""; }; + D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "small-xml-file.xml"; path = "res/small-xml-file.xml"; sourceTree = ""; }; + D380AFBB0F0C54B60009EC13 /* html.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = html.css; path = res/html.css; sourceTree = ""; }; + D380AFBC0F0C54B60009EC13 /* html.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = html.grammar; path = res/html.grammar; sourceTree = ""; }; + D380AFC20F0C56000009EC13 /* example.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = example.html; path = res/example.html; sourceTree = ""; }; + D380B5080F0D71A90009EC13 /* css.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = css.grammar; path = res/css.grammar; sourceTree = ""; }; + D380B5370F0D7DDE0009EC13 /* css.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = css.css; path = res/css.css; sourceTree = ""; }; + D380B5930F0D82F60009EC13 /* example.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = example.css; path = res/example.css; sourceTree = ""; }; + D380BA5F0F0F06CD0009EC13 /* TDParserFactoryTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryTest.h; path = test/TDParserFactoryTest.h; sourceTree = ""; }; + D380BA600F0F06CD0009EC13 /* TDParserFactoryTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryTest.m; path = test/TDParserFactoryTest.m; sourceTree = ""; }; + D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + D38205BC0EEE48EE004340DD /* TDTokenTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenTest.h; path = test/TDTokenTest.h; sourceTree = ""; }; + D38205BD0EEE48EE004340DD /* TDTokenTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenTest.m; path = test/TDTokenTest.m; sourceTree = ""; }; + D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json_with_comments.grammar; path = res/json_with_comments.grammar; sourceTree = ""; }; + D38349BB0F0C0D910055E4E0 /* json_with_comments.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = json_with_comments.css; path = res/json_with_comments.css; sourceTree = ""; }; + D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = yahoo_with_comments.json; path = res/yahoo_with_comments.json; sourceTree = ""; }; + D385F9880F046FE900DB2946 /* TDGenericAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDGenericAssembler.h; path = test/TDGenericAssembler.h; sourceTree = ""; }; + D385F9890F046FE900DB2946 /* TDGenericAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDGenericAssembler.m; path = test/TDGenericAssembler.m; sourceTree = ""; }; + D385FA210F04971400DB2946 /* TDGenericAssemblerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDGenericAssemblerTest.h; path = test/TDGenericAssemblerTest.h; sourceTree = ""; }; + D385FA220F04971400DB2946 /* TDGenericAssemblerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDGenericAssemblerTest.m; path = test/TDGenericAssemblerTest.m; sourceTree = ""; }; + D385FA240F04993500DB2946 /* json.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = json.css; path = res/json.css; sourceTree = ""; }; + D385FD400F05A88C00DB2946 /* TDMiniCSSAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDMiniCSSAssembler.h; path = test/TDMiniCSSAssembler.h; sourceTree = ""; }; + D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDMiniCSSAssembler.m; path = test/TDMiniCSSAssembler.m; sourceTree = ""; }; + D385FD420F05A88C00DB2946 /* TDMiniCSSAssemblerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDMiniCSSAssemblerTest.h; path = test/TDMiniCSSAssemblerTest.h; sourceTree = ""; }; + D385FD430F05A88C00DB2946 /* TDMiniCSSAssemblerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDMiniCSSAssemblerTest.m; path = test/TDMiniCSSAssemblerTest.m; sourceTree = ""; }; + D385FD6B0F05A99900DB2946 /* mini_css.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = mini_css.grammar; path = res/mini_css.grammar; sourceTree = ""; }; + D389A0B00F1FCC99003B43BD /* RelaxParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RelaxParser.h; path = test/RelaxParser.h; sourceTree = ""; }; + D389A0B10F1FCC99003B43BD /* RelaxParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RelaxParser.m; path = test/RelaxParser.m; sourceTree = ""; }; + D389F1CE0F1965E600558235 /* JSParseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JSParseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D389F2030F196A7500558235 /* JSDemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSDemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D389F20D0F196A9200558235 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + D389F2E30F196CAE00558235 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = jsdemoapp/main.m; sourceTree = ""; }; + D389F2E80F196F5B00558235 /* JSDemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDemoAppDelegate.h; path = jsdemoapp/JSDemoAppDelegate.h; sourceTree = ""; }; + D389F2E90F196F5B00558235 /* JSDemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSDemoAppDelegate.m; path = jsdemoapp/JSDemoAppDelegate.m; sourceTree = ""; }; + D389F38E0F19800400558235 /* DefaultValues.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = DefaultValues.plist; path = jsdemoapp/DefaultValues.plist; sourceTree = ""; }; + D389F4610F198A8800558235 /* Test.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = Test.html; path = jsdemoapp/Test.html; sourceTree = ""; }; + D389F5580F19B7BC00558235 /* JSDemoAppMainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = JSDemoAppMainMenu.xib; path = jsdemoapp/JSDemoAppMainMenu.xib; sourceTree = ""; }; + D389F5B20F19C76A00558235 /* TDJsonParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJsonParser.h; path = test/TDJsonParser.h; sourceTree = ""; }; + D389F5B30F19C76A00558235 /* TDJsonParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJsonParser.m; path = test/TDJsonParser.m; sourceTree = ""; }; + D389F5B40F19C76A00558235 /* TDJsonParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJsonParserTest.h; path = test/TDJsonParserTest.h; sourceTree = ""; }; + D389F5B50F19C76A00558235 /* TDJsonParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJsonParserTest.m; path = test/TDJsonParserTest.m; sourceTree = ""; }; + D389FBCC0F1B25E200558235 /* ParserTest.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = ParserTest.html; path = jsdemoapp/ParserTest.html; sourceTree = ""; }; + D38DD9E70EC29F260070BC4D /* nyt.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = nyt.html; path = res/nyt.html; sourceTree = ""; }; + D38E97CA1061CF6500739C39 /* TDTokenizerBlocksTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenizerBlocksTest.h; path = test/TDTokenizerBlocksTest.h; sourceTree = ""; }; + D38E97CB1061CF6500739C39 /* TDTokenizerBlocksTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenizerBlocksTest.m; path = test/TDTokenizerBlocksTest.m; sourceTree = ""; }; + D38E98D61062C5BA00739C39 /* TDParserBlocksTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserBlocksTest.h; path = test/TDParserBlocksTest.h; sourceTree = ""; }; + D38E98D71062C5BA00739C39 /* TDParserBlocksTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserBlocksTest.m; path = test/TDParserBlocksTest.m; sourceTree = ""; }; + D3AF49760FDB122E0032F4DC /* TDParserFactoryPatternTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryPatternTest.h; path = test/TDParserFactoryPatternTest.h; sourceTree = ""; }; + D3AF49770FDB122E0032F4DC /* TDParserFactoryPatternTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryPatternTest.m; path = test/TDParserFactoryPatternTest.m; sourceTree = ""; }; + D3AF4BE80FDC3DD50032F4DC /* TDBlob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDBlob.h; path = test/TDBlob.h; sourceTree = ""; }; + D3AF4BE90FDC3DD50032F4DC /* TDBlob.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDBlob.m; path = test/TDBlob.m; sourceTree = ""; }; + D3AF4BF50FDC40050032F4DC /* TDToken+Blob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "TDToken+Blob.h"; path = "test/TDToken+Blob.h"; sourceTree = ""; }; + D3AF4BF60FDC40050032F4DC /* TDToken+Blob.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "TDToken+Blob.m"; path = "test/TDToken+Blob.m"; sourceTree = ""; }; + D3AF4BFB0FDC41190032F4DC /* TDTokenizer+BlobState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "TDTokenizer+BlobState.h"; path = "test/TDTokenizer+BlobState.h"; sourceTree = ""; }; + D3AF4BFC0FDC41190032F4DC /* TDTokenizer+BlobState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "TDTokenizer+BlobState.m"; path = "test/TDTokenizer+BlobState.m"; sourceTree = ""; }; + D3AF4C190FDC568F0032F4DC /* TDBlobState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDBlobState.h; path = test/TDBlobState.h; sourceTree = ""; }; + D3AF4C1A0FDC568F0032F4DC /* TDBlobState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDBlobState.m; path = test/TDBlobState.m; sourceTree = ""; }; + D3AF4CBF0FDC740A0032F4DC /* TDNonReservedWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNonReservedWord.h; path = test/TDNonReservedWord.h; sourceTree = ""; }; + D3AF4CC00FDC740A0032F4DC /* TDNonReservedWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNonReservedWord.m; path = test/TDNonReservedWord.m; sourceTree = ""; }; + D3AF4CC10FDC740A0032F4DC /* TDReservedWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDReservedWord.h; path = test/TDReservedWord.h; sourceTree = ""; }; + D3AF4CC20FDC740A0032F4DC /* TDReservedWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDReservedWord.m; path = test/TDReservedWord.m; sourceTree = ""; }; + D3AF4CC30FDC740A0032F4DC /* TDSignificantWhitespaceState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSignificantWhitespaceState.h; path = test/TDSignificantWhitespaceState.h; sourceTree = ""; }; + D3AF4CC40FDC740A0032F4DC /* TDSignificantWhitespaceState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSignificantWhitespaceState.m; path = test/TDSignificantWhitespaceState.m; sourceTree = ""; }; + D3AF4CC50FDC740A0032F4DC /* TDWordOrReservedState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDWordOrReservedState.h; path = test/TDWordOrReservedState.h; sourceTree = ""; }; + D3AF4CC60FDC740A0032F4DC /* TDWordOrReservedState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDWordOrReservedState.m; path = test/TDWordOrReservedState.m; sourceTree = ""; }; + D3B43FB50F76E99C0072AF40 /* TDJavaScriptParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJavaScriptParserTest.h; path = test/TDJavaScriptParserTest.h; sourceTree = ""; }; + D3B43FB60F76E99C0072AF40 /* TDJavaScriptParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJavaScriptParserTest.m; path = test/TDJavaScriptParserTest.m; sourceTree = ""; }; + D3B473840E48C9CF008AFBDD /* yahoo.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = yahoo.json; path = res/yahoo.json; sourceTree = ""; }; + D3B69D310E80249900D70C41 /* nonascii.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = nonascii.html; path = res/nonascii.html; sourceTree = ""; }; + D3BBBC960FEC9722007DF30D /* TDXMLParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXMLParserTest.h; path = test/TDXMLParserTest.h; sourceTree = ""; }; + D3BBBC970FEC9722007DF30D /* TDXMLParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXMLParserTest.m; path = test/TDXMLParserTest.m; sourceTree = ""; }; + D3BBBC9B0FEC9756007DF30D /* TDXMLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXMLParser.h; path = test/TDXMLParser.h; sourceTree = ""; }; + D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXMLParser.m; path = test/TDXMLParser.m; sourceTree = ""; }; + D3C031EB0EF38D2D00C5ABEB /* TDLowercaseWordTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDLowercaseWordTest.h; path = test/TDLowercaseWordTest.h; sourceTree = ""; }; + D3C031EC0EF38D2D00C5ABEB /* TDLowercaseWordTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDLowercaseWordTest.m; path = test/TDLowercaseWordTest.m; sourceTree = ""; }; + D3C2216D0FFE8A86004514FE /* PKExclusion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKExclusion.h; path = test/PKExclusion.h; sourceTree = ""; }; + D3C221900FFE8B8C004514FE /* ParseKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ParseKit.h; path = include/ParseKit/ParseKit.h; sourceTree = ""; }; + D3C221910FFE8B8C004514FE /* PKTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTypes.h; path = include/ParseKit/PKTypes.h; sourceTree = ""; }; + D3C221960FFE8B95004514FE /* PKReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKReader.h; path = include/ParseKit/PKReader.h; sourceTree = ""; }; + D3C221990FFE8B9D004514FE /* PKAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAssembly.h; path = include/ParseKit/PKAssembly.h; sourceTree = ""; }; + D3C2219C0FFE8BA6004514FE /* PKParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParser.h; path = include/ParseKit/PKParser.h; sourceTree = ""; }; + D3C2219F0FFE8BAE004514FE /* PKRepetition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKRepetition.h; path = include/ParseKit/PKRepetition.h; sourceTree = ""; }; + D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCollectionParser.h; path = include/ParseKit/PKCollectionParser.h; sourceTree = ""; }; + D3C221A50FFE8BC1004514FE /* PKAlternation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAlternation.h; path = include/ParseKit/PKAlternation.h; sourceTree = ""; }; + D3C221A80FFE8BC9004514FE /* PKSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSequence.h; path = include/ParseKit/PKSequence.h; sourceTree = ""; }; + D3C221AB0FFE8BCF004514FE /* PKTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTrack.h; path = include/ParseKit/PKTrack.h; sourceTree = ""; }; + D3C221AE0FFE8BD4004514FE /* PKTrackException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTrackException.h; path = include/ParseKit/PKTrackException.h; sourceTree = ""; }; + D3C221B10FFE8BDB004514FE /* PKIntersection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKIntersection.h; path = include/ParseKit/PKIntersection.h; sourceTree = ""; }; + D3C221B40FFE8BE2004514FE /* PKDifference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDifference.h; path = include/ParseKit/PKDifference.h; sourceTree = ""; }; + D3C221B70FFE8BE8004514FE /* PKNegation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKNegation.h; path = include/ParseKit/PKNegation.h; sourceTree = ""; }; + D3C221BA0FFE8BEF004514FE /* PKTerminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTerminal.h; path = include/ParseKit/PKTerminal.h; sourceTree = ""; }; + D3C221BD0FFE8BF7004514FE /* PKEmpty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKEmpty.h; path = include/ParseKit/PKEmpty.h; sourceTree = ""; }; + D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenAssembly.h; path = include/ParseKit/PKTokenAssembly.h; sourceTree = ""; }; + D3C221C30FFE8C07004514FE /* PKToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKToken.h; path = include/ParseKit/PKToken.h; sourceTree = ""; }; + D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenArraySource.h; path = include/ParseKit/PKTokenArraySource.h; sourceTree = ""; }; + D3C221C90FFE8C15004514FE /* PKTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenizer.h; path = include/ParseKit/PKTokenizer.h; sourceTree = ""; }; + D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenizerState.h; path = include/ParseKit/PKTokenizerState.h; sourceTree = ""; }; + D3C221CF0FFE8C24004514FE /* PKNumberState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKNumberState.h; path = include/ParseKit/PKNumberState.h; sourceTree = ""; }; + D3C221D50FFE8C35004514FE /* PKSymbolState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbolState.h; path = include/ParseKit/PKSymbolState.h; sourceTree = ""; }; + D3C221D80FFE8C3D004514FE /* PKWordState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWordState.h; path = include/ParseKit/PKWordState.h; sourceTree = ""; }; + D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWhitespaceState.h; path = include/ParseKit/PKWhitespaceState.h; sourceTree = ""; }; + D3C221DE0FFE8C49004514FE /* PKDelimitState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDelimitState.h; path = include/ParseKit/PKDelimitState.h; sourceTree = ""; }; + D3C221E10FFE8C4E004514FE /* PKCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCommentState.h; path = include/ParseKit/PKCommentState.h; sourceTree = ""; }; + D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSingleLineCommentState.h; path = include/ParseKit/PKSingleLineCommentState.h; sourceTree = ""; }; + D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKMultiLineCommentState.h; path = include/ParseKit/PKMultiLineCommentState.h; sourceTree = ""; }; + D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbolNode.h; path = include/ParseKit/PKSymbolNode.h; sourceTree = ""; }; + D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbolRootNode.h; path = include/ParseKit/PKSymbolRootNode.h; sourceTree = ""; }; + D3C221F00FFE8C7A004514FE /* PKPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKPattern.h; path = include/ParseKit/PKPattern.h; sourceTree = ""; }; + D3C221F30FFE8C87004514FE /* PKWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWord.h; path = include/ParseKit/PKWord.h; sourceTree = ""; }; + D3C221F60FFE8C8E004514FE /* PKNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKNumber.h; path = include/ParseKit/PKNumber.h; sourceTree = ""; }; + D3C221F90FFE8C97004514FE /* PKQuotedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKQuotedString.h; path = include/ParseKit/PKQuotedString.h; sourceTree = ""; }; + D3C221FC0FFE8CB2004514FE /* PKSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbol.h; path = include/ParseKit/PKSymbol.h; sourceTree = ""; }; + D3C221FF0FFE8CB9004514FE /* PKLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKLiteral.h; path = include/ParseKit/PKLiteral.h; sourceTree = ""; }; + D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCaseInsensitiveLiteral.h; path = include/ParseKit/PKCaseInsensitiveLiteral.h; sourceTree = ""; }; + D3C222050FFE8CCA004514FE /* PKWhitespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWhitespace.h; path = include/ParseKit/PKWhitespace.h; sourceTree = ""; }; + D3C222080FFE8CD1004514FE /* PKComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKComment.h; path = include/ParseKit/PKComment.h; sourceTree = ""; }; + D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDelimitedString.h; path = include/ParseKit/PKDelimitedString.h; sourceTree = ""; }; + D3C2220E0FFE8CDF004514FE /* PKAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAny.h; path = include/ParseKit/PKAny.h; sourceTree = ""; }; + D3C222140FFE8D01004514FE /* PKLowercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKLowercaseWord.h; path = include/ParseKit/PKLowercaseWord.h; sourceTree = ""; }; + D3C222170FFE8D11004514FE /* PKUppercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKUppercaseWord.h; path = include/ParseKit/PKUppercaseWord.h; sourceTree = ""; }; + D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCharacterAssembly.h; path = include/ParseKit/PKCharacterAssembly.h; sourceTree = ""; }; + D3C2221D0FFE8D3B004514FE /* PKChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKChar.h; path = include/ParseKit/PKChar.h; sourceTree = ""; }; + D3C222200FFE8D42004514FE /* PKDigit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDigit.h; path = include/ParseKit/PKDigit.h; sourceTree = ""; }; + D3C222230FFE8D49004514FE /* PKLetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKLetter.h; path = include/ParseKit/PKLetter.h; sourceTree = ""; }; + D3C222260FFE8D6B004514FE /* PKSpecificChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSpecificChar.h; path = include/ParseKit/PKSpecificChar.h; sourceTree = ""; }; + D3C222290FFE8DAC004514FE /* PKParserFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParserFactory.h; path = include/ParseKit/PKParserFactory.h; sourceTree = ""; }; + D3C7D87A0A411FBF005DD154 /* Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + D3C85C790E63B438000445FD /* TDArithmeticParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDArithmeticParser.h; path = test/TDArithmeticParser.h; sourceTree = ""; }; + D3C85C7A0E63B438000445FD /* TDArithmeticParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDArithmeticParser.m; path = test/TDArithmeticParser.m; sourceTree = ""; }; + D3C85C7E0E63B9E9000445FD /* TDArithmeticParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDArithmeticParserTest.h; path = test/TDArithmeticParserTest.h; sourceTree = ""; }; + D3C85C7F0E63B9E9000445FD /* TDArithmeticParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDArithmeticParserTest.m; path = test/TDArithmeticParserTest.m; sourceTree = ""; }; + D3C85D430E63D1BF000445FD /* TDScientificNumberStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDScientificNumberStateTest.h; path = test/TDScientificNumberStateTest.h; sourceTree = ""; }; + D3C85D440E63D1BF000445FD /* TDScientificNumberStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDScientificNumberStateTest.m; path = test/TDScientificNumberStateTest.m; sourceTree = ""; }; + D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json_with_discards.grammar; path = res/json_with_discards.grammar; sourceTree = ""; }; + D3D1BF2610394420003656E5 /* SAXAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SAXAssembler.h; path = test/SAXAssembler.h; sourceTree = ""; }; + D3D1BF2710394420003656E5 /* SAXAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SAXAssembler.m; path = test/SAXAssembler.m; sourceTree = ""; }; + D3D1BF291039445C003656E5 /* SAXTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SAXTest.h; path = test/SAXTest.h; sourceTree = ""; }; + D3D1BF2A1039445C003656E5 /* SAXTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SAXTest.m; path = test/SAXTest.m; sourceTree = ""; }; + D3DCB35C0EF5E52500DE5110 /* OCMock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OCMock.framework; path = frameworks/OCMock.framework; sourceTree = ""; }; + D3DCB4C20EF6015300DE5110 /* json.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json.grammar; path = res/json.grammar; sourceTree = ""; }; + D3DDDA850F0779FD00A58000 /* TDSyntaxHighlighter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSyntaxHighlighter.h; path = test/TDSyntaxHighlighter.h; sourceTree = ""; }; + D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSyntaxHighlighter.m; path = test/TDSyntaxHighlighter.m; sourceTree = ""; }; + D3DDDAFC0F083C9700A58000 /* TDCommentStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDCommentStateTest.h; path = test/TDCommentStateTest.h; sourceTree = ""; }; + D3DDDAFD0F083C9700A58000 /* TDCommentStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDCommentStateTest.m; path = test/TDCommentStateTest.m; sourceTree = ""; }; + D3DDDC230F085C5400A58000 /* TDSlashSlashState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashSlashState.h; path = test/TDSlashSlashState.h; sourceTree = ""; }; + D3DDDC240F085C5400A58000 /* TDSlashSlashState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashSlashState.m; path = test/TDSlashSlashState.m; sourceTree = ""; }; + D3DDDC250F085C5400A58000 /* TDSlashStarState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashStarState.h; path = test/TDSlashStarState.h; sourceTree = ""; }; + D3DDDC260F085C5400A58000 /* TDSlashStarState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashStarState.m; path = test/TDSlashStarState.m; sourceTree = ""; }; + D3DDDC270F085C5400A58000 /* TDSlashState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashState.h; path = test/TDSlashState.h; sourceTree = ""; }; + D3DDDC280F085C5400A58000 /* TDSlashState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashState.m; path = test/TDSlashState.m; sourceTree = ""; }; + D3DDDCAC0F0880D800A58000 /* example1.srgs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = example1.srgs; path = res/example1.srgs; sourceTree = ""; }; + D3E39C3D0FC5FFD10022DAB9 /* TDDelimitStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDDelimitStateTest.h; path = test/TDDelimitStateTest.h; sourceTree = ""; }; + D3E39C3E0FC5FFD10022DAB9 /* TDDelimitStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDDelimitStateTest.m; path = test/TDDelimitStateTest.m; sourceTree = ""; }; + D3E784BC0E53DA28008C7D61 /* apple-boss.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "apple-boss.json"; path = "res/apple-boss.json"; sourceTree = ""; }; + D3E788910E567DFD008C7D61 /* SRGSParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SRGSParserTest.h; path = test/SRGSParserTest.h; sourceTree = ""; }; + D3E788920E567DFD008C7D61 /* SRGSParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SRGSParserTest.m; path = test/SRGSParserTest.m; sourceTree = ""; }; + D3E788940E567E0A008C7D61 /* SRGSParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SRGSParser.h; path = test/SRGSParser.h; sourceTree = ""; }; + D3E788950E567E0A008C7D61 /* SRGSParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SRGSParser.m; path = test/SRGSParser.m; sourceTree = ""; }; + D3E78A150E574C99008C7D61 /* EBNFParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EBNFParser.h; path = test/EBNFParser.h; sourceTree = ""; }; + D3E78A160E574C99008C7D61 /* EBNFParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EBNFParser.m; path = test/EBNFParser.m; sourceTree = ""; }; + D3E78A170E574C99008C7D61 /* EBNFParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EBNFParserTest.h; path = test/EBNFParserTest.h; sourceTree = ""; }; + D3E78A180E574C99008C7D61 /* EBNFParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EBNFParserTest.m; path = test/EBNFParserTest.m; sourceTree = ""; }; + D3EADD7F0E75E9CC00F78584 /* nasty.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = nasty.html; path = res/nasty.html; sourceTree = ""; }; + D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDHtmlSyntaxHighlighter.m; path = test/TDHtmlSyntaxHighlighter.m; sourceTree = ""; }; + D3EADD8D0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDHtmlSyntaxHighlighter.h; path = test/TDHtmlSyntaxHighlighter.h; sourceTree = ""; }; + D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKQuoteState.h; path = include/ParseKit/PKQuoteState.h; sourceTree = ""; }; + D3F0E3290FFEA1E200C9DF74 /* DebugApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "DebugApp-Info.plist"; sourceTree = ""; }; + D3F0E3600FFEA2B500C9DF74 /* DemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "DemoApp-Info.plist"; path = "demoapp/DemoApp-Info.plist"; sourceTree = ""; }; + D3F0E36C0FFEA33700C9DF74 /* Tests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Tests-Info.plist"; path = "test/Tests-Info.plist"; sourceTree = ""; }; + D3F0E37A0FFEA39000C9DF74 /* JSDemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "JSDemoApp-Info.plist"; path = "jsdemoapp/JSDemoApp-Info.plist"; sourceTree = ""; }; + D3F55F5F1025737D00DD6DB1 /* TDParseTreeTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParseTreeTest.h; path = test/TDParseTreeTest.h; sourceTree = ""; }; + D3F55F601025737D00DD6DB1 /* TDParseTreeTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParseTreeTest.m; path = test/TDParseTreeTest.m; sourceTree = ""; }; + D3F5629810266CFC00DD6DB1 /* PKParseTreeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParseTreeView.h; path = demoapp/PKParseTreeView.h; sourceTree = ""; }; + D3F5629910266CFC00DD6DB1 /* PKParseTreeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParseTreeView.m; path = demoapp/PKParseTreeView.m; sourceTree = ""; }; + D3F5629E10266DFB00DD6DB1 /* DemoTokensViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DemoTokensViewController.h; path = demoapp/DemoTokensViewController.h; sourceTree = ""; }; + D3F5629F10266DFB00DD6DB1 /* DemoTokensViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DemoTokensViewController.m; path = demoapp/DemoTokensViewController.m; sourceTree = ""; }; + D3F562A110266E5300DD6DB1 /* TokensView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = TokensView.xib; path = demoapp/TokensView.xib; sourceTree = ""; }; + D3F562A310266E6300DD6DB1 /* TreesView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = TreesView.xib; path = demoapp/TreesView.xib; sourceTree = ""; }; + D3F562A510266E8D00DD6DB1 /* DemoTreesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DemoTreesViewController.h; path = demoapp/DemoTreesViewController.h; sourceTree = ""; }; + D3F562A610266E8D00DD6DB1 /* DemoTreesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DemoTreesViewController.m; path = demoapp/DemoTreesViewController.m; sourceTree = ""; }; + D3F740B50EF8C38A00559B9F /* JSONAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONAssembler.h; sourceTree = ""; }; + D3F740B60EF8C38A00559B9F /* JSONAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONAssembler.m; sourceTree = ""; }; + D3F741430EF8E96A00559B9F /* xpath1_0.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = xpath1_0.grammar; path = res/xpath1_0.grammar; sourceTree = ""; }; + D3F741BD0EF9F28D00559B9F /* css2_1.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = css2_1.grammar; path = res/css2_1.grammar; sourceTree = ""; }; + D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rubyhash.grammar; path = res/rubyhash.grammar; sourceTree = ""; }; + D3FDC5830FFC4BFC00F1F797 /* libparsekit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libparsekit.a; sourceTree = BUILT_PRODUCTS_DIR; }; + D3FDC7360FFC4D6100F1F797 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D3FDC7380FFC4D6100F1F797 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; }; + D3FDC74B0FFC4DAC00F1F797 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + D3FDC8DB0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseKitMobile_Prefix.pch; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DC2EF560486A6940098B216 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3E787A30E5661A9008C7D61 /* Foundation.framework in Frameworks */, + D36C560C0FD363D500141CB7 /* libicucore.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D334940E0E2963FD00406085 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D33494720E29670B00406085 /* ParseKit.framework in Frameworks */, + D37D3A000FE77A71008C2E4D /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D34185020E520D3F0081B0DC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D31FE7380E60F36600A0803E /* libxml2.dylib in Frameworks */, + D341850C0E520D640081B0DC /* ParseKit.framework in Frameworks */, + D380B9800F0EF3860009EC13 /* OCMock.framework in Frameworks */, + D380BAA30F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */, + D37D3A010FE77A72008C2E4D /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1CC0F1965E600558235 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F34E0F197DF500558235 /* JavaScriptCore.framework in Frameworks */, + D389F1D50F19666500558235 /* ParseKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F2010F196A7500558235 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F3430F197DDC00558235 /* JavaScriptCore.framework in Frameworks */, + D389F20E0F196A9200558235 /* WebKit.framework in Frameworks */, + D389F20C0F196A9200558235 /* ParseKit.framework in Frameworks */, + D389F20B0F196A9200558235 /* JSParseKit.framework in Frameworks */, + D37D3A020FE77A77008C2E4D /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3C7D8770A411FBF005DD154 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3DCB37D0EF5E5E400DE5110 /* OCMock.framework in Frameworks */, + D3C7D9DA0A412874005DD154 /* ParseKit.framework in Frameworks */, + D36E9F870E5A795400496BD3 /* libxml2.dylib in Frameworks */, + D380BAA40F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */, + D3587EAF0FE83EC900DDD023 /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3FDC5810FFC4BFC00F1F797 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3FDC7370FFC4D6100F1F797 /* Foundation.framework in Frameworks */, + D3FDC7390FFC4D6100F1F797 /* libicucore.dylib in Frameworks */, + D3FDC74C0FFC4DAC00F1F797 /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 034768DFFF38A50411DB9C8B /* Products */ = { + isa = PBXGroup; + children = ( + 8DC2EF5B0486A6940098B216 /* ParseKit.framework */, + D389F1CE0F1965E600558235 /* JSParseKit.framework */, + D3C7D87A0A411FBF005DD154 /* Tests.octest */, + D33494100E2963FD00406085 /* DemoApp.app */, + D34185040E520D3F0081B0DC /* DebugApp.app */, + D389F2030F196A7500558235 /* JSDemoApp.app */, + D3FDC5830FFC4BFC00F1F797 /* libparsekit.a */, + ); + name = Products; + sourceTree = ""; + }; + 0867D691FE84028FC02AAC07 /* TODParseKit */ = { + isa = PBXGroup; + children = ( + 08FB77AEFE84172EC02AAC07 /* ParseKit Framework */, + D3C7D8220A411F31005DD154 /* ParseKit Tests */, + D36E98CB0E58C08F00496BD3 /* DebugApp */, + D334941B0E29641300406085 /* DemoApp */, + D380BA950F0F1C450009EC13 /* JSParseKit Framework */, + D389F2CA0F196ACF00558235 /* JSDemoApp */, + D3AF4C8E0FDC738B0032F4DC /* Other Sources */, + 32C88DFF0371C24200C91783 /* Other Sources (not used) */, + 089C1665FE841158C02AAC07 /* Resources */, + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, + 034768DFFF38A50411DB9C8B /* Products */, + ); + name = TODParseKit; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + D3FDC8EF0FFC52CD00F1F797 /* Mobile Frameworks */, + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + 8DC2EF5A0486A6940098B216 /* Info.plist */, + 089C1666FE841158C02AAC07 /* InfoPlist.strings */, + ); + name = Resources; + sourceTree = ""; + }; + 08FB77AEFE84172EC02AAC07 /* ParseKit Framework */ = { + isa = PBXGroup; + children = ( + D3C221900FFE8B8C004514FE /* ParseKit.h */, + D3C221910FFE8B8C004514FE /* PKTypes.h */, + D3C7D8710A411F6B005DD154 /* io */, + D3C7D8720A411F81005DD154 /* parse */, + D3C7D8740A411F8E005DD154 /* tokens */, + D3E785F10E550F63008C7D61 /* chars */, + D34BAC0F0FF87ED200D7773A /* grammar */, + ); + name = "ParseKit Framework"; + sourceTree = ""; + }; + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + D389F20D0F196A9200558235 /* WebKit.framework */, + D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */, + D3DCB35C0EF5E52500DE5110 /* OCMock.framework */, + D36E9F860E5A795400496BD3 /* libxml2.dylib */, + D36C560B0FD363D500141CB7 /* libicucore.dylib */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 0867D6A5FE840307C02AAC07 /* AppKit.framework */, + 0867D69BFE84028FC02AAC07 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 32C88DFF0371C24200C91783 /* Other Sources (not used) */ = { + isa = PBXGroup; + children = ( + D3C2216D0FFE8A86004514FE /* PKExclusion.h */, + D31270F80FFE898300CBF4C4 /* PKExclusion.m */, + D3AF4CCB0FDC74540032F4DC /* Whitespace */, + D3AF4CCA0FDC74490032F4DC /* Slash */, + D3AF4CC90FDC743C0032F4DC /* ReservedWord */, + D3AF4CC80FDC74320032F4DC /* Blob */, + ); + name = "Other Sources (not used)"; + sourceTree = ""; + }; + D318EAE30E2FD5B6009F47DF /* json */ = { + isa = PBXGroup; + children = ( + D3E784BC0E53DA28008C7D61 /* apple-boss.json */, + D3B473840E48C9CF008AFBDD /* yahoo.json */, + D389F5B20F19C76A00558235 /* TDJsonParser.h */, + D389F5B30F19C76A00558235 /* TDJsonParser.m */, + D389F5B40F19C76A00558235 /* TDJsonParserTest.h */, + D389F5B50F19C76A00558235 /* TDJsonParserTest.m */, + D31FE5A10E60E5D500A0803E /* TDFastJsonParser.h */, + D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */, + D31FE5A30E60E5D500A0803E /* TDFastJsonParserTest.h */, + D31FE5A40E60E5D500A0803E /* TDFastJsonParserTest.m */, + ); + name = json; + sourceTree = ""; + }; + D31A164F0F703899002AFDF1 /* javascript */ = { + isa = PBXGroup; + children = ( + D31A16500F7038C2002AFDF1 /* TDJavaScriptParser.h */, + D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */, + D3B43FB50F76E99C0072AF40 /* TDJavaScriptParserTest.h */, + D3B43FB60F76E99C0072AF40 /* TDJavaScriptParserTest.m */, + ); + name = javascript; + sourceTree = ""; + }; + D3252F670FCE171D005EF059 /* predicate */ = { + isa = PBXGroup; + children = ( + D355C62B0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.h */, + D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */, + D355C62F0FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.h */, + D355C6300FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m */, + D35384EC0FE9691100926552 /* nspredicate.grammar */, + D3252F7C0FCE1A87005EF059 /* TDNSPredicateBuilder.h */, + D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */, + D3252F780FCE1A7E005EF059 /* TDNSPredicateBuilderTest.h */, + D3252F790FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m */, + D3385FD70FCFB1FF003BF729 /* TDPredicateEvaluator.h */, + D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */, + D3385FDB0FCFB227003BF729 /* TDPredicateEvaluatorTest.h */, + D3385FDC0FCFB227003BF729 /* TDPredicateEvaluatorTest.m */, + ); + name = predicate; + sourceTree = ""; + }; + D3305C52102F5BB300DC4F75 /* Trees */ = { + isa = PBXGroup; + children = ( + D3F562A310266E6300DD6DB1 /* TreesView.xib */, + D3F562A510266E8D00DD6DB1 /* DemoTreesViewController.h */, + D3F562A610266E8D00DD6DB1 /* DemoTreesViewController.m */, + D3F5629810266CFC00DD6DB1 /* PKParseTreeView.h */, + D3F5629910266CFC00DD6DB1 /* PKParseTreeView.m */, + D3305C53102F5BC500DC4F75 /* SourceCodeView */, + ); + name = Trees; + sourceTree = ""; + }; + D3305C53102F5BC500DC4F75 /* SourceCodeView */ = { + isa = PBXGroup; + children = ( + D3305C4B102F5BAD00DC4F75 /* TDGutterView.h */, + D3305C4C102F5BAD00DC4F75 /* TDGutterView.m */, + D3305C4D102F5BAE00DC4F75 /* TDSourceCodeTextView.h */, + D3305C4E102F5BAE00DC4F75 /* TDSourceCodeTextView.m */, + ); + name = SourceCodeView; + sourceTree = ""; + }; + D3305C54102F5BE500DC4F75 /* Tokens */ = { + isa = PBXGroup; + children = ( + D3F562A110266E5300DD6DB1 /* TokensView.xib */, + D3F5629E10266DFB00DD6DB1 /* DemoTokensViewController.h */, + D3F5629F10266DFB00DD6DB1 /* DemoTokensViewController.m */, + ); + name = Tokens; + sourceTree = ""; + }; + D334941B0E29641300406085 /* DemoApp */ = { + isa = PBXGroup; + children = ( + D3F0E3600FFEA2B500C9DF74 /* DemoApp-Info.plist */, + D36E98F70E58C1A000496BD3 /* DemoAppMainMenu.xib */, + D36E98E50E58C14000496BD3 /* main.m */, + D36E98E30E58C14000496BD3 /* DemoAppDelegate.h */, + D36E98E40E58C14000496BD3 /* DemoAppDelegate.m */, + D3305C54102F5BE500DC4F75 /* Tokens */, + D3305C52102F5BB300DC4F75 /* Trees */, + ); + name = DemoApp; + sourceTree = ""; + }; + D3376D1110091C6C00E4602E /* ParseTree */ = { + isa = PBXGroup; + children = ( + D3F55F5F1025737D00DD6DB1 /* TDParseTreeTest.h */, + D3F55F601025737D00DD6DB1 /* TDParseTreeTest.m */, + ); + name = ParseTree; + sourceTree = ""; + }; + D3376D7710096BDE00E4602E /* IR */ = { + isa = PBXGroup; + children = ( + D3F5619C1026374400DD6DB1 /* ir */, + D3376D1110091C6C00E4602E /* ParseTree */, + D3376D8B10096BEF00E4602E /* Homo */, + ); + name = IR; + sourceTree = ""; + }; + D3376D8B10096BEF00E4602E /* Homo */ = { + isa = PBXGroup; + children = ( + D3376D8C10096C0700E4602E /* PKAST.h */, + D3376D8D10096C0700E4602E /* PKAST.m */, + ); + name = Homo; + sourceTree = ""; + }; + D341846A0E5209A60081B0DC /* tokenizer */ = { + isa = PBXGroup; + children = ( + D3C221C30FFE8C07004514FE /* PKToken.h */, + D34BAE950FF9D20900D7773A /* PKToken.m */, + D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */, + D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */, + D3C221C90FFE8C15004514FE /* PKTokenizer.h */, + D34BAE990FF9D20900D7773A /* PKTokenizer.m */, + D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */, + D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */, + ); + name = tokenizer; + sourceTree = ""; + }; + D34A20080E55FD5F00A4A0BF /* chars */ = { + isa = PBXGroup; + children = ( + D31FE58C0E60E5AC00A0803E /* TDCharacterAssemblyTest.h */, + D31FE58D0E60E5AC00A0803E /* TDCharacterAssemblyTest.m */, + D31FE58E0E60E5AC00A0803E /* TDCharTest.h */, + D31FE58F0E60E5AC00A0803E /* TDCharTest.m */, + D31FE5900E60E5AC00A0803E /* TDDigitTest.h */, + D31FE5910E60E5AC00A0803E /* TDDigitTest.m */, + D31FE5920E60E5AC00A0803E /* TDLetterTest.h */, + D31FE5930E60E5AC00A0803E /* TDLetterTest.m */, + D31FE5940E60E5AC00A0803E /* TDSpecificCharTest.h */, + D31FE5950E60E5AC00A0803E /* TDSpecificCharTest.m */, + ); + name = chars; + sourceTree = ""; + }; + D34BAC0F0FF87ED200D7773A /* grammar */ = { + isa = PBXGroup; + children = ( + D3C222290FFE8DAC004514FE /* PKParserFactory.h */, + D34BAFD80FF9E95500D7773A /* PKParserFactory.m */, + D3376D5710093A1600E4602E /* PKGrammarParser.h */, + D3376D5810093A1600E4602E /* PKGrammarParser.m */, + D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */, + D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */, + D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */, + D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */, + ); + name = grammar; + sourceTree = ""; + }; + D3541F870DFB105900429B4F /* states */ = { + isa = PBXGroup; + children = ( + D3C221CF0FFE8C24004514FE /* PKNumberState.h */, + D34BAECA0FF9D56400D7773A /* PKNumberState.m */, + D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */, + D34BAECC0FF9D56400D7773A /* PKQuoteState.m */, + D3C221D50FFE8C35004514FE /* PKSymbolState.h */, + D34BAED00FF9D56400D7773A /* PKSymbolState.m */, + D3C221D80FFE8C3D004514FE /* PKWordState.h */, + D34BAED60FF9D56400D7773A /* PKWordState.m */, + D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */, + D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */, + D3C221DE0FFE8C49004514FE /* PKDelimitState.h */, + D34BAEC60FF9D56400D7773A /* PKDelimitState.m */, + D3C221E10FFE8C4E004514FE /* PKCommentState.h */, + D34BAEC40FF9D56400D7773A /* PKCommentState.m */, + D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */, + D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */, + D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */, + D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */, + D3541F890DFB108300429B4F /* symbol */, + ); + name = states; + sourceTree = ""; + }; + D3541F890DFB108300429B4F /* symbol */ = { + isa = PBXGroup; + children = ( + D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */, + D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */, + D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */, + D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */, + ); + name = symbol; + sourceTree = ""; + }; + D35420EC0DFB275400429B4F /* tokenizer states */ = { + isa = PBXGroup; + children = ( + D34BAD16100A9B7900996341 /* TDTokenizerStateTest.h */, + D34BAD17100A9B7900996341 /* TDTokenizerStateTest.m */, + D31FE5770E60E58C00A0803E /* TDNumberStateTest.h */, + D31FE5780E60E58C00A0803E /* TDNumberStateTest.m */, + D31FE5790E60E58C00A0803E /* TDQuoteStateTest.h */, + D31FE57A0E60E58C00A0803E /* TDQuoteStateTest.m */, + D31FE57F0E60E58C00A0803E /* TDSymbolStateTest.h */, + D31FE5800E60E58C00A0803E /* TDSymbolStateTest.m */, + D31FE5810E60E58C00A0803E /* TDWhitespaceStateTest.h */, + D31FE5820E60E58C00A0803E /* TDWhitespaceStateTest.m */, + D31FE5830E60E58C00A0803E /* TDWordStateTest.h */, + D31FE5840E60E58C00A0803E /* TDWordStateTest.m */, + D3C85D430E63D1BF000445FD /* TDScientificNumberStateTest.h */, + D3C85D440E63D1BF000445FD /* TDScientificNumberStateTest.m */, + D3DDDAFC0F083C9700A58000 /* TDCommentStateTest.h */, + D3DDDAFD0F083C9700A58000 /* TDCommentStateTest.m */, + D3E39C3D0FC5FFD10022DAB9 /* TDDelimitStateTest.h */, + D3E39C3E0FC5FFD10022DAB9 /* TDDelimitStateTest.m */, + ); + name = "tokenizer states"; + sourceTree = ""; + }; + D36568A40EEF9FB600226554 /* plist */ = { + isa = PBXGroup; + children = ( + D36568A50EEF9FE900226554 /* TDPlistParser.h */, + D36568A60EEF9FE900226554 /* TDPlistParser.m */, + D36568A80EEFA05300226554 /* TDPlistParserTest.h */, + D36568A90EEFA05300226554 /* TDPlistParserTest.m */, + ); + name = plist; + sourceTree = ""; + }; + D3668290101D2BAC0008632C /* erb */ = { + isa = PBXGroup; + children = ( + D3668291101D2BFA0008632C /* erb.grammar */, + D3668294101D2C200008632C /* ERBTest.h */, + D3668295101D2C200008632C /* ERBTest.m */, + ); + name = erb; + sourceTree = ""; + }; + D36C55FB0FD3616200141CB7 /* regex */ = { + isa = PBXGroup; + children = ( + D3C221F00FFE8C7A004514FE /* PKPattern.h */, + D34BAF380FF9E18300D7773A /* PKPattern.m */, + D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */, + D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */, + ); + name = regex; + sourceTree = ""; + }; + D36E94F40E57865500496BD3 /* xpath */ = { + isa = PBXGroup; + children = ( + D34BAC490FF892C200D7773A /* XPathParserGrammarTest.h */, + D34BAC4A0FF892C200D7773A /* XPathParserGrammarTest.m */, + D31FE5EF0E60E6B500A0803E /* TDNCName.h */, + D31FE6DF0E60EE2500A0803E /* TDNCName.m */, + D31FE5F00E60E6B500A0803E /* TDNCNameState.h */, + D31FE5F10E60E6B500A0803E /* TDNCNameState.m */, + D36E95440E578ECC00496BD3 /* XPathParser.h */, + D36E95450E578ECC00496BD3 /* XPathParser.m */, + D36E97AE0E589DAE00496BD3 /* XPathAssembler.h */, + D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */, + D36E98200E58A3A800496BD3 /* XPathContext.h */, + D36E98210E58A3A800496BD3 /* XPathContext.m */, + D36E95D60E57B08400496BD3 /* XPathParserTest.h */, + D36E95D70E57B08400496BD3 /* XPathParserTest.m */, + ); + name = xpath; + sourceTree = ""; + }; + D36E98CB0E58C08F00496BD3 /* DebugApp */ = { + isa = PBXGroup; + children = ( + D3F0E3290FFEA1E200C9DF74 /* DebugApp-Info.plist */, + D36E98DF0E58C12800496BD3 /* main.m */, + D36E98DC0E58C12800496BD3 /* DebugAppDelegate.h */, + D36E98DD0E58C12800496BD3 /* DebugAppDelegate.m */, + D3F740B50EF8C38A00559B9F /* JSONAssembler.h */, + D3F740B60EF8C38A00559B9F /* JSONAssembler.m */, + D36E98DE0E58C12800496BD3 /* DebugAppMainMenu.xib */, + ); + name = DebugApp; + path = debugapp; + sourceTree = ""; + }; + D36EA1400E5CF19F00496BD3 /* xml token terminals */ = { + isa = PBXGroup; + children = ( + D31FE5B90E60E69E00A0803E /* TDXmlAttribute.h */, + D31FE5BA0E60E69E00A0803E /* TDXmlAttribute.m */, + D31FE5BB0E60E69E00A0803E /* TDXmlCdata.h */, + D31FE5BC0E60E69E00A0803E /* TDXmlCdata.m */, + D31FE5BD0E60E69E00A0803E /* TDXmlComment.h */, + D31FE5BE0E60E69E00A0803E /* TDXmlComment.m */, + D31FE5BF0E60E69E00A0803E /* TDXmlDecl.h */, + D31FE5C00E60E69E00A0803E /* TDXmlDecl.m */, + D31FE5C10E60E69E00A0803E /* TDXmlDoctype.h */, + D31FE5C20E60E69E00A0803E /* TDXmlDoctype.m */, + D31FE5C30E60E69E00A0803E /* TDXmlDocument.h */, + D31FE5C40E60E69E00A0803E /* TDXmlDocument.m */, + D31FE5C50E60E69E00A0803E /* TDXmlEndEntity.h */, + D31FE5C60E60E69E00A0803E /* TDXmlEndEntity.m */, + D31FE5C70E60E69E00A0803E /* TDXmlEndTag.h */, + D31FE5C80E60E69E00A0803E /* TDXmlEndTag.m */, + D31FE5C90E60E69E00A0803E /* TDXmlEntity.h */, + D31FE5CA0E60E69E00A0803E /* TDXmlEntity.m */, + D31FE5CB0E60E69E00A0803E /* TDXmlEntityRef.h */, + D31FE5CC0E60E69E00A0803E /* TDXmlEntityRef.m */, + D31FE5CD0E60E69E00A0803E /* TDXmlFragment.h */, + D31FE5CE0E60E69E00A0803E /* TDXmlFragment.m */, + D31FE5CF0E60E69E00A0803E /* TDXmlNotation.h */, + D31FE5D00E60E69E00A0803E /* TDXmlNotation.m */, + D31FE5D10E60E69E00A0803E /* TDXmlProcessingInstruction.h */, + D31FE5D20E60E69E00A0803E /* TDXmlProcessingInstruction.m */, + D31FE5D30E60E69E00A0803E /* TDXmlSignificantWhitespace.h */, + D31FE5D40E60E69E00A0803E /* TDXmlSignificantWhitespace.m */, + D31FE5D50E60E69E00A0803E /* TDXmlStartTag.h */, + D31FE5D60E60E69E00A0803E /* TDXmlStartTag.m */, + D31FE5D70E60E69E00A0803E /* TDXmlTerminal.h */, + D31FE5D80E60E69E00A0803E /* TDXmlTerminal.m */, + D31FE5D90E60E69E00A0803E /* TDXmlText.h */, + D31FE5DA0E60E69E00A0803E /* TDXmlText.m */, + D31FE5DB0E60E69E00A0803E /* TDXmlWhitespace.h */, + D31FE5DC0E60E69E00A0803E /* TDXmlWhitespace.m */, + ); + name = "xml token terminals"; + sourceTree = ""; + }; + D36EA1440E5CF38100496BD3 /* tokenizer */ = { + isa = PBXGroup; + children = ( + D31FE5B30E60E66600A0803E /* TDXmlToken.h */, + D31FE5B40E60E66600A0803E /* TDXmlToken.m */, + D31FE5B50E60E66600A0803E /* TDXmlTokenizer.h */, + D31FE5B60E60E66600A0803E /* TDXmlTokenizer.m */, + ); + name = tokenizer; + sourceTree = ""; + }; + D380BA950F0F1C450009EC13 /* JSParseKit Framework */ = { + isa = PBXGroup; + children = ( + D34BB04E0FF9EC4E00D7773A /* JSParseKit-Info.plist */, + D34BB0660FF9EDDF00D7773A /* JSParseKit.h */, + D34BB0670FF9EDDF00D7773A /* JSParseKit.m */, + D34BB06C0FF9EE4000D7773A /* PKJSUtils.h */, + D34BB06D0FF9EE4000D7773A /* PKJSUtils.m */, + D34BB06E0FF9EE4000D7773A /* PKJSUtils_macros.h */, + D34BB06F0FF9EE4000D7773A /* PKJSValueHolder.h */, + D34BB0700FF9EE4000D7773A /* PKJSValueHolder.m */, + D34BB06A0FF9EE4000D7773A /* PKJSAssembly.h */, + D34BB06B0FF9EE4000D7773A /* PKJSAssembly.m */, + D389F8C40F1AC89A00558235 /* Chars */, + D389F59A0F19BBAE00558235 /* Tokens */, + D389F59B0F19BBD300558235 /* Parse */, + ); + name = "JSParseKit Framework"; + sourceTree = ""; + }; + D389A0AE0F1FCC7A003B43BD /* relaxng */ = { + isa = PBXGroup; + children = ( + D389A0B00F1FCC99003B43BD /* RelaxParser.h */, + D389A0B10F1FCC99003B43BD /* RelaxParser.m */, + ); + name = relaxng; + sourceTree = ""; + }; + D389F2CA0F196ACF00558235 /* JSDemoApp */ = { + isa = PBXGroup; + children = ( + D3F0E37A0FFEA39000C9DF74 /* JSDemoApp-Info.plist */, + D389F2E30F196CAE00558235 /* main.m */, + D389F2E80F196F5B00558235 /* JSDemoAppDelegate.h */, + D389F2E90F196F5B00558235 /* JSDemoAppDelegate.m */, + D389F38E0F19800400558235 /* DefaultValues.plist */, + D389F4610F198A8800558235 /* Test.html */, + D389FBCC0F1B25E200558235 /* ParserTest.html */, + D389F5580F19B7BC00558235 /* JSDemoAppMainMenu.xib */, + ); + name = JSDemoApp; + sourceTree = ""; + }; + D389F59A0F19BBAE00558235 /* Tokens */ = { + isa = PBXGroup; + children = ( + D34BB0930FF9F14B00D7773A /* PKJSCommentState.h */, + D34BB0940FF9F14B00D7773A /* PKJSCommentState.m */, + D34BB0950FF9F14B00D7773A /* PKJSDelimitState.h */, + D34BB0960FF9F14B00D7773A /* PKJSDelimitState.m */, + D34BB0970FF9F14B00D7773A /* PKJSNumberState.h */, + D34BB0980FF9F14B00D7773A /* PKJSNumberState.m */, + D34BB0990FF9F14B00D7773A /* PKJSQuoteState.h */, + D34BB09A0FF9F14B00D7773A /* PKJSQuoteState.m */, + D34BB09B0FF9F14B00D7773A /* PKJSSymbolState.h */, + D34BB09C0FF9F14B00D7773A /* PKJSSymbolState.m */, + D34BB09D0FF9F14B00D7773A /* PKJSToken.h */, + D34BB09E0FF9F14B00D7773A /* PKJSToken.m */, + D34BB09F0FF9F14B00D7773A /* PKJSTokenAssembly.h */, + D34BB0A00FF9F14B00D7773A /* PKJSTokenAssembly.m */, + D34BB0A10FF9F14B00D7773A /* PKJSTokenizer.h */, + D34BB0A20FF9F14B00D7773A /* PKJSTokenizer.m */, + D34BB0A30FF9F14B00D7773A /* PKJSTokenizerState.h */, + D34BB0A40FF9F14B00D7773A /* PKJSTokenizerState.m */, + D34BB0A50FF9F14B00D7773A /* PKJSWhitespaceState.h */, + D34BB0A60FF9F14B00D7773A /* PKJSWhitespaceState.m */, + D34BB0A70FF9F14B00D7773A /* PKJSWordState.h */, + D34BB0A80FF9F14B00D7773A /* PKJSWordState.m */, + ); + name = Tokens; + sourceTree = ""; + }; + D389F59B0F19BBD300558235 /* Parse */ = { + isa = PBXGroup; + children = ( + D34BB0D20FF9F28000D7773A /* PKJSAlternation.h */, + D34BB0D30FF9F28000D7773A /* PKJSAlternation.m */, + D34BB0D40FF9F28000D7773A /* PKJSAny.h */, + D34BB0D50FF9F28000D7773A /* PKJSAny.m */, + D34BB0D60FF9F28000D7773A /* PKJSAssemblerAdapter.h */, + D34BB0D70FF9F28000D7773A /* PKJSAssemblerAdapter.m */, + D34BB0D80FF9F28000D7773A /* PKJSCollectionParser.h */, + D34BB0D90FF9F28000D7773A /* PKJSCollectionParser.m */, + D34BB0DA0FF9F28000D7773A /* PKJSEmpty.h */, + D34BB0DB0FF9F28000D7773A /* PKJSEmpty.m */, + D34BB0DC0FF9F28000D7773A /* PKJSParser.h */, + D34BB0DD0FF9F28000D7773A /* PKJSParser.m */, + D34BB0DE0FF9F28000D7773A /* PKJSRepetition.h */, + D34BB0DF0FF9F28000D7773A /* PKJSRepetition.m */, + D34BB0E00FF9F28000D7773A /* PKJSSequence.h */, + D34BB0E10FF9F28000D7773A /* PKJSSequence.m */, + D34BB0E20FF9F28000D7773A /* PKJSTerminal.h */, + D34BB0E30FF9F28000D7773A /* PKJSTerminal.m */, + D34BB0E40FF9F28000D7773A /* PKJSTrack.h */, + D34BB0E50FF9F28000D7773A /* PKJSTrack.m */, + D389FAE30F1B1B8F00558235 /* Char Terminals */, + D389FAE20F1B1B7200558235 /* Token Terminals */, + ); + name = Parse; + sourceTree = ""; + }; + D389F8C40F1AC89A00558235 /* Chars */ = { + isa = PBXGroup; + children = ( + D34BB08D0FF9EF9D00D7773A /* PKJSCharacterAssembly.h */, + D34BB08E0FF9EF9D00D7773A /* PKJSCharacterAssembly.m */, + ); + name = Chars; + sourceTree = ""; + }; + D389FAE20F1B1B7200558235 /* Token Terminals */ = { + isa = PBXGroup; + children = ( + D34BB0FE0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h */, + D34BB0FF0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m */, + D34BB1000FF9F36200D7773A /* PKJSComment.h */, + D34BB1010FF9F36200D7773A /* PKJSComment.m */, + D34BB1020FF9F36200D7773A /* PKJSDelimitedString.h */, + D34BB1030FF9F36200D7773A /* PKJSDelimitedString.m */, + D34BB1040FF9F36200D7773A /* PKJSLiteral.h */, + D34BB1050FF9F36200D7773A /* PKJSLiteral.m */, + D34BB1060FF9F36200D7773A /* PKJSLowercaseWord.h */, + D34BB1070FF9F36200D7773A /* PKJSLowercaseWord.m */, + D34BB1080FF9F36200D7773A /* PKJSNum.h */, + D34BB1090FF9F36200D7773A /* PKJSNum.m */, + D34BB10A0FF9F36200D7773A /* PKJSPattern.h */, + D34BB10B0FF9F36200D7773A /* PKJSPattern.m */, + D34BB10C0FF9F36200D7773A /* PKJSQuotedString.h */, + D34BB10D0FF9F36200D7773A /* PKJSQuotedString.m */, + D34BB10E0FF9F36200D7773A /* PKJSSymbol.h */, + D34BB10F0FF9F36200D7773A /* PKJSSymbol.m */, + D34BB1100FF9F36200D7773A /* PKJSUppercaseWord.h */, + D34BB1110FF9F36200D7773A /* PKJSUppercaseWord.m */, + D34BB1120FF9F36200D7773A /* PKJSWord.h */, + D34BB1130FF9F36200D7773A /* PKJSWord.m */, + ); + name = "Token Terminals"; + sourceTree = ""; + }; + D389FAE30F1B1B8F00558235 /* Char Terminals */ = { + isa = PBXGroup; + children = ( + ); + name = "Char Terminals"; + sourceTree = ""; + }; + D3AF4C8E0FDC738B0032F4DC /* Other Sources */ = { + isa = PBXGroup; + children = ( + D34BAD630FF9C6AE00D7773A /* ParseKit_Prefix.pch */, + D3FDC8DB0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + D3AF4CC80FDC74320032F4DC /* Blob */ = { + isa = PBXGroup; + children = ( + D3AF4BF50FDC40050032F4DC /* TDToken+Blob.h */, + D3AF4BF60FDC40050032F4DC /* TDToken+Blob.m */, + D3AF4BFB0FDC41190032F4DC /* TDTokenizer+BlobState.h */, + D3AF4BFC0FDC41190032F4DC /* TDTokenizer+BlobState.m */, + D3AF4C190FDC568F0032F4DC /* TDBlobState.h */, + D3AF4C1A0FDC568F0032F4DC /* TDBlobState.m */, + D3AF4BE80FDC3DD50032F4DC /* TDBlob.h */, + D3AF4BE90FDC3DD50032F4DC /* TDBlob.m */, + ); + name = Blob; + sourceTree = ""; + }; + D3AF4CC90FDC743C0032F4DC /* ReservedWord */ = { + isa = PBXGroup; + children = ( + D3AF4CC50FDC740A0032F4DC /* TDWordOrReservedState.h */, + D3AF4CC60FDC740A0032F4DC /* TDWordOrReservedState.m */, + D3AF4CBF0FDC740A0032F4DC /* TDNonReservedWord.h */, + D3AF4CC00FDC740A0032F4DC /* TDNonReservedWord.m */, + D3AF4CC10FDC740A0032F4DC /* TDReservedWord.h */, + D3AF4CC20FDC740A0032F4DC /* TDReservedWord.m */, + ); + name = ReservedWord; + sourceTree = ""; + }; + D3AF4CCA0FDC74490032F4DC /* Slash */ = { + isa = PBXGroup; + children = ( + D3DDDC230F085C5400A58000 /* TDSlashSlashState.h */, + D3DDDC240F085C5400A58000 /* TDSlashSlashState.m */, + D3DDDC250F085C5400A58000 /* TDSlashStarState.h */, + D3DDDC260F085C5400A58000 /* TDSlashStarState.m */, + D3DDDC270F085C5400A58000 /* TDSlashState.h */, + D3DDDC280F085C5400A58000 /* TDSlashState.m */, + D31FE57D0E60E58C00A0803E /* TDSlashStateTest.h */, + D31FE57E0E60E58C00A0803E /* TDSlashStateTest.m */, + ); + name = Slash; + sourceTree = ""; + }; + D3AF4CCB0FDC74540032F4DC /* Whitespace */ = { + isa = PBXGroup; + children = ( + D3AF4CC30FDC740A0032F4DC /* TDSignificantWhitespaceState.h */, + D3AF4CC40FDC740A0032F4DC /* TDSignificantWhitespaceState.m */, + D31FE57B0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.h */, + D31FE57C0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.m */, + ); + name = Whitespace; + sourceTree = ""; + }; + D3BBBC9A0FEC9739007DF30D /* old */ = { + isa = PBXGroup; + children = ( + D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */, + D36E9FB40E5A944A00496BD3 /* apple-boss.xml */, + D31FE5AD0E60E64900A0803E /* TDXmlTokenAssembly.h */, + D31FE5AE0E60E64900A0803E /* TDXmlTokenAssembly.m */, + D31FE5AF0E60E64900A0803E /* TDXmlTokenizerTest.h */, + D31FE5B00E60E64900A0803E /* TDXmlTokenizerTest.m */, + D36EA1440E5CF38100496BD3 /* tokenizer */, + D36EA1400E5CF19F00496BD3 /* xml token terminals */, + D3521F520E5FA1B0009681F9 /* XMLReader.h */, + D3521F530E5FA1B0009681F9 /* XMLReader.m */, + D3521F540E5FA1B0009681F9 /* XMLReaderTest.h */, + D3521F550E5FA1B0009681F9 /* XMLReaderTest.m */, + D31FE5F20E60E6B500A0803E /* TDXmlName.h */, + D31FE5F30E60E6B500A0803E /* TDXmlName.m */, + D31FE5F40E60E6B500A0803E /* TDXmlNameState.h */, + D31FE5F50E60E6B500A0803E /* TDXmlNameState.m */, + D31FE5F60E60E6B500A0803E /* TDXmlNameTest.h */, + D31FE5F70E60E6B500A0803E /* TDXmlNameTest.m */, + D31FE5F80E60E6B500A0803E /* TDXmlNmtoken.h */, + D31FE5F90E60E6B500A0803E /* TDXmlNmtoken.m */, + D31FE5FA0E60E6B500A0803E /* TDXmlNmtokenState.h */, + D31FE5FB0E60E6B500A0803E /* TDXmlNmtokenState.m */, + ); + name = old; + sourceTree = ""; + }; + D3C0309C0EF34DD200C5ABEB /* grammar */ = { + isa = PBXGroup; + children = ( + D380B5370F0D7DDE0009EC13 /* css.css */, + D380B5080F0D71A90009EC13 /* css.grammar */, + D380B5930F0D82F60009EC13 /* example.css */, + D380AFBB0F0C54B60009EC13 /* html.css */, + D380AFBC0F0C54B60009EC13 /* html.grammar */, + D385FD6B0F05A99900DB2946 /* mini_css.grammar */, + D3DCB4C20EF6015300DE5110 /* json.grammar */, + D385FA240F04993500DB2946 /* json.css */, + D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */, + D38349BB0F0C0D910055E4E0 /* json_with_comments.css */, + D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */, + D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */, + D380AFC20F0C56000009EC13 /* example.html */, + D3F741BD0EF9F28D00559B9F /* css2_1.grammar */, + D3F741430EF8E96A00559B9F /* xpath1_0.grammar */, + D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */, + D31A15250F6DE449002AFDF1 /* javascript.grammar */, + D385FD400F05A88C00DB2946 /* TDMiniCSSAssembler.h */, + D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */, + D385FD420F05A88C00DB2946 /* TDMiniCSSAssemblerTest.h */, + D385FD430F05A88C00DB2946 /* TDMiniCSSAssemblerTest.m */, + D385F9880F046FE900DB2946 /* TDGenericAssembler.h */, + D385F9890F046FE900DB2946 /* TDGenericAssembler.m */, + D385FA210F04971400DB2946 /* TDGenericAssemblerTest.h */, + D385FA220F04971400DB2946 /* TDGenericAssemblerTest.m */, + D3DDDA850F0779FD00A58000 /* TDSyntaxHighlighter.h */, + D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */, + D353899B0FEAC94400926552 /* c.grammar */, + D353899D0FEAC96B00926552 /* objc.grammar */, + D355C8830FEB4B94006A91A4 /* proto.grammar */, + ); + name = grammar; + sourceTree = ""; + }; + D3C7D8220A411F31005DD154 /* ParseKit Tests */ = { + isa = PBXGroup; + children = ( + D3F0E36C0FFEA33700C9DF74 /* Tests-Info.plist */, + D31FE54A0E60E46100A0803E /* TDTestScaffold.h */, + D31FE54B0E60E46100A0803E /* TDTestScaffold.m */, + D3376D7710096BDE00E4602E /* IR */, + D3F823560F57859900B7DC48 /* factory */, + D3C0309C0EF34DD200C5ABEB /* grammar */, + D3252F670FCE171D005EF059 /* predicate */, + D31A164F0F703899002AFDF1 /* javascript */, + D3D63F570E2A8548009BF5CD /* parse */, + D3D63F560E2A8538009BF5CD /* tokens */, + D34A20080E55FD5F00A4A0BF /* chars */, + D3C85C770E63B400000445FD /* arithmetic */, + D3E786030E5510AE008C7D61 /* regex */, + D3E788890E567B6D008C7D61 /* ebnf */, + D36568A40EEF9FB600226554 /* plist */, + D318EAE30E2FD5B6009F47DF /* json */, + D3D647CE0E2C7569009BF5CD /* xml */, + D36E94F40E57865500496BD3 /* xpath */, + D3E788900E567DDA008C7D61 /* srgs */, + D389A0AE0F1FCC7A003B43BD /* relaxng */, + D3C863240E67C249000445FD /* syntax highlight */, + D3668290101D2BAC0008632C /* erb */, + ); + name = "ParseKit Tests"; + sourceTree = ""; + }; + D3C7D8710A411F6B005DD154 /* io */ = { + isa = PBXGroup; + children = ( + D3C221960FFE8B95004514FE /* PKReader.h */, + D34BAD9B0FF9C95800D7773A /* PKReader.m */, + ); + name = io; + sourceTree = ""; + }; + D3C7D8720A411F81005DD154 /* parse */ = { + isa = PBXGroup; + children = ( + D3C221990FFE8B9D004514FE /* PKAssembly.h */, + D34BADA00FF9C9B000D7773A /* PKAssembly.m */, + D3D63EA90E2A7A5C009BF5CD /* parsers */, + ); + name = parse; + sourceTree = ""; + }; + D3C7D8740A411F8E005DD154 /* tokens */ = { + isa = PBXGroup; + children = ( + D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */, + D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */, + D341846A0E5209A60081B0DC /* tokenizer */, + D3541F870DFB105900429B4F /* states */, + D3D642270E2AC426009BF5CD /* token terminals */, + ); + name = tokens; + sourceTree = ""; + }; + D3C85C770E63B400000445FD /* arithmetic */ = { + isa = PBXGroup; + children = ( + D319E429106D8A1F008C63DD /* arithmetic.grammar */, + D319E42C106D8A31008C63DD /* TDArithmeticAssembler.h */, + D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */, + D3C85C790E63B438000445FD /* TDArithmeticParser.h */, + D3C85C7A0E63B438000445FD /* TDArithmeticParser.m */, + D3C85C7E0E63B9E9000445FD /* TDArithmeticParserTest.h */, + D3C85C7F0E63B9E9000445FD /* TDArithmeticParserTest.m */, + ); + name = arithmetic; + sourceTree = ""; + }; + D3C863240E67C249000445FD /* syntax highlight */ = { + isa = PBXGroup; + children = ( + D3C863250E67C255000445FD /* html */, + ); + name = "syntax highlight"; + sourceTree = ""; + }; + D3C863250E67C255000445FD /* html */ = { + isa = PBXGroup; + children = ( + D38DD9E70EC29F260070BC4D /* nyt.html */, + D3B69D310E80249900D70C41 /* nonascii.html */, + D3EADD7F0E75E9CC00F78584 /* nasty.html */, + D3EADD8D0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.h */, + D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */, + ); + name = html; + sourceTree = ""; + }; + D3D63EA90E2A7A5C009BF5CD /* parsers */ = { + isa = PBXGroup; + children = ( + D3C2219C0FFE8BA6004514FE /* PKParser.h */, + D34BADD60FF9CBFB00D7773A /* PKParser.m */, + D3C2219F0FFE8BAE004514FE /* PKRepetition.h */, + D34BAE130FF9CE0E00D7773A /* PKRepetition.m */, + D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */, + D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */, + D3C221A50FFE8BC1004514FE /* PKAlternation.h */, + D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */, + D3C221A80FFE8BC9004514FE /* PKSequence.h */, + D34BAE150FF9CE0E00D7773A /* PKSequence.m */, + D3C221AB0FFE8BCF004514FE /* PKTrack.h */, + D34BAE190FF9CE0E00D7773A /* PKTrack.m */, + D3C221AE0FFE8BD4004514FE /* PKTrackException.h */, + D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */, + D3C221B10FFE8BDB004514FE /* PKIntersection.h */, + D34BAE110FF9CE0E00D7773A /* PKIntersection.m */, + D3C221B40FFE8BE2004514FE /* PKDifference.h */, + D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */, + D3C221B70FFE8BE8004514FE /* PKNegation.h */, + D3126D040FFD9BA700CBF4C4 /* PKNegation.m */, + D3C221BA0FFE8BEF004514FE /* PKTerminal.h */, + D34BAE170FF9CE0E00D7773A /* PKTerminal.m */, + D3C221BD0FFE8BF7004514FE /* PKEmpty.h */, + D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */, + ); + name = parsers; + sourceTree = ""; + }; + D3D63F560E2A8538009BF5CD /* tokens */ = { + isa = PBXGroup; + children = ( + D31FE5710E60E55700A0803E /* TDReaderTest.h */, + D31FE5720E60E55700A0803E /* TDReaderTest.m */, + D31FE5730E60E55700A0803E /* TDTokenizerTest.h */, + D31FE5740E60E55700A0803E /* TDTokenizerTest.m */, + D38E97CA1061CF6500739C39 /* TDTokenizerBlocksTest.h */, + D38E97CB1061CF6500739C39 /* TDTokenizerBlocksTest.m */, + D38205BC0EEE48EE004340DD /* TDTokenTest.h */, + D38205BD0EEE48EE004340DD /* TDTokenTest.m */, + D3656DFC0EF2620E00226554 /* TDTokenArraySourceTest.h */, + D3656DFD0EF2620E00226554 /* TDTokenArraySourceTest.m */, + D35420EC0DFB275400429B4F /* tokenizer states */, + ); + name = tokens; + sourceTree = ""; + }; + D3D63F570E2A8548009BF5CD /* parse */ = { + isa = PBXGroup; + children = ( + D31FE54D0E60E50800A0803E /* TDAlternationTest.h */, + D31FE54E0E60E50800A0803E /* TDAlternationTest.m */, + D31FE54F0E60E50800A0803E /* TDLiteralTest.h */, + D31FE5500E60E50800A0803E /* TDLiteralTest.m */, + D31FE5510E60E50800A0803E /* TDParserTest.h */, + D31FE5520E60E50800A0803E /* TDParserTest.m */, + D38E98D61062C5BA00739C39 /* TDParserBlocksTest.h */, + D38E98D71062C5BA00739C39 /* TDParserBlocksTest.m */, + D31FE5530E60E50800A0803E /* TDRepetitionTest.h */, + D31FE5540E60E50800A0803E /* TDRepetitionTest.m */, + D31FE5550E60E50800A0803E /* TDReservedWordTest.h */, + D31FE5560E60E50800A0803E /* TDReservedWordTest.m */, + D31FE5570E60E50800A0803E /* TDRobotCommandTest.h */, + D31FE5580E60E50800A0803E /* TDRobotCommandTest.m */, + D31FE5590E60E50800A0803E /* TDSequenceTest.h */, + D31FE55A0E60E50800A0803E /* TDSequenceTest.m */, + D31FE55B0E60E50800A0803E /* TDSymbolTest.h */, + D31FE55C0E60E50800A0803E /* TDSymbolTest.m */, + D31FE55D0E60E50800A0803E /* TDTokenAssemblyTest.h */, + D31FE55E0E60E50800A0803E /* TDTokenAssemblyTest.m */, + D31FE55F0E60E50800A0803E /* TDTrackTest.h */, + D31FE5600E60E50800A0803E /* TDTrackTest.m */, + D31FE5610E60E50800A0803E /* TDUppercaseWordTest.h */, + D31FE5620E60E50800A0803E /* TDUppercaseWordTest.m */, + D3C031EB0EF38D2D00C5ABEB /* TDLowercaseWordTest.h */, + D3C031EC0EF38D2D00C5ABEB /* TDLowercaseWordTest.m */, + D3126D410FFDB4C600CBF4C4 /* TDExclusionTest.h */, + D3126D420FFDB4C600CBF4C4 /* TDExclusionTest.m */, + D36C56290FD365DB00141CB7 /* TDPatternTest.h */, + D36C562A0FD365DB00141CB7 /* TDPatternTest.m */, + D338E5B90FF5DDCB003DE6AA /* TDDifferenceTest.h */, + D338E5BA0FF5DDCB003DE6AA /* TDDifferenceTest.m */, + D3126D090FFD9E4B00CBF4C4 /* TDNegationTest.h */, + D3126D0A0FFD9E4B00CBF4C4 /* TDNegationTest.m */, + ); + name = parse; + sourceTree = ""; + }; + D3D642270E2AC426009BF5CD /* token terminals */ = { + isa = PBXGroup; + children = ( + D36C55FB0FD3616200141CB7 /* regex */, + D3C221F30FFE8C87004514FE /* PKWord.h */, + D34BAED40FF9D56400D7773A /* PKWord.m */, + D3C222140FFE8D01004514FE /* PKLowercaseWord.h */, + D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */, + D3C222170FFE8D11004514FE /* PKUppercaseWord.h */, + D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */, + D3C221F60FFE8C8E004514FE /* PKNumber.h */, + D34BAF440FF9E19700D7773A /* PKNumber.m */, + D3C221F90FFE8C97004514FE /* PKQuotedString.h */, + D34BAF460FF9E19700D7773A /* PKQuotedString.m */, + D3C221FC0FFE8CB2004514FE /* PKSymbol.h */, + D34BAF480FF9E19700D7773A /* PKSymbol.m */, + D3C221FF0FFE8CB9004514FE /* PKLiteral.h */, + D34BAF420FF9E19700D7773A /* PKLiteral.m */, + D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */, + D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */, + D3C222050FFE8CCA004514FE /* PKWhitespace.h */, + D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */, + D3C222080FFE8CD1004514FE /* PKComment.h */, + D34BAF3E0FF9E19700D7773A /* PKComment.m */, + D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */, + D34BAF400FF9E19700D7773A /* PKDelimitedString.m */, + D3C2220E0FFE8CDF004514FE /* PKAny.h */, + D34BAE2F0FF9CE6000D7773A /* PKAny.m */, + ); + name = "token terminals"; + sourceTree = ""; + }; + D3D647CE0E2C7569009BF5CD /* xml */ = { + isa = PBXGroup; + children = ( + D3D1BF291039445C003656E5 /* SAXTest.h */, + D3D1BF2A1039445C003656E5 /* SAXTest.m */, + D3D1BF2610394420003656E5 /* SAXAssembler.h */, + D3D1BF2710394420003656E5 /* SAXAssembler.m */, + D3BBBC960FEC9722007DF30D /* TDXMLParserTest.h */, + D3BBBC970FEC9722007DF30D /* TDXMLParserTest.m */, + D3BBBC9B0FEC9756007DF30D /* TDXMLParser.h */, + D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */, + D355C8800FEB36A1006A91A4 /* xml.grammar */, + D315DF710FEF59B600D876C8 /* date.grammar */, + D3BBBC9A0FEC9739007DF30D /* old */, + ); + name = xml; + sourceTree = ""; + }; + D3E785F10E550F63008C7D61 /* chars */ = { + isa = PBXGroup; + children = ( + D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */, + D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */, + D3E7861F0E55363F008C7D61 /* char terminals */, + ); + name = chars; + sourceTree = ""; + }; + D3E786030E5510AE008C7D61 /* regex */ = { + isa = PBXGroup; + children = ( + D31FE59B0E60E5C000A0803E /* TDRegularParser.h */, + D31FE59C0E60E5C000A0803E /* TDRegularParser.m */, + D31FE59D0E60E5C000A0803E /* TDRegularParserTest.h */, + D31FE59E0E60E5C000A0803E /* TDRegularParserTest.m */, + ); + name = regex; + sourceTree = ""; + }; + D3E7861F0E55363F008C7D61 /* char terminals */ = { + isa = PBXGroup; + children = ( + D3C2221D0FFE8D3B004514FE /* PKChar.h */, + D34BAFB40FF9E80300D7773A /* PKChar.m */, + D3C222200FFE8D42004514FE /* PKDigit.h */, + D34BAFB60FF9E80300D7773A /* PKDigit.m */, + D3C222230FFE8D49004514FE /* PKLetter.h */, + D34BAFB80FF9E80300D7773A /* PKLetter.m */, + D3C222260FFE8D6B004514FE /* PKSpecificChar.h */, + D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */, + ); + name = "char terminals"; + sourceTree = ""; + }; + D3E788890E567B6D008C7D61 /* ebnf */ = { + isa = PBXGroup; + children = ( + D3E78A150E574C99008C7D61 /* EBNFParser.h */, + D3E78A160E574C99008C7D61 /* EBNFParser.m */, + D3E78A170E574C99008C7D61 /* EBNFParserTest.h */, + D3E78A180E574C99008C7D61 /* EBNFParserTest.m */, + ); + name = ebnf; + sourceTree = ""; + }; + D3E788900E567DDA008C7D61 /* srgs */ = { + isa = PBXGroup; + children = ( + D3DDDCAC0F0880D800A58000 /* example1.srgs */, + D3E788940E567E0A008C7D61 /* SRGSParser.h */, + D3E788950E567E0A008C7D61 /* SRGSParser.m */, + D3E788910E567DFD008C7D61 /* SRGSParserTest.h */, + D3E788920E567DFD008C7D61 /* SRGSParserTest.m */, + D36E9FE40E5BA0FC00496BD3 /* SRGSGrammar.txt */, + ); + name = srgs; + sourceTree = ""; + }; + D3F5619C1026374400DD6DB1 /* ir */ = { + isa = PBXGroup; + children = ( + D3F5619D1026375100DD6DB1 /* syntax tree */, + D3F561B61026379700DD6DB1 /* ast */, + ); + name = ir; + sourceTree = ""; + }; + D3F5619D1026375100DD6DB1 /* syntax tree */ = { + isa = PBXGroup; + children = ( + D36934551038DE5300527AF3 /* PKParseTree.h */, + D36934561038DE5300527AF3 /* PKParseTree.m */, + D36934571038DE5300527AF3 /* PKParseTreeAssembler.h */, + D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */, + D36934591038DE5300527AF3 /* PKRuleNode.h */, + D369345A1038DE5300527AF3 /* PKRuleNode.m */, + D369345B1038DE5300527AF3 /* PKTokenNode.h */, + D369345C1038DE5300527AF3 /* PKTokenNode.m */, + ); + name = "syntax tree"; + sourceTree = ""; + }; + D3F561B61026379700DD6DB1 /* ast */ = { + isa = PBXGroup; + children = ( + ); + name = ast; + sourceTree = ""; + }; + D3F823560F57859900B7DC48 /* factory */ = { + isa = PBXGroup; + children = ( + D34BAC210FF87F8600D7773A /* TDParserFactoryTest3.h */, + D34BAC220FF87F8600D7773A /* TDParserFactoryTest3.m */, + D380BA5F0F0F06CD0009EC13 /* TDParserFactoryTest.h */, + D380BA600F0F06CD0009EC13 /* TDParserFactoryTest.m */, + D36C53770FD27F1300141CB7 /* TDParserFactoryTest2.h */, + D36C53780FD27F1300141CB7 /* TDParserFactoryTest2.m */, + D3AF49760FDB122E0032F4DC /* TDParserFactoryPatternTest.h */, + D3AF49770FDB122E0032F4DC /* TDParserFactoryPatternTest.m */, + ); + name = factory; + sourceTree = ""; + }; + D3FDC8EF0FFC52CD00F1F797 /* Mobile Frameworks */ = { + isa = PBXGroup; + children = ( + D3FDC74B0FFC4DAC00F1F797 /* CoreGraphics.framework */, + D3FDC7380FFC4D6100F1F797 /* libicucore.dylib */, + D3FDC7360FFC4D6100F1F797 /* Foundation.framework */, + ); + name = "Mobile Frameworks"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 8DC2EF500486A6940098B216 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D34BAD640FF9C6AE00D7773A /* ParseKit_Prefix.pch in Headers */, + D3FDC4A50FFB3B2A00F1F797 /* RegexKitLite.h in Headers */, + D3C221920FFE8B8C004514FE /* ParseKit.h in Headers */, + D3C221930FFE8B8C004514FE /* PKTypes.h in Headers */, + D3C221970FFE8B95004514FE /* PKReader.h in Headers */, + D3C2219A0FFE8B9D004514FE /* PKAssembly.h in Headers */, + D3C2219D0FFE8BA6004514FE /* PKParser.h in Headers */, + D3C221A00FFE8BAE004514FE /* PKRepetition.h in Headers */, + D3C221A30FFE8BBA004514FE /* PKCollectionParser.h in Headers */, + D3C221A60FFE8BC1004514FE /* PKAlternation.h in Headers */, + D3C221A90FFE8BC9004514FE /* PKSequence.h in Headers */, + D3C221AC0FFE8BCF004514FE /* PKTrack.h in Headers */, + D3C221AF0FFE8BD4004514FE /* PKTrackException.h in Headers */, + D3C221B20FFE8BDB004514FE /* PKIntersection.h in Headers */, + D3C221B50FFE8BE2004514FE /* PKDifference.h in Headers */, + D3C221B80FFE8BE8004514FE /* PKNegation.h in Headers */, + D3C221BB0FFE8BEF004514FE /* PKTerminal.h in Headers */, + D3C221BE0FFE8BF7004514FE /* PKEmpty.h in Headers */, + D3C221C10FFE8BFF004514FE /* PKTokenAssembly.h in Headers */, + D3C221C40FFE8C07004514FE /* PKToken.h in Headers */, + D3C221C70FFE8C0D004514FE /* PKTokenArraySource.h in Headers */, + D3C221CA0FFE8C15004514FE /* PKTokenizer.h in Headers */, + D3C221CD0FFE8C1B004514FE /* PKTokenizerState.h in Headers */, + D3C221D00FFE8C24004514FE /* PKNumberState.h in Headers */, + D3C221D60FFE8C35004514FE /* PKSymbolState.h in Headers */, + D3C221D90FFE8C3D004514FE /* PKWordState.h in Headers */, + D3C221DC0FFE8C43004514FE /* PKWhitespaceState.h in Headers */, + D3C221DF0FFE8C49004514FE /* PKDelimitState.h in Headers */, + D3C221E20FFE8C4E004514FE /* PKCommentState.h in Headers */, + D3C221E50FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */, + D3C221E80FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */, + D3C221EB0FFE8C69004514FE /* PKSymbolNode.h in Headers */, + D3C221EE0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */, + D3C221F10FFE8C7A004514FE /* PKPattern.h in Headers */, + D3C221F40FFE8C87004514FE /* PKWord.h in Headers */, + D3C221F70FFE8C8E004514FE /* PKNumber.h in Headers */, + D3C221FA0FFE8C97004514FE /* PKQuotedString.h in Headers */, + D3C221FD0FFE8CB2004514FE /* PKSymbol.h in Headers */, + D3C222000FFE8CB9004514FE /* PKLiteral.h in Headers */, + D3C222030FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */, + D3C222060FFE8CCA004514FE /* PKWhitespace.h in Headers */, + D3C222090FFE8CD1004514FE /* PKComment.h in Headers */, + D3C2220C0FFE8CD8004514FE /* PKDelimitedString.h in Headers */, + D3C2220F0FFE8CDF004514FE /* PKAny.h in Headers */, + D3C222150FFE8D01004514FE /* PKLowercaseWord.h in Headers */, + D3C222180FFE8D11004514FE /* PKUppercaseWord.h in Headers */, + D3C2221B0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */, + D3C2221E0FFE8D3B004514FE /* PKChar.h in Headers */, + D3C222210FFE8D42004514FE /* PKDigit.h in Headers */, + D3C222240FFE8D49004514FE /* PKLetter.h in Headers */, + D3C222270FFE8D6B004514FE /* PKSpecificChar.h in Headers */, + D3C2222A0FFE8DAC004514FE /* PKParserFactory.h in Headers */, + D3C2222D0FFE8DE9004514FE /* NSArray+ParseKitAdditions.h in Headers */, + D3C2222E0FFE8DEE004514FE /* NSString+ParseKitAdditions.h in Headers */, + D3F0E2480FFE8EB900C9DF74 /* PKQuoteState.h in Headers */, + D3376D5910093A1600E4602E /* PKGrammarParser.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1C90F1965E600558235 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D34BB0680FF9EDDF00D7773A /* JSParseKit.h in Headers */, + D34BB0710FF9EE4000D7773A /* PKJSAssembly.h in Headers */, + D34BB0730FF9EE4000D7773A /* PKJSUtils.h in Headers */, + D34BB0750FF9EE4000D7773A /* PKJSUtils_macros.h in Headers */, + D34BB0760FF9EE4000D7773A /* PKJSValueHolder.h in Headers */, + D34BB08F0FF9EF9D00D7773A /* PKJSCharacterAssembly.h in Headers */, + D34BB0A90FF9F14B00D7773A /* PKJSCommentState.h in Headers */, + D34BB0AB0FF9F14B00D7773A /* PKJSDelimitState.h in Headers */, + D34BB0AD0FF9F14B00D7773A /* PKJSNumberState.h in Headers */, + D34BB0AF0FF9F14B00D7773A /* PKJSQuoteState.h in Headers */, + D34BB0B10FF9F14B00D7773A /* PKJSSymbolState.h in Headers */, + D34BB0B30FF9F14B00D7773A /* PKJSToken.h in Headers */, + D34BB0B50FF9F14B00D7773A /* PKJSTokenAssembly.h in Headers */, + D34BB0B70FF9F14B00D7773A /* PKJSTokenizer.h in Headers */, + D34BB0B90FF9F14B00D7773A /* PKJSTokenizerState.h in Headers */, + D34BB0BB0FF9F14B00D7773A /* PKJSWhitespaceState.h in Headers */, + D34BB0BD0FF9F14B00D7773A /* PKJSWordState.h in Headers */, + D34BB0E60FF9F28000D7773A /* PKJSAlternation.h in Headers */, + D34BB0E80FF9F28000D7773A /* PKJSAny.h in Headers */, + D34BB0EA0FF9F28000D7773A /* PKJSAssemblerAdapter.h in Headers */, + D34BB0EC0FF9F28000D7773A /* PKJSCollectionParser.h in Headers */, + D34BB0EE0FF9F28000D7773A /* PKJSEmpty.h in Headers */, + D34BB0F00FF9F28000D7773A /* PKJSParser.h in Headers */, + D34BB0F20FF9F28000D7773A /* PKJSRepetition.h in Headers */, + D34BB0F40FF9F28000D7773A /* PKJSSequence.h in Headers */, + D34BB0F60FF9F28000D7773A /* PKJSTerminal.h in Headers */, + D34BB0F80FF9F28000D7773A /* PKJSTrack.h in Headers */, + D34BB1140FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h in Headers */, + D34BB1160FF9F36200D7773A /* PKJSComment.h in Headers */, + D34BB1180FF9F36200D7773A /* PKJSDelimitedString.h in Headers */, + D34BB11A0FF9F36200D7773A /* PKJSLiteral.h in Headers */, + D34BB11C0FF9F36200D7773A /* PKJSLowercaseWord.h in Headers */, + D34BB11E0FF9F36200D7773A /* PKJSNum.h in Headers */, + D34BB1200FF9F36200D7773A /* PKJSPattern.h in Headers */, + D34BB1220FF9F36200D7773A /* PKJSQuotedString.h in Headers */, + D34BB1240FF9F36200D7773A /* PKJSSymbol.h in Headers */, + D34BB1260FF9F36200D7773A /* PKJSUppercaseWord.h in Headers */, + D34BB1280FF9F36200D7773A /* PKJSWord.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3FDC57F0FFC4BFC00F1F797 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D3FDC6DA0FFC4C8C00F1F797 /* RegexKitLite.h in Headers */, + D3FDC8DC0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch in Headers */, + D3C221940FFE8B8C004514FE /* ParseKit.h in Headers */, + D3C221950FFE8B8C004514FE /* PKTypes.h in Headers */, + D3C221980FFE8B95004514FE /* PKReader.h in Headers */, + D3C2219B0FFE8B9D004514FE /* PKAssembly.h in Headers */, + D3C2219E0FFE8BA6004514FE /* PKParser.h in Headers */, + D3C221A10FFE8BAE004514FE /* PKRepetition.h in Headers */, + D3C221A40FFE8BBA004514FE /* PKCollectionParser.h in Headers */, + D3C221A70FFE8BC1004514FE /* PKAlternation.h in Headers */, + D3C221AA0FFE8BC9004514FE /* PKSequence.h in Headers */, + D3C221AD0FFE8BCF004514FE /* PKTrack.h in Headers */, + D3C221B00FFE8BD4004514FE /* PKTrackException.h in Headers */, + D3C221B30FFE8BDB004514FE /* PKIntersection.h in Headers */, + D3C221B60FFE8BE2004514FE /* PKDifference.h in Headers */, + D3C221B90FFE8BE8004514FE /* PKNegation.h in Headers */, + D3C221BC0FFE8BEF004514FE /* PKTerminal.h in Headers */, + D3C221BF0FFE8BF7004514FE /* PKEmpty.h in Headers */, + D3C221C20FFE8BFF004514FE /* PKTokenAssembly.h in Headers */, + D3C221C50FFE8C07004514FE /* PKToken.h in Headers */, + D3C221C80FFE8C0D004514FE /* PKTokenArraySource.h in Headers */, + D3C221CB0FFE8C15004514FE /* PKTokenizer.h in Headers */, + D3C221CE0FFE8C1B004514FE /* PKTokenizerState.h in Headers */, + D3C221D10FFE8C24004514FE /* PKNumberState.h in Headers */, + D3C221D70FFE8C35004514FE /* PKSymbolState.h in Headers */, + D3C221DA0FFE8C3D004514FE /* PKWordState.h in Headers */, + D3C221DD0FFE8C43004514FE /* PKWhitespaceState.h in Headers */, + D3C221E00FFE8C49004514FE /* PKDelimitState.h in Headers */, + D3C221E30FFE8C4E004514FE /* PKCommentState.h in Headers */, + D3C221E60FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */, + D3C221E90FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */, + D3C221EC0FFE8C69004514FE /* PKSymbolNode.h in Headers */, + D3C221EF0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */, + D3C221F20FFE8C7A004514FE /* PKPattern.h in Headers */, + D3C221F50FFE8C87004514FE /* PKWord.h in Headers */, + D3C221FB0FFE8C97004514FE /* PKQuotedString.h in Headers */, + D3C221FE0FFE8CB2004514FE /* PKSymbol.h in Headers */, + D3C222010FFE8CB9004514FE /* PKLiteral.h in Headers */, + D3C222040FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */, + D3C222070FFE8CCA004514FE /* PKWhitespace.h in Headers */, + D3C2220A0FFE8CD1004514FE /* PKComment.h in Headers */, + D3C2220D0FFE8CD8004514FE /* PKDelimitedString.h in Headers */, + D3C222100FFE8CDF004514FE /* PKAny.h in Headers */, + D3C222160FFE8D01004514FE /* PKLowercaseWord.h in Headers */, + D3C222190FFE8D11004514FE /* PKUppercaseWord.h in Headers */, + D3C2221C0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */, + D3C2221F0FFE8D3B004514FE /* PKChar.h in Headers */, + D3C222220FFE8D42004514FE /* PKDigit.h in Headers */, + D3C222250FFE8D49004514FE /* PKLetter.h in Headers */, + D3C222280FFE8D6B004514FE /* PKSpecificChar.h in Headers */, + D3C2222B0FFE8DAC004514FE /* PKParserFactory.h in Headers */, + D3C2222F0FFE8DEF004514FE /* NSString+ParseKitAdditions.h in Headers */, + D3C222300FFE8DF3004514FE /* NSArray+ParseKitAdditions.h in Headers */, + D3F0E2490FFE8EB900C9DF74 /* PKQuoteState.h in Headers */, + D3F0E3CB0FFEB70100C9DF74 /* PKNumber.h in Headers */, + D37A28681013942A00E936B7 /* PKGrammarParser.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 8DC2EF4F0486A6940098B216 /* ParseKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "ParseKit" */; + buildPhases = ( + 8DC2EF500486A6940098B216 /* Headers */, + 8DC2EF540486A6940098B216 /* Sources */, + 8DC2EF520486A6940098B216 /* Resources */, + 8DC2EF560486A6940098B216 /* Frameworks */, + D36C65E7100ED81B000361A0 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ParseKit; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = TODParseKit; + productReference = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; + productType = "com.apple.product-type.framework"; + }; + D334940F0E2963FD00406085 /* DemoApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = D33494150E2963FE00406085 /* Build configuration list for PBXNativeTarget "DemoApp" */; + buildPhases = ( + D334940D0E2963FD00406085 /* Sources */, + D334940C0E2963FD00406085 /* Resources */, + D334940E0E2963FD00406085 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D33494A00E296AA900406085 /* PBXTargetDependency */, + ); + name = DemoApp; + productName = DemoApp; + productReference = D33494100E2963FD00406085 /* DemoApp.app */; + productType = "com.apple.product-type.application"; + }; + D34185030E520D3F0081B0DC /* DebugApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = D34185090E520D410081B0DC /* Build configuration list for PBXNativeTarget "DebugApp" */; + buildPhases = ( + D34185010E520D3F0081B0DC /* Sources */, + D34185000E520D3F0081B0DC /* Resources */, + D380B9A10F0EF3DC0009EC13 /* Copy Frameworks */, + D34185020E520D3F0081B0DC /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D34185100E520D6F0081B0DC /* PBXTargetDependency */, + ); + name = DebugApp; + productName = TestApp; + productReference = D34185040E520D3F0081B0DC /* DebugApp.app */; + productType = "com.apple.product-type.application"; + }; + D389F1CD0F1965E600558235 /* JSParseKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = D389F1D20F1965E800558235 /* Build configuration list for PBXNativeTarget "JSParseKit" */; + buildPhases = ( + D389F1C90F1965E600558235 /* Headers */, + D389F1CB0F1965E600558235 /* Sources */, + D389F1CA0F1965E600558235 /* Resources */, + D389F1CC0F1965E600558235 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D389F1D40F19665C00558235 /* PBXTargetDependency */, + ); + name = JSParseKit; + productName = TDJSParseKit; + productReference = D389F1CE0F1965E600558235 /* JSParseKit.framework */; + productType = "com.apple.product-type.framework"; + }; + D389F2020F196A7500558235 /* JSDemoApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = D389F2080F196A7600558235 /* Build configuration list for PBXNativeTarget "JSDemoApp" */; + buildPhases = ( + D389F2000F196A7500558235 /* Sources */, + D389F1FF0F196A7500558235 /* Resources */, + D389F2010F196A7500558235 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D389F20A0F196A8000558235 /* PBXTargetDependency */, + ); + name = JSDemoApp; + productName = JSDemoApp; + productReference = D389F2030F196A7500558235 /* JSDemoApp.app */; + productType = "com.apple.product-type.application"; + }; + D3C7D8790A411FBF005DD154 /* Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3C7D87C0A411FC0005DD154 /* Build configuration list for PBXNativeTarget "Tests" */; + buildPhases = ( + D3C7D8760A411FBF005DD154 /* Sources */, + D3C7D8750A411FBF005DD154 /* Resources */, + D3DCB3880EF5E65100DE5110 /* Copy Frameworks */, + D3C7D8770A411FBF005DD154 /* Frameworks */, + D3C7D8780A411FBF005DD154 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + D31FE7180E60F24700A0803E /* PBXTargetDependency */, + ); + name = Tests; + productName = Tests; + productReference = D3C7D87A0A411FBF005DD154 /* Tests.octest */; + productType = "com.apple.product-type.bundle"; + }; + D3FDC5820FFC4BFC00F1F797 /* ParseKitMobile */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3FDC62F0FFC4C2000F1F797 /* Build configuration list for PBXNativeTarget "ParseKitMobile" */; + buildPhases = ( + D3FDC57F0FFC4BFC00F1F797 /* Headers */, + D3FDC5800FFC4BFC00F1F797 /* Sources */, + D3FDC5810FFC4BFC00F1F797 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ParseKitMobile; + productName = ParseKitMobile; + productReference = D3FDC5830FFC4BFC00F1F797 /* libparsekit.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0867D690FE84028FC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ParseKit" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 1; + mainGroup = 0867D691FE84028FC02AAC07 /* TODParseKit */; + productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DC2EF4F0486A6940098B216 /* ParseKit */, + D389F1CD0F1965E600558235 /* JSParseKit */, + D3FDC5820FFC4BFC00F1F797 /* ParseKitMobile */, + D3C7D8790A411FBF005DD154 /* Tests */, + D334940F0E2963FD00406085 /* DemoApp */, + D34185030E520D3F0081B0DC /* DebugApp */, + D389F2020F196A7500558235 /* JSDemoApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8DC2EF520486A6940098B216 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D334940C0E2963FD00406085 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36E98F80E58C1A000496BD3 /* DemoAppMainMenu.xib in Resources */, + D3DCB4C40EF6015C00DE5110 /* json.grammar in Resources */, + D3F741BF0EF9F29400559B9F /* css2_1.grammar in Resources */, + D3D01CAB0EFDB8A000C24DDE /* json_with_discards.grammar in Resources */, + D3F562A210266E5300DD6DB1 /* TokensView.xib in Resources */, + D3F562A410266E6300DD6DB1 /* TreesView.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D34185000E520D3F0081B0DC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3E27A320E741DD20078CC2C /* small-xml-file.xml in Resources */, + D3E27A330E741DD20078CC2C /* apple-boss.xml in Resources */, + D398E20E0E60F86D00A1C877 /* yahoo.json in Resources */, + D3E785560E53FB54008C7D61 /* apple-boss.json in Resources */, + D36E98E10E58C12800496BD3 /* DebugAppMainMenu.xib in Resources */, + D3EADD810E75E9CC00F78584 /* nasty.html in Resources */, + D3B69D320E80249900D70C41 /* nonascii.html in Resources */, + D3DCB4C50EF6015C00DE5110 /* json.grammar in Resources */, + D3F741C00EF9F29500559B9F /* css2_1.grammar in Resources */, + D3D01CAC0EFDB8A100C24DDE /* json_with_discards.grammar in Resources */, + D385FA260F04993500DB2946 /* json.css in Resources */, + D385FD6C0F05A99900DB2946 /* mini_css.grammar in Resources */, + D3DDDCAE0F0880D800A58000 /* example1.srgs in Resources */, + D383498C0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */, + D38349BD0F0C0D910055E4E0 /* json_with_comments.css in Resources */, + D3834A490F0C14C00055E4E0 /* yahoo_with_comments.json in Resources */, + D380AFBF0F0C54B60009EC13 /* html.css in Resources */, + D380AFC00F0C54B60009EC13 /* html.grammar in Resources */, + D380AFC30F0C56000009EC13 /* example.html in Resources */, + D380B3230F0CC0800009EC13 /* nyt.html in Resources */, + D380B50A0F0D71B00009EC13 /* css.grammar in Resources */, + D380B5390F0D7DE30009EC13 /* css.css in Resources */, + D380B5950F0D82F90009EC13 /* example.css in Resources */, + D3FD79210F4CC87900BAD816 /* rubyhash.grammar in Resources */, + D31A15270F6DE449002AFDF1 /* javascript.grammar in Resources */, + D355C6A70FE9F704006A91A4 /* nspredicate.grammar in Resources */, + D3BBBCC10FECD477007DF30D /* xml.grammar in Resources */, + D315DF730FEF59B600D876C8 /* date.grammar in Resources */, + D34BAC9A0FF8A9AD00D7773A /* xpath1_0.grammar in Resources */, + D3668293101D2C000008632C /* erb.grammar in Resources */, + D319E42B106D8A1F008C63DD /* arithmetic.grammar in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1CA0F1965E600558235 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1FF0F196A7500558235 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F38F0F19800400558235 /* DefaultValues.plist in Resources */, + D389F4620F198A8800558235 /* Test.html in Resources */, + D389F5590F19B7BC00558235 /* JSDemoAppMainMenu.xib in Resources */, + D389FBCD0F1B25E200558235 /* ParserTest.html in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3C7D8750A411FBF005DD154 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3B473850E48C9CF008AFBDD /* yahoo.json in Resources */, + D3E784BD0E53DA28008C7D61 /* apple-boss.json in Resources */, + D36E9FB50E5A944A00496BD3 /* apple-boss.xml in Resources */, + D36E9FE50E5BA0FC00496BD3 /* SRGSGrammar.txt in Resources */, + D36EA3B00E5EA67E00496BD3 /* small-xml-file.xml in Resources */, + D3EADD800E75E9CC00F78584 /* nasty.html in Resources */, + D3B69D330E80249900D70C41 /* nonascii.html in Resources */, + D38DD9E80EC29F260070BC4D /* nyt.html in Resources */, + D3DCB4C30EF6015300DE5110 /* json.grammar in Resources */, + D3F741440EF8E96A00559B9F /* xpath1_0.grammar in Resources */, + D3F741BE0EF9F28D00559B9F /* css2_1.grammar in Resources */, + D3D01CAA0EFDB89900C24DDE /* json_with_discards.grammar in Resources */, + D385FA250F04993500DB2946 /* json.css in Resources */, + D385FD6D0F05A99900DB2946 /* mini_css.grammar in Resources */, + D3DDDCAD0F0880D800A58000 /* example1.srgs in Resources */, + D383498B0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */, + D38349BC0F0C0D910055E4E0 /* json_with_comments.css in Resources */, + D3834A480F0C14B60055E4E0 /* yahoo_with_comments.json in Resources */, + D380AFBD0F0C54B60009EC13 /* html.css in Resources */, + D380AFBE0F0C54B60009EC13 /* html.grammar in Resources */, + D380AFC40F0C56000009EC13 /* example.html in Resources */, + D380B5090F0D71A90009EC13 /* css.grammar in Resources */, + D380B5380F0D7DDE0009EC13 /* css.css in Resources */, + D380B5940F0D82F60009EC13 /* example.css in Resources */, + D3FD79200F4CC86800BAD816 /* rubyhash.grammar in Resources */, + D31A15260F6DE449002AFDF1 /* javascript.grammar in Resources */, + D35384ED0FE9691100926552 /* nspredicate.grammar in Resources */, + D353899C0FEAC94400926552 /* c.grammar in Resources */, + D353899E0FEAC96B00926552 /* objc.grammar in Resources */, + D355C8810FEB36A1006A91A4 /* xml.grammar in Resources */, + D355C8840FEB4B94006A91A4 /* proto.grammar in Resources */, + D315DF720FEF59B600D876C8 /* date.grammar in Resources */, + D3668292101D2BFA0008632C /* erb.grammar in Resources */, + D319E42A106D8A1F008C63DD /* arithmetic.grammar in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + D36C65E7100ED81B000361A0 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#cp -R -f \"${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}\" ${HOME}/Library/Frameworks"; + }; + D3C7D8780A411FBF005DD154 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DC2EF540486A6940098B216 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36C55FF0FD3617B00141CB7 /* RegexKitLite.m in Sources */, + D34BAD9D0FF9C95800D7773A /* PKReader.m in Sources */, + D34BADA20FF9C9B000D7773A /* PKAssembly.m in Sources */, + D34BADD80FF9CBFB00D7773A /* PKParser.m in Sources */, + D34BAE030FF9CCAE00D7773A /* PKCollectionParser.m in Sources */, + D34BAE1D0FF9CE0E00D7773A /* PKAlternation.m in Sources */, + D34BAE1F0FF9CE0E00D7773A /* PKEmpty.m in Sources */, + D34BAE210FF9CE0E00D7773A /* PKDifference.m in Sources */, + D34BAE230FF9CE0E00D7773A /* PKIntersection.m in Sources */, + D34BAE250FF9CE0E00D7773A /* PKRepetition.m in Sources */, + D34BAE270FF9CE0E00D7773A /* PKSequence.m in Sources */, + D34BAE290FF9CE0E00D7773A /* PKTerminal.m in Sources */, + D34BAE2B0FF9CE0E00D7773A /* PKTrack.m in Sources */, + D34BAE2D0FF9CE0E00D7773A /* PKTrackException.m in Sources */, + D34BAE310FF9CE6000D7773A /* PKAny.m in Sources */, + D34BAE8D0FF9D15100D7773A /* PKTokenAssembly.m in Sources */, + D34BAE9D0FF9D20900D7773A /* PKToken.m in Sources */, + D34BAE9F0FF9D20900D7773A /* PKTokenArraySource.m in Sources */, + D34BAEA10FF9D20900D7773A /* PKTokenizer.m in Sources */, + D34BAEA30FF9D20900D7773A /* PKTokenizerState.m in Sources */, + D34BAED80FF9D56400D7773A /* PKCommentState.m in Sources */, + D34BAEDA0FF9D56400D7773A /* PKDelimitState.m in Sources */, + D34BAEDC0FF9D56400D7773A /* PKMultiLineCommentState.m in Sources */, + D34BAEDE0FF9D56400D7773A /* PKNumberState.m in Sources */, + D34BAEE00FF9D56400D7773A /* PKQuoteState.m in Sources */, + D34BAEE20FF9D56400D7773A /* PKSingleLineCommentState.m in Sources */, + D34BAEE40FF9D56400D7773A /* PKSymbolState.m in Sources */, + D34BAEE60FF9D56400D7773A /* PKWhitespaceState.m in Sources */, + D34BAEE80FF9D56400D7773A /* PKWord.m in Sources */, + D34BAEEA0FF9D56400D7773A /* PKWordState.m in Sources */, + D34BAF280FF9DF9900D7773A /* PKSymbolNode.m in Sources */, + D34BAF2A0FF9DF9900D7773A /* PKSymbolRootNode.m in Sources */, + D34BAF3A0FF9E18300D7773A /* PKPattern.m in Sources */, + D34BAF4C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m in Sources */, + D34BAF4E0FF9E19700D7773A /* PKComment.m in Sources */, + D34BAF500FF9E19700D7773A /* PKDelimitedString.m in Sources */, + D34BAF520FF9E19700D7773A /* PKLiteral.m in Sources */, + D34BAF540FF9E19700D7773A /* PKNumber.m in Sources */, + D34BAF560FF9E19700D7773A /* PKQuotedString.m in Sources */, + D34BAF580FF9E19700D7773A /* PKSymbol.m in Sources */, + D34BAF5A0FF9E19700D7773A /* PKWhitespace.m in Sources */, + D34BAF9D0FF9E6D100D7773A /* PKLowercaseWord.m in Sources */, + D34BAF9F0FF9E6D100D7773A /* PKUppercaseWord.m in Sources */, + D34BAFB20FF9E7F300D7773A /* PKCharacterAssembly.m in Sources */, + D34BAFBC0FF9E80300D7773A /* PKChar.m in Sources */, + D34BAFBE0FF9E80300D7773A /* PKDigit.m in Sources */, + D34BAFC00FF9E80300D7773A /* PKLetter.m in Sources */, + D34BAFC20FF9E80300D7773A /* PKSpecificChar.m in Sources */, + D34BAFDA0FF9E95500D7773A /* NSArray+ParseKitAdditions.m in Sources */, + D34BAFDC0FF9E95500D7773A /* NSString+ParseKitAdditions.m in Sources */, + D34BAFDE0FF9E95500D7773A /* PKParserFactory.m in Sources */, + D3126D060FFD9BA700CBF4C4 /* PKNegation.m in Sources */, + D3376D5A10093A1600E4602E /* PKGrammarParser.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D334940D0E2963FD00406085 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36E98E70E58C14000496BD3 /* DemoAppDelegate.m in Sources */, + D36E98E80E58C14000496BD3 /* main.m in Sources */, + D3F5629A10266CFC00DD6DB1 /* PKParseTreeView.m in Sources */, + D3F562A010266DFB00DD6DB1 /* DemoTokensViewController.m in Sources */, + D3F562A710266E8D00DD6DB1 /* DemoTreesViewController.m in Sources */, + D3305C4F102F5BAE00DC4F75 /* TDGutterView.m in Sources */, + D3305C50102F5BAE00DC4F75 /* TDSourceCodeTextView.m in Sources */, + D36934721038E28300527AF3 /* PKParseTree.m in Sources */, + D36934731038E28700527AF3 /* PKParseTreeAssembler.m in Sources */, + D36934741038E28B00527AF3 /* PKRuleNode.m in Sources */, + D36934751038E28F00527AF3 /* PKTokenNode.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D34185010E520D3F0081B0DC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36E98E20E58C12800496BD3 /* main.m in Sources */, + D36E98E00E58C12800496BD3 /* DebugAppDelegate.m in Sources */, + D3EADD8F0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */, + D31FE7420E60F40900A0803E /* XPathContext.m in Sources */, + D31FE7400E60F40300A0803E /* XPathAssembler.m in Sources */, + D31FE7340E60F34600A0803E /* XPathParser.m in Sources */, + D31FE7330E60F33C00A0803E /* XMLReader.m in Sources */, + D31FE7320E60F33000A0803E /* EBNFParser.m in Sources */, + D31FE7300E60F31E00A0803E /* TDFastJsonParser.m in Sources */, + D302C69D0EF044810090E714 /* TDPlistParser.m in Sources */, + D3F740B70EF8C38A00559B9F /* JSONAssembler.m in Sources */, + D385F98C0F046FE900DB2946 /* TDGenericAssembler.m in Sources */, + D385FD440F05A88C00DB2946 /* TDMiniCSSAssembler.m in Sources */, + D3DDDA870F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */, + D389F5B80F19C76A00558235 /* TDJsonParser.m in Sources */, + D31A16530F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */, + D3252F7E0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */, + D3385FDA0FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */, + D355C62E0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */, + D3BBBC9D0FEC9756007DF30D /* TDXMLParser.m in Sources */, + D3376D8F10096C0700E4602E /* PKAST.m in Sources */, + D319E42F106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1CB0F1965E600558235 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D34BB0690FF9EDDF00D7773A /* JSParseKit.m in Sources */, + D34BB0720FF9EE4000D7773A /* PKJSAssembly.m in Sources */, + D34BB0740FF9EE4000D7773A /* PKJSUtils.m in Sources */, + D34BB0770FF9EE4000D7773A /* PKJSValueHolder.m in Sources */, + D34BB0900FF9EF9D00D7773A /* PKJSCharacterAssembly.m in Sources */, + D34BB0AA0FF9F14B00D7773A /* PKJSCommentState.m in Sources */, + D34BB0AC0FF9F14B00D7773A /* PKJSDelimitState.m in Sources */, + D34BB0AE0FF9F14B00D7773A /* PKJSNumberState.m in Sources */, + D34BB0B00FF9F14B00D7773A /* PKJSQuoteState.m in Sources */, + D34BB0B20FF9F14B00D7773A /* PKJSSymbolState.m in Sources */, + D34BB0B40FF9F14B00D7773A /* PKJSToken.m in Sources */, + D34BB0B60FF9F14B00D7773A /* PKJSTokenAssembly.m in Sources */, + D34BB0B80FF9F14B00D7773A /* PKJSTokenizer.m in Sources */, + D34BB0BA0FF9F14B00D7773A /* PKJSTokenizerState.m in Sources */, + D34BB0BC0FF9F14B00D7773A /* PKJSWhitespaceState.m in Sources */, + D34BB0BE0FF9F14B00D7773A /* PKJSWordState.m in Sources */, + D34BB0E70FF9F28000D7773A /* PKJSAlternation.m in Sources */, + D34BB0E90FF9F28000D7773A /* PKJSAny.m in Sources */, + D34BB0EB0FF9F28000D7773A /* PKJSAssemblerAdapter.m in Sources */, + D34BB0ED0FF9F28000D7773A /* PKJSCollectionParser.m in Sources */, + D34BB0EF0FF9F28000D7773A /* PKJSEmpty.m in Sources */, + D34BB0F10FF9F28000D7773A /* PKJSParser.m in Sources */, + D34BB0F30FF9F28000D7773A /* PKJSRepetition.m in Sources */, + D34BB0F50FF9F28000D7773A /* PKJSSequence.m in Sources */, + D34BB0F70FF9F28000D7773A /* PKJSTerminal.m in Sources */, + D34BB0F90FF9F28000D7773A /* PKJSTrack.m in Sources */, + D34BB1150FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m in Sources */, + D34BB1170FF9F36200D7773A /* PKJSComment.m in Sources */, + D34BB1190FF9F36200D7773A /* PKJSDelimitedString.m in Sources */, + D34BB11B0FF9F36200D7773A /* PKJSLiteral.m in Sources */, + D34BB11D0FF9F36200D7773A /* PKJSLowercaseWord.m in Sources */, + D34BB11F0FF9F36200D7773A /* PKJSNum.m in Sources */, + D34BB1210FF9F36200D7773A /* PKJSPattern.m in Sources */, + D34BB1230FF9F36200D7773A /* PKJSQuotedString.m in Sources */, + D34BB1250FF9F36200D7773A /* PKJSSymbol.m in Sources */, + D34BB1270FF9F36200D7773A /* PKJSUppercaseWord.m in Sources */, + D34BB1290FF9F36200D7773A /* PKJSWord.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F2000F196A7500558235 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F2E40F196CAE00558235 /* main.m in Sources */, + D389F37A0F197E8000558235 /* JSDemoAppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3C7D8760A411FBF005DD154 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3E788930E567DFD008C7D61 /* SRGSParserTest.m in Sources */, + D3E788960E567E0A008C7D61 /* SRGSParser.m in Sources */, + D3E78A190E574C99008C7D61 /* EBNFParser.m in Sources */, + D3E78A1A0E574C99008C7D61 /* EBNFParserTest.m in Sources */, + D36E95460E578ECC00496BD3 /* XPathParser.m in Sources */, + D36E95D80E57B08400496BD3 /* XPathParserTest.m in Sources */, + D36E97B00E589DAE00496BD3 /* XPathAssembler.m in Sources */, + D36E98220E58A3A800496BD3 /* XPathContext.m in Sources */, + D3521F560E5FA1B0009681F9 /* XMLReader.m in Sources */, + D3521F570E5FA1B0009681F9 /* XMLReaderTest.m in Sources */, + D31FE54C0E60E46100A0803E /* TDTestScaffold.m in Sources */, + D31FE5630E60E50800A0803E /* TDAlternationTest.m in Sources */, + D31FE5640E60E50800A0803E /* TDLiteralTest.m in Sources */, + D31FE5650E60E50800A0803E /* TDParserTest.m in Sources */, + D31FE5660E60E50800A0803E /* TDRepetitionTest.m in Sources */, + D31FE5680E60E50800A0803E /* TDRobotCommandTest.m in Sources */, + D31FE5690E60E50800A0803E /* TDSequenceTest.m in Sources */, + D31FE56A0E60E50800A0803E /* TDSymbolTest.m in Sources */, + D31FE56B0E60E50800A0803E /* TDTokenAssemblyTest.m in Sources */, + D31FE56C0E60E50800A0803E /* TDTrackTest.m in Sources */, + D31FE56D0E60E50800A0803E /* TDUppercaseWordTest.m in Sources */, + D31FE5750E60E55700A0803E /* TDReaderTest.m in Sources */, + D31FE5760E60E55700A0803E /* TDTokenizerTest.m in Sources */, + D31FE5850E60E58C00A0803E /* TDNumberStateTest.m in Sources */, + D31FE5860E60E58C00A0803E /* TDQuoteStateTest.m in Sources */, + D31FE5890E60E58C00A0803E /* TDSymbolStateTest.m in Sources */, + D31FE58A0E60E58C00A0803E /* TDWhitespaceStateTest.m in Sources */, + D31FE58B0E60E58C00A0803E /* TDWordStateTest.m in Sources */, + D31FE5960E60E5AC00A0803E /* TDCharacterAssemblyTest.m in Sources */, + D31FE5970E60E5AC00A0803E /* TDCharTest.m in Sources */, + D31FE5980E60E5AC00A0803E /* TDDigitTest.m in Sources */, + D31FE5990E60E5AC00A0803E /* TDLetterTest.m in Sources */, + D31FE59A0E60E5AC00A0803E /* TDSpecificCharTest.m in Sources */, + D31FE59F0E60E5C000A0803E /* TDRegularParser.m in Sources */, + D31FE5A00E60E5C000A0803E /* TDRegularParserTest.m in Sources */, + D31FE5A90E60E5D500A0803E /* TDFastJsonParser.m in Sources */, + D31FE5AA0E60E5D500A0803E /* TDFastJsonParserTest.m in Sources */, + D31FE5B10E60E64900A0803E /* TDXmlTokenAssembly.m in Sources */, + D31FE5B20E60E64900A0803E /* TDXmlTokenizerTest.m in Sources */, + D31FE5B70E60E66600A0803E /* TDXmlToken.m in Sources */, + D31FE5B80E60E66600A0803E /* TDXmlTokenizer.m in Sources */, + D31FE5DD0E60E69E00A0803E /* TDXmlAttribute.m in Sources */, + D31FE5DE0E60E69E00A0803E /* TDXmlCdata.m in Sources */, + D31FE5DF0E60E69E00A0803E /* TDXmlComment.m in Sources */, + D31FE5E00E60E69E00A0803E /* TDXmlDecl.m in Sources */, + D31FE5E10E60E69E00A0803E /* TDXmlDoctype.m in Sources */, + D31FE5E20E60E69E00A0803E /* TDXmlDocument.m in Sources */, + D31FE5E30E60E69E00A0803E /* TDXmlEndEntity.m in Sources */, + D31FE5E40E60E69E00A0803E /* TDXmlEndTag.m in Sources */, + D31FE5E50E60E69E00A0803E /* TDXmlEntity.m in Sources */, + D31FE5E60E60E69E00A0803E /* TDXmlEntityRef.m in Sources */, + D31FE5E70E60E69E00A0803E /* TDXmlFragment.m in Sources */, + D31FE5E80E60E69E00A0803E /* TDXmlNotation.m in Sources */, + D31FE5E90E60E69E00A0803E /* TDXmlProcessingInstruction.m in Sources */, + D31FE5EA0E60E69E00A0803E /* TDXmlSignificantWhitespace.m in Sources */, + D31FE5EB0E60E69E00A0803E /* TDXmlStartTag.m in Sources */, + D31FE5EC0E60E69E00A0803E /* TDXmlTerminal.m in Sources */, + D31FE5ED0E60E69E00A0803E /* TDXmlText.m in Sources */, + D31FE5EE0E60E69E00A0803E /* TDXmlWhitespace.m in Sources */, + D31FE5FC0E60E6B500A0803E /* TDNCNameState.m in Sources */, + D31FE5FD0E60E6B500A0803E /* TDXmlName.m in Sources */, + D31FE5FE0E60E6B500A0803E /* TDXmlNameState.m in Sources */, + D31FE5FF0E60E6B500A0803E /* TDXmlNameTest.m in Sources */, + D31FE6000E60E6B500A0803E /* TDXmlNmtoken.m in Sources */, + D31FE6010E60E6B500A0803E /* TDXmlNmtokenState.m in Sources */, + D31FE6E00E60EE2500A0803E /* TDNCName.m in Sources */, + D3C85C7B0E63B438000445FD /* TDArithmeticParser.m in Sources */, + D3C85C800E63B9E9000445FD /* TDArithmeticParserTest.m in Sources */, + D3C85D450E63D1BF000445FD /* TDScientificNumberStateTest.m in Sources */, + D3EADD8E0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */, + D38205BE0EEE48EE004340DD /* TDTokenTest.m in Sources */, + D36568A70EEF9FE900226554 /* TDPlistParser.m in Sources */, + D36568AA0EEFA05300226554 /* TDPlistParserTest.m in Sources */, + D3656DFE0EF2620E00226554 /* TDTokenArraySourceTest.m in Sources */, + D3C031ED0EF38D2D00C5ABEB /* TDLowercaseWordTest.m in Sources */, + D385F98E0F046FE900DB2946 /* TDGenericAssembler.m in Sources */, + D385FA230F04971400DB2946 /* TDGenericAssemblerTest.m in Sources */, + D385FD460F05A89100DB2946 /* TDMiniCSSAssemblerTest.m in Sources */, + D385FD490F05A8C900DB2946 /* TDMiniCSSAssembler.m in Sources */, + D3DDDA880F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */, + D3DDDAFE0F083C9700A58000 /* TDCommentStateTest.m in Sources */, + D380BA620F0F06CD0009EC13 /* TDParserFactoryTest.m in Sources */, + D389F5B60F19C76A00558235 /* TDJsonParser.m in Sources */, + D389F5B70F19C76A00558235 /* TDJsonParserTest.m in Sources */, + D31A16520F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */, + D3B43FB80F76E99C0072AF40 /* TDJavaScriptParserTest.m in Sources */, + D3E39C3F0FC5FFD10022DAB9 /* TDDelimitStateTest.m in Sources */, + D3252F7B0FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m in Sources */, + D3252F7F0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */, + D3385FD90FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */, + D3385FDE0FCFB227003BF729 /* TDPredicateEvaluatorTest.m in Sources */, + D36C53790FD27F1300141CB7 /* TDParserFactoryTest2.m in Sources */, + D36C562B0FD365DB00141CB7 /* TDPatternTest.m in Sources */, + D3AF49780FDB122E0032F4DC /* TDParserFactoryPatternTest.m in Sources */, + D355C62D0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */, + D355C6310FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m in Sources */, + D3BBBC9E0FEC9756007DF30D /* TDXMLParser.m in Sources */, + D39E01340FEF02DA00150FC3 /* TDXMLParserTest.m in Sources */, + D338E5BB0FF5DDCB003DE6AA /* TDDifferenceTest.m in Sources */, + D34BAC230FF87F8600D7773A /* TDParserFactoryTest3.m in Sources */, + D34BAC4B0FF892C200D7773A /* XPathParserGrammarTest.m in Sources */, + D3126D0B0FFD9E4B00CBF4C4 /* TDNegationTest.m in Sources */, + D3376D8E10096C0700E4602E /* PKAST.m in Sources */, + D34BAD18100A9B7900996341 /* TDTokenizerStateTest.m in Sources */, + D3668296101D2C200008632C /* ERBTest.m in Sources */, + D3F55F611025737D00DD6DB1 /* TDParseTreeTest.m in Sources */, + D369345D1038DE5300527AF3 /* PKParseTree.m in Sources */, + D369345E1038DE5300527AF3 /* PKParseTreeAssembler.m in Sources */, + D369345F1038DE5300527AF3 /* PKRuleNode.m in Sources */, + D36934601038DE5300527AF3 /* PKTokenNode.m in Sources */, + D3D1BF2810394420003656E5 /* SAXAssembler.m in Sources */, + D3D1BF2B1039445C003656E5 /* SAXTest.m in Sources */, + D38E97CC1061CF6500739C39 /* TDTokenizerBlocksTest.m in Sources */, + D38E98D81062C5BA00739C39 /* TDParserBlocksTest.m in Sources */, + D319E42E106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3FDC5800FFC4BFC00F1F797 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3FDC6EE0FFC4C9E00F1F797 /* RegexKitLite.m in Sources */, + D3FDC6EF0FFC4C9E00F1F797 /* PKReader.m in Sources */, + D3FDC6F00FFC4C9E00F1F797 /* PKAssembly.m in Sources */, + D3FDC6F10FFC4C9E00F1F797 /* PKParser.m in Sources */, + D3FDC6F20FFC4C9E00F1F797 /* PKRepetition.m in Sources */, + D3FDC6F30FFC4C9E00F1F797 /* PKCollectionParser.m in Sources */, + D3FDC6F40FFC4C9E00F1F797 /* PKAlternation.m in Sources */, + D3FDC6F50FFC4C9E00F1F797 /* PKSequence.m in Sources */, + D3FDC6F60FFC4C9E00F1F797 /* PKTrack.m in Sources */, + D3FDC6F70FFC4C9E00F1F797 /* PKTrackException.m in Sources */, + D3FDC6F80FFC4C9E00F1F797 /* PKDifference.m in Sources */, + D3FDC6F90FFC4C9E00F1F797 /* PKIntersection.m in Sources */, + D3FDC6FA0FFC4C9E00F1F797 /* PKTerminal.m in Sources */, + D3FDC6FB0FFC4C9E00F1F797 /* PKEmpty.m in Sources */, + D3FDC6FC0FFC4C9E00F1F797 /* PKTokenAssembly.m in Sources */, + D3FDC6FD0FFC4C9E00F1F797 /* PKToken.m in Sources */, + D3FDC6FE0FFC4C9E00F1F797 /* PKTokenArraySource.m in Sources */, + D3FDC6FF0FFC4C9E00F1F797 /* PKTokenizer.m in Sources */, + D3FDC7000FFC4C9E00F1F797 /* PKTokenizerState.m in Sources */, + D3FDC7010FFC4C9E00F1F797 /* PKNumberState.m in Sources */, + D3FDC7020FFC4C9E00F1F797 /* PKQuoteState.m in Sources */, + D3FDC7030FFC4C9E00F1F797 /* PKSymbolState.m in Sources */, + D3FDC7040FFC4C9E00F1F797 /* PKWordState.m in Sources */, + D3FDC7050FFC4C9E00F1F797 /* PKWhitespaceState.m in Sources */, + D3FDC7060FFC4C9E00F1F797 /* PKDelimitState.m in Sources */, + D3FDC7070FFC4C9E00F1F797 /* PKCommentState.m in Sources */, + D3FDC7080FFC4C9E00F1F797 /* PKSingleLineCommentState.m in Sources */, + D3FDC7090FFC4C9E00F1F797 /* PKMultiLineCommentState.m in Sources */, + D3FDC70A0FFC4C9E00F1F797 /* PKSymbolNode.m in Sources */, + D3FDC70B0FFC4C9E00F1F797 /* PKSymbolRootNode.m in Sources */, + D3FDC70C0FFC4C9E00F1F797 /* PKPattern.m in Sources */, + D3FDC70D0FFC4C9E00F1F797 /* PKWord.m in Sources */, + D3FDC70F0FFC4C9E00F1F797 /* PKQuotedString.m in Sources */, + D3FDC7100FFC4C9E00F1F797 /* PKSymbol.m in Sources */, + D3FDC7110FFC4C9E00F1F797 /* PKLiteral.m in Sources */, + D3FDC7120FFC4C9E00F1F797 /* PKCaseInsensitiveLiteral.m in Sources */, + D3FDC7130FFC4C9E00F1F797 /* PKWhitespace.m in Sources */, + D3FDC7140FFC4C9E00F1F797 /* PKComment.m in Sources */, + D3FDC7150FFC4C9E00F1F797 /* PKDelimitedString.m in Sources */, + D3FDC7160FFC4C9E00F1F797 /* PKAny.m in Sources */, + D3FDC7180FFC4C9E00F1F797 /* PKLowercaseWord.m in Sources */, + D3FDC7190FFC4C9E00F1F797 /* PKUppercaseWord.m in Sources */, + D3FDC71A0FFC4C9E00F1F797 /* PKCharacterAssembly.m in Sources */, + D3FDC71B0FFC4C9E00F1F797 /* PKChar.m in Sources */, + D3FDC71C0FFC4C9E00F1F797 /* PKDigit.m in Sources */, + D3FDC71D0FFC4C9E00F1F797 /* PKLetter.m in Sources */, + D3FDC71E0FFC4C9E00F1F797 /* PKSpecificChar.m in Sources */, + D3FDC71F0FFC4C9E00F1F797 /* PKParserFactory.m in Sources */, + D3FDC7200FFC4C9E00F1F797 /* NSArray+ParseKitAdditions.m in Sources */, + D3FDC7210FFC4C9E00F1F797 /* NSString+ParseKitAdditions.m in Sources */, + D3126DEC0FFDBC1D00CBF4C4 /* PKNegation.m in Sources */, + D3F0E3CC0FFEB70700C9DF74 /* PKNumber.m in Sources */, + D37A28671013942300E936B7 /* PKGrammarParser.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + D31FE7180E60F24700A0803E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D31FE7170E60F24700A0803E /* PBXContainerItemProxy */; + }; + D33494A00E296AA900406085 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D334949F0E296AA900406085 /* PBXContainerItemProxy */; + }; + D34185100E520D6F0081B0DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D341850F0E520D6F0081B0DC /* PBXContainerItemProxy */; + }; + D389F1D40F19665C00558235 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D389F1D30F19665C00558235 /* PBXContainerItemProxy */; + }; + D389F20A0F196A8000558235 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D389F1CD0F1965E600558235 /* JSParseKit */; + targetProxy = D389F2090F196A8000558235 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C1667FE841158C02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1DEB91AE08733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_TEST_COVERAGE_FILES = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKit_Prefix.pch; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GENERATE_PROFILING_CODE = YES; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(TARGET_BUILD_DIR)"; + LLVM_LTO = NO; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + ); + PRODUCT_NAME = ParseKit; + SDKROOT = ""; + WARNING_CFLAGS = "-Wundeclared-selector"; + WRAPPER_EXTENSION = framework; + ZERO_LINK = YES; + }; + name = Debug; + }; + 1DEB91AF08733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "$(TDPARSEKIT_FRAMEWORK_TARGET_PATH)"; + FRAMEWORK_VERSION = A; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKit_Prefix.pch; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvmgcc42; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(TARGET_BUILD_DIR)"; + LLVM_LTO = YES; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + ); + PRODUCT_NAME = ParseKit; + SDKROOT = ""; + TDPARSEKIT_FRAMEWORK_TARGET_PATH = "@executable_path/../Frameworks"; + WARNING_CFLAGS = "-Wundeclared-selector"; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; + 1DEB91B208733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; + }; + name = Debug; + }; + 1DEB91B308733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; + }; + name = Release; + }; + D33494130E2963FE00406085 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = "demoapp/DemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DemoApp; + SDKROOT = ""; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + D33494140E2963FE00406085 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "demoapp/DemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DemoApp; + SDKROOT = ""; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + D34185070E520D410081B0DC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/frameworks\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_WARN_UNUSED_VARIABLE = NO; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "debugapp/DebugApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DebugApp; + SDKROOT = ""; + }; + name = Debug; + }; + D34185080E520D410081B0DC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/frameworks\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "debugapp/DebugApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DebugApp; + SDKROOT = ""; + ZERO_LINK = NO; + }; + name = Release; + }; + D389F1D00F1965E800558235 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + INFOPLIST_FILE = "JSParseKit-Info.plist"; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSParseKit; + SDKROOT = ""; + }; + name = Debug; + }; + D389F1D10F1965E800558235 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_GC = YES; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + INFOPLIST_FILE = "JSParseKit-Info.plist"; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSParseKit; + SDKROOT = ""; + ZERO_LINK = NO; + }; + name = Release; + }; + D389F2060F196A7600558235 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = required; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "jsdemoapp/JSDemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSDemoApp; + SDKROOT = ""; + }; + name = Debug; + }; + D389F2070F196A7600558235 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_GC = required; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "jsdemoapp/JSDemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSDemoApp; + SDKROOT = ""; + ZERO_LINK = NO; + }; + name = Release; + }; + D3C7D87D0A411FC0005DD154 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + "$(DEVELOPER_FRAMEWORKS_DIR_QUOTED)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/frameworks\""; + FRAMEWORK_SEARCH_PATH_DEBUG_BUILD = "\"$(SRCROOT)/build/Debug\""; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "test/Tests-Info.plist"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + LIBRARY_SEARCH_PATHS = ""; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + MACOSX_DEPLOYMENT_TARGET = 10.5; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + SenTestingKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Tests; + SDKROOT = ""; + USER_HEADER_SEARCH_PATHS = ""; + WARNING_CFLAGS = ""; + WRAPPER_EXTENSION = octest; + ZERO_LINK = YES; + }; + name = Debug; + }; + D3C7D87E0A411FC0005DD154 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + "$(DEVELOPER_FRAMEWORKS_DIR_QUOTED)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"/Library/Frameworks\""; + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/frameworks\""; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "test/Tests-Info.plist"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + SenTestingKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Tests; + SDKROOT = ""; + WARNING_CFLAGS = ""; + WRAPPER_EXTENSION = octest; + ZERO_LINK = NO; + }; + name = Release; + }; + D3FDC5840FFC4BFC00F1F797 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKitMobile_Prefix.pch; + HEADER_SEARCH_PATHS = ""; + ONLY_ACTIVE_ARCH = YES; + PREBINDING = NO; + PRODUCT_NAME = parsekit; + SDKROOT = iphoneos3.0; + }; + name = Debug; + }; + D3FDC5850FFC4BFC00F1F797 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = ""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKitMobile_Prefix.pch; + HEADER_SEARCH_PATHS = ""; + OTHER_LDFLAGS = ""; + PREBINDING = NO; + PRODUCT_NAME = parsekit; + SDKROOT = iphoneos3.0; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "ParseKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91AE08733DA50010E9CD /* Debug */, + 1DEB91AF08733DA50010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ParseKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91B208733DA50010E9CD /* Debug */, + 1DEB91B308733DA50010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D33494150E2963FE00406085 /* Build configuration list for PBXNativeTarget "DemoApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D33494130E2963FE00406085 /* Debug */, + D33494140E2963FE00406085 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D34185090E520D410081B0DC /* Build configuration list for PBXNativeTarget "DebugApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D34185070E520D410081B0DC /* Debug */, + D34185080E520D410081B0DC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D389F1D20F1965E800558235 /* Build configuration list for PBXNativeTarget "JSParseKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D389F1D00F1965E800558235 /* Debug */, + D389F1D10F1965E800558235 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D389F2080F196A7600558235 /* Build configuration list for PBXNativeTarget "JSDemoApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D389F2060F196A7600558235 /* Debug */, + D389F2070F196A7600558235 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D3C7D87C0A411FC0005DD154 /* Build configuration list for PBXNativeTarget "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3C7D87D0A411FC0005DD154 /* Debug */, + D3C7D87E0A411FC0005DD154 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D3FDC62F0FFC4C2000F1F797 /* Build configuration list for PBXNativeTarget "ParseKitMobile" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3FDC5840FFC4BFC00F1F797 /* Debug */, + D3FDC5850FFC4BFC00F1F797 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0867D690FE84028FC02AAC07 /* Project object */; +} diff --git a/ParseKit.xcodeproj/project.pbxproj b/ParseKit.xcodeproj/project.pbxproj new file mode 100644 index 0000000..382638b --- /dev/null +++ b/ParseKit.xcodeproj/project.pbxproj @@ -0,0 +1,3720 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXBuildFile section */ + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; + D302C69D0EF044810090E714 /* TDPlistParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36568A60EEF9FE900226554 /* TDPlistParser.m */; }; + D3126D060FFD9BA700CBF4C4 /* PKNegation.m in Sources */ = {isa = PBXBuildFile; fileRef = D3126D040FFD9BA700CBF4C4 /* PKNegation.m */; }; + D3126D0B0FFD9E4B00CBF4C4 /* TDNegationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3126D0A0FFD9E4B00CBF4C4 /* TDNegationTest.m */; }; + D3126DEC0FFDBC1D00CBF4C4 /* PKNegation.m in Sources */ = {isa = PBXBuildFile; fileRef = D3126D040FFD9BA700CBF4C4 /* PKNegation.m */; }; + D315DF720FEF59B600D876C8 /* date.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D315DF710FEF59B600D876C8 /* date.grammar */; }; + D315DF730FEF59B600D876C8 /* date.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D315DF710FEF59B600D876C8 /* date.grammar */; }; + D319E42A106D8A1F008C63DD /* arithmetic.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D319E429106D8A1F008C63DD /* arithmetic.grammar */; }; + D319E42B106D8A1F008C63DD /* arithmetic.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D319E429106D8A1F008C63DD /* arithmetic.grammar */; }; + D319E42E106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */; }; + D319E42F106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */; }; + D31A15260F6DE449002AFDF1 /* javascript.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D31A15250F6DE449002AFDF1 /* javascript.grammar */; }; + D31A15270F6DE449002AFDF1 /* javascript.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D31A15250F6DE449002AFDF1 /* javascript.grammar */; }; + D31A16520F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */; }; + D31A16530F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */; }; + D31FE54C0E60E46100A0803E /* TDTestScaffold.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE54B0E60E46100A0803E /* TDTestScaffold.m */; }; + D31FE5630E60E50800A0803E /* TDAlternationTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE54E0E60E50800A0803E /* TDAlternationTest.m */; }; + D31FE5640E60E50800A0803E /* TDLiteralTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5500E60E50800A0803E /* TDLiteralTest.m */; }; + D31FE5650E60E50800A0803E /* TDParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5520E60E50800A0803E /* TDParserTest.m */; }; + D31FE5660E60E50800A0803E /* TDRepetitionTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5540E60E50800A0803E /* TDRepetitionTest.m */; }; + D31FE5680E60E50800A0803E /* TDRobotCommandTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5580E60E50800A0803E /* TDRobotCommandTest.m */; }; + D31FE5690E60E50800A0803E /* TDSequenceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE55A0E60E50800A0803E /* TDSequenceTest.m */; }; + D31FE56A0E60E50800A0803E /* TDSymbolTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE55C0E60E50800A0803E /* TDSymbolTest.m */; }; + D31FE56B0E60E50800A0803E /* TDTokenAssemblyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE55E0E60E50800A0803E /* TDTokenAssemblyTest.m */; }; + D31FE56C0E60E50800A0803E /* TDTrackTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5600E60E50800A0803E /* TDTrackTest.m */; }; + D31FE56D0E60E50800A0803E /* TDUppercaseWordTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5620E60E50800A0803E /* TDUppercaseWordTest.m */; }; + D31FE5750E60E55700A0803E /* TDReaderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5720E60E55700A0803E /* TDReaderTest.m */; }; + D31FE5760E60E55700A0803E /* TDTokenizerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5740E60E55700A0803E /* TDTokenizerTest.m */; }; + D31FE5850E60E58C00A0803E /* TDNumberStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5780E60E58C00A0803E /* TDNumberStateTest.m */; }; + D31FE5860E60E58C00A0803E /* TDQuoteStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE57A0E60E58C00A0803E /* TDQuoteStateTest.m */; }; + D31FE5890E60E58C00A0803E /* TDSymbolStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5800E60E58C00A0803E /* TDSymbolStateTest.m */; }; + D31FE58A0E60E58C00A0803E /* TDWhitespaceStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5820E60E58C00A0803E /* TDWhitespaceStateTest.m */; }; + D31FE58B0E60E58C00A0803E /* TDWordStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5840E60E58C00A0803E /* TDWordStateTest.m */; }; + D31FE5960E60E5AC00A0803E /* TDCharacterAssemblyTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE58D0E60E5AC00A0803E /* TDCharacterAssemblyTest.m */; }; + D31FE5970E60E5AC00A0803E /* TDCharTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE58F0E60E5AC00A0803E /* TDCharTest.m */; }; + D31FE5980E60E5AC00A0803E /* TDDigitTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5910E60E5AC00A0803E /* TDDigitTest.m */; }; + D31FE5990E60E5AC00A0803E /* TDLetterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5930E60E5AC00A0803E /* TDLetterTest.m */; }; + D31FE59A0E60E5AC00A0803E /* TDSpecificCharTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5950E60E5AC00A0803E /* TDSpecificCharTest.m */; }; + D31FE59F0E60E5C000A0803E /* TDRegularParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE59C0E60E5C000A0803E /* TDRegularParser.m */; }; + D31FE5A00E60E5C000A0803E /* TDRegularParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE59E0E60E5C000A0803E /* TDRegularParserTest.m */; }; + D31FE5A90E60E5D500A0803E /* TDFastJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */; }; + D31FE5AA0E60E5D500A0803E /* TDFastJsonParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5A40E60E5D500A0803E /* TDFastJsonParserTest.m */; }; + D31FE5B10E60E64900A0803E /* TDXmlTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5AE0E60E64900A0803E /* TDXmlTokenAssembly.m */; }; + D31FE5B20E60E64900A0803E /* TDXmlTokenizerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5B00E60E64900A0803E /* TDXmlTokenizerTest.m */; }; + D31FE5B70E60E66600A0803E /* TDXmlToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5B40E60E66600A0803E /* TDXmlToken.m */; }; + D31FE5B80E60E66600A0803E /* TDXmlTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5B60E60E66600A0803E /* TDXmlTokenizer.m */; }; + D31FE5DD0E60E69E00A0803E /* TDXmlAttribute.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5BA0E60E69E00A0803E /* TDXmlAttribute.m */; }; + D31FE5DE0E60E69E00A0803E /* TDXmlCdata.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5BC0E60E69E00A0803E /* TDXmlCdata.m */; }; + D31FE5DF0E60E69E00A0803E /* TDXmlComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5BE0E60E69E00A0803E /* TDXmlComment.m */; }; + D31FE5E00E60E69E00A0803E /* TDXmlDecl.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C00E60E69E00A0803E /* TDXmlDecl.m */; }; + D31FE5E10E60E69E00A0803E /* TDXmlDoctype.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C20E60E69E00A0803E /* TDXmlDoctype.m */; }; + D31FE5E20E60E69E00A0803E /* TDXmlDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C40E60E69E00A0803E /* TDXmlDocument.m */; }; + D31FE5E30E60E69E00A0803E /* TDXmlEndEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C60E60E69E00A0803E /* TDXmlEndEntity.m */; }; + D31FE5E40E60E69E00A0803E /* TDXmlEndTag.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5C80E60E69E00A0803E /* TDXmlEndTag.m */; }; + D31FE5E50E60E69E00A0803E /* TDXmlEntity.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5CA0E60E69E00A0803E /* TDXmlEntity.m */; }; + D31FE5E60E60E69E00A0803E /* TDXmlEntityRef.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5CC0E60E69E00A0803E /* TDXmlEntityRef.m */; }; + D31FE5E70E60E69E00A0803E /* TDXmlFragment.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5CE0E60E69E00A0803E /* TDXmlFragment.m */; }; + D31FE5E80E60E69E00A0803E /* TDXmlNotation.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D00E60E69E00A0803E /* TDXmlNotation.m */; }; + D31FE5E90E60E69E00A0803E /* TDXmlProcessingInstruction.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D20E60E69E00A0803E /* TDXmlProcessingInstruction.m */; }; + D31FE5EA0E60E69E00A0803E /* TDXmlSignificantWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D40E60E69E00A0803E /* TDXmlSignificantWhitespace.m */; }; + D31FE5EB0E60E69E00A0803E /* TDXmlStartTag.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D60E60E69E00A0803E /* TDXmlStartTag.m */; }; + D31FE5EC0E60E69E00A0803E /* TDXmlTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5D80E60E69E00A0803E /* TDXmlTerminal.m */; }; + D31FE5ED0E60E69E00A0803E /* TDXmlText.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5DA0E60E69E00A0803E /* TDXmlText.m */; }; + D31FE5EE0E60E69E00A0803E /* TDXmlWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5DC0E60E69E00A0803E /* TDXmlWhitespace.m */; }; + D31FE5FC0E60E6B500A0803E /* TDNCNameState.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F10E60E6B500A0803E /* TDNCNameState.m */; }; + D31FE5FD0E60E6B500A0803E /* TDXmlName.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F30E60E6B500A0803E /* TDXmlName.m */; }; + D31FE5FE0E60E6B500A0803E /* TDXmlNameState.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F50E60E6B500A0803E /* TDXmlNameState.m */; }; + D31FE5FF0E60E6B500A0803E /* TDXmlNameTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F70E60E6B500A0803E /* TDXmlNameTest.m */; }; + D31FE6000E60E6B500A0803E /* TDXmlNmtoken.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5F90E60E6B500A0803E /* TDXmlNmtoken.m */; }; + D31FE6010E60E6B500A0803E /* TDXmlNmtokenState.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5FB0E60E6B500A0803E /* TDXmlNmtokenState.m */; }; + D31FE6E00E60EE2500A0803E /* TDNCName.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE6DF0E60EE2500A0803E /* TDNCName.m */; }; + D31FE7300E60F31E00A0803E /* TDFastJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */; }; + D31FE7320E60F33000A0803E /* EBNFParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E78A160E574C99008C7D61 /* EBNFParser.m */; }; + D31FE7330E60F33C00A0803E /* XMLReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D3521F530E5FA1B0009681F9 /* XMLReader.m */; }; + D31FE7340E60F34600A0803E /* XPathParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E95450E578ECC00496BD3 /* XPathParser.m */; }; + D31FE7380E60F36600A0803E /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D36E9F860E5A795400496BD3 /* libxml2.dylib */; }; + D31FE7400E60F40300A0803E /* XPathAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */; }; + D31FE7420E60F40900A0803E /* XPathContext.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98210E58A3A800496BD3 /* XPathContext.m */; }; + D3252F7B0FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3252F790FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m */; }; + D3252F7E0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */; }; + D3252F7F0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */; }; + D3305C4F102F5BAE00DC4F75 /* TDGutterView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3305C4C102F5BAD00DC4F75 /* TDGutterView.m */; }; + D3305C50102F5BAE00DC4F75 /* TDSourceCodeTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3305C4E102F5BAE00DC4F75 /* TDSourceCodeTextView.m */; }; + D33494720E29670B00406085 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D3376D5910093A1600E4602E /* PKGrammarParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3376D5710093A1600E4602E /* PKGrammarParser.h */; }; + D3376D5A10093A1600E4602E /* PKGrammarParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D5810093A1600E4602E /* PKGrammarParser.m */; }; + D3376D8E10096C0700E4602E /* PKAST.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D8D10096C0700E4602E /* PKAST.m */; }; + D3376D8F10096C0700E4602E /* PKAST.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D8D10096C0700E4602E /* PKAST.m */; }; + D3385FD90FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */; }; + D3385FDA0FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */; }; + D3385FDE0FCFB227003BF729 /* TDPredicateEvaluatorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3385FDC0FCFB227003BF729 /* TDPredicateEvaluatorTest.m */; }; + D338E5BB0FF5DDCB003DE6AA /* TDDifferenceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D338E5BA0FF5DDCB003DE6AA /* TDDifferenceTest.m */; }; + D341850C0E520D640081B0DC /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D34BAC230FF87F8600D7773A /* TDParserFactoryTest3.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAC220FF87F8600D7773A /* TDParserFactoryTest3.m */; }; + D34BAC4B0FF892C200D7773A /* XPathParserGrammarTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAC4A0FF892C200D7773A /* XPathParserGrammarTest.m */; }; + D34BAC9A0FF8A9AD00D7773A /* xpath1_0.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741430EF8E96A00559B9F /* xpath1_0.grammar */; }; + D34BAD18100A9B7900996341 /* TDTokenizerStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAD17100A9B7900996341 /* TDTokenizerStateTest.m */; }; + D34BAD640FF9C6AE00D7773A /* ParseKit_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = D34BAD630FF9C6AE00D7773A /* ParseKit_Prefix.pch */; }; + D34BAD9D0FF9C95800D7773A /* PKReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAD9B0FF9C95800D7773A /* PKReader.m */; }; + D34BADA20FF9C9B000D7773A /* PKAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADA00FF9C9B000D7773A /* PKAssembly.m */; }; + D34BADD80FF9CBFB00D7773A /* PKParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADD60FF9CBFB00D7773A /* PKParser.m */; }; + D34BAE030FF9CCAE00D7773A /* PKCollectionParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */; }; + D34BAE1D0FF9CE0E00D7773A /* PKAlternation.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */; }; + D34BAE1F0FF9CE0E00D7773A /* PKEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */; }; + D34BAE210FF9CE0E00D7773A /* PKDifference.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */; }; + D34BAE230FF9CE0E00D7773A /* PKIntersection.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE110FF9CE0E00D7773A /* PKIntersection.m */; }; + D34BAE250FF9CE0E00D7773A /* PKRepetition.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE130FF9CE0E00D7773A /* PKRepetition.m */; }; + D34BAE270FF9CE0E00D7773A /* PKSequence.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE150FF9CE0E00D7773A /* PKSequence.m */; }; + D34BAE290FF9CE0E00D7773A /* PKTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE170FF9CE0E00D7773A /* PKTerminal.m */; }; + D34BAE2B0FF9CE0E00D7773A /* PKTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE190FF9CE0E00D7773A /* PKTrack.m */; }; + D34BAE2D0FF9CE0E00D7773A /* PKTrackException.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */; }; + D34BAE310FF9CE6000D7773A /* PKAny.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE2F0FF9CE6000D7773A /* PKAny.m */; }; + D34BAE8D0FF9D15100D7773A /* PKTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */; }; + D34BAE9D0FF9D20900D7773A /* PKToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE950FF9D20900D7773A /* PKToken.m */; }; + D34BAE9F0FF9D20900D7773A /* PKTokenArraySource.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */; }; + D34BAEA10FF9D20900D7773A /* PKTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE990FF9D20900D7773A /* PKTokenizer.m */; }; + D34BAEA30FF9D20900D7773A /* PKTokenizerState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */; }; + D34BAED80FF9D56400D7773A /* PKCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC40FF9D56400D7773A /* PKCommentState.m */; }; + D34BAEDA0FF9D56400D7773A /* PKDelimitState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC60FF9D56400D7773A /* PKDelimitState.m */; }; + D34BAEDC0FF9D56400D7773A /* PKMultiLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */; }; + D34BAEDE0FF9D56400D7773A /* PKNumberState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECA0FF9D56400D7773A /* PKNumberState.m */; }; + D34BAEE00FF9D56400D7773A /* PKQuoteState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECC0FF9D56400D7773A /* PKQuoteState.m */; }; + D34BAEE20FF9D56400D7773A /* PKSingleLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */; }; + D34BAEE40FF9D56400D7773A /* PKSymbolState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED00FF9D56400D7773A /* PKSymbolState.m */; }; + D34BAEE60FF9D56400D7773A /* PKWhitespaceState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */; }; + D34BAEE80FF9D56400D7773A /* PKWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED40FF9D56400D7773A /* PKWord.m */; }; + D34BAEEA0FF9D56400D7773A /* PKWordState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED60FF9D56400D7773A /* PKWordState.m */; }; + D34BAF280FF9DF9900D7773A /* PKSymbolNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */; }; + D34BAF2A0FF9DF9900D7773A /* PKSymbolRootNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */; }; + D34BAF3A0FF9E18300D7773A /* PKPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF380FF9E18300D7773A /* PKPattern.m */; }; + D34BAF4C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */; }; + D34BAF4E0FF9E19700D7773A /* PKComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3E0FF9E19700D7773A /* PKComment.m */; }; + D34BAF500FF9E19700D7773A /* PKDelimitedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF400FF9E19700D7773A /* PKDelimitedString.m */; }; + D34BAF520FF9E19700D7773A /* PKLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF420FF9E19700D7773A /* PKLiteral.m */; }; + D34BAF540FF9E19700D7773A /* PKNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF440FF9E19700D7773A /* PKNumber.m */; }; + D34BAF560FF9E19700D7773A /* PKQuotedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF460FF9E19700D7773A /* PKQuotedString.m */; }; + D34BAF580FF9E19700D7773A /* PKSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF480FF9E19700D7773A /* PKSymbol.m */; }; + D34BAF5A0FF9E19700D7773A /* PKWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */; }; + D34BAF9D0FF9E6D100D7773A /* PKLowercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */; }; + D34BAF9F0FF9E6D100D7773A /* PKUppercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */; }; + D34BAFB20FF9E7F300D7773A /* PKCharacterAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */; }; + D34BAFBC0FF9E80300D7773A /* PKChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB40FF9E80300D7773A /* PKChar.m */; }; + D34BAFBE0FF9E80300D7773A /* PKDigit.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB60FF9E80300D7773A /* PKDigit.m */; }; + D34BAFC00FF9E80300D7773A /* PKLetter.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB80FF9E80300D7773A /* PKLetter.m */; }; + D34BAFC20FF9E80300D7773A /* PKSpecificChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */; }; + D34BAFDA0FF9E95500D7773A /* NSArray+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */; }; + D34BAFDC0FF9E95500D7773A /* NSString+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */; }; + D34BAFDE0FF9E95500D7773A /* PKParserFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD80FF9E95500D7773A /* PKParserFactory.m */; }; + D34BB0680FF9EDDF00D7773A /* JSParseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0660FF9EDDF00D7773A /* JSParseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0690FF9EDDF00D7773A /* JSParseKit.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0670FF9EDDF00D7773A /* JSParseKit.m */; }; + D34BB0710FF9EE4000D7773A /* PKJSAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06A0FF9EE4000D7773A /* PKJSAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0720FF9EE4000D7773A /* PKJSAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB06B0FF9EE4000D7773A /* PKJSAssembly.m */; }; + D34BB0730FF9EE4000D7773A /* PKJSUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06C0FF9EE4000D7773A /* PKJSUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0740FF9EE4000D7773A /* PKJSUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB06D0FF9EE4000D7773A /* PKJSUtils.m */; }; + D34BB0750FF9EE4000D7773A /* PKJSUtils_macros.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06E0FF9EE4000D7773A /* PKJSUtils_macros.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0760FF9EE4000D7773A /* PKJSValueHolder.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB06F0FF9EE4000D7773A /* PKJSValueHolder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0770FF9EE4000D7773A /* PKJSValueHolder.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0700FF9EE4000D7773A /* PKJSValueHolder.m */; }; + D34BB08F0FF9EF9D00D7773A /* PKJSCharacterAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB08D0FF9EF9D00D7773A /* PKJSCharacterAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0900FF9EF9D00D7773A /* PKJSCharacterAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB08E0FF9EF9D00D7773A /* PKJSCharacterAssembly.m */; }; + D34BB0A90FF9F14B00D7773A /* PKJSCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0930FF9F14B00D7773A /* PKJSCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0AA0FF9F14B00D7773A /* PKJSCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0940FF9F14B00D7773A /* PKJSCommentState.m */; }; + D34BB0AB0FF9F14B00D7773A /* PKJSDelimitState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0950FF9F14B00D7773A /* PKJSDelimitState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0AC0FF9F14B00D7773A /* PKJSDelimitState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0960FF9F14B00D7773A /* PKJSDelimitState.m */; }; + D34BB0AD0FF9F14B00D7773A /* PKJSNumberState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0970FF9F14B00D7773A /* PKJSNumberState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0AE0FF9F14B00D7773A /* PKJSNumberState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0980FF9F14B00D7773A /* PKJSNumberState.m */; }; + D34BB0AF0FF9F14B00D7773A /* PKJSQuoteState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0990FF9F14B00D7773A /* PKJSQuoteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B00FF9F14B00D7773A /* PKJSQuoteState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB09A0FF9F14B00D7773A /* PKJSQuoteState.m */; }; + D34BB0B10FF9F14B00D7773A /* PKJSSymbolState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB09B0FF9F14B00D7773A /* PKJSSymbolState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B20FF9F14B00D7773A /* PKJSSymbolState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB09C0FF9F14B00D7773A /* PKJSSymbolState.m */; }; + D34BB0B30FF9F14B00D7773A /* PKJSToken.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB09D0FF9F14B00D7773A /* PKJSToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B40FF9F14B00D7773A /* PKJSToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB09E0FF9F14B00D7773A /* PKJSToken.m */; }; + D34BB0B50FF9F14B00D7773A /* PKJSTokenAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB09F0FF9F14B00D7773A /* PKJSTokenAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B60FF9F14B00D7773A /* PKJSTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A00FF9F14B00D7773A /* PKJSTokenAssembly.m */; }; + D34BB0B70FF9F14B00D7773A /* PKJSTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A10FF9F14B00D7773A /* PKJSTokenizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0B80FF9F14B00D7773A /* PKJSTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A20FF9F14B00D7773A /* PKJSTokenizer.m */; }; + D34BB0B90FF9F14B00D7773A /* PKJSTokenizerState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A30FF9F14B00D7773A /* PKJSTokenizerState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0BA0FF9F14B00D7773A /* PKJSTokenizerState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A40FF9F14B00D7773A /* PKJSTokenizerState.m */; }; + D34BB0BB0FF9F14B00D7773A /* PKJSWhitespaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A50FF9F14B00D7773A /* PKJSWhitespaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0BC0FF9F14B00D7773A /* PKJSWhitespaceState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A60FF9F14B00D7773A /* PKJSWhitespaceState.m */; }; + D34BB0BD0FF9F14B00D7773A /* PKJSWordState.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0A70FF9F14B00D7773A /* PKJSWordState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0BE0FF9F14B00D7773A /* PKJSWordState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0A80FF9F14B00D7773A /* PKJSWordState.m */; }; + D34BB0E60FF9F28000D7773A /* PKJSAlternation.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D20FF9F28000D7773A /* PKJSAlternation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0E70FF9F28000D7773A /* PKJSAlternation.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D30FF9F28000D7773A /* PKJSAlternation.m */; }; + D34BB0E80FF9F28000D7773A /* PKJSAny.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D40FF9F28000D7773A /* PKJSAny.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0E90FF9F28000D7773A /* PKJSAny.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D50FF9F28000D7773A /* PKJSAny.m */; }; + D34BB0EA0FF9F28000D7773A /* PKJSAssemblerAdapter.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D60FF9F28000D7773A /* PKJSAssemblerAdapter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0EB0FF9F28000D7773A /* PKJSAssemblerAdapter.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D70FF9F28000D7773A /* PKJSAssemblerAdapter.m */; }; + D34BB0EC0FF9F28000D7773A /* PKJSCollectionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0D80FF9F28000D7773A /* PKJSCollectionParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0ED0FF9F28000D7773A /* PKJSCollectionParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0D90FF9F28000D7773A /* PKJSCollectionParser.m */; }; + D34BB0EE0FF9F28000D7773A /* PKJSEmpty.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0DA0FF9F28000D7773A /* PKJSEmpty.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0EF0FF9F28000D7773A /* PKJSEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0DB0FF9F28000D7773A /* PKJSEmpty.m */; }; + D34BB0F00FF9F28000D7773A /* PKJSParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0DC0FF9F28000D7773A /* PKJSParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F10FF9F28000D7773A /* PKJSParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0DD0FF9F28000D7773A /* PKJSParser.m */; }; + D34BB0F20FF9F28000D7773A /* PKJSRepetition.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0DE0FF9F28000D7773A /* PKJSRepetition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F30FF9F28000D7773A /* PKJSRepetition.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0DF0FF9F28000D7773A /* PKJSRepetition.m */; }; + D34BB0F40FF9F28000D7773A /* PKJSSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0E00FF9F28000D7773A /* PKJSSequence.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F50FF9F28000D7773A /* PKJSSequence.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0E10FF9F28000D7773A /* PKJSSequence.m */; }; + D34BB0F60FF9F28000D7773A /* PKJSTerminal.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0E20FF9F28000D7773A /* PKJSTerminal.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F70FF9F28000D7773A /* PKJSTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0E30FF9F28000D7773A /* PKJSTerminal.m */; }; + D34BB0F80FF9F28000D7773A /* PKJSTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0E40FF9F28000D7773A /* PKJSTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB0F90FF9F28000D7773A /* PKJSTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0E50FF9F28000D7773A /* PKJSTrack.m */; }; + D34BB1140FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB0FE0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1150FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB0FF0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m */; }; + D34BB1160FF9F36200D7773A /* PKJSComment.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1000FF9F36200D7773A /* PKJSComment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1170FF9F36200D7773A /* PKJSComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1010FF9F36200D7773A /* PKJSComment.m */; }; + D34BB1180FF9F36200D7773A /* PKJSDelimitedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1020FF9F36200D7773A /* PKJSDelimitedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1190FF9F36200D7773A /* PKJSDelimitedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1030FF9F36200D7773A /* PKJSDelimitedString.m */; }; + D34BB11A0FF9F36200D7773A /* PKJSLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1040FF9F36200D7773A /* PKJSLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB11B0FF9F36200D7773A /* PKJSLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1050FF9F36200D7773A /* PKJSLiteral.m */; }; + D34BB11C0FF9F36200D7773A /* PKJSLowercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1060FF9F36200D7773A /* PKJSLowercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB11D0FF9F36200D7773A /* PKJSLowercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1070FF9F36200D7773A /* PKJSLowercaseWord.m */; }; + D34BB11E0FF9F36200D7773A /* PKJSNum.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1080FF9F36200D7773A /* PKJSNum.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB11F0FF9F36200D7773A /* PKJSNum.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1090FF9F36200D7773A /* PKJSNum.m */; }; + D34BB1200FF9F36200D7773A /* PKJSPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB10A0FF9F36200D7773A /* PKJSPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1210FF9F36200D7773A /* PKJSPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB10B0FF9F36200D7773A /* PKJSPattern.m */; }; + D34BB1220FF9F36200D7773A /* PKJSQuotedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB10C0FF9F36200D7773A /* PKJSQuotedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1230FF9F36200D7773A /* PKJSQuotedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB10D0FF9F36200D7773A /* PKJSQuotedString.m */; }; + D34BB1240FF9F36200D7773A /* PKJSSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB10E0FF9F36200D7773A /* PKJSSymbol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1250FF9F36200D7773A /* PKJSSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB10F0FF9F36200D7773A /* PKJSSymbol.m */; }; + D34BB1260FF9F36200D7773A /* PKJSUppercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1100FF9F36200D7773A /* PKJSUppercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1270FF9F36200D7773A /* PKJSUppercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1110FF9F36200D7773A /* PKJSUppercaseWord.m */; }; + D34BB1280FF9F36200D7773A /* PKJSWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BB1120FF9F36200D7773A /* PKJSWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D34BB1290FF9F36200D7773A /* PKJSWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BB1130FF9F36200D7773A /* PKJSWord.m */; }; + D3521F560E5FA1B0009681F9 /* XMLReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D3521F530E5FA1B0009681F9 /* XMLReader.m */; }; + D3521F570E5FA1B0009681F9 /* XMLReaderTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3521F550E5FA1B0009681F9 /* XMLReaderTest.m */; }; + D35384ED0FE9691100926552 /* nspredicate.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D35384EC0FE9691100926552 /* nspredicate.grammar */; }; + D353899C0FEAC94400926552 /* c.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D353899B0FEAC94400926552 /* c.grammar */; }; + D353899E0FEAC96B00926552 /* objc.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D353899D0FEAC96B00926552 /* objc.grammar */; }; + D355C62D0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */; }; + D355C62E0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */ = {isa = PBXBuildFile; fileRef = D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */; }; + D355C6310FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D355C6300FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m */; }; + D355C6A70FE9F704006A91A4 /* nspredicate.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D35384EC0FE9691100926552 /* nspredicate.grammar */; }; + D355C8810FEB36A1006A91A4 /* xml.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D355C8800FEB36A1006A91A4 /* xml.grammar */; }; + D355C8840FEB4B94006A91A4 /* proto.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D355C8830FEB4B94006A91A4 /* proto.grammar */; }; + D3587EAF0FE83EC900DDD023 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D36568A70EEF9FE900226554 /* TDPlistParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36568A60EEF9FE900226554 /* TDPlistParser.m */; }; + D36568AA0EEFA05300226554 /* TDPlistParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D36568A90EEFA05300226554 /* TDPlistParserTest.m */; }; + D3656DFE0EF2620E00226554 /* TDTokenArraySourceTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3656DFD0EF2620E00226554 /* TDTokenArraySourceTest.m */; }; + D3668292101D2BFA0008632C /* erb.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3668291101D2BFA0008632C /* erb.grammar */; }; + D3668293101D2C000008632C /* erb.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3668291101D2BFA0008632C /* erb.grammar */; }; + D3668296101D2C200008632C /* ERBTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3668295101D2C200008632C /* ERBTest.m */; }; + D369345D1038DE5300527AF3 /* PKParseTree.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934561038DE5300527AF3 /* PKParseTree.m */; }; + D369345E1038DE5300527AF3 /* PKParseTreeAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */; }; + D369345F1038DE5300527AF3 /* PKRuleNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345A1038DE5300527AF3 /* PKRuleNode.m */; }; + D36934601038DE5300527AF3 /* PKTokenNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345C1038DE5300527AF3 /* PKTokenNode.m */; }; + D36934721038E28300527AF3 /* PKParseTree.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934561038DE5300527AF3 /* PKParseTree.m */; }; + D36934731038E28700527AF3 /* PKParseTreeAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */; }; + D36934741038E28B00527AF3 /* PKRuleNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345A1038DE5300527AF3 /* PKRuleNode.m */; }; + D36934751038E28F00527AF3 /* PKTokenNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D369345C1038DE5300527AF3 /* PKTokenNode.m */; }; + D36C53790FD27F1300141CB7 /* TDParserFactoryTest2.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C53780FD27F1300141CB7 /* TDParserFactoryTest2.m */; }; + D36C55FF0FD3617B00141CB7 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */; }; + D36C560C0FD363D500141CB7 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D36C560B0FD363D500141CB7 /* libicucore.dylib */; }; + D36C562B0FD365DB00141CB7 /* TDPatternTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C562A0FD365DB00141CB7 /* TDPatternTest.m */; }; + D36E95460E578ECC00496BD3 /* XPathParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E95450E578ECC00496BD3 /* XPathParser.m */; }; + D36E95D80E57B08400496BD3 /* XPathParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E95D70E57B08400496BD3 /* XPathParserTest.m */; }; + D36E97B00E589DAE00496BD3 /* XPathAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */; }; + D36E98220E58A3A800496BD3 /* XPathContext.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98210E58A3A800496BD3 /* XPathContext.m */; }; + D36E98E00E58C12800496BD3 /* DebugAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98DD0E58C12800496BD3 /* DebugAppDelegate.m */; }; + D36E98E10E58C12800496BD3 /* DebugAppMainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D36E98DE0E58C12800496BD3 /* DebugAppMainMenu.xib */; }; + D36E98E20E58C12800496BD3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98DF0E58C12800496BD3 /* main.m */; }; + D36E98E70E58C14000496BD3 /* DemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98E40E58C14000496BD3 /* DemoAppDelegate.m */; }; + D36E98E80E58C14000496BD3 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D36E98E50E58C14000496BD3 /* main.m */; }; + D36E98F80E58C1A000496BD3 /* DemoAppMainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D36E98F70E58C1A000496BD3 /* DemoAppMainMenu.xib */; }; + D36E9F870E5A795400496BD3 /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D36E9F860E5A795400496BD3 /* libxml2.dylib */; }; + D36E9FB50E5A944A00496BD3 /* apple-boss.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36E9FB40E5A944A00496BD3 /* apple-boss.xml */; }; + D36E9FE50E5BA0FC00496BD3 /* SRGSGrammar.txt in Resources */ = {isa = PBXBuildFile; fileRef = D36E9FE40E5BA0FC00496BD3 /* SRGSGrammar.txt */; }; + D36EA3B00E5EA67E00496BD3 /* small-xml-file.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */; }; + D37A28671013942300E936B7 /* PKGrammarParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3376D5810093A1600E4602E /* PKGrammarParser.m */; }; + D37A28681013942A00E936B7 /* PKGrammarParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3376D5710093A1600E4602E /* PKGrammarParser.h */; }; + D37D3A000FE77A71008C2E4D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D37D3A010FE77A72008C2E4D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D37D3A020FE77A77008C2E4D /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; }; + D380AFBD0F0C54B60009EC13 /* html.css in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBB0F0C54B60009EC13 /* html.css */; }; + D380AFBE0F0C54B60009EC13 /* html.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBC0F0C54B60009EC13 /* html.grammar */; }; + D380AFBF0F0C54B60009EC13 /* html.css in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBB0F0C54B60009EC13 /* html.css */; }; + D380AFC00F0C54B60009EC13 /* html.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380AFBC0F0C54B60009EC13 /* html.grammar */; }; + D380AFC30F0C56000009EC13 /* example.html in Resources */ = {isa = PBXBuildFile; fileRef = D380AFC20F0C56000009EC13 /* example.html */; }; + D380AFC40F0C56000009EC13 /* example.html in Resources */ = {isa = PBXBuildFile; fileRef = D380AFC20F0C56000009EC13 /* example.html */; }; + D380B3230F0CC0800009EC13 /* nyt.html in Resources */ = {isa = PBXBuildFile; fileRef = D38DD9E70EC29F260070BC4D /* nyt.html */; }; + D380B5090F0D71A90009EC13 /* css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380B5080F0D71A90009EC13 /* css.grammar */; }; + D380B50A0F0D71B00009EC13 /* css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D380B5080F0D71A90009EC13 /* css.grammar */; }; + D380B5380F0D7DDE0009EC13 /* css.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5370F0D7DDE0009EC13 /* css.css */; }; + D380B5390F0D7DE30009EC13 /* css.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5370F0D7DDE0009EC13 /* css.css */; }; + D380B5940F0D82F60009EC13 /* example.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5930F0D82F60009EC13 /* example.css */; }; + D380B5950F0D82F90009EC13 /* example.css in Resources */ = {isa = PBXBuildFile; fileRef = D380B5930F0D82F60009EC13 /* example.css */; }; + D380B9800F0EF3860009EC13 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D380BA620F0F06CD0009EC13 /* TDParserFactoryTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D380BA600F0F06CD0009EC13 /* TDParserFactoryTest.m */; }; + D380BAA30F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D380BAA40F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D38205BE0EEE48EE004340DD /* TDTokenTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D38205BD0EEE48EE004340DD /* TDTokenTest.m */; }; + D383498B0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */; }; + D383498C0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */; }; + D38349BC0F0C0D910055E4E0 /* json_with_comments.css in Resources */ = {isa = PBXBuildFile; fileRef = D38349BB0F0C0D910055E4E0 /* json_with_comments.css */; }; + D38349BD0F0C0D910055E4E0 /* json_with_comments.css in Resources */ = {isa = PBXBuildFile; fileRef = D38349BB0F0C0D910055E4E0 /* json_with_comments.css */; }; + D3834A480F0C14B60055E4E0 /* yahoo_with_comments.json in Resources */ = {isa = PBXBuildFile; fileRef = D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */; }; + D3834A490F0C14C00055E4E0 /* yahoo_with_comments.json in Resources */ = {isa = PBXBuildFile; fileRef = D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */; }; + D385F98C0F046FE900DB2946 /* TDGenericAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385F9890F046FE900DB2946 /* TDGenericAssembler.m */; }; + D385F98E0F046FE900DB2946 /* TDGenericAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385F9890F046FE900DB2946 /* TDGenericAssembler.m */; }; + D385FA230F04971400DB2946 /* TDGenericAssemblerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FA220F04971400DB2946 /* TDGenericAssemblerTest.m */; }; + D385FA250F04993500DB2946 /* json.css in Resources */ = {isa = PBXBuildFile; fileRef = D385FA240F04993500DB2946 /* json.css */; }; + D385FA260F04993500DB2946 /* json.css in Resources */ = {isa = PBXBuildFile; fileRef = D385FA240F04993500DB2946 /* json.css */; }; + D385FD440F05A88C00DB2946 /* TDMiniCSSAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */; }; + D385FD460F05A89100DB2946 /* TDMiniCSSAssemblerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FD430F05A88C00DB2946 /* TDMiniCSSAssemblerTest.m */; }; + D385FD490F05A8C900DB2946 /* TDMiniCSSAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */; }; + D385FD6C0F05A99900DB2946 /* mini_css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D385FD6B0F05A99900DB2946 /* mini_css.grammar */; }; + D385FD6D0F05A99900DB2946 /* mini_css.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D385FD6B0F05A99900DB2946 /* mini_css.grammar */; }; + D389F1D50F19666500558235 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D389F20B0F196A9200558235 /* JSParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D389F1CE0F1965E600558235 /* JSParseKit.framework */; }; + D389F20C0F196A9200558235 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D389F20E0F196A9200558235 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D389F20D0F196A9200558235 /* WebKit.framework */; }; + D389F2E40F196CAE00558235 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F2E30F196CAE00558235 /* main.m */; }; + D389F3430F197DDC00558235 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D389F34E0F197DF500558235 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */; }; + D389F37A0F197E8000558235 /* JSDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F2E90F196F5B00558235 /* JSDemoAppDelegate.m */; }; + D389F38F0F19800400558235 /* DefaultValues.plist in Resources */ = {isa = PBXBuildFile; fileRef = D389F38E0F19800400558235 /* DefaultValues.plist */; }; + D389F4620F198A8800558235 /* Test.html in Resources */ = {isa = PBXBuildFile; fileRef = D389F4610F198A8800558235 /* Test.html */; }; + D389F5590F19B7BC00558235 /* JSDemoAppMainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = D389F5580F19B7BC00558235 /* JSDemoAppMainMenu.xib */; }; + D389F5B60F19C76A00558235 /* TDJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F5B30F19C76A00558235 /* TDJsonParser.m */; }; + D389F5B70F19C76A00558235 /* TDJsonParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F5B50F19C76A00558235 /* TDJsonParserTest.m */; }; + D389F5B80F19C76A00558235 /* TDJsonParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D389F5B30F19C76A00558235 /* TDJsonParser.m */; }; + D389FBCD0F1B25E200558235 /* ParserTest.html in Resources */ = {isa = PBXBuildFile; fileRef = D389FBCC0F1B25E200558235 /* ParserTest.html */; }; + D38DD9E80EC29F260070BC4D /* nyt.html in Resources */ = {isa = PBXBuildFile; fileRef = D38DD9E70EC29F260070BC4D /* nyt.html */; }; + D38E97CC1061CF6500739C39 /* TDTokenizerBlocksTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D38E97CB1061CF6500739C39 /* TDTokenizerBlocksTest.m */; }; + D38E98D81062C5BA00739C39 /* TDParserBlocksTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D38E98D71062C5BA00739C39 /* TDParserBlocksTest.m */; }; + D398E20E0E60F86D00A1C877 /* yahoo.json in Resources */ = {isa = PBXBuildFile; fileRef = D3B473840E48C9CF008AFBDD /* yahoo.json */; }; + D39E01340FEF02DA00150FC3 /* TDXMLParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3BBBC970FEC9722007DF30D /* TDXMLParserTest.m */; }; + D3AF49780FDB122E0032F4DC /* TDParserFactoryPatternTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3AF49770FDB122E0032F4DC /* TDParserFactoryPatternTest.m */; }; + D3B43FB80F76E99C0072AF40 /* TDJavaScriptParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3B43FB60F76E99C0072AF40 /* TDJavaScriptParserTest.m */; }; + D3B473850E48C9CF008AFBDD /* yahoo.json in Resources */ = {isa = PBXBuildFile; fileRef = D3B473840E48C9CF008AFBDD /* yahoo.json */; }; + D3B69D320E80249900D70C41 /* nonascii.html in Resources */ = {isa = PBXBuildFile; fileRef = D3B69D310E80249900D70C41 /* nonascii.html */; }; + D3B69D330E80249900D70C41 /* nonascii.html in Resources */ = {isa = PBXBuildFile; fileRef = D3B69D310E80249900D70C41 /* nonascii.html */; }; + D3BBBC9D0FEC9756007DF30D /* TDXMLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */; }; + D3BBBC9E0FEC9756007DF30D /* TDXMLParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */; }; + D3BBBCC10FECD477007DF30D /* xml.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D355C8800FEB36A1006A91A4 /* xml.grammar */; }; + D3C031ED0EF38D2D00C5ABEB /* TDLowercaseWordTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C031EC0EF38D2D00C5ABEB /* TDLowercaseWordTest.m */; }; + D3C221920FFE8B8C004514FE /* ParseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221900FFE8B8C004514FE /* ParseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221930FFE8B8C004514FE /* PKTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221910FFE8B8C004514FE /* PKTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221940FFE8B8C004514FE /* ParseKit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221900FFE8B8C004514FE /* ParseKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221950FFE8B8C004514FE /* PKTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221910FFE8B8C004514FE /* PKTypes.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221970FFE8B95004514FE /* PKReader.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221960FFE8B95004514FE /* PKReader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221980FFE8B95004514FE /* PKReader.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221960FFE8B95004514FE /* PKReader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219A0FFE8B9D004514FE /* PKAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221990FFE8B9D004514FE /* PKAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219B0FFE8B9D004514FE /* PKAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221990FFE8B9D004514FE /* PKAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219D0FFE8BA6004514FE /* PKParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219C0FFE8BA6004514FE /* PKParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2219E0FFE8BA6004514FE /* PKParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219C0FFE8BA6004514FE /* PKParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A00FFE8BAE004514FE /* PKRepetition.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219F0FFE8BAE004514FE /* PKRepetition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A10FFE8BAE004514FE /* PKRepetition.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2219F0FFE8BAE004514FE /* PKRepetition.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A30FFE8BBA004514FE /* PKCollectionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A40FFE8BBA004514FE /* PKCollectionParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A60FFE8BC1004514FE /* PKAlternation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A50FFE8BC1004514FE /* PKAlternation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A70FFE8BC1004514FE /* PKAlternation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A50FFE8BC1004514FE /* PKAlternation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221A90FFE8BC9004514FE /* PKSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A80FFE8BC9004514FE /* PKSequence.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AA0FFE8BC9004514FE /* PKSequence.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221A80FFE8BC9004514FE /* PKSequence.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AC0FFE8BCF004514FE /* PKTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AB0FFE8BCF004514FE /* PKTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AD0FFE8BCF004514FE /* PKTrack.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AB0FFE8BCF004514FE /* PKTrack.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221AF0FFE8BD4004514FE /* PKTrackException.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AE0FFE8BD4004514FE /* PKTrackException.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B00FFE8BD4004514FE /* PKTrackException.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221AE0FFE8BD4004514FE /* PKTrackException.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B20FFE8BDB004514FE /* PKIntersection.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B10FFE8BDB004514FE /* PKIntersection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B30FFE8BDB004514FE /* PKIntersection.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B10FFE8BDB004514FE /* PKIntersection.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B50FFE8BE2004514FE /* PKDifference.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B40FFE8BE2004514FE /* PKDifference.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B60FFE8BE2004514FE /* PKDifference.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B40FFE8BE2004514FE /* PKDifference.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B80FFE8BE8004514FE /* PKNegation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B70FFE8BE8004514FE /* PKNegation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221B90FFE8BE8004514FE /* PKNegation.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221B70FFE8BE8004514FE /* PKNegation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BB0FFE8BEF004514FE /* PKTerminal.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BA0FFE8BEF004514FE /* PKTerminal.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BC0FFE8BEF004514FE /* PKTerminal.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BA0FFE8BEF004514FE /* PKTerminal.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BE0FFE8BF7004514FE /* PKEmpty.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BD0FFE8BF7004514FE /* PKEmpty.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221BF0FFE8BF7004514FE /* PKEmpty.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221BD0FFE8BF7004514FE /* PKEmpty.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C10FFE8BFF004514FE /* PKTokenAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C20FFE8BFF004514FE /* PKTokenAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C40FFE8C07004514FE /* PKToken.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C30FFE8C07004514FE /* PKToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C50FFE8C07004514FE /* PKToken.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C30FFE8C07004514FE /* PKToken.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C70FFE8C0D004514FE /* PKTokenArraySource.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221C80FFE8C0D004514FE /* PKTokenArraySource.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CA0FFE8C15004514FE /* PKTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C90FFE8C15004514FE /* PKTokenizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CB0FFE8C15004514FE /* PKTokenizer.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221C90FFE8C15004514FE /* PKTokenizer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CD0FFE8C1B004514FE /* PKTokenizerState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221CE0FFE8C1B004514FE /* PKTokenizerState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D00FFE8C24004514FE /* PKNumberState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CF0FFE8C24004514FE /* PKNumberState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D10FFE8C24004514FE /* PKNumberState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221CF0FFE8C24004514FE /* PKNumberState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D60FFE8C35004514FE /* PKSymbolState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D50FFE8C35004514FE /* PKSymbolState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D70FFE8C35004514FE /* PKSymbolState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D50FFE8C35004514FE /* PKSymbolState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221D90FFE8C3D004514FE /* PKWordState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D80FFE8C3D004514FE /* PKWordState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DA0FFE8C3D004514FE /* PKWordState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221D80FFE8C3D004514FE /* PKWordState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DC0FFE8C43004514FE /* PKWhitespaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DD0FFE8C43004514FE /* PKWhitespaceState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221DF0FFE8C49004514FE /* PKDelimitState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DE0FFE8C49004514FE /* PKDelimitState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E00FFE8C49004514FE /* PKDelimitState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221DE0FFE8C49004514FE /* PKDelimitState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E20FFE8C4E004514FE /* PKCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E10FFE8C4E004514FE /* PKCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E30FFE8C4E004514FE /* PKCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E10FFE8C4E004514FE /* PKCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E50FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E60FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E80FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221E90FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EB0FFE8C69004514FE /* PKSymbolNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EC0FFE8C69004514FE /* PKSymbolNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EE0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221EF0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F10FFE8C7A004514FE /* PKPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F00FFE8C7A004514FE /* PKPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F20FFE8C7A004514FE /* PKPattern.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F00FFE8C7A004514FE /* PKPattern.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F40FFE8C87004514FE /* PKWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F30FFE8C87004514FE /* PKWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F50FFE8C87004514FE /* PKWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F30FFE8C87004514FE /* PKWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221F70FFE8C8E004514FE /* PKNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F60FFE8C8E004514FE /* PKNumber.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FA0FFE8C97004514FE /* PKQuotedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F90FFE8C97004514FE /* PKQuotedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FB0FFE8C97004514FE /* PKQuotedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F90FFE8C97004514FE /* PKQuotedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FD0FFE8CB2004514FE /* PKSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FC0FFE8CB2004514FE /* PKSymbol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C221FE0FFE8CB2004514FE /* PKSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FC0FFE8CB2004514FE /* PKSymbol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222000FFE8CB9004514FE /* PKLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FF0FFE8CB9004514FE /* PKLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222010FFE8CB9004514FE /* PKLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221FF0FFE8CB9004514FE /* PKLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222030FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222040FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222060FFE8CCA004514FE /* PKWhitespace.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222050FFE8CCA004514FE /* PKWhitespace.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222070FFE8CCA004514FE /* PKWhitespace.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222050FFE8CCA004514FE /* PKWhitespace.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222090FFE8CD1004514FE /* PKComment.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222080FFE8CD1004514FE /* PKComment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220A0FFE8CD1004514FE /* PKComment.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222080FFE8CD1004514FE /* PKComment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220C0FFE8CD8004514FE /* PKDelimitedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220D0FFE8CD8004514FE /* PKDelimitedString.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2220F0FFE8CDF004514FE /* PKAny.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220E0FFE8CDF004514FE /* PKAny.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222100FFE8CDF004514FE /* PKAny.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2220E0FFE8CDF004514FE /* PKAny.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222150FFE8D01004514FE /* PKLowercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222140FFE8D01004514FE /* PKLowercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222160FFE8D01004514FE /* PKLowercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222140FFE8D01004514FE /* PKLowercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222180FFE8D11004514FE /* PKUppercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222170FFE8D11004514FE /* PKUppercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222190FFE8D11004514FE /* PKUppercaseWord.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222170FFE8D11004514FE /* PKUppercaseWord.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221B0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221C0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221E0FFE8D3B004514FE /* PKChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221D0FFE8D3B004514FE /* PKChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2221F0FFE8D3B004514FE /* PKChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C2221D0FFE8D3B004514FE /* PKChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222210FFE8D42004514FE /* PKDigit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222200FFE8D42004514FE /* PKDigit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222220FFE8D42004514FE /* PKDigit.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222200FFE8D42004514FE /* PKDigit.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222240FFE8D49004514FE /* PKLetter.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222230FFE8D49004514FE /* PKLetter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222250FFE8D49004514FE /* PKLetter.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222230FFE8D49004514FE /* PKLetter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222270FFE8D6B004514FE /* PKSpecificChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222260FFE8D6B004514FE /* PKSpecificChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C222280FFE8D6B004514FE /* PKSpecificChar.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222260FFE8D6B004514FE /* PKSpecificChar.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2222A0FFE8DAC004514FE /* PKParserFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222290FFE8DAC004514FE /* PKParserFactory.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2222B0FFE8DAC004514FE /* PKParserFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C222290FFE8DAC004514FE /* PKParserFactory.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3C2222D0FFE8DE9004514FE /* NSArray+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */; }; + D3C2222E0FFE8DEE004514FE /* NSString+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */; }; + D3C2222F0FFE8DEF004514FE /* NSString+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */; }; + D3C222300FFE8DF3004514FE /* NSArray+ParseKitAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */; }; + D3C7D9DA0A412874005DD154 /* ParseKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; }; + D3C85C7B0E63B438000445FD /* TDArithmeticParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C85C7A0E63B438000445FD /* TDArithmeticParser.m */; }; + D3C85C800E63B9E9000445FD /* TDArithmeticParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C85C7F0E63B9E9000445FD /* TDArithmeticParserTest.m */; }; + D3C85D450E63D1BF000445FD /* TDScientificNumberStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3C85D440E63D1BF000445FD /* TDScientificNumberStateTest.m */; }; + D3D01CAA0EFDB89900C24DDE /* json_with_discards.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */; }; + D3D01CAB0EFDB8A000C24DDE /* json_with_discards.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */; }; + D3D01CAC0EFDB8A100C24DDE /* json_with_discards.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */; }; + D3D1BF2810394420003656E5 /* SAXAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D1BF2710394420003656E5 /* SAXAssembler.m */; }; + D3D1BF2B1039445C003656E5 /* SAXTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3D1BF2A1039445C003656E5 /* SAXTest.m */; }; + D3DCB3730EF5E5D600DE5110 /* OCMock.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D3DCB37D0EF5E5E400DE5110 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D3DCB4C30EF6015300DE5110 /* json.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3DCB4C20EF6015300DE5110 /* json.grammar */; }; + D3DCB4C40EF6015C00DE5110 /* json.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3DCB4C20EF6015300DE5110 /* json.grammar */; }; + D3DCB4C50EF6015C00DE5110 /* json.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3DCB4C20EF6015300DE5110 /* json.grammar */; }; + D3DDDA870F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */; }; + D3DDDA880F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */; }; + D3DDDAFE0F083C9700A58000 /* TDCommentStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3DDDAFD0F083C9700A58000 /* TDCommentStateTest.m */; }; + D3DDDCAD0F0880D800A58000 /* example1.srgs in Resources */ = {isa = PBXBuildFile; fileRef = D3DDDCAC0F0880D800A58000 /* example1.srgs */; }; + D3DDDCAE0F0880D800A58000 /* example1.srgs in Resources */ = {isa = PBXBuildFile; fileRef = D3DDDCAC0F0880D800A58000 /* example1.srgs */; }; + D3E27A320E741DD20078CC2C /* small-xml-file.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */; }; + D3E27A330E741DD20078CC2C /* apple-boss.xml in Resources */ = {isa = PBXBuildFile; fileRef = D36E9FB40E5A944A00496BD3 /* apple-boss.xml */; }; + D3E39C3F0FC5FFD10022DAB9 /* TDDelimitStateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E39C3E0FC5FFD10022DAB9 /* TDDelimitStateTest.m */; }; + D3E784BD0E53DA28008C7D61 /* apple-boss.json in Resources */ = {isa = PBXBuildFile; fileRef = D3E784BC0E53DA28008C7D61 /* apple-boss.json */; }; + D3E785560E53FB54008C7D61 /* apple-boss.json in Resources */ = {isa = PBXBuildFile; fileRef = D3E784BC0E53DA28008C7D61 /* apple-boss.json */; }; + D3E787A30E5661A9008C7D61 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D69BFE84028FC02AAC07 /* Foundation.framework */; }; + D3E788930E567DFD008C7D61 /* SRGSParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E788920E567DFD008C7D61 /* SRGSParserTest.m */; }; + D3E788960E567E0A008C7D61 /* SRGSParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E788950E567E0A008C7D61 /* SRGSParser.m */; }; + D3E78A190E574C99008C7D61 /* EBNFParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E78A160E574C99008C7D61 /* EBNFParser.m */; }; + D3E78A1A0E574C99008C7D61 /* EBNFParserTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E78A180E574C99008C7D61 /* EBNFParserTest.m */; }; + D3EAC7EC0F2690620043D6A9 /* OCMock.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = D3DCB35C0EF5E52500DE5110 /* OCMock.framework */; }; + D3EADD800E75E9CC00F78584 /* nasty.html in Resources */ = {isa = PBXBuildFile; fileRef = D3EADD7F0E75E9CC00F78584 /* nasty.html */; }; + D3EADD810E75E9CC00F78584 /* nasty.html in Resources */ = {isa = PBXBuildFile; fileRef = D3EADD7F0E75E9CC00F78584 /* nasty.html */; }; + D3EADD8E0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */; }; + D3EADD8F0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */ = {isa = PBXBuildFile; fileRef = D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */; }; + D3F0E2480FFE8EB900C9DF74 /* PKQuoteState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3F0E2490FFE8EB900C9DF74 /* PKQuoteState.h in Headers */ = {isa = PBXBuildFile; fileRef = D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3F0E3CB0FFEB70100C9DF74 /* PKNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = D3C221F60FFE8C8E004514FE /* PKNumber.h */; settings = {ATTRIBUTES = (Public, ); }; }; + D3F0E3CC0FFEB70700C9DF74 /* PKNumber.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF440FF9E19700D7773A /* PKNumber.m */; }; + D3F55F611025737D00DD6DB1 /* TDParseTreeTest.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F55F601025737D00DD6DB1 /* TDParseTreeTest.m */; }; + D3F5629A10266CFC00DD6DB1 /* PKParseTreeView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F5629910266CFC00DD6DB1 /* PKParseTreeView.m */; }; + D3F562A010266DFB00DD6DB1 /* DemoTokensViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F5629F10266DFB00DD6DB1 /* DemoTokensViewController.m */; }; + D3F562A210266E5300DD6DB1 /* TokensView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3F562A110266E5300DD6DB1 /* TokensView.xib */; }; + D3F562A410266E6300DD6DB1 /* TreesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3F562A310266E6300DD6DB1 /* TreesView.xib */; }; + D3F562A710266E8D00DD6DB1 /* DemoTreesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F562A610266E8D00DD6DB1 /* DemoTreesViewController.m */; }; + D3F740B70EF8C38A00559B9F /* JSONAssembler.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F740B60EF8C38A00559B9F /* JSONAssembler.m */; }; + D3F741440EF8E96A00559B9F /* xpath1_0.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741430EF8E96A00559B9F /* xpath1_0.grammar */; }; + D3F741BE0EF9F28D00559B9F /* css2_1.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741BD0EF9F28D00559B9F /* css2_1.grammar */; }; + D3F741BF0EF9F29400559B9F /* css2_1.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741BD0EF9F28D00559B9F /* css2_1.grammar */; }; + D3F741C00EF9F29500559B9F /* css2_1.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3F741BD0EF9F28D00559B9F /* css2_1.grammar */; }; + D3FD79200F4CC86800BAD816 /* rubyhash.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */; }; + D3FD79210F4CC87900BAD816 /* rubyhash.grammar in Resources */ = {isa = PBXBuildFile; fileRef = D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */; }; + D3FDC4A50FFB3B2A00F1F797 /* RegexKitLite.h in Headers */ = {isa = PBXBuildFile; fileRef = D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */; }; + D3FDC6DA0FFC4C8C00F1F797 /* RegexKitLite.h in Headers */ = {isa = PBXBuildFile; fileRef = D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */; }; + D3FDC6EE0FFC4C9E00F1F797 /* RegexKitLite.m in Sources */ = {isa = PBXBuildFile; fileRef = D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */; }; + D3FDC6EF0FFC4C9E00F1F797 /* PKReader.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAD9B0FF9C95800D7773A /* PKReader.m */; }; + D3FDC6F00FFC4C9E00F1F797 /* PKAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADA00FF9C9B000D7773A /* PKAssembly.m */; }; + D3FDC6F10FFC4C9E00F1F797 /* PKParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BADD60FF9CBFB00D7773A /* PKParser.m */; }; + D3FDC6F20FFC4C9E00F1F797 /* PKRepetition.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE130FF9CE0E00D7773A /* PKRepetition.m */; }; + D3FDC6F30FFC4C9E00F1F797 /* PKCollectionParser.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */; }; + D3FDC6F40FFC4C9E00F1F797 /* PKAlternation.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */; }; + D3FDC6F50FFC4C9E00F1F797 /* PKSequence.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE150FF9CE0E00D7773A /* PKSequence.m */; }; + D3FDC6F60FFC4C9E00F1F797 /* PKTrack.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE190FF9CE0E00D7773A /* PKTrack.m */; }; + D3FDC6F70FFC4C9E00F1F797 /* PKTrackException.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */; }; + D3FDC6F80FFC4C9E00F1F797 /* PKDifference.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */; }; + D3FDC6F90FFC4C9E00F1F797 /* PKIntersection.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE110FF9CE0E00D7773A /* PKIntersection.m */; }; + D3FDC6FA0FFC4C9E00F1F797 /* PKTerminal.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE170FF9CE0E00D7773A /* PKTerminal.m */; }; + D3FDC6FB0FFC4C9E00F1F797 /* PKEmpty.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */; }; + D3FDC6FC0FFC4C9E00F1F797 /* PKTokenAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */; }; + D3FDC6FD0FFC4C9E00F1F797 /* PKToken.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE950FF9D20900D7773A /* PKToken.m */; }; + D3FDC6FE0FFC4C9E00F1F797 /* PKTokenArraySource.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */; }; + D3FDC6FF0FFC4C9E00F1F797 /* PKTokenizer.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE990FF9D20900D7773A /* PKTokenizer.m */; }; + D3FDC7000FFC4C9E00F1F797 /* PKTokenizerState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */; }; + D3FDC7010FFC4C9E00F1F797 /* PKNumberState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECA0FF9D56400D7773A /* PKNumberState.m */; }; + D3FDC7020FFC4C9E00F1F797 /* PKQuoteState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECC0FF9D56400D7773A /* PKQuoteState.m */; }; + D3FDC7030FFC4C9E00F1F797 /* PKSymbolState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED00FF9D56400D7773A /* PKSymbolState.m */; }; + D3FDC7040FFC4C9E00F1F797 /* PKWordState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED60FF9D56400D7773A /* PKWordState.m */; }; + D3FDC7050FFC4C9E00F1F797 /* PKWhitespaceState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */; }; + D3FDC7060FFC4C9E00F1F797 /* PKDelimitState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC60FF9D56400D7773A /* PKDelimitState.m */; }; + D3FDC7070FFC4C9E00F1F797 /* PKCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC40FF9D56400D7773A /* PKCommentState.m */; }; + D3FDC7080FFC4C9E00F1F797 /* PKSingleLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */; }; + D3FDC7090FFC4C9E00F1F797 /* PKMultiLineCommentState.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */; }; + D3FDC70A0FFC4C9E00F1F797 /* PKSymbolNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */; }; + D3FDC70B0FFC4C9E00F1F797 /* PKSymbolRootNode.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */; }; + D3FDC70C0FFC4C9E00F1F797 /* PKPattern.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF380FF9E18300D7773A /* PKPattern.m */; }; + D3FDC70D0FFC4C9E00F1F797 /* PKWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAED40FF9D56400D7773A /* PKWord.m */; }; + D3FDC70F0FFC4C9E00F1F797 /* PKQuotedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF460FF9E19700D7773A /* PKQuotedString.m */; }; + D3FDC7100FFC4C9E00F1F797 /* PKSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF480FF9E19700D7773A /* PKSymbol.m */; }; + D3FDC7110FFC4C9E00F1F797 /* PKLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF420FF9E19700D7773A /* PKLiteral.m */; }; + D3FDC7120FFC4C9E00F1F797 /* PKCaseInsensitiveLiteral.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */; }; + D3FDC7130FFC4C9E00F1F797 /* PKWhitespace.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */; }; + D3FDC7140FFC4C9E00F1F797 /* PKComment.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF3E0FF9E19700D7773A /* PKComment.m */; }; + D3FDC7150FFC4C9E00F1F797 /* PKDelimitedString.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF400FF9E19700D7773A /* PKDelimitedString.m */; }; + D3FDC7160FFC4C9E00F1F797 /* PKAny.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAE2F0FF9CE6000D7773A /* PKAny.m */; }; + D3FDC7180FFC4C9E00F1F797 /* PKLowercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */; }; + D3FDC7190FFC4C9E00F1F797 /* PKUppercaseWord.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */; }; + D3FDC71A0FFC4C9E00F1F797 /* PKCharacterAssembly.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */; }; + D3FDC71B0FFC4C9E00F1F797 /* PKChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB40FF9E80300D7773A /* PKChar.m */; }; + D3FDC71C0FFC4C9E00F1F797 /* PKDigit.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB60FF9E80300D7773A /* PKDigit.m */; }; + D3FDC71D0FFC4C9E00F1F797 /* PKLetter.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFB80FF9E80300D7773A /* PKLetter.m */; }; + D3FDC71E0FFC4C9E00F1F797 /* PKSpecificChar.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */; }; + D3FDC71F0FFC4C9E00F1F797 /* PKParserFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD80FF9E95500D7773A /* PKParserFactory.m */; }; + D3FDC7200FFC4C9E00F1F797 /* NSArray+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */; }; + D3FDC7210FFC4C9E00F1F797 /* NSString+ParseKitAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */; }; + D3FDC7370FFC4D6100F1F797 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3FDC7360FFC4D6100F1F797 /* Foundation.framework */; }; + D3FDC7390FFC4D6100F1F797 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3FDC7380FFC4D6100F1F797 /* libicucore.dylib */; }; + D3FDC74C0FFC4DAC00F1F797 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D3FDC74B0FFC4DAC00F1F797 /* CoreGraphics.framework */; }; + D3FDC8DC0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = D3FDC8DB0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + D31FE7170E60F24700A0803E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TDParseKit; + }; + D334949F0E296AA900406085 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TODParseKit; + }; + D341850F0E520D6F0081B0DC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TODParseKit; + }; + D389F1D30F19665C00558235 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = TDParseKit; + }; + D389F2090F196A8000558235 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = D389F1CD0F1965E600558235; + remoteInfo = TDJSParseKit; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + D380B9A10F0EF3DC0009EC13 /* Copy Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(BUILT_PRODUCTS_DIR)"; + dstSubfolderSpec = 0; + files = ( + D3EAC7EC0F2690620043D6A9 /* OCMock.framework in Copy Frameworks */, + ); + name = "Copy Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + D3DCB3880EF5E65100DE5110 /* Copy Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(BUILT_PRODUCTS_DIR)"; + dstSubfolderSpec = 0; + files = ( + D3DCB3730EF5E5D600DE5110 /* OCMock.framework in Copy Frameworks */, + ); + name = "Copy Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; + 8DC2EF5B0486A6940098B216 /* ParseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ParseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D3126D040FFD9BA700CBF4C4 /* PKNegation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKNegation.m; path = src/PKNegation.m; sourceTree = ""; }; + D3126D090FFD9E4B00CBF4C4 /* TDNegationTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNegationTest.h; path = test/TDNegationTest.h; sourceTree = ""; }; + D3126D0A0FFD9E4B00CBF4C4 /* TDNegationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNegationTest.m; path = test/TDNegationTest.m; sourceTree = ""; }; + D3126D410FFDB4C600CBF4C4 /* TDExclusionTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDExclusionTest.h; path = test/TDExclusionTest.h; sourceTree = ""; }; + D3126D420FFDB4C600CBF4C4 /* TDExclusionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDExclusionTest.m; path = test/TDExclusionTest.m; sourceTree = ""; }; + D31270F80FFE898300CBF4C4 /* PKExclusion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKExclusion.m; path = test/PKExclusion.m; sourceTree = ""; }; + D315DF710FEF59B600D876C8 /* date.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = date.grammar; path = res/date.grammar; sourceTree = ""; }; + D319E429106D8A1F008C63DD /* arithmetic.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = arithmetic.grammar; path = res/arithmetic.grammar; sourceTree = ""; }; + D319E42C106D8A31008C63DD /* TDArithmeticAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDArithmeticAssembler.h; path = test/TDArithmeticAssembler.h; sourceTree = ""; }; + D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDArithmeticAssembler.m; path = test/TDArithmeticAssembler.m; sourceTree = ""; }; + D31A15250F6DE449002AFDF1 /* javascript.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = javascript.grammar; path = res/javascript.grammar; sourceTree = ""; }; + D31A16500F7038C2002AFDF1 /* TDJavaScriptParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJavaScriptParser.h; path = test/TDJavaScriptParser.h; sourceTree = ""; }; + D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJavaScriptParser.m; path = test/TDJavaScriptParser.m; sourceTree = ""; }; + D31FE54A0E60E46100A0803E /* TDTestScaffold.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTestScaffold.h; path = test/TDTestScaffold.h; sourceTree = ""; }; + D31FE54B0E60E46100A0803E /* TDTestScaffold.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTestScaffold.m; path = test/TDTestScaffold.m; sourceTree = ""; }; + D31FE54D0E60E50800A0803E /* TDAlternationTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDAlternationTest.h; path = test/TDAlternationTest.h; sourceTree = ""; }; + D31FE54E0E60E50800A0803E /* TDAlternationTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDAlternationTest.m; path = test/TDAlternationTest.m; sourceTree = ""; }; + D31FE54F0E60E50800A0803E /* TDLiteralTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDLiteralTest.h; path = test/TDLiteralTest.h; sourceTree = ""; }; + D31FE5500E60E50800A0803E /* TDLiteralTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDLiteralTest.m; path = test/TDLiteralTest.m; sourceTree = ""; }; + D31FE5510E60E50800A0803E /* TDParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserTest.h; path = test/TDParserTest.h; sourceTree = ""; }; + D31FE5520E60E50800A0803E /* TDParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserTest.m; path = test/TDParserTest.m; sourceTree = ""; }; + D31FE5530E60E50800A0803E /* TDRepetitionTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRepetitionTest.h; path = test/TDRepetitionTest.h; sourceTree = ""; }; + D31FE5540E60E50800A0803E /* TDRepetitionTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRepetitionTest.m; path = test/TDRepetitionTest.m; sourceTree = ""; }; + D31FE5550E60E50800A0803E /* TDReservedWordTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDReservedWordTest.h; path = test/TDReservedWordTest.h; sourceTree = ""; }; + D31FE5560E60E50800A0803E /* TDReservedWordTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDReservedWordTest.m; path = test/TDReservedWordTest.m; sourceTree = ""; }; + D31FE5570E60E50800A0803E /* TDRobotCommandTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRobotCommandTest.h; path = test/TDRobotCommandTest.h; sourceTree = ""; }; + D31FE5580E60E50800A0803E /* TDRobotCommandTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRobotCommandTest.m; path = test/TDRobotCommandTest.m; sourceTree = ""; }; + D31FE5590E60E50800A0803E /* TDSequenceTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSequenceTest.h; path = test/TDSequenceTest.h; sourceTree = ""; }; + D31FE55A0E60E50800A0803E /* TDSequenceTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSequenceTest.m; path = test/TDSequenceTest.m; sourceTree = ""; }; + D31FE55B0E60E50800A0803E /* TDSymbolTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSymbolTest.h; path = test/TDSymbolTest.h; sourceTree = ""; }; + D31FE55C0E60E50800A0803E /* TDSymbolTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSymbolTest.m; path = test/TDSymbolTest.m; sourceTree = ""; }; + D31FE55D0E60E50800A0803E /* TDTokenAssemblyTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenAssemblyTest.h; path = test/TDTokenAssemblyTest.h; sourceTree = ""; }; + D31FE55E0E60E50800A0803E /* TDTokenAssemblyTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenAssemblyTest.m; path = test/TDTokenAssemblyTest.m; sourceTree = ""; }; + D31FE55F0E60E50800A0803E /* TDTrackTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTrackTest.h; path = test/TDTrackTest.h; sourceTree = ""; }; + D31FE5600E60E50800A0803E /* TDTrackTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTrackTest.m; path = test/TDTrackTest.m; sourceTree = ""; }; + D31FE5610E60E50800A0803E /* TDUppercaseWordTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDUppercaseWordTest.h; path = test/TDUppercaseWordTest.h; sourceTree = ""; }; + D31FE5620E60E50800A0803E /* TDUppercaseWordTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDUppercaseWordTest.m; path = test/TDUppercaseWordTest.m; sourceTree = ""; }; + D31FE5710E60E55700A0803E /* TDReaderTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDReaderTest.h; path = test/TDReaderTest.h; sourceTree = ""; }; + D31FE5720E60E55700A0803E /* TDReaderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDReaderTest.m; path = test/TDReaderTest.m; sourceTree = ""; }; + D31FE5730E60E55700A0803E /* TDTokenizerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenizerTest.h; path = test/TDTokenizerTest.h; sourceTree = ""; }; + D31FE5740E60E55700A0803E /* TDTokenizerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenizerTest.m; path = test/TDTokenizerTest.m; sourceTree = ""; }; + D31FE5770E60E58C00A0803E /* TDNumberStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNumberStateTest.h; path = test/TDNumberStateTest.h; sourceTree = ""; }; + D31FE5780E60E58C00A0803E /* TDNumberStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNumberStateTest.m; path = test/TDNumberStateTest.m; sourceTree = ""; }; + D31FE5790E60E58C00A0803E /* TDQuoteStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDQuoteStateTest.h; path = test/TDQuoteStateTest.h; sourceTree = ""; }; + D31FE57A0E60E58C00A0803E /* TDQuoteStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDQuoteStateTest.m; path = test/TDQuoteStateTest.m; sourceTree = ""; }; + D31FE57B0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSignificantWhitespaceStateTest.h; path = test/TDSignificantWhitespaceStateTest.h; sourceTree = ""; }; + D31FE57C0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSignificantWhitespaceStateTest.m; path = test/TDSignificantWhitespaceStateTest.m; sourceTree = ""; }; + D31FE57D0E60E58C00A0803E /* TDSlashStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashStateTest.h; path = test/TDSlashStateTest.h; sourceTree = ""; }; + D31FE57E0E60E58C00A0803E /* TDSlashStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashStateTest.m; path = test/TDSlashStateTest.m; sourceTree = ""; }; + D31FE57F0E60E58C00A0803E /* TDSymbolStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSymbolStateTest.h; path = test/TDSymbolStateTest.h; sourceTree = ""; }; + D31FE5800E60E58C00A0803E /* TDSymbolStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSymbolStateTest.m; path = test/TDSymbolStateTest.m; sourceTree = ""; }; + D31FE5810E60E58C00A0803E /* TDWhitespaceStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDWhitespaceStateTest.h; path = test/TDWhitespaceStateTest.h; sourceTree = ""; }; + D31FE5820E60E58C00A0803E /* TDWhitespaceStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDWhitespaceStateTest.m; path = test/TDWhitespaceStateTest.m; sourceTree = ""; }; + D31FE5830E60E58C00A0803E /* TDWordStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDWordStateTest.h; path = test/TDWordStateTest.h; sourceTree = ""; }; + D31FE5840E60E58C00A0803E /* TDWordStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDWordStateTest.m; path = test/TDWordStateTest.m; sourceTree = ""; }; + D31FE58C0E60E5AC00A0803E /* TDCharacterAssemblyTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDCharacterAssemblyTest.h; path = test/TDCharacterAssemblyTest.h; sourceTree = ""; }; + D31FE58D0E60E5AC00A0803E /* TDCharacterAssemblyTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDCharacterAssemblyTest.m; path = test/TDCharacterAssemblyTest.m; sourceTree = ""; }; + D31FE58E0E60E5AC00A0803E /* TDCharTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDCharTest.h; path = test/TDCharTest.h; sourceTree = ""; }; + D31FE58F0E60E5AC00A0803E /* TDCharTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDCharTest.m; path = test/TDCharTest.m; sourceTree = ""; }; + D31FE5900E60E5AC00A0803E /* TDDigitTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDDigitTest.h; path = test/TDDigitTest.h; sourceTree = ""; }; + D31FE5910E60E5AC00A0803E /* TDDigitTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDDigitTest.m; path = test/TDDigitTest.m; sourceTree = ""; }; + D31FE5920E60E5AC00A0803E /* TDLetterTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDLetterTest.h; path = test/TDLetterTest.h; sourceTree = ""; }; + D31FE5930E60E5AC00A0803E /* TDLetterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDLetterTest.m; path = test/TDLetterTest.m; sourceTree = ""; }; + D31FE5940E60E5AC00A0803E /* TDSpecificCharTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSpecificCharTest.h; path = test/TDSpecificCharTest.h; sourceTree = ""; }; + D31FE5950E60E5AC00A0803E /* TDSpecificCharTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSpecificCharTest.m; path = test/TDSpecificCharTest.m; sourceTree = ""; }; + D31FE59B0E60E5C000A0803E /* TDRegularParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRegularParser.h; path = test/TDRegularParser.h; sourceTree = ""; }; + D31FE59C0E60E5C000A0803E /* TDRegularParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRegularParser.m; path = test/TDRegularParser.m; sourceTree = ""; }; + D31FE59D0E60E5C000A0803E /* TDRegularParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDRegularParserTest.h; path = test/TDRegularParserTest.h; sourceTree = ""; }; + D31FE59E0E60E5C000A0803E /* TDRegularParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDRegularParserTest.m; path = test/TDRegularParserTest.m; sourceTree = ""; }; + D31FE5A10E60E5D500A0803E /* TDFastJsonParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDFastJsonParser.h; path = test/TDFastJsonParser.h; sourceTree = ""; }; + D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDFastJsonParser.m; path = test/TDFastJsonParser.m; sourceTree = ""; }; + D31FE5A30E60E5D500A0803E /* TDFastJsonParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDFastJsonParserTest.h; path = test/TDFastJsonParserTest.h; sourceTree = ""; }; + D31FE5A40E60E5D500A0803E /* TDFastJsonParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDFastJsonParserTest.m; path = test/TDFastJsonParserTest.m; sourceTree = ""; }; + D31FE5AD0E60E64900A0803E /* TDXmlTokenAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTokenAssembly.h; path = test/TDXmlTokenAssembly.h; sourceTree = ""; }; + D31FE5AE0E60E64900A0803E /* TDXmlTokenAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTokenAssembly.m; path = test/TDXmlTokenAssembly.m; sourceTree = ""; }; + D31FE5AF0E60E64900A0803E /* TDXmlTokenizerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTokenizerTest.h; path = test/TDXmlTokenizerTest.h; sourceTree = ""; }; + D31FE5B00E60E64900A0803E /* TDXmlTokenizerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTokenizerTest.m; path = test/TDXmlTokenizerTest.m; sourceTree = ""; }; + D31FE5B30E60E66600A0803E /* TDXmlToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlToken.h; path = test/TDXmlToken.h; sourceTree = ""; }; + D31FE5B40E60E66600A0803E /* TDXmlToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlToken.m; path = test/TDXmlToken.m; sourceTree = ""; }; + D31FE5B50E60E66600A0803E /* TDXmlTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTokenizer.h; path = test/TDXmlTokenizer.h; sourceTree = ""; }; + D31FE5B60E60E66600A0803E /* TDXmlTokenizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTokenizer.m; path = test/TDXmlTokenizer.m; sourceTree = ""; }; + D31FE5B90E60E69E00A0803E /* TDXmlAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlAttribute.h; path = test/TDXmlAttribute.h; sourceTree = ""; }; + D31FE5BA0E60E69E00A0803E /* TDXmlAttribute.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlAttribute.m; path = test/TDXmlAttribute.m; sourceTree = ""; }; + D31FE5BB0E60E69E00A0803E /* TDXmlCdata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlCdata.h; path = test/TDXmlCdata.h; sourceTree = ""; }; + D31FE5BC0E60E69E00A0803E /* TDXmlCdata.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlCdata.m; path = test/TDXmlCdata.m; sourceTree = ""; }; + D31FE5BD0E60E69E00A0803E /* TDXmlComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlComment.h; path = test/TDXmlComment.h; sourceTree = ""; }; + D31FE5BE0E60E69E00A0803E /* TDXmlComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlComment.m; path = test/TDXmlComment.m; sourceTree = ""; }; + D31FE5BF0E60E69E00A0803E /* TDXmlDecl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlDecl.h; path = test/TDXmlDecl.h; sourceTree = ""; }; + D31FE5C00E60E69E00A0803E /* TDXmlDecl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlDecl.m; path = test/TDXmlDecl.m; sourceTree = ""; }; + D31FE5C10E60E69E00A0803E /* TDXmlDoctype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlDoctype.h; path = test/TDXmlDoctype.h; sourceTree = ""; }; + D31FE5C20E60E69E00A0803E /* TDXmlDoctype.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlDoctype.m; path = test/TDXmlDoctype.m; sourceTree = ""; }; + D31FE5C30E60E69E00A0803E /* TDXmlDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlDocument.h; path = test/TDXmlDocument.h; sourceTree = ""; }; + D31FE5C40E60E69E00A0803E /* TDXmlDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlDocument.m; path = test/TDXmlDocument.m; sourceTree = ""; }; + D31FE5C50E60E69E00A0803E /* TDXmlEndEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEndEntity.h; path = test/TDXmlEndEntity.h; sourceTree = ""; }; + D31FE5C60E60E69E00A0803E /* TDXmlEndEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEndEntity.m; path = test/TDXmlEndEntity.m; sourceTree = ""; }; + D31FE5C70E60E69E00A0803E /* TDXmlEndTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEndTag.h; path = test/TDXmlEndTag.h; sourceTree = ""; }; + D31FE5C80E60E69E00A0803E /* TDXmlEndTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEndTag.m; path = test/TDXmlEndTag.m; sourceTree = ""; }; + D31FE5C90E60E69E00A0803E /* TDXmlEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEntity.h; path = test/TDXmlEntity.h; sourceTree = ""; }; + D31FE5CA0E60E69E00A0803E /* TDXmlEntity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEntity.m; path = test/TDXmlEntity.m; sourceTree = ""; }; + D31FE5CB0E60E69E00A0803E /* TDXmlEntityRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlEntityRef.h; path = test/TDXmlEntityRef.h; sourceTree = ""; }; + D31FE5CC0E60E69E00A0803E /* TDXmlEntityRef.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlEntityRef.m; path = test/TDXmlEntityRef.m; sourceTree = ""; }; + D31FE5CD0E60E69E00A0803E /* TDXmlFragment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlFragment.h; path = test/TDXmlFragment.h; sourceTree = ""; }; + D31FE5CE0E60E69E00A0803E /* TDXmlFragment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlFragment.m; path = test/TDXmlFragment.m; sourceTree = ""; }; + D31FE5CF0E60E69E00A0803E /* TDXmlNotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNotation.h; path = test/TDXmlNotation.h; sourceTree = ""; }; + D31FE5D00E60E69E00A0803E /* TDXmlNotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNotation.m; path = test/TDXmlNotation.m; sourceTree = ""; }; + D31FE5D10E60E69E00A0803E /* TDXmlProcessingInstruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlProcessingInstruction.h; path = test/TDXmlProcessingInstruction.h; sourceTree = ""; }; + D31FE5D20E60E69E00A0803E /* TDXmlProcessingInstruction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlProcessingInstruction.m; path = test/TDXmlProcessingInstruction.m; sourceTree = ""; }; + D31FE5D30E60E69E00A0803E /* TDXmlSignificantWhitespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlSignificantWhitespace.h; path = test/TDXmlSignificantWhitespace.h; sourceTree = ""; }; + D31FE5D40E60E69E00A0803E /* TDXmlSignificantWhitespace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlSignificantWhitespace.m; path = test/TDXmlSignificantWhitespace.m; sourceTree = ""; }; + D31FE5D50E60E69E00A0803E /* TDXmlStartTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlStartTag.h; path = test/TDXmlStartTag.h; sourceTree = ""; }; + D31FE5D60E60E69E00A0803E /* TDXmlStartTag.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlStartTag.m; path = test/TDXmlStartTag.m; sourceTree = ""; }; + D31FE5D70E60E69E00A0803E /* TDXmlTerminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlTerminal.h; path = test/TDXmlTerminal.h; sourceTree = ""; }; + D31FE5D80E60E69E00A0803E /* TDXmlTerminal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlTerminal.m; path = test/TDXmlTerminal.m; sourceTree = ""; }; + D31FE5D90E60E69E00A0803E /* TDXmlText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlText.h; path = test/TDXmlText.h; sourceTree = ""; }; + D31FE5DA0E60E69E00A0803E /* TDXmlText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlText.m; path = test/TDXmlText.m; sourceTree = ""; }; + D31FE5DB0E60E69E00A0803E /* TDXmlWhitespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlWhitespace.h; path = test/TDXmlWhitespace.h; sourceTree = ""; }; + D31FE5DC0E60E69E00A0803E /* TDXmlWhitespace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlWhitespace.m; path = test/TDXmlWhitespace.m; sourceTree = ""; }; + D31FE5EF0E60E6B500A0803E /* TDNCName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNCName.h; path = test/TDNCName.h; sourceTree = ""; }; + D31FE5F00E60E6B500A0803E /* TDNCNameState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNCNameState.h; path = test/TDNCNameState.h; sourceTree = ""; }; + D31FE5F10E60E6B500A0803E /* TDNCNameState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNCNameState.m; path = test/TDNCNameState.m; sourceTree = ""; }; + D31FE5F20E60E6B500A0803E /* TDXmlName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlName.h; path = test/TDXmlName.h; sourceTree = ""; }; + D31FE5F30E60E6B500A0803E /* TDXmlName.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlName.m; path = test/TDXmlName.m; sourceTree = ""; }; + D31FE5F40E60E6B500A0803E /* TDXmlNameState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNameState.h; path = test/TDXmlNameState.h; sourceTree = ""; }; + D31FE5F50E60E6B500A0803E /* TDXmlNameState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNameState.m; path = test/TDXmlNameState.m; sourceTree = ""; }; + D31FE5F60E60E6B500A0803E /* TDXmlNameTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNameTest.h; path = test/TDXmlNameTest.h; sourceTree = ""; }; + D31FE5F70E60E6B500A0803E /* TDXmlNameTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNameTest.m; path = test/TDXmlNameTest.m; sourceTree = ""; }; + D31FE5F80E60E6B500A0803E /* TDXmlNmtoken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNmtoken.h; path = test/TDXmlNmtoken.h; sourceTree = ""; }; + D31FE5F90E60E6B500A0803E /* TDXmlNmtoken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNmtoken.m; path = test/TDXmlNmtoken.m; sourceTree = ""; }; + D31FE5FA0E60E6B500A0803E /* TDXmlNmtokenState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXmlNmtokenState.h; path = test/TDXmlNmtokenState.h; sourceTree = ""; }; + D31FE5FB0E60E6B500A0803E /* TDXmlNmtokenState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXmlNmtokenState.m; path = test/TDXmlNmtokenState.m; sourceTree = ""; }; + D31FE6DF0E60EE2500A0803E /* TDNCName.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNCName.m; path = test/TDNCName.m; sourceTree = ""; }; + D3252F780FCE1A7E005EF059 /* TDNSPredicateBuilderTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateBuilderTest.h; path = test/TDNSPredicateBuilderTest.h; sourceTree = ""; }; + D3252F790FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateBuilderTest.m; path = test/TDNSPredicateBuilderTest.m; sourceTree = ""; }; + D3252F7C0FCE1A87005EF059 /* TDNSPredicateBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateBuilder.h; path = test/TDNSPredicateBuilder.h; sourceTree = ""; }; + D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateBuilder.m; path = test/TDNSPredicateBuilder.m; sourceTree = ""; }; + D3305C4B102F5BAD00DC4F75 /* TDGutterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDGutterView.h; path = demoapp/TDGutterView.h; sourceTree = ""; }; + D3305C4C102F5BAD00DC4F75 /* TDGutterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDGutterView.m; path = demoapp/TDGutterView.m; sourceTree = ""; }; + D3305C4D102F5BAE00DC4F75 /* TDSourceCodeTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSourceCodeTextView.h; path = demoapp/TDSourceCodeTextView.h; sourceTree = ""; }; + D3305C4E102F5BAE00DC4F75 /* TDSourceCodeTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSourceCodeTextView.m; path = demoapp/TDSourceCodeTextView.m; sourceTree = ""; }; + D33494100E2963FD00406085 /* DemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D3376D5710093A1600E4602E /* PKGrammarParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKGrammarParser.h; path = src/PKGrammarParser.h; sourceTree = ""; }; + D3376D5810093A1600E4602E /* PKGrammarParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKGrammarParser.m; path = src/PKGrammarParser.m; sourceTree = ""; }; + D3376D8C10096C0700E4602E /* PKAST.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAST.h; path = test/PKAST.h; sourceTree = ""; }; + D3376D8D10096C0700E4602E /* PKAST.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAST.m; path = test/PKAST.m; sourceTree = ""; }; + D3385FD70FCFB1FF003BF729 /* TDPredicateEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPredicateEvaluator.h; path = test/TDPredicateEvaluator.h; sourceTree = ""; }; + D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPredicateEvaluator.m; path = test/TDPredicateEvaluator.m; sourceTree = ""; }; + D3385FDB0FCFB227003BF729 /* TDPredicateEvaluatorTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPredicateEvaluatorTest.h; path = test/TDPredicateEvaluatorTest.h; sourceTree = ""; }; + D3385FDC0FCFB227003BF729 /* TDPredicateEvaluatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPredicateEvaluatorTest.m; path = test/TDPredicateEvaluatorTest.m; sourceTree = ""; }; + D338E5B90FF5DDCB003DE6AA /* TDDifferenceTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDDifferenceTest.h; path = test/TDDifferenceTest.h; sourceTree = ""; }; + D338E5BA0FF5DDCB003DE6AA /* TDDifferenceTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDDifferenceTest.m; path = test/TDDifferenceTest.m; sourceTree = ""; }; + D34185040E520D3F0081B0DC /* DebugApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DebugApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D34BAC210FF87F8600D7773A /* TDParserFactoryTest3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryTest3.h; path = test/TDParserFactoryTest3.h; sourceTree = ""; }; + D34BAC220FF87F8600D7773A /* TDParserFactoryTest3.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryTest3.m; path = test/TDParserFactoryTest3.m; sourceTree = ""; }; + D34BAC490FF892C200D7773A /* XPathParserGrammarTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathParserGrammarTest.h; path = test/XPathParserGrammarTest.h; sourceTree = ""; }; + D34BAC4A0FF892C200D7773A /* XPathParserGrammarTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathParserGrammarTest.m; path = test/XPathParserGrammarTest.m; sourceTree = ""; }; + D34BAD16100A9B7900996341 /* TDTokenizerStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenizerStateTest.h; path = test/TDTokenizerStateTest.h; sourceTree = ""; }; + D34BAD17100A9B7900996341 /* TDTokenizerStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenizerStateTest.m; path = test/TDTokenizerStateTest.m; sourceTree = ""; }; + D34BAD630FF9C6AE00D7773A /* ParseKit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseKit_Prefix.pch; sourceTree = ""; }; + D34BAD9B0FF9C95800D7773A /* PKReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKReader.m; path = src/PKReader.m; sourceTree = ""; }; + D34BADA00FF9C9B000D7773A /* PKAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAssembly.m; path = src/PKAssembly.m; sourceTree = ""; }; + D34BADD60FF9CBFB00D7773A /* PKParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParser.m; path = src/PKParser.m; sourceTree = ""; }; + D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCollectionParser.m; path = src/PKCollectionParser.m; sourceTree = ""; }; + D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAlternation.m; path = src/PKAlternation.m; sourceTree = ""; }; + D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKEmpty.m; path = src/PKEmpty.m; sourceTree = ""; }; + D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDifference.m; path = src/PKDifference.m; sourceTree = ""; }; + D34BAE110FF9CE0E00D7773A /* PKIntersection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKIntersection.m; path = src/PKIntersection.m; sourceTree = ""; }; + D34BAE130FF9CE0E00D7773A /* PKRepetition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKRepetition.m; path = src/PKRepetition.m; sourceTree = ""; }; + D34BAE150FF9CE0E00D7773A /* PKSequence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSequence.m; path = src/PKSequence.m; sourceTree = ""; }; + D34BAE170FF9CE0E00D7773A /* PKTerminal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTerminal.m; path = src/PKTerminal.m; sourceTree = ""; }; + D34BAE190FF9CE0E00D7773A /* PKTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTrack.m; path = src/PKTrack.m; sourceTree = ""; }; + D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTrackException.m; path = src/PKTrackException.m; sourceTree = ""; }; + D34BAE2F0FF9CE6000D7773A /* PKAny.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKAny.m; path = src/PKAny.m; sourceTree = ""; }; + D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenAssembly.m; path = src/PKTokenAssembly.m; sourceTree = ""; }; + D34BAE950FF9D20900D7773A /* PKToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKToken.m; path = src/PKToken.m; sourceTree = ""; }; + D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenArraySource.m; path = src/PKTokenArraySource.m; sourceTree = ""; }; + D34BAE990FF9D20900D7773A /* PKTokenizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenizer.m; path = src/PKTokenizer.m; sourceTree = ""; }; + D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenizerState.m; path = src/PKTokenizerState.m; sourceTree = ""; }; + D34BAEC40FF9D56400D7773A /* PKCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCommentState.m; path = src/PKCommentState.m; sourceTree = ""; }; + D34BAEC60FF9D56400D7773A /* PKDelimitState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDelimitState.m; path = src/PKDelimitState.m; sourceTree = ""; }; + D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKMultiLineCommentState.m; path = src/PKMultiLineCommentState.m; sourceTree = ""; }; + D34BAECA0FF9D56400D7773A /* PKNumberState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKNumberState.m; path = src/PKNumberState.m; sourceTree = ""; }; + D34BAECC0FF9D56400D7773A /* PKQuoteState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKQuoteState.m; path = src/PKQuoteState.m; sourceTree = ""; }; + D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSingleLineCommentState.m; path = src/PKSingleLineCommentState.m; sourceTree = ""; }; + D34BAED00FF9D56400D7773A /* PKSymbolState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbolState.m; path = src/PKSymbolState.m; sourceTree = ""; }; + D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWhitespaceState.m; path = src/PKWhitespaceState.m; sourceTree = ""; }; + D34BAED40FF9D56400D7773A /* PKWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWord.m; path = src/PKWord.m; sourceTree = ""; }; + D34BAED60FF9D56400D7773A /* PKWordState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWordState.m; path = src/PKWordState.m; sourceTree = ""; }; + D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbolNode.m; path = src/PKSymbolNode.m; sourceTree = ""; }; + D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbolRootNode.m; path = src/PKSymbolRootNode.m; sourceTree = ""; }; + D34BAF380FF9E18300D7773A /* PKPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKPattern.m; path = src/PKPattern.m; sourceTree = ""; }; + D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCaseInsensitiveLiteral.m; path = src/PKCaseInsensitiveLiteral.m; sourceTree = ""; }; + D34BAF3E0FF9E19700D7773A /* PKComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKComment.m; path = src/PKComment.m; sourceTree = ""; }; + D34BAF400FF9E19700D7773A /* PKDelimitedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDelimitedString.m; path = src/PKDelimitedString.m; sourceTree = ""; }; + D34BAF420FF9E19700D7773A /* PKLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKLiteral.m; path = src/PKLiteral.m; sourceTree = ""; }; + D34BAF440FF9E19700D7773A /* PKNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKNumber.m; path = src/PKNumber.m; sourceTree = ""; }; + D34BAF460FF9E19700D7773A /* PKQuotedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKQuotedString.m; path = src/PKQuotedString.m; sourceTree = ""; }; + D34BAF480FF9E19700D7773A /* PKSymbol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSymbol.m; path = src/PKSymbol.m; sourceTree = ""; }; + D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKWhitespace.m; path = src/PKWhitespace.m; sourceTree = ""; }; + D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKLowercaseWord.m; path = src/PKLowercaseWord.m; sourceTree = ""; }; + D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKUppercaseWord.m; path = src/PKUppercaseWord.m; sourceTree = ""; }; + D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKCharacterAssembly.m; path = src/PKCharacterAssembly.m; sourceTree = ""; }; + D34BAFB40FF9E80300D7773A /* PKChar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKChar.m; path = src/PKChar.m; sourceTree = ""; }; + D34BAFB60FF9E80300D7773A /* PKDigit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKDigit.m; path = src/PKDigit.m; sourceTree = ""; }; + D34BAFB80FF9E80300D7773A /* PKLetter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKLetter.m; path = src/PKLetter.m; sourceTree = ""; }; + D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKSpecificChar.m; path = src/PKSpecificChar.m; sourceTree = ""; }; + D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSArray+ParseKitAdditions.h"; path = "src/NSArray+ParseKitAdditions.h"; sourceTree = ""; }; + D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSArray+ParseKitAdditions.m"; path = "src/NSArray+ParseKitAdditions.m"; sourceTree = ""; }; + D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+ParseKitAdditions.h"; path = "src/NSString+ParseKitAdditions.h"; sourceTree = ""; }; + D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+ParseKitAdditions.m"; path = "src/NSString+ParseKitAdditions.m"; sourceTree = ""; }; + D34BAFD80FF9E95500D7773A /* PKParserFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParserFactory.m; path = src/PKParserFactory.m; sourceTree = ""; }; + D34BB04E0FF9EC4E00D7773A /* JSParseKit-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "JSParseKit-Info.plist"; sourceTree = ""; }; + D34BB0660FF9EDDF00D7773A /* JSParseKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSParseKit.h; path = jssrc/JSParseKit.h; sourceTree = ""; }; + D34BB0670FF9EDDF00D7773A /* JSParseKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSParseKit.m; path = jssrc/JSParseKit.m; sourceTree = ""; }; + D34BB06A0FF9EE4000D7773A /* PKJSAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAssembly.h; path = jssrc/PKJSAssembly.h; sourceTree = ""; }; + D34BB06B0FF9EE4000D7773A /* PKJSAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAssembly.m; path = jssrc/PKJSAssembly.m; sourceTree = ""; }; + D34BB06C0FF9EE4000D7773A /* PKJSUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSUtils.h; path = jssrc/PKJSUtils.h; sourceTree = ""; }; + D34BB06D0FF9EE4000D7773A /* PKJSUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSUtils.m; path = jssrc/PKJSUtils.m; sourceTree = ""; }; + D34BB06E0FF9EE4000D7773A /* PKJSUtils_macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSUtils_macros.h; path = jssrc/PKJSUtils_macros.h; sourceTree = ""; }; + D34BB06F0FF9EE4000D7773A /* PKJSValueHolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSValueHolder.h; path = jssrc/PKJSValueHolder.h; sourceTree = ""; }; + D34BB0700FF9EE4000D7773A /* PKJSValueHolder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSValueHolder.m; path = jssrc/PKJSValueHolder.m; sourceTree = ""; }; + D34BB08D0FF9EF9D00D7773A /* PKJSCharacterAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCharacterAssembly.h; path = jssrc/PKJSCharacterAssembly.h; sourceTree = ""; }; + D34BB08E0FF9EF9D00D7773A /* PKJSCharacterAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCharacterAssembly.m; path = jssrc/PKJSCharacterAssembly.m; sourceTree = ""; }; + D34BB0930FF9F14B00D7773A /* PKJSCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCommentState.h; path = jssrc/PKJSCommentState.h; sourceTree = ""; }; + D34BB0940FF9F14B00D7773A /* PKJSCommentState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCommentState.m; path = jssrc/PKJSCommentState.m; sourceTree = ""; }; + D34BB0950FF9F14B00D7773A /* PKJSDelimitState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSDelimitState.h; path = jssrc/PKJSDelimitState.h; sourceTree = ""; }; + D34BB0960FF9F14B00D7773A /* PKJSDelimitState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSDelimitState.m; path = jssrc/PKJSDelimitState.m; sourceTree = ""; }; + D34BB0970FF9F14B00D7773A /* PKJSNumberState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSNumberState.h; path = jssrc/PKJSNumberState.h; sourceTree = ""; }; + D34BB0980FF9F14B00D7773A /* PKJSNumberState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSNumberState.m; path = jssrc/PKJSNumberState.m; sourceTree = ""; }; + D34BB0990FF9F14B00D7773A /* PKJSQuoteState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSQuoteState.h; path = jssrc/PKJSQuoteState.h; sourceTree = ""; }; + D34BB09A0FF9F14B00D7773A /* PKJSQuoteState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSQuoteState.m; path = jssrc/PKJSQuoteState.m; sourceTree = ""; }; + D34BB09B0FF9F14B00D7773A /* PKJSSymbolState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSSymbolState.h; path = jssrc/PKJSSymbolState.h; sourceTree = ""; }; + D34BB09C0FF9F14B00D7773A /* PKJSSymbolState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSSymbolState.m; path = jssrc/PKJSSymbolState.m; sourceTree = ""; }; + D34BB09D0FF9F14B00D7773A /* PKJSToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSToken.h; path = jssrc/PKJSToken.h; sourceTree = ""; }; + D34BB09E0FF9F14B00D7773A /* PKJSToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSToken.m; path = jssrc/PKJSToken.m; sourceTree = ""; }; + D34BB09F0FF9F14B00D7773A /* PKJSTokenAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTokenAssembly.h; path = jssrc/PKJSTokenAssembly.h; sourceTree = ""; }; + D34BB0A00FF9F14B00D7773A /* PKJSTokenAssembly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTokenAssembly.m; path = jssrc/PKJSTokenAssembly.m; sourceTree = ""; }; + D34BB0A10FF9F14B00D7773A /* PKJSTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTokenizer.h; path = jssrc/PKJSTokenizer.h; sourceTree = ""; }; + D34BB0A20FF9F14B00D7773A /* PKJSTokenizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTokenizer.m; path = jssrc/PKJSTokenizer.m; sourceTree = ""; }; + D34BB0A30FF9F14B00D7773A /* PKJSTokenizerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTokenizerState.h; path = jssrc/PKJSTokenizerState.h; sourceTree = ""; }; + D34BB0A40FF9F14B00D7773A /* PKJSTokenizerState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTokenizerState.m; path = jssrc/PKJSTokenizerState.m; sourceTree = ""; }; + D34BB0A50FF9F14B00D7773A /* PKJSWhitespaceState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSWhitespaceState.h; path = jssrc/PKJSWhitespaceState.h; sourceTree = ""; }; + D34BB0A60FF9F14B00D7773A /* PKJSWhitespaceState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSWhitespaceState.m; path = jssrc/PKJSWhitespaceState.m; sourceTree = ""; }; + D34BB0A70FF9F14B00D7773A /* PKJSWordState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSWordState.h; path = jssrc/PKJSWordState.h; sourceTree = ""; }; + D34BB0A80FF9F14B00D7773A /* PKJSWordState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSWordState.m; path = jssrc/PKJSWordState.m; sourceTree = ""; }; + D34BB0D20FF9F28000D7773A /* PKJSAlternation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAlternation.h; path = jssrc/PKJSAlternation.h; sourceTree = ""; }; + D34BB0D30FF9F28000D7773A /* PKJSAlternation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAlternation.m; path = jssrc/PKJSAlternation.m; sourceTree = ""; }; + D34BB0D40FF9F28000D7773A /* PKJSAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAny.h; path = jssrc/PKJSAny.h; sourceTree = ""; }; + D34BB0D50FF9F28000D7773A /* PKJSAny.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAny.m; path = jssrc/PKJSAny.m; sourceTree = ""; }; + D34BB0D60FF9F28000D7773A /* PKJSAssemblerAdapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSAssemblerAdapter.h; path = jssrc/PKJSAssemblerAdapter.h; sourceTree = ""; }; + D34BB0D70FF9F28000D7773A /* PKJSAssemblerAdapter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSAssemblerAdapter.m; path = jssrc/PKJSAssemblerAdapter.m; sourceTree = ""; }; + D34BB0D80FF9F28000D7773A /* PKJSCollectionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCollectionParser.h; path = jssrc/PKJSCollectionParser.h; sourceTree = ""; }; + D34BB0D90FF9F28000D7773A /* PKJSCollectionParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCollectionParser.m; path = jssrc/PKJSCollectionParser.m; sourceTree = ""; }; + D34BB0DA0FF9F28000D7773A /* PKJSEmpty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSEmpty.h; path = jssrc/PKJSEmpty.h; sourceTree = ""; }; + D34BB0DB0FF9F28000D7773A /* PKJSEmpty.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSEmpty.m; path = jssrc/PKJSEmpty.m; sourceTree = ""; }; + D34BB0DC0FF9F28000D7773A /* PKJSParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSParser.h; path = jssrc/PKJSParser.h; sourceTree = ""; }; + D34BB0DD0FF9F28000D7773A /* PKJSParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSParser.m; path = jssrc/PKJSParser.m; sourceTree = ""; }; + D34BB0DE0FF9F28000D7773A /* PKJSRepetition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSRepetition.h; path = jssrc/PKJSRepetition.h; sourceTree = ""; }; + D34BB0DF0FF9F28000D7773A /* PKJSRepetition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSRepetition.m; path = jssrc/PKJSRepetition.m; sourceTree = ""; }; + D34BB0E00FF9F28000D7773A /* PKJSSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSSequence.h; path = jssrc/PKJSSequence.h; sourceTree = ""; }; + D34BB0E10FF9F28000D7773A /* PKJSSequence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSSequence.m; path = jssrc/PKJSSequence.m; sourceTree = ""; }; + D34BB0E20FF9F28000D7773A /* PKJSTerminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTerminal.h; path = jssrc/PKJSTerminal.h; sourceTree = ""; }; + D34BB0E30FF9F28000D7773A /* PKJSTerminal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTerminal.m; path = jssrc/PKJSTerminal.m; sourceTree = ""; }; + D34BB0E40FF9F28000D7773A /* PKJSTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSTrack.h; path = jssrc/PKJSTrack.h; sourceTree = ""; }; + D34BB0E50FF9F28000D7773A /* PKJSTrack.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSTrack.m; path = jssrc/PKJSTrack.m; sourceTree = ""; }; + D34BB0FE0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSCaseInsensitiveLiteral.h; path = jssrc/PKJSCaseInsensitiveLiteral.h; sourceTree = ""; }; + D34BB0FF0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSCaseInsensitiveLiteral.m; path = jssrc/PKJSCaseInsensitiveLiteral.m; sourceTree = ""; }; + D34BB1000FF9F36200D7773A /* PKJSComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSComment.h; path = jssrc/PKJSComment.h; sourceTree = ""; }; + D34BB1010FF9F36200D7773A /* PKJSComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSComment.m; path = jssrc/PKJSComment.m; sourceTree = ""; }; + D34BB1020FF9F36200D7773A /* PKJSDelimitedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSDelimitedString.h; path = jssrc/PKJSDelimitedString.h; sourceTree = ""; }; + D34BB1030FF9F36200D7773A /* PKJSDelimitedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSDelimitedString.m; path = jssrc/PKJSDelimitedString.m; sourceTree = ""; }; + D34BB1040FF9F36200D7773A /* PKJSLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSLiteral.h; path = jssrc/PKJSLiteral.h; sourceTree = ""; }; + D34BB1050FF9F36200D7773A /* PKJSLiteral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSLiteral.m; path = jssrc/PKJSLiteral.m; sourceTree = ""; }; + D34BB1060FF9F36200D7773A /* PKJSLowercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSLowercaseWord.h; path = jssrc/PKJSLowercaseWord.h; sourceTree = ""; }; + D34BB1070FF9F36200D7773A /* PKJSLowercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSLowercaseWord.m; path = jssrc/PKJSLowercaseWord.m; sourceTree = ""; }; + D34BB1080FF9F36200D7773A /* PKJSNum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSNum.h; path = jssrc/PKJSNum.h; sourceTree = ""; }; + D34BB1090FF9F36200D7773A /* PKJSNum.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSNum.m; path = jssrc/PKJSNum.m; sourceTree = ""; }; + D34BB10A0FF9F36200D7773A /* PKJSPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSPattern.h; path = jssrc/PKJSPattern.h; sourceTree = ""; }; + D34BB10B0FF9F36200D7773A /* PKJSPattern.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSPattern.m; path = jssrc/PKJSPattern.m; sourceTree = ""; }; + D34BB10C0FF9F36200D7773A /* PKJSQuotedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSQuotedString.h; path = jssrc/PKJSQuotedString.h; sourceTree = ""; }; + D34BB10D0FF9F36200D7773A /* PKJSQuotedString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSQuotedString.m; path = jssrc/PKJSQuotedString.m; sourceTree = ""; }; + D34BB10E0FF9F36200D7773A /* PKJSSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSSymbol.h; path = jssrc/PKJSSymbol.h; sourceTree = ""; }; + D34BB10F0FF9F36200D7773A /* PKJSSymbol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSSymbol.m; path = jssrc/PKJSSymbol.m; sourceTree = ""; }; + D34BB1100FF9F36200D7773A /* PKJSUppercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSUppercaseWord.h; path = jssrc/PKJSUppercaseWord.h; sourceTree = ""; }; + D34BB1110FF9F36200D7773A /* PKJSUppercaseWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSUppercaseWord.m; path = jssrc/PKJSUppercaseWord.m; sourceTree = ""; }; + D34BB1120FF9F36200D7773A /* PKJSWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKJSWord.h; path = jssrc/PKJSWord.h; sourceTree = ""; }; + D34BB1130FF9F36200D7773A /* PKJSWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKJSWord.m; path = jssrc/PKJSWord.m; sourceTree = ""; }; + D3521F520E5FA1B0009681F9 /* XMLReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMLReader.h; path = test/XMLReader.h; sourceTree = ""; }; + D3521F530E5FA1B0009681F9 /* XMLReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMLReader.m; path = test/XMLReader.m; sourceTree = ""; }; + D3521F540E5FA1B0009681F9 /* XMLReaderTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XMLReaderTest.h; path = test/XMLReaderTest.h; sourceTree = ""; }; + D3521F550E5FA1B0009681F9 /* XMLReaderTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XMLReaderTest.m; path = test/XMLReaderTest.m; sourceTree = ""; }; + D35384EC0FE9691100926552 /* nspredicate.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = nspredicate.grammar; path = res/nspredicate.grammar; sourceTree = ""; }; + D353899B0FEAC94400926552 /* c.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = c.grammar; path = res/c.grammar; sourceTree = ""; }; + D353899D0FEAC96B00926552 /* objc.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = objc.grammar; path = res/objc.grammar; sourceTree = ""; }; + D355C62B0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateEvaluator.h; path = test/TDNSPredicateEvaluator.h; sourceTree = ""; }; + D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateEvaluator.m; path = test/TDNSPredicateEvaluator.m; sourceTree = ""; }; + D355C62F0FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNSPredicateEvaluatorTest.h; path = test/TDNSPredicateEvaluatorTest.h; sourceTree = ""; }; + D355C6300FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNSPredicateEvaluatorTest.m; path = test/TDNSPredicateEvaluatorTest.m; sourceTree = ""; }; + D355C8800FEB36A1006A91A4 /* xml.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = xml.grammar; path = res/xml.grammar; sourceTree = ""; }; + D355C8830FEB4B94006A91A4 /* proto.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = proto.grammar; path = res/proto.grammar; sourceTree = ""; }; + D36568A50EEF9FE900226554 /* TDPlistParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPlistParser.h; path = test/TDPlistParser.h; sourceTree = ""; }; + D36568A60EEF9FE900226554 /* TDPlistParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPlistParser.m; path = test/TDPlistParser.m; sourceTree = ""; }; + D36568A80EEFA05300226554 /* TDPlistParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPlistParserTest.h; path = test/TDPlistParserTest.h; sourceTree = ""; }; + D36568A90EEFA05300226554 /* TDPlistParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPlistParserTest.m; path = test/TDPlistParserTest.m; sourceTree = ""; }; + D3656DFC0EF2620E00226554 /* TDTokenArraySourceTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenArraySourceTest.h; path = test/TDTokenArraySourceTest.h; sourceTree = ""; }; + D3656DFD0EF2620E00226554 /* TDTokenArraySourceTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenArraySourceTest.m; path = test/TDTokenArraySourceTest.m; sourceTree = ""; }; + D3668291101D2BFA0008632C /* erb.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = erb.grammar; path = res/erb.grammar; sourceTree = ""; }; + D3668294101D2C200008632C /* ERBTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ERBTest.h; path = test/ERBTest.h; sourceTree = ""; }; + D3668295101D2C200008632C /* ERBTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ERBTest.m; path = test/ERBTest.m; sourceTree = ""; }; + D36934551038DE5300527AF3 /* PKParseTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParseTree.h; path = test/PKParseTree.h; sourceTree = ""; }; + D36934561038DE5300527AF3 /* PKParseTree.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParseTree.m; path = test/PKParseTree.m; sourceTree = ""; }; + D36934571038DE5300527AF3 /* PKParseTreeAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParseTreeAssembler.h; path = test/PKParseTreeAssembler.h; sourceTree = ""; }; + D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParseTreeAssembler.m; path = test/PKParseTreeAssembler.m; sourceTree = ""; }; + D36934591038DE5300527AF3 /* PKRuleNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKRuleNode.h; path = test/PKRuleNode.h; sourceTree = ""; }; + D369345A1038DE5300527AF3 /* PKRuleNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKRuleNode.m; path = test/PKRuleNode.m; sourceTree = ""; }; + D369345B1038DE5300527AF3 /* PKTokenNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenNode.h; path = test/PKTokenNode.h; sourceTree = ""; }; + D369345C1038DE5300527AF3 /* PKTokenNode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKTokenNode.m; path = test/PKTokenNode.m; sourceTree = ""; }; + D36C53770FD27F1300141CB7 /* TDParserFactoryTest2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryTest2.h; path = test/TDParserFactoryTest2.h; sourceTree = ""; }; + D36C53780FD27F1300141CB7 /* TDParserFactoryTest2.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryTest2.m; path = test/TDParserFactoryTest2.m; sourceTree = ""; }; + D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexKitLite.h; path = src/RegexKitLite.h; sourceTree = ""; }; + D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RegexKitLite.m; path = src/RegexKitLite.m; sourceTree = ""; }; + D36C560B0FD363D500141CB7 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = /usr/lib/libicucore.dylib; sourceTree = ""; }; + D36C56290FD365DB00141CB7 /* TDPatternTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDPatternTest.h; path = test/TDPatternTest.h; sourceTree = ""; }; + D36C562A0FD365DB00141CB7 /* TDPatternTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDPatternTest.m; path = test/TDPatternTest.m; sourceTree = ""; }; + D36E95440E578ECC00496BD3 /* XPathParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathParser.h; path = test/XPathParser.h; sourceTree = ""; }; + D36E95450E578ECC00496BD3 /* XPathParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathParser.m; path = test/XPathParser.m; sourceTree = ""; }; + D36E95D60E57B08400496BD3 /* XPathParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathParserTest.h; path = test/XPathParserTest.h; sourceTree = ""; }; + D36E95D70E57B08400496BD3 /* XPathParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathParserTest.m; path = test/XPathParserTest.m; sourceTree = ""; }; + D36E97AE0E589DAE00496BD3 /* XPathAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathAssembler.h; path = test/XPathAssembler.h; sourceTree = ""; }; + D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathAssembler.m; path = test/XPathAssembler.m; sourceTree = ""; }; + D36E98200E58A3A800496BD3 /* XPathContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPathContext.h; path = test/XPathContext.h; sourceTree = ""; }; + D36E98210E58A3A800496BD3 /* XPathContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = XPathContext.m; path = test/XPathContext.m; sourceTree = ""; }; + D36E98DC0E58C12800496BD3 /* DebugAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugAppDelegate.h; sourceTree = ""; }; + D36E98DD0E58C12800496BD3 /* DebugAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugAppDelegate.m; sourceTree = ""; }; + D36E98DE0E58C12800496BD3 /* DebugAppMainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DebugAppMainMenu.xib; sourceTree = ""; }; + D36E98DF0E58C12800496BD3 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + D36E98E30E58C14000496BD3 /* DemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DemoAppDelegate.h; path = demoapp/DemoAppDelegate.h; sourceTree = ""; }; + D36E98E40E58C14000496BD3 /* DemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DemoAppDelegate.m; path = demoapp/DemoAppDelegate.m; sourceTree = ""; }; + D36E98E50E58C14000496BD3 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = demoapp/main.m; sourceTree = ""; }; + D36E98F70E58C1A000496BD3 /* DemoAppMainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DemoAppMainMenu.xib; path = demoapp/DemoAppMainMenu.xib; sourceTree = ""; }; + D36E9F860E5A795400496BD3 /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = ""; }; + D36E9FB40E5A944A00496BD3 /* apple-boss.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "apple-boss.xml"; path = "res/apple-boss.xml"; sourceTree = ""; }; + D36E9FE40E5BA0FC00496BD3 /* SRGSGrammar.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = SRGSGrammar.txt; path = res/SRGSGrammar.txt; sourceTree = ""; }; + D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "small-xml-file.xml"; path = "res/small-xml-file.xml"; sourceTree = ""; }; + D380AFBB0F0C54B60009EC13 /* html.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = html.css; path = res/html.css; sourceTree = ""; }; + D380AFBC0F0C54B60009EC13 /* html.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = html.grammar; path = res/html.grammar; sourceTree = ""; }; + D380AFC20F0C56000009EC13 /* example.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = example.html; path = res/example.html; sourceTree = ""; }; + D380B5080F0D71A90009EC13 /* css.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = css.grammar; path = res/css.grammar; sourceTree = ""; }; + D380B5370F0D7DDE0009EC13 /* css.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = css.css; path = res/css.css; sourceTree = ""; }; + D380B5930F0D82F60009EC13 /* example.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = example.css; path = res/example.css; sourceTree = ""; }; + D380BA5F0F0F06CD0009EC13 /* TDParserFactoryTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryTest.h; path = test/TDParserFactoryTest.h; sourceTree = ""; }; + D380BA600F0F06CD0009EC13 /* TDParserFactoryTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryTest.m; path = test/TDParserFactoryTest.m; sourceTree = ""; }; + D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = /System/Library/Frameworks/JavaScriptCore.framework; sourceTree = ""; }; + D38205BC0EEE48EE004340DD /* TDTokenTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenTest.h; path = test/TDTokenTest.h; sourceTree = ""; }; + D38205BD0EEE48EE004340DD /* TDTokenTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenTest.m; path = test/TDTokenTest.m; sourceTree = ""; }; + D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json_with_comments.grammar; path = res/json_with_comments.grammar; sourceTree = ""; }; + D38349BB0F0C0D910055E4E0 /* json_with_comments.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = json_with_comments.css; path = res/json_with_comments.css; sourceTree = ""; }; + D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = yahoo_with_comments.json; path = res/yahoo_with_comments.json; sourceTree = ""; }; + D385F9880F046FE900DB2946 /* TDGenericAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDGenericAssembler.h; path = test/TDGenericAssembler.h; sourceTree = ""; }; + D385F9890F046FE900DB2946 /* TDGenericAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDGenericAssembler.m; path = test/TDGenericAssembler.m; sourceTree = ""; }; + D385FA210F04971400DB2946 /* TDGenericAssemblerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDGenericAssemblerTest.h; path = test/TDGenericAssemblerTest.h; sourceTree = ""; }; + D385FA220F04971400DB2946 /* TDGenericAssemblerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDGenericAssemblerTest.m; path = test/TDGenericAssemblerTest.m; sourceTree = ""; }; + D385FA240F04993500DB2946 /* json.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; name = json.css; path = res/json.css; sourceTree = ""; }; + D385FD400F05A88C00DB2946 /* TDMiniCSSAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDMiniCSSAssembler.h; path = test/TDMiniCSSAssembler.h; sourceTree = ""; }; + D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDMiniCSSAssembler.m; path = test/TDMiniCSSAssembler.m; sourceTree = ""; }; + D385FD420F05A88C00DB2946 /* TDMiniCSSAssemblerTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDMiniCSSAssemblerTest.h; path = test/TDMiniCSSAssemblerTest.h; sourceTree = ""; }; + D385FD430F05A88C00DB2946 /* TDMiniCSSAssemblerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDMiniCSSAssemblerTest.m; path = test/TDMiniCSSAssemblerTest.m; sourceTree = ""; }; + D385FD6B0F05A99900DB2946 /* mini_css.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = mini_css.grammar; path = res/mini_css.grammar; sourceTree = ""; }; + D389A0B00F1FCC99003B43BD /* RelaxParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RelaxParser.h; path = test/RelaxParser.h; sourceTree = ""; }; + D389A0B10F1FCC99003B43BD /* RelaxParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RelaxParser.m; path = test/RelaxParser.m; sourceTree = ""; }; + D389F1CE0F1965E600558235 /* JSParseKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JSParseKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D389F2030F196A7500558235 /* JSDemoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JSDemoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D389F20D0F196A9200558235 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + D389F2E30F196CAE00558235 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = jsdemoapp/main.m; sourceTree = ""; }; + D389F2E80F196F5B00558235 /* JSDemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSDemoAppDelegate.h; path = jsdemoapp/JSDemoAppDelegate.h; sourceTree = ""; }; + D389F2E90F196F5B00558235 /* JSDemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSDemoAppDelegate.m; path = jsdemoapp/JSDemoAppDelegate.m; sourceTree = ""; }; + D389F38E0F19800400558235 /* DefaultValues.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = DefaultValues.plist; path = jsdemoapp/DefaultValues.plist; sourceTree = ""; }; + D389F4610F198A8800558235 /* Test.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = Test.html; path = jsdemoapp/Test.html; sourceTree = ""; }; + D389F5580F19B7BC00558235 /* JSDemoAppMainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = JSDemoAppMainMenu.xib; path = jsdemoapp/JSDemoAppMainMenu.xib; sourceTree = ""; }; + D389F5B20F19C76A00558235 /* TDJsonParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJsonParser.h; path = test/TDJsonParser.h; sourceTree = ""; }; + D389F5B30F19C76A00558235 /* TDJsonParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJsonParser.m; path = test/TDJsonParser.m; sourceTree = ""; }; + D389F5B40F19C76A00558235 /* TDJsonParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJsonParserTest.h; path = test/TDJsonParserTest.h; sourceTree = ""; }; + D389F5B50F19C76A00558235 /* TDJsonParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJsonParserTest.m; path = test/TDJsonParserTest.m; sourceTree = ""; }; + D389FBCC0F1B25E200558235 /* ParserTest.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = ParserTest.html; path = jsdemoapp/ParserTest.html; sourceTree = ""; }; + D38DD9E70EC29F260070BC4D /* nyt.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = nyt.html; path = res/nyt.html; sourceTree = ""; }; + D38E97CA1061CF6500739C39 /* TDTokenizerBlocksTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDTokenizerBlocksTest.h; path = test/TDTokenizerBlocksTest.h; sourceTree = ""; }; + D38E97CB1061CF6500739C39 /* TDTokenizerBlocksTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDTokenizerBlocksTest.m; path = test/TDTokenizerBlocksTest.m; sourceTree = ""; }; + D38E98D61062C5BA00739C39 /* TDParserBlocksTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserBlocksTest.h; path = test/TDParserBlocksTest.h; sourceTree = ""; }; + D38E98D71062C5BA00739C39 /* TDParserBlocksTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserBlocksTest.m; path = test/TDParserBlocksTest.m; sourceTree = ""; }; + D3AF49760FDB122E0032F4DC /* TDParserFactoryPatternTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParserFactoryPatternTest.h; path = test/TDParserFactoryPatternTest.h; sourceTree = ""; }; + D3AF49770FDB122E0032F4DC /* TDParserFactoryPatternTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParserFactoryPatternTest.m; path = test/TDParserFactoryPatternTest.m; sourceTree = ""; }; + D3AF4BE80FDC3DD50032F4DC /* TDBlob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDBlob.h; path = test/TDBlob.h; sourceTree = ""; }; + D3AF4BE90FDC3DD50032F4DC /* TDBlob.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDBlob.m; path = test/TDBlob.m; sourceTree = ""; }; + D3AF4BF50FDC40050032F4DC /* TDToken+Blob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "TDToken+Blob.h"; path = "test/TDToken+Blob.h"; sourceTree = ""; }; + D3AF4BF60FDC40050032F4DC /* TDToken+Blob.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "TDToken+Blob.m"; path = "test/TDToken+Blob.m"; sourceTree = ""; }; + D3AF4BFB0FDC41190032F4DC /* TDTokenizer+BlobState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "TDTokenizer+BlobState.h"; path = "test/TDTokenizer+BlobState.h"; sourceTree = ""; }; + D3AF4BFC0FDC41190032F4DC /* TDTokenizer+BlobState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "TDTokenizer+BlobState.m"; path = "test/TDTokenizer+BlobState.m"; sourceTree = ""; }; + D3AF4C190FDC568F0032F4DC /* TDBlobState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDBlobState.h; path = test/TDBlobState.h; sourceTree = ""; }; + D3AF4C1A0FDC568F0032F4DC /* TDBlobState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDBlobState.m; path = test/TDBlobState.m; sourceTree = ""; }; + D3AF4CBF0FDC740A0032F4DC /* TDNonReservedWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDNonReservedWord.h; path = test/TDNonReservedWord.h; sourceTree = ""; }; + D3AF4CC00FDC740A0032F4DC /* TDNonReservedWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDNonReservedWord.m; path = test/TDNonReservedWord.m; sourceTree = ""; }; + D3AF4CC10FDC740A0032F4DC /* TDReservedWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDReservedWord.h; path = test/TDReservedWord.h; sourceTree = ""; }; + D3AF4CC20FDC740A0032F4DC /* TDReservedWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDReservedWord.m; path = test/TDReservedWord.m; sourceTree = ""; }; + D3AF4CC30FDC740A0032F4DC /* TDSignificantWhitespaceState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSignificantWhitespaceState.h; path = test/TDSignificantWhitespaceState.h; sourceTree = ""; }; + D3AF4CC40FDC740A0032F4DC /* TDSignificantWhitespaceState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSignificantWhitespaceState.m; path = test/TDSignificantWhitespaceState.m; sourceTree = ""; }; + D3AF4CC50FDC740A0032F4DC /* TDWordOrReservedState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDWordOrReservedState.h; path = test/TDWordOrReservedState.h; sourceTree = ""; }; + D3AF4CC60FDC740A0032F4DC /* TDWordOrReservedState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDWordOrReservedState.m; path = test/TDWordOrReservedState.m; sourceTree = ""; }; + D3B43FB50F76E99C0072AF40 /* TDJavaScriptParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDJavaScriptParserTest.h; path = test/TDJavaScriptParserTest.h; sourceTree = ""; }; + D3B43FB60F76E99C0072AF40 /* TDJavaScriptParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDJavaScriptParserTest.m; path = test/TDJavaScriptParserTest.m; sourceTree = ""; }; + D3B473840E48C9CF008AFBDD /* yahoo.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = yahoo.json; path = res/yahoo.json; sourceTree = ""; }; + D3B69D310E80249900D70C41 /* nonascii.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = nonascii.html; path = res/nonascii.html; sourceTree = ""; }; + D3BBBC960FEC9722007DF30D /* TDXMLParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXMLParserTest.h; path = test/TDXMLParserTest.h; sourceTree = ""; }; + D3BBBC970FEC9722007DF30D /* TDXMLParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXMLParserTest.m; path = test/TDXMLParserTest.m; sourceTree = ""; }; + D3BBBC9B0FEC9756007DF30D /* TDXMLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDXMLParser.h; path = test/TDXMLParser.h; sourceTree = ""; }; + D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDXMLParser.m; path = test/TDXMLParser.m; sourceTree = ""; }; + D3C031EB0EF38D2D00C5ABEB /* TDLowercaseWordTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDLowercaseWordTest.h; path = test/TDLowercaseWordTest.h; sourceTree = ""; }; + D3C031EC0EF38D2D00C5ABEB /* TDLowercaseWordTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDLowercaseWordTest.m; path = test/TDLowercaseWordTest.m; sourceTree = ""; }; + D3C2216D0FFE8A86004514FE /* PKExclusion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKExclusion.h; path = test/PKExclusion.h; sourceTree = ""; }; + D3C221900FFE8B8C004514FE /* ParseKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ParseKit.h; path = include/ParseKit/ParseKit.h; sourceTree = ""; }; + D3C221910FFE8B8C004514FE /* PKTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTypes.h; path = include/ParseKit/PKTypes.h; sourceTree = ""; }; + D3C221960FFE8B95004514FE /* PKReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKReader.h; path = include/ParseKit/PKReader.h; sourceTree = ""; }; + D3C221990FFE8B9D004514FE /* PKAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAssembly.h; path = include/ParseKit/PKAssembly.h; sourceTree = ""; }; + D3C2219C0FFE8BA6004514FE /* PKParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParser.h; path = include/ParseKit/PKParser.h; sourceTree = ""; }; + D3C2219F0FFE8BAE004514FE /* PKRepetition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKRepetition.h; path = include/ParseKit/PKRepetition.h; sourceTree = ""; }; + D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCollectionParser.h; path = include/ParseKit/PKCollectionParser.h; sourceTree = ""; }; + D3C221A50FFE8BC1004514FE /* PKAlternation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAlternation.h; path = include/ParseKit/PKAlternation.h; sourceTree = ""; }; + D3C221A80FFE8BC9004514FE /* PKSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSequence.h; path = include/ParseKit/PKSequence.h; sourceTree = ""; }; + D3C221AB0FFE8BCF004514FE /* PKTrack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTrack.h; path = include/ParseKit/PKTrack.h; sourceTree = ""; }; + D3C221AE0FFE8BD4004514FE /* PKTrackException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTrackException.h; path = include/ParseKit/PKTrackException.h; sourceTree = ""; }; + D3C221B10FFE8BDB004514FE /* PKIntersection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKIntersection.h; path = include/ParseKit/PKIntersection.h; sourceTree = ""; }; + D3C221B40FFE8BE2004514FE /* PKDifference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDifference.h; path = include/ParseKit/PKDifference.h; sourceTree = ""; }; + D3C221B70FFE8BE8004514FE /* PKNegation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKNegation.h; path = include/ParseKit/PKNegation.h; sourceTree = ""; }; + D3C221BA0FFE8BEF004514FE /* PKTerminal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTerminal.h; path = include/ParseKit/PKTerminal.h; sourceTree = ""; }; + D3C221BD0FFE8BF7004514FE /* PKEmpty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKEmpty.h; path = include/ParseKit/PKEmpty.h; sourceTree = ""; }; + D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenAssembly.h; path = include/ParseKit/PKTokenAssembly.h; sourceTree = ""; }; + D3C221C30FFE8C07004514FE /* PKToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKToken.h; path = include/ParseKit/PKToken.h; sourceTree = ""; }; + D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenArraySource.h; path = include/ParseKit/PKTokenArraySource.h; sourceTree = ""; }; + D3C221C90FFE8C15004514FE /* PKTokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenizer.h; path = include/ParseKit/PKTokenizer.h; sourceTree = ""; }; + D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKTokenizerState.h; path = include/ParseKit/PKTokenizerState.h; sourceTree = ""; }; + D3C221CF0FFE8C24004514FE /* PKNumberState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKNumberState.h; path = include/ParseKit/PKNumberState.h; sourceTree = ""; }; + D3C221D50FFE8C35004514FE /* PKSymbolState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbolState.h; path = include/ParseKit/PKSymbolState.h; sourceTree = ""; }; + D3C221D80FFE8C3D004514FE /* PKWordState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWordState.h; path = include/ParseKit/PKWordState.h; sourceTree = ""; }; + D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWhitespaceState.h; path = include/ParseKit/PKWhitespaceState.h; sourceTree = ""; }; + D3C221DE0FFE8C49004514FE /* PKDelimitState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDelimitState.h; path = include/ParseKit/PKDelimitState.h; sourceTree = ""; }; + D3C221E10FFE8C4E004514FE /* PKCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCommentState.h; path = include/ParseKit/PKCommentState.h; sourceTree = ""; }; + D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSingleLineCommentState.h; path = include/ParseKit/PKSingleLineCommentState.h; sourceTree = ""; }; + D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKMultiLineCommentState.h; path = include/ParseKit/PKMultiLineCommentState.h; sourceTree = ""; }; + D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbolNode.h; path = include/ParseKit/PKSymbolNode.h; sourceTree = ""; }; + D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbolRootNode.h; path = include/ParseKit/PKSymbolRootNode.h; sourceTree = ""; }; + D3C221F00FFE8C7A004514FE /* PKPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKPattern.h; path = include/ParseKit/PKPattern.h; sourceTree = ""; }; + D3C221F30FFE8C87004514FE /* PKWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWord.h; path = include/ParseKit/PKWord.h; sourceTree = ""; }; + D3C221F60FFE8C8E004514FE /* PKNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKNumber.h; path = include/ParseKit/PKNumber.h; sourceTree = ""; }; + D3C221F90FFE8C97004514FE /* PKQuotedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKQuotedString.h; path = include/ParseKit/PKQuotedString.h; sourceTree = ""; }; + D3C221FC0FFE8CB2004514FE /* PKSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSymbol.h; path = include/ParseKit/PKSymbol.h; sourceTree = ""; }; + D3C221FF0FFE8CB9004514FE /* PKLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKLiteral.h; path = include/ParseKit/PKLiteral.h; sourceTree = ""; }; + D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCaseInsensitiveLiteral.h; path = include/ParseKit/PKCaseInsensitiveLiteral.h; sourceTree = ""; }; + D3C222050FFE8CCA004514FE /* PKWhitespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKWhitespace.h; path = include/ParseKit/PKWhitespace.h; sourceTree = ""; }; + D3C222080FFE8CD1004514FE /* PKComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKComment.h; path = include/ParseKit/PKComment.h; sourceTree = ""; }; + D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDelimitedString.h; path = include/ParseKit/PKDelimitedString.h; sourceTree = ""; }; + D3C2220E0FFE8CDF004514FE /* PKAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKAny.h; path = include/ParseKit/PKAny.h; sourceTree = ""; }; + D3C222140FFE8D01004514FE /* PKLowercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKLowercaseWord.h; path = include/ParseKit/PKLowercaseWord.h; sourceTree = ""; }; + D3C222170FFE8D11004514FE /* PKUppercaseWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKUppercaseWord.h; path = include/ParseKit/PKUppercaseWord.h; sourceTree = ""; }; + D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKCharacterAssembly.h; path = include/ParseKit/PKCharacterAssembly.h; sourceTree = ""; }; + D3C2221D0FFE8D3B004514FE /* PKChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKChar.h; path = include/ParseKit/PKChar.h; sourceTree = ""; }; + D3C222200FFE8D42004514FE /* PKDigit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKDigit.h; path = include/ParseKit/PKDigit.h; sourceTree = ""; }; + D3C222230FFE8D49004514FE /* PKLetter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKLetter.h; path = include/ParseKit/PKLetter.h; sourceTree = ""; }; + D3C222260FFE8D6B004514FE /* PKSpecificChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKSpecificChar.h; path = include/ParseKit/PKSpecificChar.h; sourceTree = ""; }; + D3C222290FFE8DAC004514FE /* PKParserFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParserFactory.h; path = include/ParseKit/PKParserFactory.h; sourceTree = ""; }; + D3C7D87A0A411FBF005DD154 /* Tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.octest; sourceTree = BUILT_PRODUCTS_DIR; }; + D3C85C790E63B438000445FD /* TDArithmeticParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDArithmeticParser.h; path = test/TDArithmeticParser.h; sourceTree = ""; }; + D3C85C7A0E63B438000445FD /* TDArithmeticParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDArithmeticParser.m; path = test/TDArithmeticParser.m; sourceTree = ""; }; + D3C85C7E0E63B9E9000445FD /* TDArithmeticParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDArithmeticParserTest.h; path = test/TDArithmeticParserTest.h; sourceTree = ""; }; + D3C85C7F0E63B9E9000445FD /* TDArithmeticParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDArithmeticParserTest.m; path = test/TDArithmeticParserTest.m; sourceTree = ""; }; + D3C85D430E63D1BF000445FD /* TDScientificNumberStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDScientificNumberStateTest.h; path = test/TDScientificNumberStateTest.h; sourceTree = ""; }; + D3C85D440E63D1BF000445FD /* TDScientificNumberStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDScientificNumberStateTest.m; path = test/TDScientificNumberStateTest.m; sourceTree = ""; }; + D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json_with_discards.grammar; path = res/json_with_discards.grammar; sourceTree = ""; }; + D3D1BF2610394420003656E5 /* SAXAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SAXAssembler.h; path = test/SAXAssembler.h; sourceTree = ""; }; + D3D1BF2710394420003656E5 /* SAXAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SAXAssembler.m; path = test/SAXAssembler.m; sourceTree = ""; }; + D3D1BF291039445C003656E5 /* SAXTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SAXTest.h; path = test/SAXTest.h; sourceTree = ""; }; + D3D1BF2A1039445C003656E5 /* SAXTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SAXTest.m; path = test/SAXTest.m; sourceTree = ""; }; + D3DCB35C0EF5E52500DE5110 /* OCMock.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OCMock.framework; path = frameworks/OCMock.framework; sourceTree = ""; }; + D3DCB4C20EF6015300DE5110 /* json.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = json.grammar; path = res/json.grammar; sourceTree = ""; }; + D3DDDA850F0779FD00A58000 /* TDSyntaxHighlighter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSyntaxHighlighter.h; path = test/TDSyntaxHighlighter.h; sourceTree = ""; }; + D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSyntaxHighlighter.m; path = test/TDSyntaxHighlighter.m; sourceTree = ""; }; + D3DDDAFC0F083C9700A58000 /* TDCommentStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDCommentStateTest.h; path = test/TDCommentStateTest.h; sourceTree = ""; }; + D3DDDAFD0F083C9700A58000 /* TDCommentStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDCommentStateTest.m; path = test/TDCommentStateTest.m; sourceTree = ""; }; + D3DDDC230F085C5400A58000 /* TDSlashSlashState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashSlashState.h; path = test/TDSlashSlashState.h; sourceTree = ""; }; + D3DDDC240F085C5400A58000 /* TDSlashSlashState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashSlashState.m; path = test/TDSlashSlashState.m; sourceTree = ""; }; + D3DDDC250F085C5400A58000 /* TDSlashStarState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashStarState.h; path = test/TDSlashStarState.h; sourceTree = ""; }; + D3DDDC260F085C5400A58000 /* TDSlashStarState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashStarState.m; path = test/TDSlashStarState.m; sourceTree = ""; }; + D3DDDC270F085C5400A58000 /* TDSlashState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDSlashState.h; path = test/TDSlashState.h; sourceTree = ""; }; + D3DDDC280F085C5400A58000 /* TDSlashState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDSlashState.m; path = test/TDSlashState.m; sourceTree = ""; }; + D3DDDCAC0F0880D800A58000 /* example1.srgs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = example1.srgs; path = res/example1.srgs; sourceTree = ""; }; + D3E39C3D0FC5FFD10022DAB9 /* TDDelimitStateTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDDelimitStateTest.h; path = test/TDDelimitStateTest.h; sourceTree = ""; }; + D3E39C3E0FC5FFD10022DAB9 /* TDDelimitStateTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDDelimitStateTest.m; path = test/TDDelimitStateTest.m; sourceTree = ""; }; + D3E784BC0E53DA28008C7D61 /* apple-boss.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "apple-boss.json"; path = "res/apple-boss.json"; sourceTree = ""; }; + D3E788910E567DFD008C7D61 /* SRGSParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SRGSParserTest.h; path = test/SRGSParserTest.h; sourceTree = ""; }; + D3E788920E567DFD008C7D61 /* SRGSParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SRGSParserTest.m; path = test/SRGSParserTest.m; sourceTree = ""; }; + D3E788940E567E0A008C7D61 /* SRGSParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SRGSParser.h; path = test/SRGSParser.h; sourceTree = ""; }; + D3E788950E567E0A008C7D61 /* SRGSParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SRGSParser.m; path = test/SRGSParser.m; sourceTree = ""; }; + D3E78A150E574C99008C7D61 /* EBNFParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EBNFParser.h; path = test/EBNFParser.h; sourceTree = ""; }; + D3E78A160E574C99008C7D61 /* EBNFParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EBNFParser.m; path = test/EBNFParser.m; sourceTree = ""; }; + D3E78A170E574C99008C7D61 /* EBNFParserTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EBNFParserTest.h; path = test/EBNFParserTest.h; sourceTree = ""; }; + D3E78A180E574C99008C7D61 /* EBNFParserTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EBNFParserTest.m; path = test/EBNFParserTest.m; sourceTree = ""; }; + D3EADD7F0E75E9CC00F78584 /* nasty.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = nasty.html; path = res/nasty.html; sourceTree = ""; }; + D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDHtmlSyntaxHighlighter.m; path = test/TDHtmlSyntaxHighlighter.m; sourceTree = ""; }; + D3EADD8D0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDHtmlSyntaxHighlighter.h; path = test/TDHtmlSyntaxHighlighter.h; sourceTree = ""; }; + D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKQuoteState.h; path = include/ParseKit/PKQuoteState.h; sourceTree = ""; }; + D3F0E3290FFEA1E200C9DF74 /* DebugApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "DebugApp-Info.plist"; sourceTree = ""; }; + D3F0E3600FFEA2B500C9DF74 /* DemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "DemoApp-Info.plist"; path = "demoapp/DemoApp-Info.plist"; sourceTree = ""; }; + D3F0E36C0FFEA33700C9DF74 /* Tests-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Tests-Info.plist"; path = "test/Tests-Info.plist"; sourceTree = ""; }; + D3F0E37A0FFEA39000C9DF74 /* JSDemoApp-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "JSDemoApp-Info.plist"; path = "jsdemoapp/JSDemoApp-Info.plist"; sourceTree = ""; }; + D3F55F5F1025737D00DD6DB1 /* TDParseTreeTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TDParseTreeTest.h; path = test/TDParseTreeTest.h; sourceTree = ""; }; + D3F55F601025737D00DD6DB1 /* TDParseTreeTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TDParseTreeTest.m; path = test/TDParseTreeTest.m; sourceTree = ""; }; + D3F5629810266CFC00DD6DB1 /* PKParseTreeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PKParseTreeView.h; path = demoapp/PKParseTreeView.h; sourceTree = ""; }; + D3F5629910266CFC00DD6DB1 /* PKParseTreeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PKParseTreeView.m; path = demoapp/PKParseTreeView.m; sourceTree = ""; }; + D3F5629E10266DFB00DD6DB1 /* DemoTokensViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DemoTokensViewController.h; path = demoapp/DemoTokensViewController.h; sourceTree = ""; }; + D3F5629F10266DFB00DD6DB1 /* DemoTokensViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DemoTokensViewController.m; path = demoapp/DemoTokensViewController.m; sourceTree = ""; }; + D3F562A110266E5300DD6DB1 /* TokensView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = TokensView.xib; path = demoapp/TokensView.xib; sourceTree = ""; }; + D3F562A310266E6300DD6DB1 /* TreesView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = TreesView.xib; path = demoapp/TreesView.xib; sourceTree = ""; }; + D3F562A510266E8D00DD6DB1 /* DemoTreesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DemoTreesViewController.h; path = demoapp/DemoTreesViewController.h; sourceTree = ""; }; + D3F562A610266E8D00DD6DB1 /* DemoTreesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DemoTreesViewController.m; path = demoapp/DemoTreesViewController.m; sourceTree = ""; }; + D3F740B50EF8C38A00559B9F /* JSONAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONAssembler.h; sourceTree = ""; }; + D3F740B60EF8C38A00559B9F /* JSONAssembler.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONAssembler.m; sourceTree = ""; }; + D3F741430EF8E96A00559B9F /* xpath1_0.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = xpath1_0.grammar; path = res/xpath1_0.grammar; sourceTree = ""; }; + D3F741BD0EF9F28D00559B9F /* css2_1.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = css2_1.grammar; path = res/css2_1.grammar; sourceTree = ""; }; + D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = rubyhash.grammar; path = res/rubyhash.grammar; sourceTree = ""; }; + D3FDC5830FFC4BFC00F1F797 /* libparsekit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libparsekit.a; sourceTree = BUILT_PRODUCTS_DIR; }; + D3FDC7360FFC4D6100F1F797 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + D3FDC7380FFC4D6100F1F797 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; }; + D3FDC74B0FFC4DAC00F1F797 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + D3FDC8DB0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseKitMobile_Prefix.pch; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8DC2EF560486A6940098B216 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3E787A30E5661A9008C7D61 /* Foundation.framework in Frameworks */, + D36C560C0FD363D500141CB7 /* libicucore.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D334940E0E2963FD00406085 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D33494720E29670B00406085 /* ParseKit.framework in Frameworks */, + D37D3A000FE77A71008C2E4D /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D34185020E520D3F0081B0DC /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D31FE7380E60F36600A0803E /* libxml2.dylib in Frameworks */, + D341850C0E520D640081B0DC /* ParseKit.framework in Frameworks */, + D380B9800F0EF3860009EC13 /* OCMock.framework in Frameworks */, + D380BAA30F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */, + D37D3A010FE77A72008C2E4D /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1CC0F1965E600558235 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F34E0F197DF500558235 /* JavaScriptCore.framework in Frameworks */, + D389F1D50F19666500558235 /* ParseKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F2010F196A7500558235 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F3430F197DDC00558235 /* JavaScriptCore.framework in Frameworks */, + D389F20E0F196A9200558235 /* WebKit.framework in Frameworks */, + D389F20C0F196A9200558235 /* ParseKit.framework in Frameworks */, + D389F20B0F196A9200558235 /* JSParseKit.framework in Frameworks */, + D37D3A020FE77A77008C2E4D /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3C7D8770A411FBF005DD154 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3DCB37D0EF5E5E400DE5110 /* OCMock.framework in Frameworks */, + D3C7D9DA0A412874005DD154 /* ParseKit.framework in Frameworks */, + D36E9F870E5A795400496BD3 /* libxml2.dylib in Frameworks */, + D380BAA40F0F1D980009EC13 /* JavaScriptCore.framework in Frameworks */, + D3587EAF0FE83EC900DDD023 /* AppKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3FDC5810FFC4BFC00F1F797 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3FDC7370FFC4D6100F1F797 /* Foundation.framework in Frameworks */, + D3FDC7390FFC4D6100F1F797 /* libicucore.dylib in Frameworks */, + D3FDC74C0FFC4DAC00F1F797 /* CoreGraphics.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 034768DFFF38A50411DB9C8B /* Products */ = { + isa = PBXGroup; + children = ( + 8DC2EF5B0486A6940098B216 /* ParseKit.framework */, + D389F1CE0F1965E600558235 /* JSParseKit.framework */, + D3C7D87A0A411FBF005DD154 /* Tests.octest */, + D33494100E2963FD00406085 /* DemoApp.app */, + D34185040E520D3F0081B0DC /* DebugApp.app */, + D389F2030F196A7500558235 /* JSDemoApp.app */, + D3FDC5830FFC4BFC00F1F797 /* libparsekit.a */, + ); + name = Products; + sourceTree = ""; + }; + 0867D691FE84028FC02AAC07 /* TODParseKit */ = { + isa = PBXGroup; + children = ( + 08FB77AEFE84172EC02AAC07 /* ParseKit Framework */, + D3C7D8220A411F31005DD154 /* ParseKit Tests */, + D36E98CB0E58C08F00496BD3 /* DebugApp */, + D334941B0E29641300406085 /* DemoApp */, + D380BA950F0F1C450009EC13 /* JSParseKit Framework */, + D389F2CA0F196ACF00558235 /* JSDemoApp */, + D3AF4C8E0FDC738B0032F4DC /* Other Sources */, + 32C88DFF0371C24200C91783 /* Other Sources (not used) */, + 089C1665FE841158C02AAC07 /* Resources */, + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, + 034768DFFF38A50411DB9C8B /* Products */, + ); + name = TODParseKit; + sourceTree = ""; + }; + 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { + isa = PBXGroup; + children = ( + D3FDC8EF0FFC52CD00F1F797 /* Mobile Frameworks */, + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, + ); + name = "External Frameworks and Libraries"; + sourceTree = ""; + }; + 089C1665FE841158C02AAC07 /* Resources */ = { + isa = PBXGroup; + children = ( + 8DC2EF5A0486A6940098B216 /* Info.plist */, + 089C1666FE841158C02AAC07 /* InfoPlist.strings */, + ); + name = Resources; + sourceTree = ""; + }; + 08FB77AEFE84172EC02AAC07 /* ParseKit Framework */ = { + isa = PBXGroup; + children = ( + D3C221900FFE8B8C004514FE /* ParseKit.h */, + D3C221910FFE8B8C004514FE /* PKTypes.h */, + D3C7D8710A411F6B005DD154 /* io */, + D3C7D8720A411F81005DD154 /* parse */, + D3C7D8740A411F8E005DD154 /* tokens */, + D3E785F10E550F63008C7D61 /* chars */, + D34BAC0F0FF87ED200D7773A /* grammar */, + ); + name = "ParseKit Framework"; + sourceTree = ""; + }; + 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + D389F20D0F196A9200558235 /* WebKit.framework */, + D380BAA20F0F1D980009EC13 /* JavaScriptCore.framework */, + D3DCB35C0EF5E52500DE5110 /* OCMock.framework */, + D36E9F860E5A795400496BD3 /* libxml2.dylib */, + D36C560B0FD363D500141CB7 /* libicucore.dylib */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 0867D6A5FE840307C02AAC07 /* AppKit.framework */, + 0867D69BFE84028FC02AAC07 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 32C88DFF0371C24200C91783 /* Other Sources (not used) */ = { + isa = PBXGroup; + children = ( + D3C2216D0FFE8A86004514FE /* PKExclusion.h */, + D31270F80FFE898300CBF4C4 /* PKExclusion.m */, + D3AF4CCB0FDC74540032F4DC /* Whitespace */, + D3AF4CCA0FDC74490032F4DC /* Slash */, + D3AF4CC90FDC743C0032F4DC /* ReservedWord */, + D3AF4CC80FDC74320032F4DC /* Blob */, + ); + name = "Other Sources (not used)"; + sourceTree = ""; + }; + D318EAE30E2FD5B6009F47DF /* json */ = { + isa = PBXGroup; + children = ( + D3E784BC0E53DA28008C7D61 /* apple-boss.json */, + D3B473840E48C9CF008AFBDD /* yahoo.json */, + D389F5B20F19C76A00558235 /* TDJsonParser.h */, + D389F5B30F19C76A00558235 /* TDJsonParser.m */, + D389F5B40F19C76A00558235 /* TDJsonParserTest.h */, + D389F5B50F19C76A00558235 /* TDJsonParserTest.m */, + D31FE5A10E60E5D500A0803E /* TDFastJsonParser.h */, + D31FE5A20E60E5D500A0803E /* TDFastJsonParser.m */, + D31FE5A30E60E5D500A0803E /* TDFastJsonParserTest.h */, + D31FE5A40E60E5D500A0803E /* TDFastJsonParserTest.m */, + ); + name = json; + sourceTree = ""; + }; + D31A164F0F703899002AFDF1 /* javascript */ = { + isa = PBXGroup; + children = ( + D31A16500F7038C2002AFDF1 /* TDJavaScriptParser.h */, + D31A16510F7038C2002AFDF1 /* TDJavaScriptParser.m */, + D3B43FB50F76E99C0072AF40 /* TDJavaScriptParserTest.h */, + D3B43FB60F76E99C0072AF40 /* TDJavaScriptParserTest.m */, + ); + name = javascript; + sourceTree = ""; + }; + D3252F670FCE171D005EF059 /* predicate */ = { + isa = PBXGroup; + children = ( + D355C62B0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.h */, + D355C62C0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m */, + D355C62F0FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.h */, + D355C6300FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m */, + D35384EC0FE9691100926552 /* nspredicate.grammar */, + D3252F7C0FCE1A87005EF059 /* TDNSPredicateBuilder.h */, + D3252F7D0FCE1A87005EF059 /* TDNSPredicateBuilder.m */, + D3252F780FCE1A7E005EF059 /* TDNSPredicateBuilderTest.h */, + D3252F790FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m */, + D3385FD70FCFB1FF003BF729 /* TDPredicateEvaluator.h */, + D3385FD80FCFB1FF003BF729 /* TDPredicateEvaluator.m */, + D3385FDB0FCFB227003BF729 /* TDPredicateEvaluatorTest.h */, + D3385FDC0FCFB227003BF729 /* TDPredicateEvaluatorTest.m */, + ); + name = predicate; + sourceTree = ""; + }; + D3305C52102F5BB300DC4F75 /* Trees */ = { + isa = PBXGroup; + children = ( + D3F562A310266E6300DD6DB1 /* TreesView.xib */, + D3F562A510266E8D00DD6DB1 /* DemoTreesViewController.h */, + D3F562A610266E8D00DD6DB1 /* DemoTreesViewController.m */, + D3F5629810266CFC00DD6DB1 /* PKParseTreeView.h */, + D3F5629910266CFC00DD6DB1 /* PKParseTreeView.m */, + D3305C53102F5BC500DC4F75 /* SourceCodeView */, + ); + name = Trees; + sourceTree = ""; + }; + D3305C53102F5BC500DC4F75 /* SourceCodeView */ = { + isa = PBXGroup; + children = ( + D3305C4B102F5BAD00DC4F75 /* TDGutterView.h */, + D3305C4C102F5BAD00DC4F75 /* TDGutterView.m */, + D3305C4D102F5BAE00DC4F75 /* TDSourceCodeTextView.h */, + D3305C4E102F5BAE00DC4F75 /* TDSourceCodeTextView.m */, + ); + name = SourceCodeView; + sourceTree = ""; + }; + D3305C54102F5BE500DC4F75 /* Tokens */ = { + isa = PBXGroup; + children = ( + D3F562A110266E5300DD6DB1 /* TokensView.xib */, + D3F5629E10266DFB00DD6DB1 /* DemoTokensViewController.h */, + D3F5629F10266DFB00DD6DB1 /* DemoTokensViewController.m */, + ); + name = Tokens; + sourceTree = ""; + }; + D334941B0E29641300406085 /* DemoApp */ = { + isa = PBXGroup; + children = ( + D3F0E3600FFEA2B500C9DF74 /* DemoApp-Info.plist */, + D36E98F70E58C1A000496BD3 /* DemoAppMainMenu.xib */, + D36E98E50E58C14000496BD3 /* main.m */, + D36E98E30E58C14000496BD3 /* DemoAppDelegate.h */, + D36E98E40E58C14000496BD3 /* DemoAppDelegate.m */, + D3305C54102F5BE500DC4F75 /* Tokens */, + D3305C52102F5BB300DC4F75 /* Trees */, + ); + name = DemoApp; + sourceTree = ""; + }; + D3376D1110091C6C00E4602E /* ParseTree */ = { + isa = PBXGroup; + children = ( + D3F55F5F1025737D00DD6DB1 /* TDParseTreeTest.h */, + D3F55F601025737D00DD6DB1 /* TDParseTreeTest.m */, + ); + name = ParseTree; + sourceTree = ""; + }; + D3376D7710096BDE00E4602E /* IR */ = { + isa = PBXGroup; + children = ( + D3F5619C1026374400DD6DB1 /* ir */, + D3376D1110091C6C00E4602E /* ParseTree */, + D3376D8B10096BEF00E4602E /* Homo */, + ); + name = IR; + sourceTree = ""; + }; + D3376D8B10096BEF00E4602E /* Homo */ = { + isa = PBXGroup; + children = ( + D3376D8C10096C0700E4602E /* PKAST.h */, + D3376D8D10096C0700E4602E /* PKAST.m */, + ); + name = Homo; + sourceTree = ""; + }; + D341846A0E5209A60081B0DC /* tokenizer */ = { + isa = PBXGroup; + children = ( + D3C221C30FFE8C07004514FE /* PKToken.h */, + D34BAE950FF9D20900D7773A /* PKToken.m */, + D3C221C60FFE8C0D004514FE /* PKTokenArraySource.h */, + D34BAE970FF9D20900D7773A /* PKTokenArraySource.m */, + D3C221C90FFE8C15004514FE /* PKTokenizer.h */, + D34BAE990FF9D20900D7773A /* PKTokenizer.m */, + D3C221CC0FFE8C1B004514FE /* PKTokenizerState.h */, + D34BAE9B0FF9D20900D7773A /* PKTokenizerState.m */, + ); + name = tokenizer; + sourceTree = ""; + }; + D34A20080E55FD5F00A4A0BF /* chars */ = { + isa = PBXGroup; + children = ( + D31FE58C0E60E5AC00A0803E /* TDCharacterAssemblyTest.h */, + D31FE58D0E60E5AC00A0803E /* TDCharacterAssemblyTest.m */, + D31FE58E0E60E5AC00A0803E /* TDCharTest.h */, + D31FE58F0E60E5AC00A0803E /* TDCharTest.m */, + D31FE5900E60E5AC00A0803E /* TDDigitTest.h */, + D31FE5910E60E5AC00A0803E /* TDDigitTest.m */, + D31FE5920E60E5AC00A0803E /* TDLetterTest.h */, + D31FE5930E60E5AC00A0803E /* TDLetterTest.m */, + D31FE5940E60E5AC00A0803E /* TDSpecificCharTest.h */, + D31FE5950E60E5AC00A0803E /* TDSpecificCharTest.m */, + ); + name = chars; + sourceTree = ""; + }; + D34BAC0F0FF87ED200D7773A /* grammar */ = { + isa = PBXGroup; + children = ( + D3C222290FFE8DAC004514FE /* PKParserFactory.h */, + D34BAFD80FF9E95500D7773A /* PKParserFactory.m */, + D3376D5710093A1600E4602E /* PKGrammarParser.h */, + D3376D5810093A1600E4602E /* PKGrammarParser.m */, + D34BAFD30FF9E95500D7773A /* NSArray+ParseKitAdditions.h */, + D34BAFD40FF9E95500D7773A /* NSArray+ParseKitAdditions.m */, + D34BAFD50FF9E95500D7773A /* NSString+ParseKitAdditions.h */, + D34BAFD60FF9E95500D7773A /* NSString+ParseKitAdditions.m */, + ); + name = grammar; + sourceTree = ""; + }; + D3541F870DFB105900429B4F /* states */ = { + isa = PBXGroup; + children = ( + D3C221CF0FFE8C24004514FE /* PKNumberState.h */, + D34BAECA0FF9D56400D7773A /* PKNumberState.m */, + D3F0E2470FFE8EB900C9DF74 /* PKQuoteState.h */, + D34BAECC0FF9D56400D7773A /* PKQuoteState.m */, + D3C221D50FFE8C35004514FE /* PKSymbolState.h */, + D34BAED00FF9D56400D7773A /* PKSymbolState.m */, + D3C221D80FFE8C3D004514FE /* PKWordState.h */, + D34BAED60FF9D56400D7773A /* PKWordState.m */, + D3C221DB0FFE8C43004514FE /* PKWhitespaceState.h */, + D34BAED20FF9D56400D7773A /* PKWhitespaceState.m */, + D3C221DE0FFE8C49004514FE /* PKDelimitState.h */, + D34BAEC60FF9D56400D7773A /* PKDelimitState.m */, + D3C221E10FFE8C4E004514FE /* PKCommentState.h */, + D34BAEC40FF9D56400D7773A /* PKCommentState.m */, + D3C221E40FFE8C56004514FE /* PKSingleLineCommentState.h */, + D34BAECE0FF9D56400D7773A /* PKSingleLineCommentState.m */, + D3C221E70FFE8C60004514FE /* PKMultiLineCommentState.h */, + D34BAEC80FF9D56400D7773A /* PKMultiLineCommentState.m */, + D3541F890DFB108300429B4F /* symbol */, + ); + name = states; + sourceTree = ""; + }; + D3541F890DFB108300429B4F /* symbol */ = { + isa = PBXGroup; + children = ( + D3C221EA0FFE8C69004514FE /* PKSymbolNode.h */, + D34BAF240FF9DF9900D7773A /* PKSymbolNode.m */, + D3C221ED0FFE8C6F004514FE /* PKSymbolRootNode.h */, + D34BAF260FF9DF9900D7773A /* PKSymbolRootNode.m */, + ); + name = symbol; + sourceTree = ""; + }; + D35420EC0DFB275400429B4F /* tokenizer states */ = { + isa = PBXGroup; + children = ( + D34BAD16100A9B7900996341 /* TDTokenizerStateTest.h */, + D34BAD17100A9B7900996341 /* TDTokenizerStateTest.m */, + D31FE5770E60E58C00A0803E /* TDNumberStateTest.h */, + D31FE5780E60E58C00A0803E /* TDNumberStateTest.m */, + D31FE5790E60E58C00A0803E /* TDQuoteStateTest.h */, + D31FE57A0E60E58C00A0803E /* TDQuoteStateTest.m */, + D31FE57F0E60E58C00A0803E /* TDSymbolStateTest.h */, + D31FE5800E60E58C00A0803E /* TDSymbolStateTest.m */, + D31FE5810E60E58C00A0803E /* TDWhitespaceStateTest.h */, + D31FE5820E60E58C00A0803E /* TDWhitespaceStateTest.m */, + D31FE5830E60E58C00A0803E /* TDWordStateTest.h */, + D31FE5840E60E58C00A0803E /* TDWordStateTest.m */, + D3C85D430E63D1BF000445FD /* TDScientificNumberStateTest.h */, + D3C85D440E63D1BF000445FD /* TDScientificNumberStateTest.m */, + D3DDDAFC0F083C9700A58000 /* TDCommentStateTest.h */, + D3DDDAFD0F083C9700A58000 /* TDCommentStateTest.m */, + D3E39C3D0FC5FFD10022DAB9 /* TDDelimitStateTest.h */, + D3E39C3E0FC5FFD10022DAB9 /* TDDelimitStateTest.m */, + ); + name = "tokenizer states"; + sourceTree = ""; + }; + D36568A40EEF9FB600226554 /* plist */ = { + isa = PBXGroup; + children = ( + D36568A50EEF9FE900226554 /* TDPlistParser.h */, + D36568A60EEF9FE900226554 /* TDPlistParser.m */, + D36568A80EEFA05300226554 /* TDPlistParserTest.h */, + D36568A90EEFA05300226554 /* TDPlistParserTest.m */, + ); + name = plist; + sourceTree = ""; + }; + D3668290101D2BAC0008632C /* erb */ = { + isa = PBXGroup; + children = ( + D3668291101D2BFA0008632C /* erb.grammar */, + D3668294101D2C200008632C /* ERBTest.h */, + D3668295101D2C200008632C /* ERBTest.m */, + ); + name = erb; + sourceTree = ""; + }; + D36C55FB0FD3616200141CB7 /* regex */ = { + isa = PBXGroup; + children = ( + D3C221F00FFE8C7A004514FE /* PKPattern.h */, + D34BAF380FF9E18300D7773A /* PKPattern.m */, + D36C55FC0FD3617B00141CB7 /* RegexKitLite.h */, + D36C55FD0FD3617B00141CB7 /* RegexKitLite.m */, + ); + name = regex; + sourceTree = ""; + }; + D36E94F40E57865500496BD3 /* xpath */ = { + isa = PBXGroup; + children = ( + D34BAC490FF892C200D7773A /* XPathParserGrammarTest.h */, + D34BAC4A0FF892C200D7773A /* XPathParserGrammarTest.m */, + D31FE5EF0E60E6B500A0803E /* TDNCName.h */, + D31FE6DF0E60EE2500A0803E /* TDNCName.m */, + D31FE5F00E60E6B500A0803E /* TDNCNameState.h */, + D31FE5F10E60E6B500A0803E /* TDNCNameState.m */, + D36E95440E578ECC00496BD3 /* XPathParser.h */, + D36E95450E578ECC00496BD3 /* XPathParser.m */, + D36E97AE0E589DAE00496BD3 /* XPathAssembler.h */, + D36E97AF0E589DAE00496BD3 /* XPathAssembler.m */, + D36E98200E58A3A800496BD3 /* XPathContext.h */, + D36E98210E58A3A800496BD3 /* XPathContext.m */, + D36E95D60E57B08400496BD3 /* XPathParserTest.h */, + D36E95D70E57B08400496BD3 /* XPathParserTest.m */, + ); + name = xpath; + sourceTree = ""; + }; + D36E98CB0E58C08F00496BD3 /* DebugApp */ = { + isa = PBXGroup; + children = ( + D3F0E3290FFEA1E200C9DF74 /* DebugApp-Info.plist */, + D36E98DF0E58C12800496BD3 /* main.m */, + D36E98DC0E58C12800496BD3 /* DebugAppDelegate.h */, + D36E98DD0E58C12800496BD3 /* DebugAppDelegate.m */, + D3F740B50EF8C38A00559B9F /* JSONAssembler.h */, + D3F740B60EF8C38A00559B9F /* JSONAssembler.m */, + D36E98DE0E58C12800496BD3 /* DebugAppMainMenu.xib */, + ); + name = DebugApp; + path = debugapp; + sourceTree = ""; + }; + D36EA1400E5CF19F00496BD3 /* xml token terminals */ = { + isa = PBXGroup; + children = ( + D31FE5B90E60E69E00A0803E /* TDXmlAttribute.h */, + D31FE5BA0E60E69E00A0803E /* TDXmlAttribute.m */, + D31FE5BB0E60E69E00A0803E /* TDXmlCdata.h */, + D31FE5BC0E60E69E00A0803E /* TDXmlCdata.m */, + D31FE5BD0E60E69E00A0803E /* TDXmlComment.h */, + D31FE5BE0E60E69E00A0803E /* TDXmlComment.m */, + D31FE5BF0E60E69E00A0803E /* TDXmlDecl.h */, + D31FE5C00E60E69E00A0803E /* TDXmlDecl.m */, + D31FE5C10E60E69E00A0803E /* TDXmlDoctype.h */, + D31FE5C20E60E69E00A0803E /* TDXmlDoctype.m */, + D31FE5C30E60E69E00A0803E /* TDXmlDocument.h */, + D31FE5C40E60E69E00A0803E /* TDXmlDocument.m */, + D31FE5C50E60E69E00A0803E /* TDXmlEndEntity.h */, + D31FE5C60E60E69E00A0803E /* TDXmlEndEntity.m */, + D31FE5C70E60E69E00A0803E /* TDXmlEndTag.h */, + D31FE5C80E60E69E00A0803E /* TDXmlEndTag.m */, + D31FE5C90E60E69E00A0803E /* TDXmlEntity.h */, + D31FE5CA0E60E69E00A0803E /* TDXmlEntity.m */, + D31FE5CB0E60E69E00A0803E /* TDXmlEntityRef.h */, + D31FE5CC0E60E69E00A0803E /* TDXmlEntityRef.m */, + D31FE5CD0E60E69E00A0803E /* TDXmlFragment.h */, + D31FE5CE0E60E69E00A0803E /* TDXmlFragment.m */, + D31FE5CF0E60E69E00A0803E /* TDXmlNotation.h */, + D31FE5D00E60E69E00A0803E /* TDXmlNotation.m */, + D31FE5D10E60E69E00A0803E /* TDXmlProcessingInstruction.h */, + D31FE5D20E60E69E00A0803E /* TDXmlProcessingInstruction.m */, + D31FE5D30E60E69E00A0803E /* TDXmlSignificantWhitespace.h */, + D31FE5D40E60E69E00A0803E /* TDXmlSignificantWhitespace.m */, + D31FE5D50E60E69E00A0803E /* TDXmlStartTag.h */, + D31FE5D60E60E69E00A0803E /* TDXmlStartTag.m */, + D31FE5D70E60E69E00A0803E /* TDXmlTerminal.h */, + D31FE5D80E60E69E00A0803E /* TDXmlTerminal.m */, + D31FE5D90E60E69E00A0803E /* TDXmlText.h */, + D31FE5DA0E60E69E00A0803E /* TDXmlText.m */, + D31FE5DB0E60E69E00A0803E /* TDXmlWhitespace.h */, + D31FE5DC0E60E69E00A0803E /* TDXmlWhitespace.m */, + ); + name = "xml token terminals"; + sourceTree = ""; + }; + D36EA1440E5CF38100496BD3 /* tokenizer */ = { + isa = PBXGroup; + children = ( + D31FE5B30E60E66600A0803E /* TDXmlToken.h */, + D31FE5B40E60E66600A0803E /* TDXmlToken.m */, + D31FE5B50E60E66600A0803E /* TDXmlTokenizer.h */, + D31FE5B60E60E66600A0803E /* TDXmlTokenizer.m */, + ); + name = tokenizer; + sourceTree = ""; + }; + D380BA950F0F1C450009EC13 /* JSParseKit Framework */ = { + isa = PBXGroup; + children = ( + D34BB04E0FF9EC4E00D7773A /* JSParseKit-Info.plist */, + D34BB0660FF9EDDF00D7773A /* JSParseKit.h */, + D34BB0670FF9EDDF00D7773A /* JSParseKit.m */, + D34BB06C0FF9EE4000D7773A /* PKJSUtils.h */, + D34BB06D0FF9EE4000D7773A /* PKJSUtils.m */, + D34BB06E0FF9EE4000D7773A /* PKJSUtils_macros.h */, + D34BB06F0FF9EE4000D7773A /* PKJSValueHolder.h */, + D34BB0700FF9EE4000D7773A /* PKJSValueHolder.m */, + D34BB06A0FF9EE4000D7773A /* PKJSAssembly.h */, + D34BB06B0FF9EE4000D7773A /* PKJSAssembly.m */, + D389F8C40F1AC89A00558235 /* Chars */, + D389F59A0F19BBAE00558235 /* Tokens */, + D389F59B0F19BBD300558235 /* Parse */, + ); + name = "JSParseKit Framework"; + sourceTree = ""; + }; + D389A0AE0F1FCC7A003B43BD /* relaxng */ = { + isa = PBXGroup; + children = ( + D389A0B00F1FCC99003B43BD /* RelaxParser.h */, + D389A0B10F1FCC99003B43BD /* RelaxParser.m */, + ); + name = relaxng; + sourceTree = ""; + }; + D389F2CA0F196ACF00558235 /* JSDemoApp */ = { + isa = PBXGroup; + children = ( + D3F0E37A0FFEA39000C9DF74 /* JSDemoApp-Info.plist */, + D389F2E30F196CAE00558235 /* main.m */, + D389F2E80F196F5B00558235 /* JSDemoAppDelegate.h */, + D389F2E90F196F5B00558235 /* JSDemoAppDelegate.m */, + D389F38E0F19800400558235 /* DefaultValues.plist */, + D389F4610F198A8800558235 /* Test.html */, + D389FBCC0F1B25E200558235 /* ParserTest.html */, + D389F5580F19B7BC00558235 /* JSDemoAppMainMenu.xib */, + ); + name = JSDemoApp; + sourceTree = ""; + }; + D389F59A0F19BBAE00558235 /* Tokens */ = { + isa = PBXGroup; + children = ( + D34BB0930FF9F14B00D7773A /* PKJSCommentState.h */, + D34BB0940FF9F14B00D7773A /* PKJSCommentState.m */, + D34BB0950FF9F14B00D7773A /* PKJSDelimitState.h */, + D34BB0960FF9F14B00D7773A /* PKJSDelimitState.m */, + D34BB0970FF9F14B00D7773A /* PKJSNumberState.h */, + D34BB0980FF9F14B00D7773A /* PKJSNumberState.m */, + D34BB0990FF9F14B00D7773A /* PKJSQuoteState.h */, + D34BB09A0FF9F14B00D7773A /* PKJSQuoteState.m */, + D34BB09B0FF9F14B00D7773A /* PKJSSymbolState.h */, + D34BB09C0FF9F14B00D7773A /* PKJSSymbolState.m */, + D34BB09D0FF9F14B00D7773A /* PKJSToken.h */, + D34BB09E0FF9F14B00D7773A /* PKJSToken.m */, + D34BB09F0FF9F14B00D7773A /* PKJSTokenAssembly.h */, + D34BB0A00FF9F14B00D7773A /* PKJSTokenAssembly.m */, + D34BB0A10FF9F14B00D7773A /* PKJSTokenizer.h */, + D34BB0A20FF9F14B00D7773A /* PKJSTokenizer.m */, + D34BB0A30FF9F14B00D7773A /* PKJSTokenizerState.h */, + D34BB0A40FF9F14B00D7773A /* PKJSTokenizerState.m */, + D34BB0A50FF9F14B00D7773A /* PKJSWhitespaceState.h */, + D34BB0A60FF9F14B00D7773A /* PKJSWhitespaceState.m */, + D34BB0A70FF9F14B00D7773A /* PKJSWordState.h */, + D34BB0A80FF9F14B00D7773A /* PKJSWordState.m */, + ); + name = Tokens; + sourceTree = ""; + }; + D389F59B0F19BBD300558235 /* Parse */ = { + isa = PBXGroup; + children = ( + D34BB0D20FF9F28000D7773A /* PKJSAlternation.h */, + D34BB0D30FF9F28000D7773A /* PKJSAlternation.m */, + D34BB0D40FF9F28000D7773A /* PKJSAny.h */, + D34BB0D50FF9F28000D7773A /* PKJSAny.m */, + D34BB0D60FF9F28000D7773A /* PKJSAssemblerAdapter.h */, + D34BB0D70FF9F28000D7773A /* PKJSAssemblerAdapter.m */, + D34BB0D80FF9F28000D7773A /* PKJSCollectionParser.h */, + D34BB0D90FF9F28000D7773A /* PKJSCollectionParser.m */, + D34BB0DA0FF9F28000D7773A /* PKJSEmpty.h */, + D34BB0DB0FF9F28000D7773A /* PKJSEmpty.m */, + D34BB0DC0FF9F28000D7773A /* PKJSParser.h */, + D34BB0DD0FF9F28000D7773A /* PKJSParser.m */, + D34BB0DE0FF9F28000D7773A /* PKJSRepetition.h */, + D34BB0DF0FF9F28000D7773A /* PKJSRepetition.m */, + D34BB0E00FF9F28000D7773A /* PKJSSequence.h */, + D34BB0E10FF9F28000D7773A /* PKJSSequence.m */, + D34BB0E20FF9F28000D7773A /* PKJSTerminal.h */, + D34BB0E30FF9F28000D7773A /* PKJSTerminal.m */, + D34BB0E40FF9F28000D7773A /* PKJSTrack.h */, + D34BB0E50FF9F28000D7773A /* PKJSTrack.m */, + D389FAE30F1B1B8F00558235 /* Char Terminals */, + D389FAE20F1B1B7200558235 /* Token Terminals */, + ); + name = Parse; + sourceTree = ""; + }; + D389F8C40F1AC89A00558235 /* Chars */ = { + isa = PBXGroup; + children = ( + D34BB08D0FF9EF9D00D7773A /* PKJSCharacterAssembly.h */, + D34BB08E0FF9EF9D00D7773A /* PKJSCharacterAssembly.m */, + ); + name = Chars; + sourceTree = ""; + }; + D389FAE20F1B1B7200558235 /* Token Terminals */ = { + isa = PBXGroup; + children = ( + D34BB0FE0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h */, + D34BB0FF0FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m */, + D34BB1000FF9F36200D7773A /* PKJSComment.h */, + D34BB1010FF9F36200D7773A /* PKJSComment.m */, + D34BB1020FF9F36200D7773A /* PKJSDelimitedString.h */, + D34BB1030FF9F36200D7773A /* PKJSDelimitedString.m */, + D34BB1040FF9F36200D7773A /* PKJSLiteral.h */, + D34BB1050FF9F36200D7773A /* PKJSLiteral.m */, + D34BB1060FF9F36200D7773A /* PKJSLowercaseWord.h */, + D34BB1070FF9F36200D7773A /* PKJSLowercaseWord.m */, + D34BB1080FF9F36200D7773A /* PKJSNum.h */, + D34BB1090FF9F36200D7773A /* PKJSNum.m */, + D34BB10A0FF9F36200D7773A /* PKJSPattern.h */, + D34BB10B0FF9F36200D7773A /* PKJSPattern.m */, + D34BB10C0FF9F36200D7773A /* PKJSQuotedString.h */, + D34BB10D0FF9F36200D7773A /* PKJSQuotedString.m */, + D34BB10E0FF9F36200D7773A /* PKJSSymbol.h */, + D34BB10F0FF9F36200D7773A /* PKJSSymbol.m */, + D34BB1100FF9F36200D7773A /* PKJSUppercaseWord.h */, + D34BB1110FF9F36200D7773A /* PKJSUppercaseWord.m */, + D34BB1120FF9F36200D7773A /* PKJSWord.h */, + D34BB1130FF9F36200D7773A /* PKJSWord.m */, + ); + name = "Token Terminals"; + sourceTree = ""; + }; + D389FAE30F1B1B8F00558235 /* Char Terminals */ = { + isa = PBXGroup; + children = ( + ); + name = "Char Terminals"; + sourceTree = ""; + }; + D3AF4C8E0FDC738B0032F4DC /* Other Sources */ = { + isa = PBXGroup; + children = ( + D34BAD630FF9C6AE00D7773A /* ParseKit_Prefix.pch */, + D3FDC8DB0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + D3AF4CC80FDC74320032F4DC /* Blob */ = { + isa = PBXGroup; + children = ( + D3AF4BF50FDC40050032F4DC /* TDToken+Blob.h */, + D3AF4BF60FDC40050032F4DC /* TDToken+Blob.m */, + D3AF4BFB0FDC41190032F4DC /* TDTokenizer+BlobState.h */, + D3AF4BFC0FDC41190032F4DC /* TDTokenizer+BlobState.m */, + D3AF4C190FDC568F0032F4DC /* TDBlobState.h */, + D3AF4C1A0FDC568F0032F4DC /* TDBlobState.m */, + D3AF4BE80FDC3DD50032F4DC /* TDBlob.h */, + D3AF4BE90FDC3DD50032F4DC /* TDBlob.m */, + ); + name = Blob; + sourceTree = ""; + }; + D3AF4CC90FDC743C0032F4DC /* ReservedWord */ = { + isa = PBXGroup; + children = ( + D3AF4CC50FDC740A0032F4DC /* TDWordOrReservedState.h */, + D3AF4CC60FDC740A0032F4DC /* TDWordOrReservedState.m */, + D3AF4CBF0FDC740A0032F4DC /* TDNonReservedWord.h */, + D3AF4CC00FDC740A0032F4DC /* TDNonReservedWord.m */, + D3AF4CC10FDC740A0032F4DC /* TDReservedWord.h */, + D3AF4CC20FDC740A0032F4DC /* TDReservedWord.m */, + ); + name = ReservedWord; + sourceTree = ""; + }; + D3AF4CCA0FDC74490032F4DC /* Slash */ = { + isa = PBXGroup; + children = ( + D3DDDC230F085C5400A58000 /* TDSlashSlashState.h */, + D3DDDC240F085C5400A58000 /* TDSlashSlashState.m */, + D3DDDC250F085C5400A58000 /* TDSlashStarState.h */, + D3DDDC260F085C5400A58000 /* TDSlashStarState.m */, + D3DDDC270F085C5400A58000 /* TDSlashState.h */, + D3DDDC280F085C5400A58000 /* TDSlashState.m */, + D31FE57D0E60E58C00A0803E /* TDSlashStateTest.h */, + D31FE57E0E60E58C00A0803E /* TDSlashStateTest.m */, + ); + name = Slash; + sourceTree = ""; + }; + D3AF4CCB0FDC74540032F4DC /* Whitespace */ = { + isa = PBXGroup; + children = ( + D3AF4CC30FDC740A0032F4DC /* TDSignificantWhitespaceState.h */, + D3AF4CC40FDC740A0032F4DC /* TDSignificantWhitespaceState.m */, + D31FE57B0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.h */, + D31FE57C0E60E58C00A0803E /* TDSignificantWhitespaceStateTest.m */, + ); + name = Whitespace; + sourceTree = ""; + }; + D3BBBC9A0FEC9739007DF30D /* old */ = { + isa = PBXGroup; + children = ( + D36EA3AF0E5EA67E00496BD3 /* small-xml-file.xml */, + D36E9FB40E5A944A00496BD3 /* apple-boss.xml */, + D31FE5AD0E60E64900A0803E /* TDXmlTokenAssembly.h */, + D31FE5AE0E60E64900A0803E /* TDXmlTokenAssembly.m */, + D31FE5AF0E60E64900A0803E /* TDXmlTokenizerTest.h */, + D31FE5B00E60E64900A0803E /* TDXmlTokenizerTest.m */, + D36EA1440E5CF38100496BD3 /* tokenizer */, + D36EA1400E5CF19F00496BD3 /* xml token terminals */, + D3521F520E5FA1B0009681F9 /* XMLReader.h */, + D3521F530E5FA1B0009681F9 /* XMLReader.m */, + D3521F540E5FA1B0009681F9 /* XMLReaderTest.h */, + D3521F550E5FA1B0009681F9 /* XMLReaderTest.m */, + D31FE5F20E60E6B500A0803E /* TDXmlName.h */, + D31FE5F30E60E6B500A0803E /* TDXmlName.m */, + D31FE5F40E60E6B500A0803E /* TDXmlNameState.h */, + D31FE5F50E60E6B500A0803E /* TDXmlNameState.m */, + D31FE5F60E60E6B500A0803E /* TDXmlNameTest.h */, + D31FE5F70E60E6B500A0803E /* TDXmlNameTest.m */, + D31FE5F80E60E6B500A0803E /* TDXmlNmtoken.h */, + D31FE5F90E60E6B500A0803E /* TDXmlNmtoken.m */, + D31FE5FA0E60E6B500A0803E /* TDXmlNmtokenState.h */, + D31FE5FB0E60E6B500A0803E /* TDXmlNmtokenState.m */, + ); + name = old; + sourceTree = ""; + }; + D3C0309C0EF34DD200C5ABEB /* grammar */ = { + isa = PBXGroup; + children = ( + D380B5370F0D7DDE0009EC13 /* css.css */, + D380B5080F0D71A90009EC13 /* css.grammar */, + D380B5930F0D82F60009EC13 /* example.css */, + D380AFBB0F0C54B60009EC13 /* html.css */, + D380AFBC0F0C54B60009EC13 /* html.grammar */, + D385FD6B0F05A99900DB2946 /* mini_css.grammar */, + D3DCB4C20EF6015300DE5110 /* json.grammar */, + D385FA240F04993500DB2946 /* json.css */, + D383498A0F0C0CF30055E4E0 /* json_with_comments.grammar */, + D38349BB0F0C0D910055E4E0 /* json_with_comments.css */, + D3834A470F0C14B60055E4E0 /* yahoo_with_comments.json */, + D3FD791F0F4CC86800BAD816 /* rubyhash.grammar */, + D380AFC20F0C56000009EC13 /* example.html */, + D3F741BD0EF9F28D00559B9F /* css2_1.grammar */, + D3F741430EF8E96A00559B9F /* xpath1_0.grammar */, + D3D01CA90EFDB89900C24DDE /* json_with_discards.grammar */, + D31A15250F6DE449002AFDF1 /* javascript.grammar */, + D385FD400F05A88C00DB2946 /* TDMiniCSSAssembler.h */, + D385FD410F05A88C00DB2946 /* TDMiniCSSAssembler.m */, + D385FD420F05A88C00DB2946 /* TDMiniCSSAssemblerTest.h */, + D385FD430F05A88C00DB2946 /* TDMiniCSSAssemblerTest.m */, + D385F9880F046FE900DB2946 /* TDGenericAssembler.h */, + D385F9890F046FE900DB2946 /* TDGenericAssembler.m */, + D385FA210F04971400DB2946 /* TDGenericAssemblerTest.h */, + D385FA220F04971400DB2946 /* TDGenericAssemblerTest.m */, + D3DDDA850F0779FD00A58000 /* TDSyntaxHighlighter.h */, + D3DDDA860F0779FD00A58000 /* TDSyntaxHighlighter.m */, + D353899B0FEAC94400926552 /* c.grammar */, + D353899D0FEAC96B00926552 /* objc.grammar */, + D355C8830FEB4B94006A91A4 /* proto.grammar */, + ); + name = grammar; + sourceTree = ""; + }; + D3C7D8220A411F31005DD154 /* ParseKit Tests */ = { + isa = PBXGroup; + children = ( + D3F0E36C0FFEA33700C9DF74 /* Tests-Info.plist */, + D31FE54A0E60E46100A0803E /* TDTestScaffold.h */, + D31FE54B0E60E46100A0803E /* TDTestScaffold.m */, + D3376D7710096BDE00E4602E /* IR */, + D3F823560F57859900B7DC48 /* factory */, + D3C0309C0EF34DD200C5ABEB /* grammar */, + D3252F670FCE171D005EF059 /* predicate */, + D31A164F0F703899002AFDF1 /* javascript */, + D3D63F570E2A8548009BF5CD /* parse */, + D3D63F560E2A8538009BF5CD /* tokens */, + D34A20080E55FD5F00A4A0BF /* chars */, + D3C85C770E63B400000445FD /* arithmetic */, + D3E786030E5510AE008C7D61 /* regex */, + D3E788890E567B6D008C7D61 /* ebnf */, + D36568A40EEF9FB600226554 /* plist */, + D318EAE30E2FD5B6009F47DF /* json */, + D3D647CE0E2C7569009BF5CD /* xml */, + D36E94F40E57865500496BD3 /* xpath */, + D3E788900E567DDA008C7D61 /* srgs */, + D389A0AE0F1FCC7A003B43BD /* relaxng */, + D3C863240E67C249000445FD /* syntax highlight */, + D3668290101D2BAC0008632C /* erb */, + ); + name = "ParseKit Tests"; + sourceTree = ""; + }; + D3C7D8710A411F6B005DD154 /* io */ = { + isa = PBXGroup; + children = ( + D3C221960FFE8B95004514FE /* PKReader.h */, + D34BAD9B0FF9C95800D7773A /* PKReader.m */, + ); + name = io; + sourceTree = ""; + }; + D3C7D8720A411F81005DD154 /* parse */ = { + isa = PBXGroup; + children = ( + D3C221990FFE8B9D004514FE /* PKAssembly.h */, + D34BADA00FF9C9B000D7773A /* PKAssembly.m */, + D3D63EA90E2A7A5C009BF5CD /* parsers */, + ); + name = parse; + sourceTree = ""; + }; + D3C7D8740A411F8E005DD154 /* tokens */ = { + isa = PBXGroup; + children = ( + D3C221C00FFE8BFF004514FE /* PKTokenAssembly.h */, + D34BAE8B0FF9D15100D7773A /* PKTokenAssembly.m */, + D341846A0E5209A60081B0DC /* tokenizer */, + D3541F870DFB105900429B4F /* states */, + D3D642270E2AC426009BF5CD /* token terminals */, + ); + name = tokens; + sourceTree = ""; + }; + D3C85C770E63B400000445FD /* arithmetic */ = { + isa = PBXGroup; + children = ( + D319E429106D8A1F008C63DD /* arithmetic.grammar */, + D319E42C106D8A31008C63DD /* TDArithmeticAssembler.h */, + D319E42D106D8A31008C63DD /* TDArithmeticAssembler.m */, + D3C85C790E63B438000445FD /* TDArithmeticParser.h */, + D3C85C7A0E63B438000445FD /* TDArithmeticParser.m */, + D3C85C7E0E63B9E9000445FD /* TDArithmeticParserTest.h */, + D3C85C7F0E63B9E9000445FD /* TDArithmeticParserTest.m */, + ); + name = arithmetic; + sourceTree = ""; + }; + D3C863240E67C249000445FD /* syntax highlight */ = { + isa = PBXGroup; + children = ( + D3C863250E67C255000445FD /* html */, + ); + name = "syntax highlight"; + sourceTree = ""; + }; + D3C863250E67C255000445FD /* html */ = { + isa = PBXGroup; + children = ( + D38DD9E70EC29F260070BC4D /* nyt.html */, + D3B69D310E80249900D70C41 /* nonascii.html */, + D3EADD7F0E75E9CC00F78584 /* nasty.html */, + D3EADD8D0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.h */, + D3EADD8C0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m */, + ); + name = html; + sourceTree = ""; + }; + D3D63EA90E2A7A5C009BF5CD /* parsers */ = { + isa = PBXGroup; + children = ( + D3C2219C0FFE8BA6004514FE /* PKParser.h */, + D34BADD60FF9CBFB00D7773A /* PKParser.m */, + D3C2219F0FFE8BAE004514FE /* PKRepetition.h */, + D34BAE130FF9CE0E00D7773A /* PKRepetition.m */, + D3C221A20FFE8BBA004514FE /* PKCollectionParser.h */, + D34BAE010FF9CCAE00D7773A /* PKCollectionParser.m */, + D3C221A50FFE8BC1004514FE /* PKAlternation.h */, + D34BAE0B0FF9CE0E00D7773A /* PKAlternation.m */, + D3C221A80FFE8BC9004514FE /* PKSequence.h */, + D34BAE150FF9CE0E00D7773A /* PKSequence.m */, + D3C221AB0FFE8BCF004514FE /* PKTrack.h */, + D34BAE190FF9CE0E00D7773A /* PKTrack.m */, + D3C221AE0FFE8BD4004514FE /* PKTrackException.h */, + D34BAE1B0FF9CE0E00D7773A /* PKTrackException.m */, + D3C221B10FFE8BDB004514FE /* PKIntersection.h */, + D34BAE110FF9CE0E00D7773A /* PKIntersection.m */, + D3C221B40FFE8BE2004514FE /* PKDifference.h */, + D34BAE0F0FF9CE0E00D7773A /* PKDifference.m */, + D3C221B70FFE8BE8004514FE /* PKNegation.h */, + D3126D040FFD9BA700CBF4C4 /* PKNegation.m */, + D3C221BA0FFE8BEF004514FE /* PKTerminal.h */, + D34BAE170FF9CE0E00D7773A /* PKTerminal.m */, + D3C221BD0FFE8BF7004514FE /* PKEmpty.h */, + D34BAE0D0FF9CE0E00D7773A /* PKEmpty.m */, + ); + name = parsers; + sourceTree = ""; + }; + D3D63F560E2A8538009BF5CD /* tokens */ = { + isa = PBXGroup; + children = ( + D31FE5710E60E55700A0803E /* TDReaderTest.h */, + D31FE5720E60E55700A0803E /* TDReaderTest.m */, + D31FE5730E60E55700A0803E /* TDTokenizerTest.h */, + D31FE5740E60E55700A0803E /* TDTokenizerTest.m */, + D38E97CA1061CF6500739C39 /* TDTokenizerBlocksTest.h */, + D38E97CB1061CF6500739C39 /* TDTokenizerBlocksTest.m */, + D38205BC0EEE48EE004340DD /* TDTokenTest.h */, + D38205BD0EEE48EE004340DD /* TDTokenTest.m */, + D3656DFC0EF2620E00226554 /* TDTokenArraySourceTest.h */, + D3656DFD0EF2620E00226554 /* TDTokenArraySourceTest.m */, + D35420EC0DFB275400429B4F /* tokenizer states */, + ); + name = tokens; + sourceTree = ""; + }; + D3D63F570E2A8548009BF5CD /* parse */ = { + isa = PBXGroup; + children = ( + D31FE54D0E60E50800A0803E /* TDAlternationTest.h */, + D31FE54E0E60E50800A0803E /* TDAlternationTest.m */, + D31FE54F0E60E50800A0803E /* TDLiteralTest.h */, + D31FE5500E60E50800A0803E /* TDLiteralTest.m */, + D31FE5510E60E50800A0803E /* TDParserTest.h */, + D31FE5520E60E50800A0803E /* TDParserTest.m */, + D38E98D61062C5BA00739C39 /* TDParserBlocksTest.h */, + D38E98D71062C5BA00739C39 /* TDParserBlocksTest.m */, + D31FE5530E60E50800A0803E /* TDRepetitionTest.h */, + D31FE5540E60E50800A0803E /* TDRepetitionTest.m */, + D31FE5550E60E50800A0803E /* TDReservedWordTest.h */, + D31FE5560E60E50800A0803E /* TDReservedWordTest.m */, + D31FE5570E60E50800A0803E /* TDRobotCommandTest.h */, + D31FE5580E60E50800A0803E /* TDRobotCommandTest.m */, + D31FE5590E60E50800A0803E /* TDSequenceTest.h */, + D31FE55A0E60E50800A0803E /* TDSequenceTest.m */, + D31FE55B0E60E50800A0803E /* TDSymbolTest.h */, + D31FE55C0E60E50800A0803E /* TDSymbolTest.m */, + D31FE55D0E60E50800A0803E /* TDTokenAssemblyTest.h */, + D31FE55E0E60E50800A0803E /* TDTokenAssemblyTest.m */, + D31FE55F0E60E50800A0803E /* TDTrackTest.h */, + D31FE5600E60E50800A0803E /* TDTrackTest.m */, + D31FE5610E60E50800A0803E /* TDUppercaseWordTest.h */, + D31FE5620E60E50800A0803E /* TDUppercaseWordTest.m */, + D3C031EB0EF38D2D00C5ABEB /* TDLowercaseWordTest.h */, + D3C031EC0EF38D2D00C5ABEB /* TDLowercaseWordTest.m */, + D3126D410FFDB4C600CBF4C4 /* TDExclusionTest.h */, + D3126D420FFDB4C600CBF4C4 /* TDExclusionTest.m */, + D36C56290FD365DB00141CB7 /* TDPatternTest.h */, + D36C562A0FD365DB00141CB7 /* TDPatternTest.m */, + D338E5B90FF5DDCB003DE6AA /* TDDifferenceTest.h */, + D338E5BA0FF5DDCB003DE6AA /* TDDifferenceTest.m */, + D3126D090FFD9E4B00CBF4C4 /* TDNegationTest.h */, + D3126D0A0FFD9E4B00CBF4C4 /* TDNegationTest.m */, + ); + name = parse; + sourceTree = ""; + }; + D3D642270E2AC426009BF5CD /* token terminals */ = { + isa = PBXGroup; + children = ( + D36C55FB0FD3616200141CB7 /* regex */, + D3C221F30FFE8C87004514FE /* PKWord.h */, + D34BAED40FF9D56400D7773A /* PKWord.m */, + D3C222140FFE8D01004514FE /* PKLowercaseWord.h */, + D34BAF990FF9E6D100D7773A /* PKLowercaseWord.m */, + D3C222170FFE8D11004514FE /* PKUppercaseWord.h */, + D34BAF9B0FF9E6D100D7773A /* PKUppercaseWord.m */, + D3C221F60FFE8C8E004514FE /* PKNumber.h */, + D34BAF440FF9E19700D7773A /* PKNumber.m */, + D3C221F90FFE8C97004514FE /* PKQuotedString.h */, + D34BAF460FF9E19700D7773A /* PKQuotedString.m */, + D3C221FC0FFE8CB2004514FE /* PKSymbol.h */, + D34BAF480FF9E19700D7773A /* PKSymbol.m */, + D3C221FF0FFE8CB9004514FE /* PKLiteral.h */, + D34BAF420FF9E19700D7773A /* PKLiteral.m */, + D3C222020FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h */, + D34BAF3C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m */, + D3C222050FFE8CCA004514FE /* PKWhitespace.h */, + D34BAF4A0FF9E19700D7773A /* PKWhitespace.m */, + D3C222080FFE8CD1004514FE /* PKComment.h */, + D34BAF3E0FF9E19700D7773A /* PKComment.m */, + D3C2220B0FFE8CD8004514FE /* PKDelimitedString.h */, + D34BAF400FF9E19700D7773A /* PKDelimitedString.m */, + D3C2220E0FFE8CDF004514FE /* PKAny.h */, + D34BAE2F0FF9CE6000D7773A /* PKAny.m */, + ); + name = "token terminals"; + sourceTree = ""; + }; + D3D647CE0E2C7569009BF5CD /* xml */ = { + isa = PBXGroup; + children = ( + D3D1BF291039445C003656E5 /* SAXTest.h */, + D3D1BF2A1039445C003656E5 /* SAXTest.m */, + D3D1BF2610394420003656E5 /* SAXAssembler.h */, + D3D1BF2710394420003656E5 /* SAXAssembler.m */, + D3BBBC960FEC9722007DF30D /* TDXMLParserTest.h */, + D3BBBC970FEC9722007DF30D /* TDXMLParserTest.m */, + D3BBBC9B0FEC9756007DF30D /* TDXMLParser.h */, + D3BBBC9C0FEC9756007DF30D /* TDXMLParser.m */, + D355C8800FEB36A1006A91A4 /* xml.grammar */, + D315DF710FEF59B600D876C8 /* date.grammar */, + D3BBBC9A0FEC9739007DF30D /* old */, + ); + name = xml; + sourceTree = ""; + }; + D3E785F10E550F63008C7D61 /* chars */ = { + isa = PBXGroup; + children = ( + D3C2221A0FFE8D32004514FE /* PKCharacterAssembly.h */, + D34BAFB00FF9E7F300D7773A /* PKCharacterAssembly.m */, + D3E7861F0E55363F008C7D61 /* char terminals */, + ); + name = chars; + sourceTree = ""; + }; + D3E786030E5510AE008C7D61 /* regex */ = { + isa = PBXGroup; + children = ( + D31FE59B0E60E5C000A0803E /* TDRegularParser.h */, + D31FE59C0E60E5C000A0803E /* TDRegularParser.m */, + D31FE59D0E60E5C000A0803E /* TDRegularParserTest.h */, + D31FE59E0E60E5C000A0803E /* TDRegularParserTest.m */, + ); + name = regex; + sourceTree = ""; + }; + D3E7861F0E55363F008C7D61 /* char terminals */ = { + isa = PBXGroup; + children = ( + D3C2221D0FFE8D3B004514FE /* PKChar.h */, + D34BAFB40FF9E80300D7773A /* PKChar.m */, + D3C222200FFE8D42004514FE /* PKDigit.h */, + D34BAFB60FF9E80300D7773A /* PKDigit.m */, + D3C222230FFE8D49004514FE /* PKLetter.h */, + D34BAFB80FF9E80300D7773A /* PKLetter.m */, + D3C222260FFE8D6B004514FE /* PKSpecificChar.h */, + D34BAFBA0FF9E80300D7773A /* PKSpecificChar.m */, + ); + name = "char terminals"; + sourceTree = ""; + }; + D3E788890E567B6D008C7D61 /* ebnf */ = { + isa = PBXGroup; + children = ( + D3E78A150E574C99008C7D61 /* EBNFParser.h */, + D3E78A160E574C99008C7D61 /* EBNFParser.m */, + D3E78A170E574C99008C7D61 /* EBNFParserTest.h */, + D3E78A180E574C99008C7D61 /* EBNFParserTest.m */, + ); + name = ebnf; + sourceTree = ""; + }; + D3E788900E567DDA008C7D61 /* srgs */ = { + isa = PBXGroup; + children = ( + D3DDDCAC0F0880D800A58000 /* example1.srgs */, + D3E788940E567E0A008C7D61 /* SRGSParser.h */, + D3E788950E567E0A008C7D61 /* SRGSParser.m */, + D3E788910E567DFD008C7D61 /* SRGSParserTest.h */, + D3E788920E567DFD008C7D61 /* SRGSParserTest.m */, + D36E9FE40E5BA0FC00496BD3 /* SRGSGrammar.txt */, + ); + name = srgs; + sourceTree = ""; + }; + D3F5619C1026374400DD6DB1 /* ir */ = { + isa = PBXGroup; + children = ( + D3F5619D1026375100DD6DB1 /* syntax tree */, + D3F561B61026379700DD6DB1 /* ast */, + ); + name = ir; + sourceTree = ""; + }; + D3F5619D1026375100DD6DB1 /* syntax tree */ = { + isa = PBXGroup; + children = ( + D36934551038DE5300527AF3 /* PKParseTree.h */, + D36934561038DE5300527AF3 /* PKParseTree.m */, + D36934571038DE5300527AF3 /* PKParseTreeAssembler.h */, + D36934581038DE5300527AF3 /* PKParseTreeAssembler.m */, + D36934591038DE5300527AF3 /* PKRuleNode.h */, + D369345A1038DE5300527AF3 /* PKRuleNode.m */, + D369345B1038DE5300527AF3 /* PKTokenNode.h */, + D369345C1038DE5300527AF3 /* PKTokenNode.m */, + ); + name = "syntax tree"; + sourceTree = ""; + }; + D3F561B61026379700DD6DB1 /* ast */ = { + isa = PBXGroup; + children = ( + ); + name = ast; + sourceTree = ""; + }; + D3F823560F57859900B7DC48 /* factory */ = { + isa = PBXGroup; + children = ( + D34BAC210FF87F8600D7773A /* TDParserFactoryTest3.h */, + D34BAC220FF87F8600D7773A /* TDParserFactoryTest3.m */, + D380BA5F0F0F06CD0009EC13 /* TDParserFactoryTest.h */, + D380BA600F0F06CD0009EC13 /* TDParserFactoryTest.m */, + D36C53770FD27F1300141CB7 /* TDParserFactoryTest2.h */, + D36C53780FD27F1300141CB7 /* TDParserFactoryTest2.m */, + D3AF49760FDB122E0032F4DC /* TDParserFactoryPatternTest.h */, + D3AF49770FDB122E0032F4DC /* TDParserFactoryPatternTest.m */, + ); + name = factory; + sourceTree = ""; + }; + D3FDC8EF0FFC52CD00F1F797 /* Mobile Frameworks */ = { + isa = PBXGroup; + children = ( + D3FDC74B0FFC4DAC00F1F797 /* CoreGraphics.framework */, + D3FDC7380FFC4D6100F1F797 /* libicucore.dylib */, + D3FDC7360FFC4D6100F1F797 /* Foundation.framework */, + ); + name = "Mobile Frameworks"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 8DC2EF500486A6940098B216 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D34BAD640FF9C6AE00D7773A /* ParseKit_Prefix.pch in Headers */, + D3FDC4A50FFB3B2A00F1F797 /* RegexKitLite.h in Headers */, + D3C221920FFE8B8C004514FE /* ParseKit.h in Headers */, + D3C221930FFE8B8C004514FE /* PKTypes.h in Headers */, + D3C221970FFE8B95004514FE /* PKReader.h in Headers */, + D3C2219A0FFE8B9D004514FE /* PKAssembly.h in Headers */, + D3C2219D0FFE8BA6004514FE /* PKParser.h in Headers */, + D3C221A00FFE8BAE004514FE /* PKRepetition.h in Headers */, + D3C221A30FFE8BBA004514FE /* PKCollectionParser.h in Headers */, + D3C221A60FFE8BC1004514FE /* PKAlternation.h in Headers */, + D3C221A90FFE8BC9004514FE /* PKSequence.h in Headers */, + D3C221AC0FFE8BCF004514FE /* PKTrack.h in Headers */, + D3C221AF0FFE8BD4004514FE /* PKTrackException.h in Headers */, + D3C221B20FFE8BDB004514FE /* PKIntersection.h in Headers */, + D3C221B50FFE8BE2004514FE /* PKDifference.h in Headers */, + D3C221B80FFE8BE8004514FE /* PKNegation.h in Headers */, + D3C221BB0FFE8BEF004514FE /* PKTerminal.h in Headers */, + D3C221BE0FFE8BF7004514FE /* PKEmpty.h in Headers */, + D3C221C10FFE8BFF004514FE /* PKTokenAssembly.h in Headers */, + D3C221C40FFE8C07004514FE /* PKToken.h in Headers */, + D3C221C70FFE8C0D004514FE /* PKTokenArraySource.h in Headers */, + D3C221CA0FFE8C15004514FE /* PKTokenizer.h in Headers */, + D3C221CD0FFE8C1B004514FE /* PKTokenizerState.h in Headers */, + D3C221D00FFE8C24004514FE /* PKNumberState.h in Headers */, + D3C221D60FFE8C35004514FE /* PKSymbolState.h in Headers */, + D3C221D90FFE8C3D004514FE /* PKWordState.h in Headers */, + D3C221DC0FFE8C43004514FE /* PKWhitespaceState.h in Headers */, + D3C221DF0FFE8C49004514FE /* PKDelimitState.h in Headers */, + D3C221E20FFE8C4E004514FE /* PKCommentState.h in Headers */, + D3C221E50FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */, + D3C221E80FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */, + D3C221EB0FFE8C69004514FE /* PKSymbolNode.h in Headers */, + D3C221EE0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */, + D3C221F10FFE8C7A004514FE /* PKPattern.h in Headers */, + D3C221F40FFE8C87004514FE /* PKWord.h in Headers */, + D3C221F70FFE8C8E004514FE /* PKNumber.h in Headers */, + D3C221FA0FFE8C97004514FE /* PKQuotedString.h in Headers */, + D3C221FD0FFE8CB2004514FE /* PKSymbol.h in Headers */, + D3C222000FFE8CB9004514FE /* PKLiteral.h in Headers */, + D3C222030FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */, + D3C222060FFE8CCA004514FE /* PKWhitespace.h in Headers */, + D3C222090FFE8CD1004514FE /* PKComment.h in Headers */, + D3C2220C0FFE8CD8004514FE /* PKDelimitedString.h in Headers */, + D3C2220F0FFE8CDF004514FE /* PKAny.h in Headers */, + D3C222150FFE8D01004514FE /* PKLowercaseWord.h in Headers */, + D3C222180FFE8D11004514FE /* PKUppercaseWord.h in Headers */, + D3C2221B0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */, + D3C2221E0FFE8D3B004514FE /* PKChar.h in Headers */, + D3C222210FFE8D42004514FE /* PKDigit.h in Headers */, + D3C222240FFE8D49004514FE /* PKLetter.h in Headers */, + D3C222270FFE8D6B004514FE /* PKSpecificChar.h in Headers */, + D3C2222A0FFE8DAC004514FE /* PKParserFactory.h in Headers */, + D3C2222D0FFE8DE9004514FE /* NSArray+ParseKitAdditions.h in Headers */, + D3C2222E0FFE8DEE004514FE /* NSString+ParseKitAdditions.h in Headers */, + D3F0E2480FFE8EB900C9DF74 /* PKQuoteState.h in Headers */, + D3376D5910093A1600E4602E /* PKGrammarParser.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1C90F1965E600558235 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D34BB0680FF9EDDF00D7773A /* JSParseKit.h in Headers */, + D34BB0710FF9EE4000D7773A /* PKJSAssembly.h in Headers */, + D34BB0730FF9EE4000D7773A /* PKJSUtils.h in Headers */, + D34BB0750FF9EE4000D7773A /* PKJSUtils_macros.h in Headers */, + D34BB0760FF9EE4000D7773A /* PKJSValueHolder.h in Headers */, + D34BB08F0FF9EF9D00D7773A /* PKJSCharacterAssembly.h in Headers */, + D34BB0A90FF9F14B00D7773A /* PKJSCommentState.h in Headers */, + D34BB0AB0FF9F14B00D7773A /* PKJSDelimitState.h in Headers */, + D34BB0AD0FF9F14B00D7773A /* PKJSNumberState.h in Headers */, + D34BB0AF0FF9F14B00D7773A /* PKJSQuoteState.h in Headers */, + D34BB0B10FF9F14B00D7773A /* PKJSSymbolState.h in Headers */, + D34BB0B30FF9F14B00D7773A /* PKJSToken.h in Headers */, + D34BB0B50FF9F14B00D7773A /* PKJSTokenAssembly.h in Headers */, + D34BB0B70FF9F14B00D7773A /* PKJSTokenizer.h in Headers */, + D34BB0B90FF9F14B00D7773A /* PKJSTokenizerState.h in Headers */, + D34BB0BB0FF9F14B00D7773A /* PKJSWhitespaceState.h in Headers */, + D34BB0BD0FF9F14B00D7773A /* PKJSWordState.h in Headers */, + D34BB0E60FF9F28000D7773A /* PKJSAlternation.h in Headers */, + D34BB0E80FF9F28000D7773A /* PKJSAny.h in Headers */, + D34BB0EA0FF9F28000D7773A /* PKJSAssemblerAdapter.h in Headers */, + D34BB0EC0FF9F28000D7773A /* PKJSCollectionParser.h in Headers */, + D34BB0EE0FF9F28000D7773A /* PKJSEmpty.h in Headers */, + D34BB0F00FF9F28000D7773A /* PKJSParser.h in Headers */, + D34BB0F20FF9F28000D7773A /* PKJSRepetition.h in Headers */, + D34BB0F40FF9F28000D7773A /* PKJSSequence.h in Headers */, + D34BB0F60FF9F28000D7773A /* PKJSTerminal.h in Headers */, + D34BB0F80FF9F28000D7773A /* PKJSTrack.h in Headers */, + D34BB1140FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.h in Headers */, + D34BB1160FF9F36200D7773A /* PKJSComment.h in Headers */, + D34BB1180FF9F36200D7773A /* PKJSDelimitedString.h in Headers */, + D34BB11A0FF9F36200D7773A /* PKJSLiteral.h in Headers */, + D34BB11C0FF9F36200D7773A /* PKJSLowercaseWord.h in Headers */, + D34BB11E0FF9F36200D7773A /* PKJSNum.h in Headers */, + D34BB1200FF9F36200D7773A /* PKJSPattern.h in Headers */, + D34BB1220FF9F36200D7773A /* PKJSQuotedString.h in Headers */, + D34BB1240FF9F36200D7773A /* PKJSSymbol.h in Headers */, + D34BB1260FF9F36200D7773A /* PKJSUppercaseWord.h in Headers */, + D34BB1280FF9F36200D7773A /* PKJSWord.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3FDC57F0FFC4BFC00F1F797 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + D3FDC6DA0FFC4C8C00F1F797 /* RegexKitLite.h in Headers */, + D3FDC8DC0FFC51F200F1F797 /* ParseKitMobile_Prefix.pch in Headers */, + D3C221940FFE8B8C004514FE /* ParseKit.h in Headers */, + D3C221950FFE8B8C004514FE /* PKTypes.h in Headers */, + D3C221980FFE8B95004514FE /* PKReader.h in Headers */, + D3C2219B0FFE8B9D004514FE /* PKAssembly.h in Headers */, + D3C2219E0FFE8BA6004514FE /* PKParser.h in Headers */, + D3C221A10FFE8BAE004514FE /* PKRepetition.h in Headers */, + D3C221A40FFE8BBA004514FE /* PKCollectionParser.h in Headers */, + D3C221A70FFE8BC1004514FE /* PKAlternation.h in Headers */, + D3C221AA0FFE8BC9004514FE /* PKSequence.h in Headers */, + D3C221AD0FFE8BCF004514FE /* PKTrack.h in Headers */, + D3C221B00FFE8BD4004514FE /* PKTrackException.h in Headers */, + D3C221B30FFE8BDB004514FE /* PKIntersection.h in Headers */, + D3C221B60FFE8BE2004514FE /* PKDifference.h in Headers */, + D3C221B90FFE8BE8004514FE /* PKNegation.h in Headers */, + D3C221BC0FFE8BEF004514FE /* PKTerminal.h in Headers */, + D3C221BF0FFE8BF7004514FE /* PKEmpty.h in Headers */, + D3C221C20FFE8BFF004514FE /* PKTokenAssembly.h in Headers */, + D3C221C50FFE8C07004514FE /* PKToken.h in Headers */, + D3C221C80FFE8C0D004514FE /* PKTokenArraySource.h in Headers */, + D3C221CB0FFE8C15004514FE /* PKTokenizer.h in Headers */, + D3C221CE0FFE8C1B004514FE /* PKTokenizerState.h in Headers */, + D3C221D10FFE8C24004514FE /* PKNumberState.h in Headers */, + D3C221D70FFE8C35004514FE /* PKSymbolState.h in Headers */, + D3C221DA0FFE8C3D004514FE /* PKWordState.h in Headers */, + D3C221DD0FFE8C43004514FE /* PKWhitespaceState.h in Headers */, + D3C221E00FFE8C49004514FE /* PKDelimitState.h in Headers */, + D3C221E30FFE8C4E004514FE /* PKCommentState.h in Headers */, + D3C221E60FFE8C56004514FE /* PKSingleLineCommentState.h in Headers */, + D3C221E90FFE8C60004514FE /* PKMultiLineCommentState.h in Headers */, + D3C221EC0FFE8C69004514FE /* PKSymbolNode.h in Headers */, + D3C221EF0FFE8C6F004514FE /* PKSymbolRootNode.h in Headers */, + D3C221F20FFE8C7A004514FE /* PKPattern.h in Headers */, + D3C221F50FFE8C87004514FE /* PKWord.h in Headers */, + D3C221FB0FFE8C97004514FE /* PKQuotedString.h in Headers */, + D3C221FE0FFE8CB2004514FE /* PKSymbol.h in Headers */, + D3C222010FFE8CB9004514FE /* PKLiteral.h in Headers */, + D3C222040FFE8CC4004514FE /* PKCaseInsensitiveLiteral.h in Headers */, + D3C222070FFE8CCA004514FE /* PKWhitespace.h in Headers */, + D3C2220A0FFE8CD1004514FE /* PKComment.h in Headers */, + D3C2220D0FFE8CD8004514FE /* PKDelimitedString.h in Headers */, + D3C222100FFE8CDF004514FE /* PKAny.h in Headers */, + D3C222160FFE8D01004514FE /* PKLowercaseWord.h in Headers */, + D3C222190FFE8D11004514FE /* PKUppercaseWord.h in Headers */, + D3C2221C0FFE8D32004514FE /* PKCharacterAssembly.h in Headers */, + D3C2221F0FFE8D3B004514FE /* PKChar.h in Headers */, + D3C222220FFE8D42004514FE /* PKDigit.h in Headers */, + D3C222250FFE8D49004514FE /* PKLetter.h in Headers */, + D3C222280FFE8D6B004514FE /* PKSpecificChar.h in Headers */, + D3C2222B0FFE8DAC004514FE /* PKParserFactory.h in Headers */, + D3C2222F0FFE8DEF004514FE /* NSString+ParseKitAdditions.h in Headers */, + D3C222300FFE8DF3004514FE /* NSArray+ParseKitAdditions.h in Headers */, + D3F0E2490FFE8EB900C9DF74 /* PKQuoteState.h in Headers */, + D3F0E3CB0FFEB70100C9DF74 /* PKNumber.h in Headers */, + D37A28681013942A00E936B7 /* PKGrammarParser.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 8DC2EF4F0486A6940098B216 /* ParseKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "ParseKit" */; + buildPhases = ( + 8DC2EF500486A6940098B216 /* Headers */, + 8DC2EF540486A6940098B216 /* Sources */, + 8DC2EF520486A6940098B216 /* Resources */, + 8DC2EF560486A6940098B216 /* Frameworks */, + D36C65E7100ED81B000361A0 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ParseKit; + productInstallPath = "$(HOME)/Library/Frameworks"; + productName = TODParseKit; + productReference = 8DC2EF5B0486A6940098B216 /* ParseKit.framework */; + productType = "com.apple.product-type.framework"; + }; + D334940F0E2963FD00406085 /* DemoApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = D33494150E2963FE00406085 /* Build configuration list for PBXNativeTarget "DemoApp" */; + buildPhases = ( + D334940D0E2963FD00406085 /* Sources */, + D334940C0E2963FD00406085 /* Resources */, + D334940E0E2963FD00406085 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D33494A00E296AA900406085 /* PBXTargetDependency */, + ); + name = DemoApp; + productName = DemoApp; + productReference = D33494100E2963FD00406085 /* DemoApp.app */; + productType = "com.apple.product-type.application"; + }; + D34185030E520D3F0081B0DC /* DebugApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = D34185090E520D410081B0DC /* Build configuration list for PBXNativeTarget "DebugApp" */; + buildPhases = ( + D34185010E520D3F0081B0DC /* Sources */, + D34185000E520D3F0081B0DC /* Resources */, + D380B9A10F0EF3DC0009EC13 /* Copy Frameworks */, + D34185020E520D3F0081B0DC /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D34185100E520D6F0081B0DC /* PBXTargetDependency */, + ); + name = DebugApp; + productName = TestApp; + productReference = D34185040E520D3F0081B0DC /* DebugApp.app */; + productType = "com.apple.product-type.application"; + }; + D389F1CD0F1965E600558235 /* JSParseKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = D389F1D20F1965E800558235 /* Build configuration list for PBXNativeTarget "JSParseKit" */; + buildPhases = ( + D389F1C90F1965E600558235 /* Headers */, + D389F1CB0F1965E600558235 /* Sources */, + D389F1CA0F1965E600558235 /* Resources */, + D389F1CC0F1965E600558235 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D389F1D40F19665C00558235 /* PBXTargetDependency */, + ); + name = JSParseKit; + productName = TDJSParseKit; + productReference = D389F1CE0F1965E600558235 /* JSParseKit.framework */; + productType = "com.apple.product-type.framework"; + }; + D389F2020F196A7500558235 /* JSDemoApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = D389F2080F196A7600558235 /* Build configuration list for PBXNativeTarget "JSDemoApp" */; + buildPhases = ( + D389F2000F196A7500558235 /* Sources */, + D389F1FF0F196A7500558235 /* Resources */, + D389F2010F196A7500558235 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + D389F20A0F196A8000558235 /* PBXTargetDependency */, + ); + name = JSDemoApp; + productName = JSDemoApp; + productReference = D389F2030F196A7500558235 /* JSDemoApp.app */; + productType = "com.apple.product-type.application"; + }; + D3C7D8790A411FBF005DD154 /* Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3C7D87C0A411FC0005DD154 /* Build configuration list for PBXNativeTarget "Tests" */; + buildPhases = ( + D3C7D8760A411FBF005DD154 /* Sources */, + D3C7D8750A411FBF005DD154 /* Resources */, + D3DCB3880EF5E65100DE5110 /* Copy Frameworks */, + D3C7D8770A411FBF005DD154 /* Frameworks */, + D3C7D8780A411FBF005DD154 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + D31FE7180E60F24700A0803E /* PBXTargetDependency */, + ); + name = Tests; + productName = Tests; + productReference = D3C7D87A0A411FBF005DD154 /* Tests.octest */; + productType = "com.apple.product-type.bundle"; + }; + D3FDC5820FFC4BFC00F1F797 /* ParseKitMobile */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3FDC62F0FFC4C2000F1F797 /* Build configuration list for PBXNativeTarget "ParseKitMobile" */; + buildPhases = ( + D3FDC57F0FFC4BFC00F1F797 /* Headers */, + D3FDC5800FFC4BFC00F1F797 /* Sources */, + D3FDC5810FFC4BFC00F1F797 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = ParseKitMobile; + productName = ParseKitMobile; + productReference = D3FDC5830FFC4BFC00F1F797 /* libparsekit.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 0867D690FE84028FC02AAC07 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ParseKit" */; + compatibilityVersion = "Xcode 2.4"; + hasScannedForEncodings = 1; + mainGroup = 0867D691FE84028FC02AAC07 /* TODParseKit */; + productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DC2EF4F0486A6940098B216 /* ParseKit */, + D389F1CD0F1965E600558235 /* JSParseKit */, + D3FDC5820FFC4BFC00F1F797 /* ParseKitMobile */, + D3C7D8790A411FBF005DD154 /* Tests */, + D334940F0E2963FD00406085 /* DemoApp */, + D34185030E520D3F0081B0DC /* DebugApp */, + D389F2020F196A7500558235 /* JSDemoApp */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 8DC2EF520486A6940098B216 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D334940C0E2963FD00406085 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36E98F80E58C1A000496BD3 /* DemoAppMainMenu.xib in Resources */, + D3DCB4C40EF6015C00DE5110 /* json.grammar in Resources */, + D3F741BF0EF9F29400559B9F /* css2_1.grammar in Resources */, + D3D01CAB0EFDB8A000C24DDE /* json_with_discards.grammar in Resources */, + D3F562A210266E5300DD6DB1 /* TokensView.xib in Resources */, + D3F562A410266E6300DD6DB1 /* TreesView.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D34185000E520D3F0081B0DC /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3E27A320E741DD20078CC2C /* small-xml-file.xml in Resources */, + D3E27A330E741DD20078CC2C /* apple-boss.xml in Resources */, + D398E20E0E60F86D00A1C877 /* yahoo.json in Resources */, + D3E785560E53FB54008C7D61 /* apple-boss.json in Resources */, + D36E98E10E58C12800496BD3 /* DebugAppMainMenu.xib in Resources */, + D3EADD810E75E9CC00F78584 /* nasty.html in Resources */, + D3B69D320E80249900D70C41 /* nonascii.html in Resources */, + D3DCB4C50EF6015C00DE5110 /* json.grammar in Resources */, + D3F741C00EF9F29500559B9F /* css2_1.grammar in Resources */, + D3D01CAC0EFDB8A100C24DDE /* json_with_discards.grammar in Resources */, + D385FA260F04993500DB2946 /* json.css in Resources */, + D385FD6C0F05A99900DB2946 /* mini_css.grammar in Resources */, + D3DDDCAE0F0880D800A58000 /* example1.srgs in Resources */, + D383498C0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */, + D38349BD0F0C0D910055E4E0 /* json_with_comments.css in Resources */, + D3834A490F0C14C00055E4E0 /* yahoo_with_comments.json in Resources */, + D380AFBF0F0C54B60009EC13 /* html.css in Resources */, + D380AFC00F0C54B60009EC13 /* html.grammar in Resources */, + D380AFC30F0C56000009EC13 /* example.html in Resources */, + D380B3230F0CC0800009EC13 /* nyt.html in Resources */, + D380B50A0F0D71B00009EC13 /* css.grammar in Resources */, + D380B5390F0D7DE30009EC13 /* css.css in Resources */, + D380B5950F0D82F90009EC13 /* example.css in Resources */, + D3FD79210F4CC87900BAD816 /* rubyhash.grammar in Resources */, + D31A15270F6DE449002AFDF1 /* javascript.grammar in Resources */, + D355C6A70FE9F704006A91A4 /* nspredicate.grammar in Resources */, + D3BBBCC10FECD477007DF30D /* xml.grammar in Resources */, + D315DF730FEF59B600D876C8 /* date.grammar in Resources */, + D34BAC9A0FF8A9AD00D7773A /* xpath1_0.grammar in Resources */, + D3668293101D2C000008632C /* erb.grammar in Resources */, + D319E42B106D8A1F008C63DD /* arithmetic.grammar in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1CA0F1965E600558235 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1FF0F196A7500558235 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F38F0F19800400558235 /* DefaultValues.plist in Resources */, + D389F4620F198A8800558235 /* Test.html in Resources */, + D389F5590F19B7BC00558235 /* JSDemoAppMainMenu.xib in Resources */, + D389FBCD0F1B25E200558235 /* ParserTest.html in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3C7D8750A411FBF005DD154 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3B473850E48C9CF008AFBDD /* yahoo.json in Resources */, + D3E784BD0E53DA28008C7D61 /* apple-boss.json in Resources */, + D36E9FB50E5A944A00496BD3 /* apple-boss.xml in Resources */, + D36E9FE50E5BA0FC00496BD3 /* SRGSGrammar.txt in Resources */, + D36EA3B00E5EA67E00496BD3 /* small-xml-file.xml in Resources */, + D3EADD800E75E9CC00F78584 /* nasty.html in Resources */, + D3B69D330E80249900D70C41 /* nonascii.html in Resources */, + D38DD9E80EC29F260070BC4D /* nyt.html in Resources */, + D3DCB4C30EF6015300DE5110 /* json.grammar in Resources */, + D3F741440EF8E96A00559B9F /* xpath1_0.grammar in Resources */, + D3F741BE0EF9F28D00559B9F /* css2_1.grammar in Resources */, + D3D01CAA0EFDB89900C24DDE /* json_with_discards.grammar in Resources */, + D385FA250F04993500DB2946 /* json.css in Resources */, + D385FD6D0F05A99900DB2946 /* mini_css.grammar in Resources */, + D3DDDCAD0F0880D800A58000 /* example1.srgs in Resources */, + D383498B0F0C0CF30055E4E0 /* json_with_comments.grammar in Resources */, + D38349BC0F0C0D910055E4E0 /* json_with_comments.css in Resources */, + D3834A480F0C14B60055E4E0 /* yahoo_with_comments.json in Resources */, + D380AFBD0F0C54B60009EC13 /* html.css in Resources */, + D380AFBE0F0C54B60009EC13 /* html.grammar in Resources */, + D380AFC40F0C56000009EC13 /* example.html in Resources */, + D380B5090F0D71A90009EC13 /* css.grammar in Resources */, + D380B5380F0D7DDE0009EC13 /* css.css in Resources */, + D380B5940F0D82F60009EC13 /* example.css in Resources */, + D3FD79200F4CC86800BAD816 /* rubyhash.grammar in Resources */, + D31A15260F6DE449002AFDF1 /* javascript.grammar in Resources */, + D35384ED0FE9691100926552 /* nspredicate.grammar in Resources */, + D353899C0FEAC94400926552 /* c.grammar in Resources */, + D353899E0FEAC96B00926552 /* objc.grammar in Resources */, + D355C8810FEB36A1006A91A4 /* xml.grammar in Resources */, + D355C8840FEB4B94006A91A4 /* proto.grammar in Resources */, + D315DF720FEF59B600D876C8 /* date.grammar in Resources */, + D3668292101D2BFA0008632C /* erb.grammar in Resources */, + D319E42A106D8A1F008C63DD /* arithmetic.grammar in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + D36C65E7100ED81B000361A0 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#cp -R -f \"${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}\" ${HOME}/Library/Frameworks"; + }; + D3C7D8780A411FBF005DD154 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8DC2EF540486A6940098B216 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36C55FF0FD3617B00141CB7 /* RegexKitLite.m in Sources */, + D34BAD9D0FF9C95800D7773A /* PKReader.m in Sources */, + D34BADA20FF9C9B000D7773A /* PKAssembly.m in Sources */, + D34BADD80FF9CBFB00D7773A /* PKParser.m in Sources */, + D34BAE030FF9CCAE00D7773A /* PKCollectionParser.m in Sources */, + D34BAE1D0FF9CE0E00D7773A /* PKAlternation.m in Sources */, + D34BAE1F0FF9CE0E00D7773A /* PKEmpty.m in Sources */, + D34BAE210FF9CE0E00D7773A /* PKDifference.m in Sources */, + D34BAE230FF9CE0E00D7773A /* PKIntersection.m in Sources */, + D34BAE250FF9CE0E00D7773A /* PKRepetition.m in Sources */, + D34BAE270FF9CE0E00D7773A /* PKSequence.m in Sources */, + D34BAE290FF9CE0E00D7773A /* PKTerminal.m in Sources */, + D34BAE2B0FF9CE0E00D7773A /* PKTrack.m in Sources */, + D34BAE2D0FF9CE0E00D7773A /* PKTrackException.m in Sources */, + D34BAE310FF9CE6000D7773A /* PKAny.m in Sources */, + D34BAE8D0FF9D15100D7773A /* PKTokenAssembly.m in Sources */, + D34BAE9D0FF9D20900D7773A /* PKToken.m in Sources */, + D34BAE9F0FF9D20900D7773A /* PKTokenArraySource.m in Sources */, + D34BAEA10FF9D20900D7773A /* PKTokenizer.m in Sources */, + D34BAEA30FF9D20900D7773A /* PKTokenizerState.m in Sources */, + D34BAED80FF9D56400D7773A /* PKCommentState.m in Sources */, + D34BAEDA0FF9D56400D7773A /* PKDelimitState.m in Sources */, + D34BAEDC0FF9D56400D7773A /* PKMultiLineCommentState.m in Sources */, + D34BAEDE0FF9D56400D7773A /* PKNumberState.m in Sources */, + D34BAEE00FF9D56400D7773A /* PKQuoteState.m in Sources */, + D34BAEE20FF9D56400D7773A /* PKSingleLineCommentState.m in Sources */, + D34BAEE40FF9D56400D7773A /* PKSymbolState.m in Sources */, + D34BAEE60FF9D56400D7773A /* PKWhitespaceState.m in Sources */, + D34BAEE80FF9D56400D7773A /* PKWord.m in Sources */, + D34BAEEA0FF9D56400D7773A /* PKWordState.m in Sources */, + D34BAF280FF9DF9900D7773A /* PKSymbolNode.m in Sources */, + D34BAF2A0FF9DF9900D7773A /* PKSymbolRootNode.m in Sources */, + D34BAF3A0FF9E18300D7773A /* PKPattern.m in Sources */, + D34BAF4C0FF9E19700D7773A /* PKCaseInsensitiveLiteral.m in Sources */, + D34BAF4E0FF9E19700D7773A /* PKComment.m in Sources */, + D34BAF500FF9E19700D7773A /* PKDelimitedString.m in Sources */, + D34BAF520FF9E19700D7773A /* PKLiteral.m in Sources */, + D34BAF540FF9E19700D7773A /* PKNumber.m in Sources */, + D34BAF560FF9E19700D7773A /* PKQuotedString.m in Sources */, + D34BAF580FF9E19700D7773A /* PKSymbol.m in Sources */, + D34BAF5A0FF9E19700D7773A /* PKWhitespace.m in Sources */, + D34BAF9D0FF9E6D100D7773A /* PKLowercaseWord.m in Sources */, + D34BAF9F0FF9E6D100D7773A /* PKUppercaseWord.m in Sources */, + D34BAFB20FF9E7F300D7773A /* PKCharacterAssembly.m in Sources */, + D34BAFBC0FF9E80300D7773A /* PKChar.m in Sources */, + D34BAFBE0FF9E80300D7773A /* PKDigit.m in Sources */, + D34BAFC00FF9E80300D7773A /* PKLetter.m in Sources */, + D34BAFC20FF9E80300D7773A /* PKSpecificChar.m in Sources */, + D34BAFDA0FF9E95500D7773A /* NSArray+ParseKitAdditions.m in Sources */, + D34BAFDC0FF9E95500D7773A /* NSString+ParseKitAdditions.m in Sources */, + D34BAFDE0FF9E95500D7773A /* PKParserFactory.m in Sources */, + D3126D060FFD9BA700CBF4C4 /* PKNegation.m in Sources */, + D3376D5A10093A1600E4602E /* PKGrammarParser.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D334940D0E2963FD00406085 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36E98E70E58C14000496BD3 /* DemoAppDelegate.m in Sources */, + D36E98E80E58C14000496BD3 /* main.m in Sources */, + D3F5629A10266CFC00DD6DB1 /* PKParseTreeView.m in Sources */, + D3F562A010266DFB00DD6DB1 /* DemoTokensViewController.m in Sources */, + D3F562A710266E8D00DD6DB1 /* DemoTreesViewController.m in Sources */, + D3305C4F102F5BAE00DC4F75 /* TDGutterView.m in Sources */, + D3305C50102F5BAE00DC4F75 /* TDSourceCodeTextView.m in Sources */, + D36934721038E28300527AF3 /* PKParseTree.m in Sources */, + D36934731038E28700527AF3 /* PKParseTreeAssembler.m in Sources */, + D36934741038E28B00527AF3 /* PKRuleNode.m in Sources */, + D36934751038E28F00527AF3 /* PKTokenNode.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D34185010E520D3F0081B0DC /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D36E98E20E58C12800496BD3 /* main.m in Sources */, + D36E98E00E58C12800496BD3 /* DebugAppDelegate.m in Sources */, + D3EADD8F0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */, + D31FE7420E60F40900A0803E /* XPathContext.m in Sources */, + D31FE7400E60F40300A0803E /* XPathAssembler.m in Sources */, + D31FE7340E60F34600A0803E /* XPathParser.m in Sources */, + D31FE7330E60F33C00A0803E /* XMLReader.m in Sources */, + D31FE7320E60F33000A0803E /* EBNFParser.m in Sources */, + D31FE7300E60F31E00A0803E /* TDFastJsonParser.m in Sources */, + D302C69D0EF044810090E714 /* TDPlistParser.m in Sources */, + D3F740B70EF8C38A00559B9F /* JSONAssembler.m in Sources */, + D385F98C0F046FE900DB2946 /* TDGenericAssembler.m in Sources */, + D385FD440F05A88C00DB2946 /* TDMiniCSSAssembler.m in Sources */, + D3DDDA870F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */, + D389F5B80F19C76A00558235 /* TDJsonParser.m in Sources */, + D31A16530F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */, + D3252F7E0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */, + D3385FDA0FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */, + D355C62E0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */, + D3BBBC9D0FEC9756007DF30D /* TDXMLParser.m in Sources */, + D3376D8F10096C0700E4602E /* PKAST.m in Sources */, + D319E42F106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F1CB0F1965E600558235 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D34BB0690FF9EDDF00D7773A /* JSParseKit.m in Sources */, + D34BB0720FF9EE4000D7773A /* PKJSAssembly.m in Sources */, + D34BB0740FF9EE4000D7773A /* PKJSUtils.m in Sources */, + D34BB0770FF9EE4000D7773A /* PKJSValueHolder.m in Sources */, + D34BB0900FF9EF9D00D7773A /* PKJSCharacterAssembly.m in Sources */, + D34BB0AA0FF9F14B00D7773A /* PKJSCommentState.m in Sources */, + D34BB0AC0FF9F14B00D7773A /* PKJSDelimitState.m in Sources */, + D34BB0AE0FF9F14B00D7773A /* PKJSNumberState.m in Sources */, + D34BB0B00FF9F14B00D7773A /* PKJSQuoteState.m in Sources */, + D34BB0B20FF9F14B00D7773A /* PKJSSymbolState.m in Sources */, + D34BB0B40FF9F14B00D7773A /* PKJSToken.m in Sources */, + D34BB0B60FF9F14B00D7773A /* PKJSTokenAssembly.m in Sources */, + D34BB0B80FF9F14B00D7773A /* PKJSTokenizer.m in Sources */, + D34BB0BA0FF9F14B00D7773A /* PKJSTokenizerState.m in Sources */, + D34BB0BC0FF9F14B00D7773A /* PKJSWhitespaceState.m in Sources */, + D34BB0BE0FF9F14B00D7773A /* PKJSWordState.m in Sources */, + D34BB0E70FF9F28000D7773A /* PKJSAlternation.m in Sources */, + D34BB0E90FF9F28000D7773A /* PKJSAny.m in Sources */, + D34BB0EB0FF9F28000D7773A /* PKJSAssemblerAdapter.m in Sources */, + D34BB0ED0FF9F28000D7773A /* PKJSCollectionParser.m in Sources */, + D34BB0EF0FF9F28000D7773A /* PKJSEmpty.m in Sources */, + D34BB0F10FF9F28000D7773A /* PKJSParser.m in Sources */, + D34BB0F30FF9F28000D7773A /* PKJSRepetition.m in Sources */, + D34BB0F50FF9F28000D7773A /* PKJSSequence.m in Sources */, + D34BB0F70FF9F28000D7773A /* PKJSTerminal.m in Sources */, + D34BB0F90FF9F28000D7773A /* PKJSTrack.m in Sources */, + D34BB1150FF9F36200D7773A /* PKJSCaseInsensitiveLiteral.m in Sources */, + D34BB1170FF9F36200D7773A /* PKJSComment.m in Sources */, + D34BB1190FF9F36200D7773A /* PKJSDelimitedString.m in Sources */, + D34BB11B0FF9F36200D7773A /* PKJSLiteral.m in Sources */, + D34BB11D0FF9F36200D7773A /* PKJSLowercaseWord.m in Sources */, + D34BB11F0FF9F36200D7773A /* PKJSNum.m in Sources */, + D34BB1210FF9F36200D7773A /* PKJSPattern.m in Sources */, + D34BB1230FF9F36200D7773A /* PKJSQuotedString.m in Sources */, + D34BB1250FF9F36200D7773A /* PKJSSymbol.m in Sources */, + D34BB1270FF9F36200D7773A /* PKJSUppercaseWord.m in Sources */, + D34BB1290FF9F36200D7773A /* PKJSWord.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D389F2000F196A7500558235 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D389F2E40F196CAE00558235 /* main.m in Sources */, + D389F37A0F197E8000558235 /* JSDemoAppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3C7D8760A411FBF005DD154 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3E788930E567DFD008C7D61 /* SRGSParserTest.m in Sources */, + D3E788960E567E0A008C7D61 /* SRGSParser.m in Sources */, + D3E78A190E574C99008C7D61 /* EBNFParser.m in Sources */, + D3E78A1A0E574C99008C7D61 /* EBNFParserTest.m in Sources */, + D36E95460E578ECC00496BD3 /* XPathParser.m in Sources */, + D36E95D80E57B08400496BD3 /* XPathParserTest.m in Sources */, + D36E97B00E589DAE00496BD3 /* XPathAssembler.m in Sources */, + D36E98220E58A3A800496BD3 /* XPathContext.m in Sources */, + D3521F560E5FA1B0009681F9 /* XMLReader.m in Sources */, + D3521F570E5FA1B0009681F9 /* XMLReaderTest.m in Sources */, + D31FE54C0E60E46100A0803E /* TDTestScaffold.m in Sources */, + D31FE5630E60E50800A0803E /* TDAlternationTest.m in Sources */, + D31FE5640E60E50800A0803E /* TDLiteralTest.m in Sources */, + D31FE5650E60E50800A0803E /* TDParserTest.m in Sources */, + D31FE5660E60E50800A0803E /* TDRepetitionTest.m in Sources */, + D31FE5680E60E50800A0803E /* TDRobotCommandTest.m in Sources */, + D31FE5690E60E50800A0803E /* TDSequenceTest.m in Sources */, + D31FE56A0E60E50800A0803E /* TDSymbolTest.m in Sources */, + D31FE56B0E60E50800A0803E /* TDTokenAssemblyTest.m in Sources */, + D31FE56C0E60E50800A0803E /* TDTrackTest.m in Sources */, + D31FE56D0E60E50800A0803E /* TDUppercaseWordTest.m in Sources */, + D31FE5750E60E55700A0803E /* TDReaderTest.m in Sources */, + D31FE5760E60E55700A0803E /* TDTokenizerTest.m in Sources */, + D31FE5850E60E58C00A0803E /* TDNumberStateTest.m in Sources */, + D31FE5860E60E58C00A0803E /* TDQuoteStateTest.m in Sources */, + D31FE5890E60E58C00A0803E /* TDSymbolStateTest.m in Sources */, + D31FE58A0E60E58C00A0803E /* TDWhitespaceStateTest.m in Sources */, + D31FE58B0E60E58C00A0803E /* TDWordStateTest.m in Sources */, + D31FE5960E60E5AC00A0803E /* TDCharacterAssemblyTest.m in Sources */, + D31FE5970E60E5AC00A0803E /* TDCharTest.m in Sources */, + D31FE5980E60E5AC00A0803E /* TDDigitTest.m in Sources */, + D31FE5990E60E5AC00A0803E /* TDLetterTest.m in Sources */, + D31FE59A0E60E5AC00A0803E /* TDSpecificCharTest.m in Sources */, + D31FE59F0E60E5C000A0803E /* TDRegularParser.m in Sources */, + D31FE5A00E60E5C000A0803E /* TDRegularParserTest.m in Sources */, + D31FE5A90E60E5D500A0803E /* TDFastJsonParser.m in Sources */, + D31FE5AA0E60E5D500A0803E /* TDFastJsonParserTest.m in Sources */, + D31FE5B10E60E64900A0803E /* TDXmlTokenAssembly.m in Sources */, + D31FE5B20E60E64900A0803E /* TDXmlTokenizerTest.m in Sources */, + D31FE5B70E60E66600A0803E /* TDXmlToken.m in Sources */, + D31FE5B80E60E66600A0803E /* TDXmlTokenizer.m in Sources */, + D31FE5DD0E60E69E00A0803E /* TDXmlAttribute.m in Sources */, + D31FE5DE0E60E69E00A0803E /* TDXmlCdata.m in Sources */, + D31FE5DF0E60E69E00A0803E /* TDXmlComment.m in Sources */, + D31FE5E00E60E69E00A0803E /* TDXmlDecl.m in Sources */, + D31FE5E10E60E69E00A0803E /* TDXmlDoctype.m in Sources */, + D31FE5E20E60E69E00A0803E /* TDXmlDocument.m in Sources */, + D31FE5E30E60E69E00A0803E /* TDXmlEndEntity.m in Sources */, + D31FE5E40E60E69E00A0803E /* TDXmlEndTag.m in Sources */, + D31FE5E50E60E69E00A0803E /* TDXmlEntity.m in Sources */, + D31FE5E60E60E69E00A0803E /* TDXmlEntityRef.m in Sources */, + D31FE5E70E60E69E00A0803E /* TDXmlFragment.m in Sources */, + D31FE5E80E60E69E00A0803E /* TDXmlNotation.m in Sources */, + D31FE5E90E60E69E00A0803E /* TDXmlProcessingInstruction.m in Sources */, + D31FE5EA0E60E69E00A0803E /* TDXmlSignificantWhitespace.m in Sources */, + D31FE5EB0E60E69E00A0803E /* TDXmlStartTag.m in Sources */, + D31FE5EC0E60E69E00A0803E /* TDXmlTerminal.m in Sources */, + D31FE5ED0E60E69E00A0803E /* TDXmlText.m in Sources */, + D31FE5EE0E60E69E00A0803E /* TDXmlWhitespace.m in Sources */, + D31FE5FC0E60E6B500A0803E /* TDNCNameState.m in Sources */, + D31FE5FD0E60E6B500A0803E /* TDXmlName.m in Sources */, + D31FE5FE0E60E6B500A0803E /* TDXmlNameState.m in Sources */, + D31FE5FF0E60E6B500A0803E /* TDXmlNameTest.m in Sources */, + D31FE6000E60E6B500A0803E /* TDXmlNmtoken.m in Sources */, + D31FE6010E60E6B500A0803E /* TDXmlNmtokenState.m in Sources */, + D31FE6E00E60EE2500A0803E /* TDNCName.m in Sources */, + D3C85C7B0E63B438000445FD /* TDArithmeticParser.m in Sources */, + D3C85C800E63B9E9000445FD /* TDArithmeticParserTest.m in Sources */, + D3C85D450E63D1BF000445FD /* TDScientificNumberStateTest.m in Sources */, + D3EADD8E0E75EAA400F78584 /* TDHtmlSyntaxHighlighter.m in Sources */, + D38205BE0EEE48EE004340DD /* TDTokenTest.m in Sources */, + D36568A70EEF9FE900226554 /* TDPlistParser.m in Sources */, + D36568AA0EEFA05300226554 /* TDPlistParserTest.m in Sources */, + D3656DFE0EF2620E00226554 /* TDTokenArraySourceTest.m in Sources */, + D3C031ED0EF38D2D00C5ABEB /* TDLowercaseWordTest.m in Sources */, + D385F98E0F046FE900DB2946 /* TDGenericAssembler.m in Sources */, + D385FA230F04971400DB2946 /* TDGenericAssemblerTest.m in Sources */, + D385FD460F05A89100DB2946 /* TDMiniCSSAssemblerTest.m in Sources */, + D385FD490F05A8C900DB2946 /* TDMiniCSSAssembler.m in Sources */, + D3DDDA880F0779FD00A58000 /* TDSyntaxHighlighter.m in Sources */, + D3DDDAFE0F083C9700A58000 /* TDCommentStateTest.m in Sources */, + D380BA620F0F06CD0009EC13 /* TDParserFactoryTest.m in Sources */, + D389F5B60F19C76A00558235 /* TDJsonParser.m in Sources */, + D389F5B70F19C76A00558235 /* TDJsonParserTest.m in Sources */, + D31A16520F7038C2002AFDF1 /* TDJavaScriptParser.m in Sources */, + D3B43FB80F76E99C0072AF40 /* TDJavaScriptParserTest.m in Sources */, + D3E39C3F0FC5FFD10022DAB9 /* TDDelimitStateTest.m in Sources */, + D3252F7B0FCE1A7F005EF059 /* TDNSPredicateBuilderTest.m in Sources */, + D3252F7F0FCE1A87005EF059 /* TDNSPredicateBuilder.m in Sources */, + D3385FD90FCFB1FF003BF729 /* TDPredicateEvaluator.m in Sources */, + D3385FDE0FCFB227003BF729 /* TDPredicateEvaluatorTest.m in Sources */, + D36C53790FD27F1300141CB7 /* TDParserFactoryTest2.m in Sources */, + D36C562B0FD365DB00141CB7 /* TDPatternTest.m in Sources */, + D3AF49780FDB122E0032F4DC /* TDParserFactoryPatternTest.m in Sources */, + D355C62D0FE9EFD6006A91A4 /* TDNSPredicateEvaluator.m in Sources */, + D355C6310FE9EFEA006A91A4 /* TDNSPredicateEvaluatorTest.m in Sources */, + D3BBBC9E0FEC9756007DF30D /* TDXMLParser.m in Sources */, + D39E01340FEF02DA00150FC3 /* TDXMLParserTest.m in Sources */, + D338E5BB0FF5DDCB003DE6AA /* TDDifferenceTest.m in Sources */, + D34BAC230FF87F8600D7773A /* TDParserFactoryTest3.m in Sources */, + D34BAC4B0FF892C200D7773A /* XPathParserGrammarTest.m in Sources */, + D3126D0B0FFD9E4B00CBF4C4 /* TDNegationTest.m in Sources */, + D3376D8E10096C0700E4602E /* PKAST.m in Sources */, + D34BAD18100A9B7900996341 /* TDTokenizerStateTest.m in Sources */, + D3668296101D2C200008632C /* ERBTest.m in Sources */, + D3F55F611025737D00DD6DB1 /* TDParseTreeTest.m in Sources */, + D369345D1038DE5300527AF3 /* PKParseTree.m in Sources */, + D369345E1038DE5300527AF3 /* PKParseTreeAssembler.m in Sources */, + D369345F1038DE5300527AF3 /* PKRuleNode.m in Sources */, + D36934601038DE5300527AF3 /* PKTokenNode.m in Sources */, + D3D1BF2810394420003656E5 /* SAXAssembler.m in Sources */, + D3D1BF2B1039445C003656E5 /* SAXTest.m in Sources */, + D38E97CC1061CF6500739C39 /* TDTokenizerBlocksTest.m in Sources */, + D38E98D81062C5BA00739C39 /* TDParserBlocksTest.m in Sources */, + D319E42E106D8A31008C63DD /* TDArithmeticAssembler.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3FDC5800FFC4BFC00F1F797 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3FDC6EE0FFC4C9E00F1F797 /* RegexKitLite.m in Sources */, + D3FDC6EF0FFC4C9E00F1F797 /* PKReader.m in Sources */, + D3FDC6F00FFC4C9E00F1F797 /* PKAssembly.m in Sources */, + D3FDC6F10FFC4C9E00F1F797 /* PKParser.m in Sources */, + D3FDC6F20FFC4C9E00F1F797 /* PKRepetition.m in Sources */, + D3FDC6F30FFC4C9E00F1F797 /* PKCollectionParser.m in Sources */, + D3FDC6F40FFC4C9E00F1F797 /* PKAlternation.m in Sources */, + D3FDC6F50FFC4C9E00F1F797 /* PKSequence.m in Sources */, + D3FDC6F60FFC4C9E00F1F797 /* PKTrack.m in Sources */, + D3FDC6F70FFC4C9E00F1F797 /* PKTrackException.m in Sources */, + D3FDC6F80FFC4C9E00F1F797 /* PKDifference.m in Sources */, + D3FDC6F90FFC4C9E00F1F797 /* PKIntersection.m in Sources */, + D3FDC6FA0FFC4C9E00F1F797 /* PKTerminal.m in Sources */, + D3FDC6FB0FFC4C9E00F1F797 /* PKEmpty.m in Sources */, + D3FDC6FC0FFC4C9E00F1F797 /* PKTokenAssembly.m in Sources */, + D3FDC6FD0FFC4C9E00F1F797 /* PKToken.m in Sources */, + D3FDC6FE0FFC4C9E00F1F797 /* PKTokenArraySource.m in Sources */, + D3FDC6FF0FFC4C9E00F1F797 /* PKTokenizer.m in Sources */, + D3FDC7000FFC4C9E00F1F797 /* PKTokenizerState.m in Sources */, + D3FDC7010FFC4C9E00F1F797 /* PKNumberState.m in Sources */, + D3FDC7020FFC4C9E00F1F797 /* PKQuoteState.m in Sources */, + D3FDC7030FFC4C9E00F1F797 /* PKSymbolState.m in Sources */, + D3FDC7040FFC4C9E00F1F797 /* PKWordState.m in Sources */, + D3FDC7050FFC4C9E00F1F797 /* PKWhitespaceState.m in Sources */, + D3FDC7060FFC4C9E00F1F797 /* PKDelimitState.m in Sources */, + D3FDC7070FFC4C9E00F1F797 /* PKCommentState.m in Sources */, + D3FDC7080FFC4C9E00F1F797 /* PKSingleLineCommentState.m in Sources */, + D3FDC7090FFC4C9E00F1F797 /* PKMultiLineCommentState.m in Sources */, + D3FDC70A0FFC4C9E00F1F797 /* PKSymbolNode.m in Sources */, + D3FDC70B0FFC4C9E00F1F797 /* PKSymbolRootNode.m in Sources */, + D3FDC70C0FFC4C9E00F1F797 /* PKPattern.m in Sources */, + D3FDC70D0FFC4C9E00F1F797 /* PKWord.m in Sources */, + D3FDC70F0FFC4C9E00F1F797 /* PKQuotedString.m in Sources */, + D3FDC7100FFC4C9E00F1F797 /* PKSymbol.m in Sources */, + D3FDC7110FFC4C9E00F1F797 /* PKLiteral.m in Sources */, + D3FDC7120FFC4C9E00F1F797 /* PKCaseInsensitiveLiteral.m in Sources */, + D3FDC7130FFC4C9E00F1F797 /* PKWhitespace.m in Sources */, + D3FDC7140FFC4C9E00F1F797 /* PKComment.m in Sources */, + D3FDC7150FFC4C9E00F1F797 /* PKDelimitedString.m in Sources */, + D3FDC7160FFC4C9E00F1F797 /* PKAny.m in Sources */, + D3FDC7180FFC4C9E00F1F797 /* PKLowercaseWord.m in Sources */, + D3FDC7190FFC4C9E00F1F797 /* PKUppercaseWord.m in Sources */, + D3FDC71A0FFC4C9E00F1F797 /* PKCharacterAssembly.m in Sources */, + D3FDC71B0FFC4C9E00F1F797 /* PKChar.m in Sources */, + D3FDC71C0FFC4C9E00F1F797 /* PKDigit.m in Sources */, + D3FDC71D0FFC4C9E00F1F797 /* PKLetter.m in Sources */, + D3FDC71E0FFC4C9E00F1F797 /* PKSpecificChar.m in Sources */, + D3FDC71F0FFC4C9E00F1F797 /* PKParserFactory.m in Sources */, + D3FDC7200FFC4C9E00F1F797 /* NSArray+ParseKitAdditions.m in Sources */, + D3FDC7210FFC4C9E00F1F797 /* NSString+ParseKitAdditions.m in Sources */, + D3126DEC0FFDBC1D00CBF4C4 /* PKNegation.m in Sources */, + D3F0E3CC0FFEB70700C9DF74 /* PKNumber.m in Sources */, + D37A28671013942300E936B7 /* PKGrammarParser.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + D31FE7180E60F24700A0803E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D31FE7170E60F24700A0803E /* PBXContainerItemProxy */; + }; + D33494A00E296AA900406085 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D334949F0E296AA900406085 /* PBXContainerItemProxy */; + }; + D34185100E520D6F0081B0DC /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D341850F0E520D6F0081B0DC /* PBXContainerItemProxy */; + }; + D389F1D40F19665C00558235 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8DC2EF4F0486A6940098B216 /* ParseKit */; + targetProxy = D389F1D30F19665C00558235 /* PBXContainerItemProxy */; + }; + D389F20A0F196A8000558235 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D389F1CD0F1965E600558235 /* JSParseKit */; + targetProxy = D389F2090F196A8000558235 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C1667FE841158C02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1DEB91AE08733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_TEST_COVERAGE_FILES = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKit_Prefix.pch; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvmgcc42; + GENERATE_PROFILING_CODE = YES; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(TARGET_BUILD_DIR)"; + LLVM_LTO = NO; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + ); + PRODUCT_NAME = ParseKit; + SDKROOT = ""; + WARNING_CFLAGS = "-Wundeclared-selector"; + WRAPPER_EXTENSION = framework; + ZERO_LINK = YES; + }; + name = Debug; + }; + 1DEB91AF08733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "$(TDPARSEKIT_FRAMEWORK_TARGET_PATH)"; + FRAMEWORK_VERSION = A; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKit_Prefix.pch; + GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = com.apple.compilers.llvmgcc42; + INFOPLIST_FILE = Info.plist; + INSTALL_PATH = "$(TARGET_BUILD_DIR)"; + LLVM_LTO = YES; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + ); + PRODUCT_NAME = ParseKit; + SDKROOT = ""; + TDPARSEKIT_FRAMEWORK_TARGET_PATH = "@executable_path/../Frameworks"; + WARNING_CFLAGS = "-Wundeclared-selector"; + WRAPPER_EXTENSION = framework; + }; + name = Release; + }; + 1DEB91B208733DA50010E9CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; + }; + name = Debug; + }; + 1DEB91B308733DA50010E9CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; + }; + name = Release; + }; + D33494130E2963FE00406085 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_WARN_UNUSED_VARIABLE = YES; + INFOPLIST_FILE = "demoapp/DemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DemoApp; + SDKROOT = ""; + WRAPPER_EXTENSION = app; + ZERO_LINK = YES; + }; + name = Debug; + }; + D33494140E2963FE00406085 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "demoapp/DemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DemoApp; + SDKROOT = ""; + WRAPPER_EXTENSION = app; + ZERO_LINK = NO; + }; + name = Release; + }; + D34185070E520D410081B0DC /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/frameworks\""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = NO; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_WARN_UNUSED_VARIABLE = NO; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "debugapp/DebugApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DebugApp; + SDKROOT = ""; + }; + name = Debug; + }; + D34185080E520D410081B0DC /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/frameworks\""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "debugapp/DebugApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = DebugApp; + SDKROOT = ""; + ZERO_LINK = NO; + }; + name = Release; + }; + D389F1D00F1965E800558235 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + INFOPLIST_FILE = "JSParseKit-Info.plist"; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSParseKit; + SDKROOT = ""; + }; + name = Debug; + }; + D389F1D10F1965E800558235 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + FRAMEWORK_VERSION = A; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_GC = YES; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + INFOPLIST_FILE = "JSParseKit-Info.plist"; + INSTALL_PATH = "$(HOME)/Library/Frameworks"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSParseKit; + SDKROOT = ""; + ZERO_LINK = NO; + }; + name = Release; + }; + D389F2060F196A7600558235 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_ENABLE_OBJC_GC = required; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "jsdemoapp/JSDemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSDemoApp; + SDKROOT = ""; + }; + name = Debug; + }; + D389F2070F196A7600558235 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_GC = required; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; + INFOPLIST_FILE = "jsdemoapp/JSDemoApp-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + AppKit, + ); + PREBINDING = NO; + PRODUCT_NAME = JSDemoApp; + SDKROOT = ""; + ZERO_LINK = NO; + }; + name = Release; + }; + D3C7D87D0A411FC0005DD154 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ONLY_ACTIVE_ARCH_PRE_XCODE_3_1)"; + COPY_PHASE_STRIP = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + "$(DEVELOPER_FRAMEWORKS_DIR_QUOTED)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/frameworks\""; + FRAMEWORK_SEARCH_PATH_DEBUG_BUILD = "\"$(SRCROOT)/build/Debug\""; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "test/Tests-Info.plist"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + LIBRARY_SEARCH_PATHS = ""; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + MACOSX_DEPLOYMENT_TARGET = 10.5; + ONLY_ACTIVE_ARCH_PRE_XCODE_3_1 = "$(NATIVE_ARCH_ACTUAL)"; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + SenTestingKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Tests; + SDKROOT = ""; + USER_HEADER_SEARCH_PATHS = ""; + WARNING_CFLAGS = ""; + WRAPPER_EXTENSION = octest; + ZERO_LINK = YES; + }; + name = Debug; + }; + D3C7D87E0A411FC0005DD154 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + COPY_PHASE_STRIP = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)", + "$(DEVELOPER_FRAMEWORKS_DIR_QUOTED)", + "$(FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1)", + ); + FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"/Library/Frameworks\""; + FRAMEWORK_SEARCH_PATHS_QUOTED_FOR_TARGET_1 = "\"$(SRCROOT)/frameworks\""; + GCC_C_LANGUAGE_STANDARD = "compiler-default"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_ENABLE_OBJC_GC = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = NO; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Cocoa.framework/Headers/Cocoa.h"; + GCC_VERSION = com.apple.compilers.llvmgcc42; + HEADER_SEARCH_PATHS = "$(LIBXML_PATH)"; + INFOPLIST_FILE = "test/Tests-Info.plist"; + INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; + LIBXML_PATH = "\"/usr/include/libxml2/\""; + OTHER_LDFLAGS = ( + "-framework", + Foundation, + "-framework", + SenTestingKit, + ); + PREBINDING = NO; + PRODUCT_NAME = Tests; + SDKROOT = ""; + WARNING_CFLAGS = ""; + WRAPPER_EXTENSION = octest; + ZERO_LINK = NO; + }; + name = Release; + }; + D3FDC5840FFC4BFC00F1F797 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKitMobile_Prefix.pch; + HEADER_SEARCH_PATHS = ""; + ONLY_ACTIVE_ARCH = YES; + PREBINDING = NO; + PRODUCT_NAME = parsekit; + SDKROOT = iphoneos3.0; + }; + name = Debug; + }; + D3FDC5850FFC4BFC00F1F797 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + EXECUTABLE_PREFIX = ""; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = ParseKitMobile_Prefix.pch; + HEADER_SEARCH_PATHS = ""; + OTHER_LDFLAGS = ""; + PREBINDING = NO; + PRODUCT_NAME = parsekit; + SDKROOT = iphoneos3.0; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "ParseKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91AE08733DA50010E9CD /* Debug */, + 1DEB91AF08733DA50010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ParseKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91B208733DA50010E9CD /* Debug */, + 1DEB91B308733DA50010E9CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D33494150E2963FE00406085 /* Build configuration list for PBXNativeTarget "DemoApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D33494130E2963FE00406085 /* Debug */, + D33494140E2963FE00406085 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D34185090E520D410081B0DC /* Build configuration list for PBXNativeTarget "DebugApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D34185070E520D410081B0DC /* Debug */, + D34185080E520D410081B0DC /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D389F1D20F1965E800558235 /* Build configuration list for PBXNativeTarget "JSParseKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D389F1D00F1965E800558235 /* Debug */, + D389F1D10F1965E800558235 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D389F2080F196A7600558235 /* Build configuration list for PBXNativeTarget "JSDemoApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D389F2060F196A7600558235 /* Debug */, + D389F2070F196A7600558235 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D3C7D87C0A411FC0005DD154 /* Build configuration list for PBXNativeTarget "Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3C7D87D0A411FC0005DD154 /* Debug */, + D3C7D87E0A411FC0005DD154 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + D3FDC62F0FFC4C2000F1F797 /* Build configuration list for PBXNativeTarget "ParseKitMobile" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3FDC5840FFC4BFC00F1F797 /* Debug */, + D3FDC5850FFC4BFC00F1F797 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; +/* End XCConfigurationList section */ + }; + rootObject = 0867D690FE84028FC02AAC07 /* Project object */; +} diff --git a/ParseKitMobile_Prefix.pch b/ParseKitMobile_Prefix.pch new file mode 100644 index 0000000..60e5b4c --- /dev/null +++ b/ParseKitMobile_Prefix.pch @@ -0,0 +1,5 @@ +#ifdef __OBJC__ + #import + #import + #import +#endif diff --git a/ParseKit_Prefix.pch b/ParseKit_Prefix.pch new file mode 100644 index 0000000..ec631e8 --- /dev/null +++ b/ParseKit_Prefix.pch @@ -0,0 +1,14 @@ +// +// Prefix header for all source files of the 'ParseKit' target in the 'ParseKit' project. +// + +#ifdef __OBJC__ + #import +#endif + +#if defined(MAC_OS_X_VERSION_10_6) && defined(TARGET_OS_MAC) + #define TARGET_OS_SNOW_LEOPARD +#endif + +#define PLATFORM(PK_FEATURE) (defined PK_PLATFORM_##PK_FEATURE && PK_PLATFORM_##PK_FEATURE) + diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..e69de29 diff --git a/debugapp/.svn/all-wcprops b/debugapp/.svn/all-wcprops new file mode 100644 index 0000000..ae14544 --- /dev/null +++ b/debugapp/.svn/all-wcprops @@ -0,0 +1,47 @@ +K 25 +svn:wc:ra_dav:version-url +V 33 +/svn/!svn/ver/1405/trunk/debugapp +END +main.m +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/!svn/ver/583/trunk/debugapp/main.m +END +DebugAppMainMenu.xib +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/647/trunk/debugapp/DebugAppMainMenu.xib +END +JSONAssembler.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1405/trunk/debugapp/JSONAssembler.m +END +DebugAppDelegate.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1171/trunk/debugapp/DebugAppDelegate.h +END +DebugApp-Info.plist +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1173/trunk/debugapp/DebugApp-Info.plist +END +DebugAppDelegate.m +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1365/trunk/debugapp/DebugAppDelegate.m +END +JSONAssembler.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1171/trunk/debugapp/JSONAssembler.h +END diff --git a/debugapp/.svn/entries b/debugapp/.svn/entries new file mode 100644 index 0000000..310e646 --- /dev/null +++ b/debugapp/.svn/entries @@ -0,0 +1,273 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/debugapp +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + + + + + + +0 + +main.m +file + + + + +2009-06-16T06:56:24.000000Z +fb19bae94920d49fd7c1459593d19bf3 +2009-01-11T01:15:32.782160Z +583 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +256 + +DebugAppMainMenu.xib +file + + + + +2009-01-21T20:59:46.000000Z +03ecb4bb9b7274244a359af9e9116fc5 +2009-01-21T19:56:44.943333Z +647 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +153676 + +JSONAssembler.m +file + + + + +2009-11-13T07:14:30.000000Z +875a47aff9e3f18fcc8e97569e1b3bd3 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +6095 + +DebugAppDelegate.h +file + + + + +2009-07-03T19:31:31.000000Z +6613e707e43f42ae0bcd0c50db743bd4 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +343 + +DebugApp-Info.plist +file + + + + +2009-07-03T20:30:15.000000Z +84e79a9792ef7d7c36e888315f843322 +2009-07-03T20:39:51.719779Z +1173 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +756 + +DebugAppDelegate.m +file + + + + +2009-09-04T02:11:38.000000Z +ac89521d384479682eabd8290dc861ee +2009-09-04T02:11:47.318283Z +1365 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +18661 + +JSONAssembler.h +file + + + + +2009-07-03T19:31:30.000000Z +cae2b7069c00d1a5a53c923b1cb9f16d +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +868 + diff --git a/debugapp/.svn/text-base/DebugApp-Info.plist.svn-base b/debugapp/.svn/text-base/DebugApp-Info.plist.svn-base new file mode 100644 index 0000000..9bfec49 --- /dev/null +++ b/debugapp/.svn/text-base/DebugApp-Info.plist.svn-base @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + DebugAppMainMenu + NSPrincipalClass + NSApplication + + diff --git a/debugapp/.svn/text-base/DebugAppDelegate.h.svn-base b/debugapp/.svn/text-base/DebugAppDelegate.h.svn-base new file mode 100644 index 0000000..73ad6d8 --- /dev/null +++ b/debugapp/.svn/text-base/DebugAppDelegate.h.svn-base @@ -0,0 +1,17 @@ +// +// DebugAppDelegate.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/12/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface DebugAppDelegate : NSObject { + NSAttributedString *displayString; +} +- (IBAction)run:(id)sender; + +@property (retain) NSAttributedString *displayString; +@end diff --git a/debugapp/.svn/text-base/DebugAppDelegate.m.svn-base b/debugapp/.svn/text-base/DebugAppDelegate.m.svn-base new file mode 100644 index 0000000..79f7c52 --- /dev/null +++ b/debugapp/.svn/text-base/DebugAppDelegate.m.svn-base @@ -0,0 +1,510 @@ +// +// DebugAppDelegate.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/12/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "DebugAppDelegate.h" +#import +#import "PKParserFactory.h" +#import "TDJsonParser.h" +#import "TDFastJsonParser.h" +#import "TDRegularParser.h" +#import "EBNFParser.h" +#import "TDPlistParser.h" +#import "TDXmlNameState.h" +#import "TDXmlToken.h" +#import "TDHtmlSyntaxHighlighter.h" +#import "JSONAssembler.h" +#import "TDMiniCSSAssembler.h" +#import "TDGenericAssembler.h" +#import "NSArray+ParseKitAdditions.h" +#import "TDSyntaxHighlighter.h" +#import "TDJavaScriptParser.h" +#import "TDNSPredicateEvaluator.h" +#import + +@protocol TDMockAssember +- (void)didMatchFoo:(PKAssembly *)a; +- (void)didMatchBaz:(PKAssembly *)a; +- (void)didMatchStart:(PKAssembly *)a; +- (void)didMatchStart:(PKAssembly *)a; +- (void)didMatch_Start:(PKAssembly *)a; +@end + +@interface PKParserFactory () +- (PKSequence *)parserFromExpression:(NSString *)s; +@property (retain) PKCollectionParser *expressionParser; +@end + +@implementation DebugAppDelegate + +- (void)dealloc { + self.displayString = nil; + [super dealloc]; +} + + +- (void)doPlistParser { + NSString *s = nil; + PKTokenAssembly *a = nil; + PKAssembly *res = nil; + TDPlistParser *p = nil; + + p = [[[TDPlistParser alloc] init] autorelease]; + + s = @"{" + @" 0 = 0;" + @" dictKey = {" + @" bar = foo;" + @" };" + @" 47 = 0;" + @" IntegerKey = 1;" + @" 47.7 = 0;" + @" = ;" + @" ArrayKey = (" + @" \"one one\"," + @" two," + @" three" + @" );" + @" \"Null Key\" = ;" + @" emptyDictKey = {" + @" };" + @" StringKey = String;" + @" \"1.0\" = 1;" + @" YESKey = 1;" + @" \"NO Key\" = 0;" + @"}"; + + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + + id attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSColor whiteColor], NSForegroundColorAttributeName, + [NSFont fontWithName:@"Monaco" size:12.], NSFontAttributeName, + nil]; + id dict = [res pop]; + + p.tokenizer.string = [[[dict description] copy] autorelease]; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser bestMatchFor:a]; + dict = [res pop]; + + p.tokenizer.string = nil; // prevent retain cycle leak + s = [[[dict description] copy] autorelease]; + + self.displayString = [[[NSAttributedString alloc] initWithString:s attributes:attrs] autorelease]; +} + + +- (void)doHtmlSyntaxHighlighter { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"nyt" ofType:@"html"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + //NSString *s = @"ア"; + + TDHtmlSyntaxHighlighter *highlighter = [[TDHtmlSyntaxHighlighter alloc] initWithAttributesForDarkBackground:YES]; + NSAttributedString *o = [highlighter attributedStringForString:s]; + //NSLog(@"o: %@", [o string]); + self.displayString = o; + [highlighter release]; +} + + +- (void)doJsonParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + TDJsonParser *p = [[[TDJsonParser alloc] init] autorelease]; +// TDFastJsonParser *p = [[[TDFastJsonParser alloc] init] autorelease]; + + id result = nil; + + @try { + result = [p parse:s]; + } @catch (NSException *e) { + NSLog(@"\n\n\nexception:\n\n %@", [e reason]); + } + NSLog(@"result %@", result); +} + + +- (void)doEBNFParser { + //NSString *s = @"foo (bar|baz)*;"; + NSString *s = @"$baz = bar; ($baz|foo)*;"; + //NSString *s = @"foo;"; + EBNFParser *p = [[[EBNFParser alloc] init] autorelease]; + + // PKAssembly *a = [p bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + // NSLog(@"a: %@", a); + // NSLog(@"a.target: %@", a.target); + + PKParser *res = [p parse:s]; + // NSLog(@"res: %@", res); + // NSLog(@"res: %@", res.string); + // NSLog(@"res.subparsers: %@", res.subparsers); + // NSLog(@"res.subparsers 0: %@", [[res.subparsers objectAtIndex:0] string]); + // NSLog(@"res.subparsers 1: %@", [[res.subparsers objectAtIndex:1] string]); + + s = @"bar foo bar foo"; + PKAssembly *a = [res completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + NSLog(@"\n\na: %@\n\n", a); +} + + +- (void)doGrammarParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; +// s = @"@start = openCurly closeCurly; openCurly = '{'; closeCurly = '}';"; +// s = @"@start = start*; start = 'bar';"; + + PKParserFactory *factory = [PKParserFactory factory]; + + JSONAssembler *ass = [[[JSONAssembler alloc] init] autorelease]; + PKParser *lp = [factory parserFromGrammar:s assembler:ass]; + + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + +// s = @"bar bar"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:t]; + a.preservesWhitespaceTokens = YES; + //PKAssembly *res = + [lp completeMatchFor:a]; + + self.displayString = ass.displayString; +} + + +- (void)doJavaScriptGrammarParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"javascript" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKParser *p = [[PKParserFactory factory] parserFromGrammar:s assembler:nil]; + //PKParser *plus = [p parserNamed:@"plus"]; + + s = @";"; + p.tokenizer.string = s; + //PKAssembly *a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + //PKAssembly *res = [p bestMatchFor:a]; + // TDEqualObjects(@"[var, foo, =, 'bar', ;]var/foo/=/bar/;^", [res description]); +} + + +- (void)doProf { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json_with_discards" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + NSDate *start = [NSDate date]; + while ((tok = [t nextToken]) != eof) ; + CGFloat ms4tok = -([start timeIntervalSinceNow]); + + PKParserFactory *factory = [PKParserFactory factory]; + TDJsonParser *p = nil; + + p = [[[TDJsonParser alloc] initWithIntentToAssemble:NO] autorelease]; + + //JSONAssembler *assembler = [[[JSONAssembler alloc] init] autorelease]; + start = [NSDate date]; + PKParser *lp = [factory parserFromGrammar:s assembler:p]; + CGFloat ms4grammar = -([start timeIntervalSinceNow]); + + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + start = [NSDate date]; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + a = [lp completeMatchFor:a]; + CGFloat ms4json = -([start timeIntervalSinceNow]); + + PKReleaseSubparserTree(lp); + + p = [[TDJsonParser alloc] initWithIntentToAssemble:NO]; + start = [NSDate date]; + id res = [p parse:s]; + CGFloat ms4json2 = -([start timeIntervalSinceNow]); + [p release]; + + p = [[TDJsonParser alloc] initWithIntentToAssemble:YES]; + start = [NSDate date]; + res = [p parse:s]; + CGFloat ms4json3 = -([start timeIntervalSinceNow]); + [p release]; + + id fp = [[[TDFastJsonParser alloc] init] autorelease]; + start = [NSDate date]; + res = [fp parse:s]; + CGFloat ms4json4 = -([start timeIntervalSinceNow]); + + id attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont fontWithName:@"Monaco" size:14.], NSFontAttributeName, + [NSColor whiteColor], NSForegroundColorAttributeName, + nil]; + + s = [NSString stringWithFormat:@"tokenization: %f \n\ngrammar parse: %f sec\n\nlp json parse: %f sec\n\np json parse (not assembled): %f sec\n\np json parse (assembled): %f sec\n\nfast json parse (assembled): %f sec\n\n %f", ms4tok, ms4grammar, ms4json, ms4json2, ms4json3, ms4json4, (ms4json3/ms4json4)]; + self.displayString = [[[NSMutableAttributedString alloc] initWithString:s attributes:attrs] autorelease]; +} + + +- (void)doTokenize { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + NSDate *start = [NSDate date]; + while ((tok = [t nextToken]) != eof) ; + CGFloat secs = -([start timeIntervalSinceNow]); + + id attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont fontWithName:@"Monaco" size:14.], NSFontAttributeName, + [NSColor whiteColor], NSForegroundColorAttributeName, + nil]; + + s = [NSString stringWithFormat:@"tokenize: %f", secs]; + self.displayString = [[[NSMutableAttributedString alloc] initWithString:s attributes:attrs] autorelease]; +} + + +- (void)doSimpleCSS { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKParserFactory *factory = [PKParserFactory factory]; + + TDMiniCSSAssembler *assembler = [[[TDMiniCSSAssembler alloc] init] autorelease]; + PKParser *lp = [factory parserFromGrammar:s assembler:assembler]; + s = @"foo { color:rgb(111.0, 99.0, 255.0); }"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + a = [lp completeMatchFor:a]; + +} + + +- (void)doSimpleCSS2 { + PKParserFactory *factory = [PKParserFactory factory]; + + // create CSS parser + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + NSString *grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDMiniCSSAssembler *cssAssembler = [[[TDMiniCSSAssembler alloc] init] autorelease]; + PKParser *cssParser = [factory parserFromGrammar:grammarString assembler:cssAssembler]; + + // parse CSS + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"css"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + a = [cssParser bestMatchFor:a]; + + // get attributes from css + id attrs = cssAssembler.attributes; + + // create JSON Parser + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"grammar"]; + grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDGenericAssembler *genericAssembler = [[[TDGenericAssembler alloc] init] autorelease]; + + // give it the attrs from CSS + genericAssembler.attributes = attrs; + PKParser *jsonParser = [factory parserFromGrammar:grammarString assembler:genericAssembler]; + + // parse JSON + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + // take care to preseve the whitespace in the JSON + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + PKTokenAssembly *a1 = [PKTokenAssembly assemblyWithTokenizer:t]; + a1.preservesWhitespaceTokens = YES; +// [jsonParser completeMatchFor:a1]; +// self.displayString = genericAssembler.displayString; + self.displayString = [[jsonParser completeMatchFor:a1] target]; +} + + +- (void)doJSONHighlighting { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDSyntaxHighlighter *shc = [[[TDSyntaxHighlighter alloc] init] autorelease]; + self.displayString = [shc highlightedStringForString:s ofGrammar:@"json"]; +} + + +- (void)doCSSHighlighting { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"example" ofType:@"css"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDSyntaxHighlighter *shc = [[[TDSyntaxHighlighter alloc] init] autorelease]; + self.displayString = [shc highlightedStringForString:s ofGrammar:@"css"]; +} + + +- (void)doHTMLHighlighting { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"example" ofType:@"html"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDSyntaxHighlighter *shc = [[[TDSyntaxHighlighter alloc] init] autorelease]; + self.displayString = [shc highlightedStringForString:s ofGrammar:@"html"]; +} + + +- (void)doMultiLineComment { + NSString *s = @"/* foo */ "; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + t.commentState.reportsCommentTokens = YES; + //PKToken *tok = + [t nextToken]; +} + + +- (void)doRubyHashParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"rubyhash" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKParser *lp = [[PKParserFactory factory] parserFromGrammar:s assembler:nil]; + + s = @"{\"brand\"=>{\"name\"=>\"something\"," + @"\"logo\"=>#," + @"\"summary\"=>\"wee\", \"content\"=>\"woopy doo\"}, \"commit\"=>\"Save\"," + @"\"authenticity_token\"=>\"43a94d60304a7fb13a4ff61a5960461ce714e92b\"," + @"\"action\"=>\"create\", \"controller\"=>\"admin/brands\"}"; + + NSLog(@"%@", [lp parse:s]); +} + + + +- (void)doFactory { +// id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; +// PKParserFactory *factory = [PKParserFactory factory]; +// NSString *s = nil; +// s = @"@start = foo|baz; foo (didMatchFooAssembly:) = 'bar'; baz (didMatchBazAssembly:) = 'bat'"; +// factory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnExplicit; +// PKParser *lp = [factory parserFromGrammar:s assembler:mock]; +// +//// [[mock expect] didMatchBazAssembly:OCMOCK_ANY]; +//// NSString *s = @"bar bat"; +//// a = [PKTokenAssembly assemblyWithString:s]; +//// res = [lp completeMatchFor:a]; +//// TDEqualObjects(@"[bar, bat]bar/bat^", [res description]); +//// [mock verify]; + +// NSString *g = @"@delimitState = '$'; @delimitedString = '$' '%' nil; @start = DelimitedString('$', '%');"; +// PKParser *lp = [[PKParserFactory factory] parserFromGrammar:g assembler:nil]; +// +// NSString *s = @"$foo%"; +// PKTokenizer *t = lp.tokenizer; +// t.string = s; +// PKAssembly *res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"xpath1_0" ofType:@"grammar"]; + NSString *g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKParser *p = [[PKParserFactory factory] parserFromGrammar:g assembler:nil]; + PKTokenizer *t = p.tokenizer; + t.string = @"foo"; + //PKAssembly *res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + +} + + +- (void)doParenStuff { + NSString *s = @"-(ab+5)"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + +// TDTrue(tok.isSymbol); +// TDEqualObjects(tok.stringValue, @"-"); +// TDEquals((CGFloat)0.0, tok.floatValue); + + tok = [t nextToken]; +// TDTrue(tok.isSymbol); +// TDEqualObjects(tok.stringValue, @"("); +// TDEquals((CGFloat)0.0, tok.floatValue); +} + + +- (void)doDelimitedString { + NSString *s = @""; + + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + NSCharacterSet *cs = nil; + + [t setTokenizerState:t.delimitState from:'<' to:'<']; + [t.delimitState addStartMarker:@"" allowedCharacterSet:cs]; + +// PKToken *tok = [t nextToken]; + + //TDTrue(tok.isDelimitedString); + +} + + +- (void)doJSParser { + TDJavaScriptParser *jsp = [TDJavaScriptParser parser]; + NSString *s = @"for( ; true; true) {}"; + jsp.tokenizer.string = s; +// PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; +// id res = [jsp bestMatchFor:a]; + //TDEqualObjects([res description], @"['foo']'foo'^"); + + //TDEqualObjects([res description], @"[for, (, ;, true, ;, true, ), {, }]for/(/;/true/;/true/)/{/}^"); +} + + +- (void)doNSPredicateEvaluator { + //TDNSPredicateEvaluator *eval = [[[TDNSPredicateEvaluator alloc] initWithKeyPathResolver:nil] autorelease]; +} + + +- (void)doXMLParser { +// NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"xml" ofType:@"grammar"]; +// NSString *g = [NSString stringWithContentsOfFile:path]; +// PKParser *p = [[PKParserFactory factory] parserFromGrammar:g assembler:self]; +// PKTokenizer *t = p.tokenizer; +} + + + + +- (IBAction)run:(id)sender { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + +// [self doPlistParser]; +// [self doHtmlSyntaxHighlighter]; +// [self doJsonParser]; +// [self doRubyHashParser]; + +// [self doJSParser]; + + [self doProf]; + + //[self doJavaScriptGrammarParser]; + + // [self doTokenize]; +// [self doGrammarParser]; +// [self doSimpleCSS]; +// [self doSimpleCSS2]; +// [self doParenStuff]; + +// [self doJSONHighlighting]; +// [self doCSSHighlighting]; +// [self doHTMLHighlighting]; + +// [self doMultiLineComment]; +// [self doDelimitedString]; + +// [self doFactory]; + +// [self doXMLParser]; +// [self doNSPredicateEvaluator]; + + [pool drain]; +} + +@synthesize displayString; +@end diff --git a/debugapp/.svn/text-base/DebugAppMainMenu.xib.svn-base b/debugapp/.svn/text-base/DebugAppMainMenu.xib.svn-base new file mode 100644 index 0000000..b739318 --- /dev/null +++ b/debugapp/.svn/text-base/DebugAppMainMenu.xib.svn-base @@ -0,0 +1,3529 @@ + + + + 1050 + 9G55 + 677 + 949.43 + 353.00 + + YES + + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + NSFontManager + + + AMainMenu + + YES + + + DebugApp + + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + DebugApp + + YES + + + About DebugApp + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Services + + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 2147483647 + + + + + + Hide DebugApp + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Quit DebugApp + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Find + + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 2147483647 + + + + + + Check Grammar With Spelling + + 2147483647 + + + + + + + + + Substitutions + + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 2147483647 + + + + + + Stop Speaking + + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 2147483647 + + + + + + + + + Window + + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bring All to Front + + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 15 + 2 + {{479, 251}, {504, 447}} + 611844096 + Window + NSWindow + + {3.40282e+38, 3.40282e+38} + {484, 310} + + + 256 + + YES + + + 266 + {{14, 293}, {476, 32}} + + YES + + 67239424 + 134217728 + Run + + LucidaGrande + 1.300000e+01 + 1044 + + + -2038284033 + 129 + + DQ + 200 + 25 + + + + + 266 + {{17, 342}, {470, 85}} + + YES + + 67239424 + 272629760 + VGhlIHB1cnBvc2Ugb2YgdGhpcyBhcHBsaWNhdGlvbiBpcyBvbmx5IHRvIHJ1biBhcmJ0cmFyeSB0ZXN0 +IGNvZGUgaW4gIkRlYnVnIiBtb2RlIHVzaW5nIEdEQiBhbmQgYnJlYWtwb2ludHMgKHdoaWNoIGRvZXMg +bm90IHNlZW0gdG8gYmUgcG9zc2libGUgZm9tIHRoZSBVbml0VGVzdCBCdW5kbGUpLiBUbyB1c2UsIGNv +cHkgc29tZSB1bml0IHRlc3QgY29kZSBvdmVyIHRvIHRoZSAtW0RlYnVnQXBwRGVsZWdhdGUgcnVuOl0g +YWN0aW9uIG1ldGhvZCB3aGljaCBpcyBleGVjdXRlZCB3aGVuIHRoZSAiUnVuIiBidXR0b24gYmVsb3cg +aXMgY2xpY2tlZC4 + + LucidaGrande + 1.300000e+01 + 16 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 274 + + YES + + + 2304 + + YES + + + 2322 + {447, 96} + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda + + + YES + + YES + + YES + NSFont + NSParagraphStyle + + + YES + + LucidaGrande + 1.000000e+01 + 2843 + + + 3 + + YES + + 0.000000e+00 + + + 5.600000e+01 + + + 1.120000e+02 + + + 1.680000e+02 + + + 2.240000e+02 + + + 2.800000e+02 + + + 3.360000e+02 + + + 3.920000e+02 + + + 4.480000e+02 + + + 5.040000e+02 + + + 5.600000e+02 + + + 6.160000e+02 + + + 6.720000e+02 + + + 7.280000e+02 + + + 7.840000e+02 + + + 8.400000e+02 + + + 8.960000e+02 + + + 9.520000e+02 + + + 1.008000e+03 + + + 1.064000e+03 + + + 1.120000e+03 + + + 1.176000e+03 + + + 1.232000e+03 + + + 1.288000e+03 + + + 1.344000e+03 + + + 1.400000e+03 + + + 1.456000e+03 + + + 1.512000e+03 + + + 1.568000e+03 + + + 1.624000e+03 + + + 1.680000e+03 + + + 1.736000e+03 + + + + + + + YES + + YES + NSFont + NSParagraphStyle + + + YES + + LucidaGrande-Bold + 1.000000e+01 + 16 + + + 3 + + YES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GQAEAQgADAEiAAcBhAQAA + + + + + YES + + + 6 + + + + 4.470000e+02 + 1 + + + 11621 + + 1 + MC4xMTc2NDcwNiAwLjExNzY0NzA2IDAuMTQxMTc2NDgAA + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + 6 + System + selectedTextBackgroundColor + + + + 6 + System + selectedTextColor + + + + + + + YES + + YES + NSColor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + + + + + 6 + {3081, 1e+07} + {223, 0} + + + + {{1, 1}, {447, 259}} + + + + + 3 + MQA + + + {4, -5} + 1 + + 4 + + + + 256 + {{448, 1}, {15, 259}} + + + _doScroller: + 9.843750e-01 + + + + 256 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 + + + {{20, 20}, {464, 261}} + + + 18 + + + + + + {504, 447} + + + {{0, 0}, {1440, 878}} + {484, 332} + {3.40282e+38, 3.40282e+38} + + + DebugAppDelegate + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + terminate: + + + + 369 + + + + unhideAllApplications: + + + + 370 + + + + addFontTrait: + + + + 418 + + + + addFontTrait: + + + + 419 + + + + modifyFont: + + + + 420 + + + + orderFrontFontPanel: + + + + 421 + + + + modifyFont: + + + + 422 + + + + raiseBaseline: + + + + 423 + + + + lowerBaseline: + + + + 424 + + + + copyFont: + + + + 425 + + + + subscript: + + + + 426 + + + + superscript: + + + + 427 + + + + tightenKerning: + + + + 428 + + + + underline: + + + + 429 + + + + orderFrontColorPanel: + + + + 430 + + + + useAllLigatures: + + + + 431 + + + + loosenKerning: + + + + 432 + + + + pasteFont: + + + + 433 + + + + unscript: + + + + 434 + + + + useStandardKerning: + + + + 435 + + + + useStandardLigatures: + + + + 436 + + + + turnOffLigatures: + + + + 437 + + + + turnOffKerning: + + + + 438 + + + + alignLeft: + + + + 439 + + + + alignJustified: + + + + 440 + + + + copyRuler: + + + + 441 + + + + alignCenter: + + + + 442 + + + + toggleRuler: + + + + 443 + + + + alignRight: + + + + 444 + + + + pasteRuler: + + + + 445 + + + + run: + + + + 454 + + + + attributedString: displayString + + + + + + attributedString: displayString + attributedString + displayString + + NSContinuouslyUpdatesValue + + + 2 + + + 462 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + + + 373 + + + YES + + + + + + 374 + + + YES + + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + 377 + + + YES + + + + + + + + + + + + + 378 + + + + + 379 + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + YES + + + + + + + + + + + + + + + + + + + + + 387 + + + + + 388 + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + YES + + + + + + 396 + + + YES + + + + + + 397 + + + YES + + + + + + 398 + + + + + 399 + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + YES + + + + + + + + + + 404 + + + + + 405 + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + YES + + + + + + + + 410 + + + + + 411 + + + + + 412 + + + + + 413 + + + YES + + + + + + + + + 414 + + + + + 415 + + + + + 416 + + + + + 417 + + + + + 446 + + + YES + + + + + + 447 + + + YES + + + + + + + + 448 + + + + + 449 + + + YES + + + + + + 450 + + + + + 452 + + + YES + + + + + + 453 + + + + + 455 + + + YES + + + + + + + + 456 + + + + + 457 + + + + + 458 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBEditorWindowLastContentRect + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBEditorWindowLastContentRect + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBEditorWindowLastContentRect + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBEditorWindowLastContentRect + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBEditorWindowLastContentRect + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBPluginDependency + 373.IBPluginDependency + 374.IBPluginDependency + 375.IBPluginDependency + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 446.IBEditorWindowLastContentRect + 446.IBWindowTemplateEditedContentRect + 446.NSWindowTemplate.visibleAtLaunch + 446.windowTemplate.hasMinSize + 446.windowTemplate.minSize + 447.IBPluginDependency + 448.IBPluginDependency + 449.IBPluginDependency + 450.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 455.IBPluginDependency + 456.IBPluginDependency + 457.IBPluginDependency + 458.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + {{553, 524}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{479, 484}, {132, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{565, 284}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{322, 304}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{365, 632}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{565, 284}, {153, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{565, 284}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{798, 236}, {197, 73}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{490, 309}, {440, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{11, 977}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{432, 504}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{565, 284}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{511, 212}, {504, 447}} + {{511, 212}, {504, 447}} + + + {484, 310} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{556, 261}, {211, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{280, 344}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{323, 672}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 462 + + + + YES + + DebugAppDelegate + NSObject + + run: + id + + + IBProjectSource + debugapp/DebugAppDelegate.h + + + + NSObject + + IBProjectSource + test/XMLReader.h + + + + + 0 + ../TDParseKit.xcodeproj + 3 + + diff --git a/debugapp/.svn/text-base/JSONAssembler.h.svn-base b/debugapp/.svn/text-base/JSONAssembler.h.svn-base new file mode 100644 index 0000000..7bf1018 --- /dev/null +++ b/debugapp/.svn/text-base/JSONAssembler.h.svn-base @@ -0,0 +1,36 @@ +// +// JSONAssembler.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKToken; + +@interface JSONAssembler : NSObject { + NSMutableAttributedString *displayString; + id defaultAttrs; + id objectAttrs; + id arrayAttrs; + id propertyNameAttrs; + id valueAttrs; + id constantAttrs; + + PKToken *comma; + PKToken *curly; + PKToken *bracket; +} +@property (retain) NSMutableAttributedString *displayString; +@property (retain) id defaultAttrs; +@property (retain) id objectAttrs; +@property (retain) id arrayAttrs; +@property (retain) id propertyNameAttrs; +@property (retain) id valueAttrs; +@property (retain) id constantAttrs; +@property (retain) PKToken *comma; +@property (retain) PKToken *curly; +@property (retain) PKToken *bracket; +@end diff --git a/debugapp/.svn/text-base/JSONAssembler.m.svn-base b/debugapp/.svn/text-base/JSONAssembler.m.svn-base new file mode 100644 index 0000000..19641c4 --- /dev/null +++ b/debugapp/.svn/text-base/JSONAssembler.m.svn-base @@ -0,0 +1,163 @@ +// +// JSONAssembler.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "JSONAssembler.h" +#import "NSArray+ParseKitAdditions.h" +#import + +@implementation JSONAssembler + +- (id)init { + self = [super init]; + if (self != nil) { + NSColor *textColor = [NSColor whiteColor]; + NSColor *tagColor = [NSColor colorWithDeviceRed:.70 green:.14 blue:.53 alpha:1.]; + NSColor *attrNameColor = [NSColor colorWithDeviceRed:.33 green:.45 blue:.48 alpha:1.]; + NSColor *attrValueColor = [NSColor colorWithDeviceRed:.77 green:.18 blue:.20 alpha:1.]; + NSColor *commentColor = [NSColor colorWithDeviceRed:.24 green:.70 blue:.27 alpha:1.]; + NSColor *piColor = [NSColor colorWithDeviceRed:.09 green:.62 blue:.74 alpha:1.]; + + NSFont *monacoFont = [NSFont fontWithName:@"Monaco" size:11.]; + + self.defaultAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + textColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.objectAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + tagColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.propertyNameAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + attrNameColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.valueAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + attrValueColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.constantAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + piColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.arrayAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + commentColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + + self.displayString = [[[NSMutableAttributedString alloc] initWithString:@"" attributes:defaultAttrs] autorelease]; + + self.comma = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"," floatValue:0]; + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0]; + self.bracket = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"[" floatValue:0]; + } + return self; +} + + +- (void)dealloc { + self.displayString = nil; + self.defaultAttrs = nil; + self.objectAttrs = nil; + self.arrayAttrs = nil; + self.propertyNameAttrs = nil; + self.valueAttrs = nil; + self.constantAttrs = nil; + self.comma = nil; + self.curly = nil; + self.bracket = nil; + [super dealloc]; +} + + +- (void)appendAttributedStringForObjects:(NSArray *)objs withAttrs:(id)attrs { + for (id obj in objs) { + NSAttributedString *as = [[NSAttributedString alloc] initWithString:[obj stringValue] attributes:attrs]; + [displayString appendAttributedString:as]; + [as release]; + } +} + + +- (void)consumeWhitespaceFrom:(PKAssembly *)a { + NSMutableArray *whitespaceToks = [NSMutableArray array]; + PKToken *tok = nil; + while (1) { + tok = [a pop]; + if (PKTokenTypeWhitespace == tok.tokenType) { + [whitespaceToks addObject:tok]; + } else { + [a push:tok]; + break; + } + } + + if ([whitespaceToks count]) { + whitespaceToks = [whitespaceToks reversedMutableArray]; + [self appendAttributedStringForObjects:whitespaceToks withAttrs:defaultAttrs]; + } +} + + +- (void)didMatchSymbolChar:(PKAssembly *)a { + NSArray *objs = [NSArray arrayWithObject:[a pop]]; + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:objs withAttrs:objectAttrs]; +} + + +- (void)didMatchPropertyName:(PKAssembly *)a { + NSArray *objs = [NSArray arrayWithObject:[a pop]]; + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:objs withAttrs:propertyNameAttrs]; +} + + +- (void)didMatchString:(PKAssembly *)a { + NSArray *objs = [NSArray arrayWithObject:[a pop]]; + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:objs withAttrs:arrayAttrs]; +} + + +- (void)didMatchNumber:(PKAssembly *)a { + NSArray *objs = [NSArray arrayWithObject:[a pop]]; + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:objs withAttrs:valueAttrs]; +} + + +- (void)didMatchConstant:(PKAssembly *)a { + NSArray *objs = [NSArray arrayWithObject:[a pop]]; + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:objs withAttrs:constantAttrs]; +} + + +- (void)didMatchNull:(PKAssembly *)a { [self didMatchConstant:a]; } +- (void)didMatchTrue:(PKAssembly *)a { [self didMatchConstant:a]; } +- (void)didMatchFalse:(PKAssembly *)a { [self didMatchConstant:a]; } + +- (void)didMatchColon:(PKAssembly *)a { [self didMatchSymbolChar:a]; } +- (void)didMatchComma:(PKAssembly *)a { [self didMatchSymbolChar:a]; } +- (void)didMatchOpenCurly:(PKAssembly *)a { [self didMatchSymbolChar:a]; } +- (void)didMatchCloseCurly:(PKAssembly *)a { [self didMatchSymbolChar:a]; } +- (void)didMatchOpenBracket:(PKAssembly *)a { [self didMatchSymbolChar:a]; } +- (void)didMatchCloseBracket:(PKAssembly *)a { [self didMatchSymbolChar:a]; } + +@synthesize displayString; +@synthesize defaultAttrs; +@synthesize objectAttrs; +@synthesize arrayAttrs; +@synthesize propertyNameAttrs; +@synthesize valueAttrs; +@synthesize constantAttrs; +@synthesize comma; +@synthesize curly; +@synthesize bracket; +@end + diff --git a/debugapp/.svn/text-base/main.m.svn-base b/debugapp/.svn/text-base/main.m.svn-base new file mode 100644 index 0000000..ec133b9 --- /dev/null +++ b/debugapp/.svn/text-base/main.m.svn-base @@ -0,0 +1,13 @@ +// +// main.m +// TestApp +// +// Created by Todd Ditchendorf on 7/12/08. +// Copyright Todd Ditchendorf 2008. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) { + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/debugapp/.svn/tmp/tempfile.tmp b/debugapp/.svn/tmp/tempfile.tmp new file mode 100644 index 0000000..fd75b38 --- /dev/null +++ b/debugapp/.svn/tmp/tempfile.tmp @@ -0,0 +1,433 @@ +// +// DebugAppDelegate.m +// TDParseKit +// +// Created by Todd Ditchendorf on 8/12/08. +// Copyright 2008 Todd Ditchendorf. All rights reserved. +// + +#import "DebugAppDelegate.h" +#import +#import "TDJsonParser.h" +#import "TDFastJsonParser.h" +#import "TDRegularParser.h" +#import "EBNFParser.h" +#import "TDPlistParser.h" +#import "TDXmlNameState.h" +#import "TDXmlToken.h" +#import "TDHtmlSyntaxHighlighter.h" +#import "TDParserFactory.h" +#import "JSONAssembler.h" +#import "TDMiniCSSAssembler.h" +#import "TDGenericAssembler.h" +#import "NSArray+TDParseKitAdditions.h" +#import "TDSyntaxHighlighter.h" +#import + +@protocol TDMockAssember +- (void)workOnFooAssembly:(TDAssembly *)a; +- (void)workOnBazAssembly:(TDAssembly *)a; +- (void)workOnStart:(TDAssembly *)a; +- (void)workOnStartAssembly:(TDAssembly *)a; +- (void)workOn_StartAssembly:(TDAssembly *)a; +@end + +@interface TDParserFactory () +- (TDSequence *)parserFromExpression:(NSString *)s; +@property (retain) TDCollectionParser *expressionParser; +@end + +@implementation DebugAppDelegate + +- (void)dealloc { + self.displayString = nil; + [super dealloc]; +} + + +- (void)doPlistParser { + NSString *s = nil; + TDTokenAssembly *a = nil; + TDAssembly *res = nil; + TDPlistParser *p = nil; + + p = [[[TDPlistParser alloc] init] autorelease]; + + s = @"{" + @" 0 = 0;" + @" dictKey = {" + @" bar = foo;" + @" };" + @" 47 = 0;" + @" IntegerKey = 1;" + @" 47.7 = 0;" + @" = ;" + @" ArrayKey = (" + @" \"one one\"," + @" two," + @" three" + @" );" + @" \"Null Key\" = ;" + @" emptyDictKey = {" + @" };" + @" StringKey = String;" + @" \"1.0\" = 1;" + @" YESKey = 1;" + @" \"NO Key\" = 0;" + @"}"; + + p.tokenizer.string = s; + a = [TDTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + + id attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSColor whiteColor], NSForegroundColorAttributeName, + [NSFont fontWithName:@"Monaco" size:12.], NSFontAttributeName, + nil]; + id dict = [res pop]; + + p.tokenizer.string = [[[dict description] copy] autorelease]; + a = [TDTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser bestMatchFor:a]; + dict = [res pop]; + + p.tokenizer.string = nil; // prevent retain cycle leak + s = [[[dict description] copy] autorelease]; + + self.displayString = [[[NSAttributedString alloc] initWithString:s attributes:attrs] autorelease]; +} + + +- (void)doHtmlSyntaxHighlighter { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"nyt" ofType:@"html"]; + NSString *s = [NSString stringWithContentsOfFile:path]; + //NSString *s = @"ア"; + + TDHtmlSyntaxHighlighter *highlighter = [[TDHtmlSyntaxHighlighter alloc] initWithAttributesForDarkBackground:YES]; + NSAttributedString *o = [highlighter attributedStringForString:s]; + //NSLog(@"o: %@", [o string]); + self.displayString = o; + [highlighter release]; +} + + +- (void)doJsonParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path]; + + TDJsonParser *p = [[[TDJsonParser alloc] init] autorelease]; +// TDFastJsonParser *p = [[[TDFastJsonParser alloc] init] autorelease]; + + id result = nil; + + @try { + result = [p parse:s]; + } @catch (NSException *e) { + NSLog(@"\n\n\nexception:\n\n %@", [e reason]); + } + NSLog(@"result %@", result); +} + + +- (void)doEBNFParser { + //NSString *s = @"foo (bar|baz)*;"; + NSString *s = @"$baz = bar; ($baz|foo)*;"; + //NSString *s = @"foo;"; + EBNFParser *p = [[[EBNFParser alloc] init] autorelease]; + + // TDAssembly *a = [p bestMatchFor:[TDTokenAssembly assemblyWithString:s]]; + // NSLog(@"a: %@", a); + // NSLog(@"a.target: %@", a.target); + + TDParser *res = [p parse:s]; + // NSLog(@"res: %@", res); + // NSLog(@"res: %@", res.string); + // NSLog(@"res.subparsers: %@", res.subparsers); + // NSLog(@"res.subparsers 0: %@", [[res.subparsers objectAtIndex:0] string]); + // NSLog(@"res.subparsers 1: %@", [[res.subparsers objectAtIndex:1] string]); + + s = @"bar foo bar foo"; + TDAssembly *a = [res completeMatchFor:[TDTokenAssembly assemblyWithString:s]]; + NSLog(@"\n\na: %@\n\n", a); +} + + +- (void)doGrammarParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path]; +// s = @"@start = openCurly closeCurly; openCurly = '{'; closeCurly = '}';"; +// s = @"@start = start*; start = 'bar';"; + + TDParserFactory *factory = [TDParserFactory factory]; + + JSONAssembler *ass = [[[JSONAssembler alloc] init] autorelease]; + TDParser *lp = [factory parserFromGrammar:s assembler:ass]; + + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path]; + +// s = @"bar bar"; + TDTokenizer *t = [TDTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + TDTokenAssembly *a = [TDTokenAssembly assemblyWithTokenizer:t]; + a.preservesWhitespaceTokens = YES; + //TDAssembly *res = + [lp completeMatchFor:a]; + + self.displayString = ass.displayString; +} + + +- (void)doProf { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json_with_discards" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path]; + TDTokenizer *t = [TDTokenizer tokenizerWithString:s]; + TDToken *eof = [TDToken EOFToken]; + TDToken *tok = nil; + NSDate *start = [NSDate date]; + while ((tok = [t nextToken]) != eof) ; + CGFloat ms4tok = -([start timeIntervalSinceNow]); + + TDParserFactory *factory = [TDParserFactory factory]; + TDJsonParser *p = nil; + + p = [[[TDJsonParser alloc] initWithIntentToAssemble:NO] autorelease]; + + //JSONAssembler *assembler = [[[JSONAssembler alloc] init] autorelease]; + start = [NSDate date]; + TDParser *lp = [factory parserFromGrammar:s assembler:p]; + CGFloat ms4grammar = -([start timeIntervalSinceNow]); + + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path]; + + start = [NSDate date]; + TDAssembly *a = [TDTokenAssembly assemblyWithString:s]; + a = [lp completeMatchFor:a]; + CGFloat ms4json = -([start timeIntervalSinceNow]); + + p = [[TDJsonParser alloc] initWithIntentToAssemble:NO]; + start = [NSDate date]; + id res = [p parse:s]; + CGFloat ms4json2 = -([start timeIntervalSinceNow]); + [p release]; + + p = [[TDJsonParser alloc] initWithIntentToAssemble:YES]; + start = [NSDate date]; + res = [p parse:s]; + CGFloat ms4json3 = -([start timeIntervalSinceNow]); + [p release]; + + id fp = [[[TDFastJsonParser alloc] init] autorelease]; + start = [NSDate date]; + res = [fp parse:s]; + CGFloat ms4json4 = -([start timeIntervalSinceNow]); + + id attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont fontWithName:@"Monaco" size:14.], NSFontAttributeName, + [NSColor whiteColor], NSForegroundColorAttributeName, + nil]; + + s = [NSString stringWithFormat:@"tokenization: %f \n\ngrammar parse: %f sec\n\nlp json parse: %f sec\n\np json parse (not assembled): %f sec\n\np json parse (assembled): %f sec\n\nfast json parse (assembled): %f sec\n\n %f", ms4tok, ms4grammar, ms4json, ms4json2, ms4json3, ms4json4, (ms4json3/ms4json4)]; + self.displayString = [[[NSMutableAttributedString alloc] initWithString:s attributes:attrs] autorelease]; +} + + +- (void)doTokenize { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path]; + + TDTokenizer *t = [TDTokenizer tokenizerWithString:s]; + TDToken *eof = [TDToken EOFToken]; + TDToken *tok = nil; + + NSDate *start = [NSDate date]; + while ((tok = [t nextToken]) != eof) ; + CGFloat secs = -([start timeIntervalSinceNow]); + + id attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont fontWithName:@"Monaco" size:14.], NSFontAttributeName, + [NSColor whiteColor], NSForegroundColorAttributeName, + nil]; + + s = [NSString stringWithFormat:@"tokenize: %f", secs]; + self.displayString = [[[NSMutableAttributedString alloc] initWithString:s attributes:attrs] autorelease]; +} + + +- (void)doSimpleCSS { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path]; + TDParserFactory *factory = [TDParserFactory factory]; + + TDMiniCSSAssembler *assembler = [[[TDMiniCSSAssembler alloc] init] autorelease]; + TDParser *lp = [factory parserFromGrammar:s assembler:assembler]; + s = @"foo { color:rgb(111.0, 99.0, 255.0); }"; + TDAssembly *a = [TDTokenAssembly assemblyWithString:s]; + a = [lp completeMatchFor:a]; + +} + + +- (void)doSimpleCSS2 { + TDParserFactory *factory = [TDParserFactory factory]; + + // create CSS parser + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + NSString *grammarString = [NSString stringWithContentsOfFile:path]; + TDMiniCSSAssembler *cssAssembler = [[[TDMiniCSSAssembler alloc] init] autorelease]; + TDParser *cssParser = [factory parserFromGrammar:grammarString assembler:cssAssembler]; + + // parse CSS + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"css"]; + NSString *s = [NSString stringWithContentsOfFile:path]; + TDAssembly *a = [TDTokenAssembly assemblyWithString:s]; + a = [cssParser bestMatchFor:a]; + + // get attributes from css + id attrs = cssAssembler.attributes; + + // create JSON Parser + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"grammar"]; + grammarString = [NSString stringWithContentsOfFile:path]; + TDGenericAssembler *genericAssembler = [[[TDGenericAssembler alloc] init] autorelease]; + + // give it the attrs from CSS + genericAssembler.attributes = attrs; + TDParser *jsonParser = [factory parserFromGrammar:grammarString assembler:genericAssembler]; + + // parse JSON + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path]; + + // take care to preseve the whitespace in the JSON + TDTokenizer *t = [TDTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + TDTokenAssembly *a1 = [TDTokenAssembly assemblyWithTokenizer:t]; + a1.preservesWhitespaceTokens = YES; + [jsonParser completeMatchFor:a1]; + + self.displayString = genericAssembler.displayString; +} + + +- (void)doJSONHighlighting { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path]; + TDSyntaxHighlighter *shc = [[[TDSyntaxHighlighter alloc] init] autorelease]; + self.displayString = [shc highlightedStringForString:s ofGrammar:@"json"]; +} + + +- (void)doCSSHighlighting { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"example" ofType:@"css"]; + NSString *s = [NSString stringWithContentsOfFile:path]; + TDSyntaxHighlighter *shc = [[[TDSyntaxHighlighter alloc] init] autorelease]; + self.displayString = [shc highlightedStringForString:s ofGrammar:@"css"]; +} + + +- (void)doHTMLHighlighting { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"example" ofType:@"html"]; + NSString *s = [NSString stringWithContentsOfFile:path]; + TDSyntaxHighlighter *shc = [[[TDSyntaxHighlighter alloc] init] autorelease]; + self.displayString = [shc highlightedStringForString:s ofGrammar:@"html"]; +} + + +- (void)doMultiLineComment { + NSString *s = @"/* foo */ "; + TDTokenizer *t = [TDTokenizer tokenizerWithString:s]; + t.commentState.reportsCommentTokens = YES; + //TDToken *tok = + [t nextToken]; +} + + +- (void)doRubyHashParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"rubyhash" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path]; + TDTokenizer *t = nil; + TDParser *lp = [[TDParserFactory factory] parserFromGrammar:s assembler:nil getTokenizer:&t]; + + s = @"{\"brand\"=>{\"name\"=>\"something\"," + @"\"logo\"=>#," + @"\"summary\"=>\"wee\", \"content\"=>\"woopy doo\"}, \"commit\"=>\"Save\"," + @"\"authenticity_token\"=>\"43a94d60304a7fb13a4ff61a5960461ce714e92b\"," + @"\"action\"=>\"create\", \"controller\"=>\"admin/brands\"}"; + + t.string = s; //@"{\"foo\"=>\"bar\"}"; + t.commentState.reportsCommentTokens = YES; + + TDAssembly *a = [TDTokenAssembly assemblyWithTokenizer:t]; + TDAssembly *res = [lp bestMatchFor:a]; + NSLog(@"%@", res); +} + + + +- (void)doFactory { +// id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; +// TDParserFactory *factory = [TDParserFactory factory]; +// NSString *s = nil; +// s = @"@start = foo|baz; foo (workOnFooAssembly:) = 'bar'; baz (workOnBazAssembly:) = 'bat'"; +// factory.assemblerSettingBehavior = TDParserFactoryAssemblerSettingBehaviorOnExplicit; +// TDParser *lp = [factory parserFromGrammar:s assembler:mock]; +// +//// [[mock expect] workOnBazAssembly:OCMOCK_ANY]; +//// NSString *s = @"bar bat"; +//// a = [TDTokenAssembly assemblyWithString:s]; +//// res = [lp completeMatchFor:a]; +//// TDEqualObjects(@"[bar, bat]bar/bat^", [res description]); +//// [mock verify]; +} + + +- (void)doParenStuff { + NSString *s = @"-(ab+5)"; + TDTokenizer *t = [TDTokenizer tokenizerWithString:s]; + + TDToken *tok = [t nextToken]; + +// TDTrue(tok.isSymbol); +// TDEqualObjects(tok.stringValue, @"-"); +// TDEquals((CGFloat)0.0, tok.floatValue); + + tok = [t nextToken]; +// TDTrue(tok.isSymbol); +// TDEqualObjects(tok.stringValue, @"("); +// TDEquals((CGFloat)0.0, tok.floatValue); +} + + +- (IBAction)run:(id)sender { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + +// [self doPlistParser]; +// [self doHtmlSyntaxHighlighter]; +// [self doJsonParser]; +<<<<<<< .mine +// [self doProf]; +======= + [self doRubyHashParser]; +// [self doProf]; +>>>>>>> .r657 +// [self doTokenize]; +// [self doGrammarParser]; +// [self doSimpleCSS]; +// [self doSimpleCSS2]; +// [self doParenStuff]; + + [self doJSONHighlighting]; +// [self doCSSHighlighting]; +// [self doHTMLHighlighting]; + +// [self doMultiLineComment]; + + [self doFactory]; + + [pool drain]; +} + +@synthesize displayString; +@end diff --git a/debugapp/DebugApp-Info.plist b/debugapp/DebugApp-Info.plist new file mode 100644 index 0000000..9bfec49 --- /dev/null +++ b/debugapp/DebugApp-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + DebugAppMainMenu + NSPrincipalClass + NSApplication + + diff --git a/debugapp/DebugAppDelegate.h b/debugapp/DebugAppDelegate.h new file mode 100644 index 0000000..64494c3 --- /dev/null +++ b/debugapp/DebugAppDelegate.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface DebugAppDelegate : NSObject { + NSAttributedString *displayString; +} +- (IBAction)run:(id)sender; + +@property (retain) NSAttributedString *displayString; +@end diff --git a/debugapp/DebugAppDelegate.m b/debugapp/DebugAppDelegate.m new file mode 100644 index 0000000..aa63730 --- /dev/null +++ b/debugapp/DebugAppDelegate.m @@ -0,0 +1,516 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "DebugAppDelegate.h" +#import +#import "PKParserFactory.h" +#import "TDJsonParser.h" +#import "TDFastJsonParser.h" +#import "TDRegularParser.h" +#import "EBNFParser.h" +#import "TDPlistParser.h" +#import "TDXmlNameState.h" +#import "TDXmlToken.h" +#import "TDHtmlSyntaxHighlighter.h" +#import "JSONAssembler.h" +#import "TDMiniCSSAssembler.h" +#import "TDGenericAssembler.h" +#import "NSArray+ParseKitAdditions.h" +#import "TDSyntaxHighlighter.h" +#import "TDJavaScriptParser.h" +#import "TDNSPredicateEvaluator.h" +#import + +@protocol TDMockAssember +- (void)didMatchFoo:(PKAssembly *)a; +- (void)didMatchBaz:(PKAssembly *)a; +- (void)didMatchStart:(PKAssembly *)a; +- (void)didMatchStart:(PKAssembly *)a; +- (void)didMatch_Start:(PKAssembly *)a; +@end + +@interface PKParserFactory () +- (PKSequence *)parserFromExpression:(NSString *)s; +@property (retain) PKCollectionParser *expressionParser; +@end + +@implementation DebugAppDelegate + +- (void)dealloc { + self.displayString = nil; + [super dealloc]; +} + + +- (void)doPlistParser { + NSString *s = nil; + PKTokenAssembly *a = nil; + PKAssembly *res = nil; + TDPlistParser *p = nil; + + p = [[[TDPlistParser alloc] init] autorelease]; + + s = @"{" + @" 0 = 0;" + @" dictKey = {" + @" bar = foo;" + @" };" + @" 47 = 0;" + @" IntegerKey = 1;" + @" 47.7 = 0;" + @" = ;" + @" ArrayKey = (" + @" \"one one\"," + @" two," + @" three" + @" );" + @" \"Null Key\" = ;" + @" emptyDictKey = {" + @" };" + @" StringKey = String;" + @" \"1.0\" = 1;" + @" YESKey = 1;" + @" \"NO Key\" = 0;" + @"}"; + + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + + id attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSColor whiteColor], NSForegroundColorAttributeName, + [NSFont fontWithName:@"Monaco" size:12.], NSFontAttributeName, + nil]; + id dict = [res pop]; + + p.tokenizer.string = [[[dict description] copy] autorelease]; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser bestMatchFor:a]; + dict = [res pop]; + + p.tokenizer.string = nil; // prevent retain cycle leak + s = [[[dict description] copy] autorelease]; + + self.displayString = [[[NSAttributedString alloc] initWithString:s attributes:attrs] autorelease]; +} + + +- (void)doHtmlSyntaxHighlighter { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"nyt" ofType:@"html"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + //NSString *s = @"ア"; + + TDHtmlSyntaxHighlighter *highlighter = [[TDHtmlSyntaxHighlighter alloc] initWithAttributesForDarkBackground:YES]; + NSAttributedString *o = [highlighter attributedStringForString:s]; + //NSLog(@"o: %@", [o string]); + self.displayString = o; + [highlighter release]; +} + + +- (void)doJsonParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + TDJsonParser *p = [[[TDJsonParser alloc] init] autorelease]; +// TDFastJsonParser *p = [[[TDFastJsonParser alloc] init] autorelease]; + + id result = nil; + + @try { + result = [p parse:s]; + } @catch (NSException *e) { + NSLog(@"\n\n\nexception:\n\n %@", [e reason]); + } + NSLog(@"result %@", result); +} + + +- (void)doEBNFParser { + //NSString *s = @"foo (bar|baz)*;"; + NSString *s = @"$baz = bar; ($baz|foo)*;"; + //NSString *s = @"foo;"; + EBNFParser *p = [[[EBNFParser alloc] init] autorelease]; + + // PKAssembly *a = [p bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + // NSLog(@"a: %@", a); + // NSLog(@"a.target: %@", a.target); + + PKParser *res = [p parse:s]; + // NSLog(@"res: %@", res); + // NSLog(@"res: %@", res.string); + // NSLog(@"res.subparsers: %@", res.subparsers); + // NSLog(@"res.subparsers 0: %@", [[res.subparsers objectAtIndex:0] string]); + // NSLog(@"res.subparsers 1: %@", [[res.subparsers objectAtIndex:1] string]); + + s = @"bar foo bar foo"; + PKAssembly *a = [res completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + NSLog(@"\n\na: %@\n\n", a); +} + + +- (void)doGrammarParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; +// s = @"@start = openCurly closeCurly; openCurly = '{'; closeCurly = '}';"; +// s = @"@start = start*; start = 'bar';"; + + PKParserFactory *factory = [PKParserFactory factory]; + + JSONAssembler *ass = [[[JSONAssembler alloc] init] autorelease]; + PKParser *lp = [factory parserFromGrammar:s assembler:ass]; + + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + +// s = @"bar bar"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:t]; + a.preservesWhitespaceTokens = YES; + //PKAssembly *res = + [lp completeMatchFor:a]; + + self.displayString = ass.displayString; +} + + +- (void)doJavaScriptGrammarParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"javascript" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKParser *p = [[PKParserFactory factory] parserFromGrammar:s assembler:nil]; + //PKParser *plus = [p parserNamed:@"plus"]; + + s = @";"; + p.tokenizer.string = s; + //PKAssembly *a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + //PKAssembly *res = [p bestMatchFor:a]; + // TDEqualObjects(@"[var, foo, =, 'bar', ;]var/foo/=/bar/;^", [res description]); +} + + +- (void)doProf { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json_with_discards" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + NSDate *start = [NSDate date]; + while ((tok = [t nextToken]) != eof) ; + CGFloat ms4tok = -([start timeIntervalSinceNow]); + + PKParserFactory *factory = [PKParserFactory factory]; + TDJsonParser *p = nil; + + p = [[[TDJsonParser alloc] initWithIntentToAssemble:NO] autorelease]; + + //JSONAssembler *assembler = [[[JSONAssembler alloc] init] autorelease]; + start = [NSDate date]; + PKParser *lp = [factory parserFromGrammar:s assembler:p]; + CGFloat ms4grammar = -([start timeIntervalSinceNow]); + + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + start = [NSDate date]; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + a = [lp completeMatchFor:a]; + CGFloat ms4json = -([start timeIntervalSinceNow]); + + PKReleaseSubparserTree(lp); + + p = [[TDJsonParser alloc] initWithIntentToAssemble:NO]; + start = [NSDate date]; + id res = [p parse:s]; + CGFloat ms4json2 = -([start timeIntervalSinceNow]); + [p release]; + + p = [[TDJsonParser alloc] initWithIntentToAssemble:YES]; + start = [NSDate date]; + res = [p parse:s]; + CGFloat ms4json3 = -([start timeIntervalSinceNow]); + [p release]; + + id fp = [[[TDFastJsonParser alloc] init] autorelease]; + start = [NSDate date]; + res = [fp parse:s]; + CGFloat ms4json4 = -([start timeIntervalSinceNow]); + + id attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont fontWithName:@"Monaco" size:14.], NSFontAttributeName, + [NSColor whiteColor], NSForegroundColorAttributeName, + nil]; + + s = [NSString stringWithFormat:@"tokenization: %f \n\ngrammar parse: %f sec\n\nlp json parse: %f sec\n\np json parse (not assembled): %f sec\n\np json parse (assembled): %f sec\n\nfast json parse (assembled): %f sec\n\n %f", ms4tok, ms4grammar, ms4json, ms4json2, ms4json3, ms4json4, (ms4json3/ms4json4)]; + self.displayString = [[[NSMutableAttributedString alloc] initWithString:s attributes:attrs] autorelease]; +} + + +- (void)doTokenize { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + NSDate *start = [NSDate date]; + while ((tok = [t nextToken]) != eof) ; + CGFloat secs = -([start timeIntervalSinceNow]); + + id attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont fontWithName:@"Monaco" size:14.], NSFontAttributeName, + [NSColor whiteColor], NSForegroundColorAttributeName, + nil]; + + s = [NSString stringWithFormat:@"tokenize: %f", secs]; + self.displayString = [[[NSMutableAttributedString alloc] initWithString:s attributes:attrs] autorelease]; +} + + +- (void)doSimpleCSS { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKParserFactory *factory = [PKParserFactory factory]; + + TDMiniCSSAssembler *assembler = [[[TDMiniCSSAssembler alloc] init] autorelease]; + PKParser *lp = [factory parserFromGrammar:s assembler:assembler]; + s = @"foo { color:rgb(111.0, 99.0, 255.0); }"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + a = [lp completeMatchFor:a]; + +} + + +- (void)doSimpleCSS2 { + PKParserFactory *factory = [PKParserFactory factory]; + + // create CSS parser + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + NSString *grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDMiniCSSAssembler *cssAssembler = [[[TDMiniCSSAssembler alloc] init] autorelease]; + PKParser *cssParser = [factory parserFromGrammar:grammarString assembler:cssAssembler]; + + // parse CSS + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"css"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + a = [cssParser bestMatchFor:a]; + + // get attributes from css + id attrs = cssAssembler.attributes; + + // create JSON Parser + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"grammar"]; + grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDGenericAssembler *genericAssembler = [[[TDGenericAssembler alloc] init] autorelease]; + + // give it the attrs from CSS + genericAssembler.attributes = attrs; + PKParser *jsonParser = [factory parserFromGrammar:grammarString assembler:genericAssembler]; + + // parse JSON + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + // take care to preseve the whitespace in the JSON + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + PKTokenAssembly *a1 = [PKTokenAssembly assemblyWithTokenizer:t]; + a1.preservesWhitespaceTokens = YES; +// [jsonParser completeMatchFor:a1]; +// self.displayString = genericAssembler.displayString; + self.displayString = [[jsonParser completeMatchFor:a1] target]; +} + + +- (void)doJSONHighlighting { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDSyntaxHighlighter *shc = [[[TDSyntaxHighlighter alloc] init] autorelease]; + self.displayString = [shc highlightedStringForString:s ofGrammar:@"json"]; +} + + +- (void)doCSSHighlighting { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"example" ofType:@"css"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDSyntaxHighlighter *shc = [[[TDSyntaxHighlighter alloc] init] autorelease]; + self.displayString = [shc highlightedStringForString:s ofGrammar:@"css"]; +} + + +- (void)doHTMLHighlighting { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"example" ofType:@"html"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDSyntaxHighlighter *shc = [[[TDSyntaxHighlighter alloc] init] autorelease]; + self.displayString = [shc highlightedStringForString:s ofGrammar:@"html"]; +} + + +- (void)doMultiLineComment { + NSString *s = @"/* foo */ "; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + t.commentState.reportsCommentTokens = YES; + //PKToken *tok = + [t nextToken]; +} + + +- (void)doRubyHashParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"rubyhash" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKParser *lp = [[PKParserFactory factory] parserFromGrammar:s assembler:nil]; + + s = @"{\"brand\"=>{\"name\"=>\"something\"," + @"\"logo\"=>#," + @"\"summary\"=>\"wee\", \"content\"=>\"woopy doo\"}, \"commit\"=>\"Save\"," + @"\"authenticity_token\"=>\"43a94d60304a7fb13a4ff61a5960461ce714e92b\"," + @"\"action\"=>\"create\", \"controller\"=>\"admin/brands\"}"; + + NSLog(@"%@", [lp parse:s]); +} + + + +- (void)doFactory { +// id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; +// PKParserFactory *factory = [PKParserFactory factory]; +// NSString *s = nil; +// s = @"@start = foo|baz; foo (didMatchFooAssembly:) = 'bar'; baz (didMatchBazAssembly:) = 'bat'"; +// factory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnExplicit; +// PKParser *lp = [factory parserFromGrammar:s assembler:mock]; +// +//// [[mock expect] didMatchBazAssembly:OCMOCK_ANY]; +//// NSString *s = @"bar bat"; +//// a = [PKTokenAssembly assemblyWithString:s]; +//// res = [lp completeMatchFor:a]; +//// TDEqualObjects(@"[bar, bat]bar/bat^", [res description]); +//// [mock verify]; + +// NSString *g = @"@delimitState = '$'; @delimitedString = '$' '%' nil; @start = DelimitedString('$', '%');"; +// PKParser *lp = [[PKParserFactory factory] parserFromGrammar:g assembler:nil]; +// +// NSString *s = @"$foo%"; +// PKTokenizer *t = lp.tokenizer; +// t.string = s; +// PKAssembly *res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"xpath1_0" ofType:@"grammar"]; + NSString *g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKParser *p = [[PKParserFactory factory] parserFromGrammar:g assembler:nil]; + PKTokenizer *t = p.tokenizer; + t.string = @"foo"; + //PKAssembly *res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + +} + + +- (void)doParenStuff { + NSString *s = @"-(ab+5)"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + +// TDTrue(tok.isSymbol); +// TDEqualObjects(tok.stringValue, @"-"); +// TDEquals((CGFloat)0.0, tok.floatValue); + + tok = [t nextToken]; +// TDTrue(tok.isSymbol); +// TDEqualObjects(tok.stringValue, @"("); +// TDEquals((CGFloat)0.0, tok.floatValue); +} + + +- (void)doDelimitedString { + NSString *s = @""; + + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + NSCharacterSet *cs = nil; + + [t setTokenizerState:t.delimitState from:'<' to:'<']; + [t.delimitState addStartMarker:@"" allowedCharacterSet:cs]; + +// PKToken *tok = [t nextToken]; + + //TDTrue(tok.isDelimitedString); + +} + + +- (void)doJSParser { + TDJavaScriptParser *jsp = [TDJavaScriptParser parser]; + NSString *s = @"for( ; true; true) {}"; + jsp.tokenizer.string = s; +// PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; +// id res = [jsp bestMatchFor:a]; + //TDEqualObjects([res description], @"['foo']'foo'^"); + + //TDEqualObjects([res description], @"[for, (, ;, true, ;, true, ), {, }]for/(/;/true/;/true/)/{/}^"); +} + + +- (void)doNSPredicateEvaluator { + //TDNSPredicateEvaluator *eval = [[[TDNSPredicateEvaluator alloc] initWithKeyPathResolver:nil] autorelease]; +} + + +- (void)doXMLParser { +// NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"xml" ofType:@"grammar"]; +// NSString *g = [NSString stringWithContentsOfFile:path]; +// PKParser *p = [[PKParserFactory factory] parserFromGrammar:g assembler:self]; +// PKTokenizer *t = p.tokenizer; +} + + + + +- (IBAction)run:(id)sender { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + +// [self doPlistParser]; +// [self doHtmlSyntaxHighlighter]; +// [self doJsonParser]; +// [self doRubyHashParser]; + +// [self doJSParser]; + + [self doProf]; + + //[self doJavaScriptGrammarParser]; + + // [self doTokenize]; +// [self doGrammarParser]; +// [self doSimpleCSS]; +// [self doSimpleCSS2]; +// [self doParenStuff]; + +// [self doJSONHighlighting]; +// [self doCSSHighlighting]; +// [self doHTMLHighlighting]; + +// [self doMultiLineComment]; +// [self doDelimitedString]; + +// [self doFactory]; + +// [self doXMLParser]; +// [self doNSPredicateEvaluator]; + + [pool drain]; +} + +@synthesize displayString; +@end diff --git a/debugapp/DebugAppMainMenu.xib b/debugapp/DebugAppMainMenu.xib new file mode 100644 index 0000000..b739318 --- /dev/null +++ b/debugapp/DebugAppMainMenu.xib @@ -0,0 +1,3529 @@ + + + + 1050 + 9G55 + 677 + 949.43 + 353.00 + + YES + + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + NSFontManager + + + AMainMenu + + YES + + + DebugApp + + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + DebugApp + + YES + + + About DebugApp + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Services + + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 2147483647 + + + + + + Hide DebugApp + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Quit DebugApp + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Find + + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 2147483647 + + + + + + Check Grammar With Spelling + + 2147483647 + + + + + + + + + Substitutions + + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 2147483647 + + + + + + Stop Speaking + + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 2147483647 + + + + + + + + + Window + + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bring All to Front + + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 15 + 2 + {{479, 251}, {504, 447}} + 611844096 + Window + NSWindow + + {3.40282e+38, 3.40282e+38} + {484, 310} + + + 256 + + YES + + + 266 + {{14, 293}, {476, 32}} + + YES + + 67239424 + 134217728 + Run + + LucidaGrande + 1.300000e+01 + 1044 + + + -2038284033 + 129 + + DQ + 200 + 25 + + + + + 266 + {{17, 342}, {470, 85}} + + YES + + 67239424 + 272629760 + VGhlIHB1cnBvc2Ugb2YgdGhpcyBhcHBsaWNhdGlvbiBpcyBvbmx5IHRvIHJ1biBhcmJ0cmFyeSB0ZXN0 +IGNvZGUgaW4gIkRlYnVnIiBtb2RlIHVzaW5nIEdEQiBhbmQgYnJlYWtwb2ludHMgKHdoaWNoIGRvZXMg +bm90IHNlZW0gdG8gYmUgcG9zc2libGUgZm9tIHRoZSBVbml0VGVzdCBCdW5kbGUpLiBUbyB1c2UsIGNv +cHkgc29tZSB1bml0IHRlc3QgY29kZSBvdmVyIHRvIHRoZSAtW0RlYnVnQXBwRGVsZWdhdGUgcnVuOl0g +YWN0aW9uIG1ldGhvZCB3aGljaCBpcyBleGVjdXRlZCB3aGVuIHRoZSAiUnVuIiBidXR0b24gYmVsb3cg +aXMgY2xpY2tlZC4 + + LucidaGrande + 1.300000e+01 + 16 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 274 + + YES + + + 2304 + + YES + + + 2322 + {447, 96} + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda + + + YES + + YES + + YES + NSFont + NSParagraphStyle + + + YES + + LucidaGrande + 1.000000e+01 + 2843 + + + 3 + + YES + + 0.000000e+00 + + + 5.600000e+01 + + + 1.120000e+02 + + + 1.680000e+02 + + + 2.240000e+02 + + + 2.800000e+02 + + + 3.360000e+02 + + + 3.920000e+02 + + + 4.480000e+02 + + + 5.040000e+02 + + + 5.600000e+02 + + + 6.160000e+02 + + + 6.720000e+02 + + + 7.280000e+02 + + + 7.840000e+02 + + + 8.400000e+02 + + + 8.960000e+02 + + + 9.520000e+02 + + + 1.008000e+03 + + + 1.064000e+03 + + + 1.120000e+03 + + + 1.176000e+03 + + + 1.232000e+03 + + + 1.288000e+03 + + + 1.344000e+03 + + + 1.400000e+03 + + + 1.456000e+03 + + + 1.512000e+03 + + + 1.568000e+03 + + + 1.624000e+03 + + + 1.680000e+03 + + + 1.736000e+03 + + + + + + + YES + + YES + NSFont + NSParagraphStyle + + + YES + + LucidaGrande-Bold + 1.000000e+01 + 16 + + + 3 + + YES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GQAEAQgADAEiAAcBhAQAA + + + + + YES + + + 6 + + + + 4.470000e+02 + 1 + + + 11621 + + 1 + MC4xMTc2NDcwNiAwLjExNzY0NzA2IDAuMTQxMTc2NDgAA + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + 6 + System + selectedTextBackgroundColor + + + + 6 + System + selectedTextColor + + + + + + + YES + + YES + NSColor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + + + + + 6 + {3081, 1e+07} + {223, 0} + + + + {{1, 1}, {447, 259}} + + + + + 3 + MQA + + + {4, -5} + 1 + + 4 + + + + 256 + {{448, 1}, {15, 259}} + + + _doScroller: + 9.843750e-01 + + + + 256 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 + + + {{20, 20}, {464, 261}} + + + 18 + + + + + + {504, 447} + + + {{0, 0}, {1440, 878}} + {484, 332} + {3.40282e+38, 3.40282e+38} + + + DebugAppDelegate + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + terminate: + + + + 369 + + + + unhideAllApplications: + + + + 370 + + + + addFontTrait: + + + + 418 + + + + addFontTrait: + + + + 419 + + + + modifyFont: + + + + 420 + + + + orderFrontFontPanel: + + + + 421 + + + + modifyFont: + + + + 422 + + + + raiseBaseline: + + + + 423 + + + + lowerBaseline: + + + + 424 + + + + copyFont: + + + + 425 + + + + subscript: + + + + 426 + + + + superscript: + + + + 427 + + + + tightenKerning: + + + + 428 + + + + underline: + + + + 429 + + + + orderFrontColorPanel: + + + + 430 + + + + useAllLigatures: + + + + 431 + + + + loosenKerning: + + + + 432 + + + + pasteFont: + + + + 433 + + + + unscript: + + + + 434 + + + + useStandardKerning: + + + + 435 + + + + useStandardLigatures: + + + + 436 + + + + turnOffLigatures: + + + + 437 + + + + turnOffKerning: + + + + 438 + + + + alignLeft: + + + + 439 + + + + alignJustified: + + + + 440 + + + + copyRuler: + + + + 441 + + + + alignCenter: + + + + 442 + + + + toggleRuler: + + + + 443 + + + + alignRight: + + + + 444 + + + + pasteRuler: + + + + 445 + + + + run: + + + + 454 + + + + attributedString: displayString + + + + + + attributedString: displayString + attributedString + displayString + + NSContinuouslyUpdatesValue + + + 2 + + + 462 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + + + 373 + + + YES + + + + + + 374 + + + YES + + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + 377 + + + YES + + + + + + + + + + + + + 378 + + + + + 379 + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + YES + + + + + + + + + + + + + + + + + + + + + 387 + + + + + 388 + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + YES + + + + + + 396 + + + YES + + + + + + 397 + + + YES + + + + + + 398 + + + + + 399 + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + YES + + + + + + + + + + 404 + + + + + 405 + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + YES + + + + + + + + 410 + + + + + 411 + + + + + 412 + + + + + 413 + + + YES + + + + + + + + + 414 + + + + + 415 + + + + + 416 + + + + + 417 + + + + + 446 + + + YES + + + + + + 447 + + + YES + + + + + + + + 448 + + + + + 449 + + + YES + + + + + + 450 + + + + + 452 + + + YES + + + + + + 453 + + + + + 455 + + + YES + + + + + + + + 456 + + + + + 457 + + + + + 458 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBEditorWindowLastContentRect + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBEditorWindowLastContentRect + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBEditorWindowLastContentRect + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBEditorWindowLastContentRect + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBEditorWindowLastContentRect + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBPluginDependency + 373.IBPluginDependency + 374.IBPluginDependency + 375.IBPluginDependency + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 446.IBEditorWindowLastContentRect + 446.IBWindowTemplateEditedContentRect + 446.NSWindowTemplate.visibleAtLaunch + 446.windowTemplate.hasMinSize + 446.windowTemplate.minSize + 447.IBPluginDependency + 448.IBPluginDependency + 449.IBPluginDependency + 450.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 455.IBPluginDependency + 456.IBPluginDependency + 457.IBPluginDependency + 458.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + {{553, 524}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{479, 484}, {132, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{565, 284}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{322, 304}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{365, 632}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{565, 284}, {153, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{565, 284}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{798, 236}, {197, 73}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{490, 309}, {440, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{11, 977}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{432, 504}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{565, 284}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{511, 212}, {504, 447}} + {{511, 212}, {504, 447}} + + + {484, 310} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{556, 261}, {211, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{280, 344}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{323, 672}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 462 + + + + YES + + DebugAppDelegate + NSObject + + run: + id + + + IBProjectSource + debugapp/DebugAppDelegate.h + + + + NSObject + + IBProjectSource + test/XMLReader.h + + + + + 0 + ../TDParseKit.xcodeproj + 3 + + diff --git a/debugapp/JSONAssembler.h b/debugapp/JSONAssembler.h new file mode 100644 index 0000000..c8bbb7d --- /dev/null +++ b/debugapp/JSONAssembler.h @@ -0,0 +1,42 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKToken; + +@interface JSONAssembler : NSObject { + NSMutableAttributedString *displayString; + id defaultAttrs; + id objectAttrs; + id arrayAttrs; + id propertyNameAttrs; + id valueAttrs; + id constantAttrs; + + PKToken *comma; + PKToken *curly; + PKToken *bracket; +} +@property (retain) NSMutableAttributedString *displayString; +@property (retain) id defaultAttrs; +@property (retain) id objectAttrs; +@property (retain) id arrayAttrs; +@property (retain) id propertyNameAttrs; +@property (retain) id valueAttrs; +@property (retain) id constantAttrs; +@property (retain) PKToken *comma; +@property (retain) PKToken *curly; +@property (retain) PKToken *bracket; +@end diff --git a/debugapp/JSONAssembler.m b/debugapp/JSONAssembler.m new file mode 100644 index 0000000..4064a16 --- /dev/null +++ b/debugapp/JSONAssembler.m @@ -0,0 +1,169 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "JSONAssembler.h" +#import "NSArray+ParseKitAdditions.h" +#import + +@implementation JSONAssembler + +- (id)init { + self = [super init]; + if (self != nil) { + NSColor *textColor = [NSColor whiteColor]; + NSColor *tagColor = [NSColor colorWithDeviceRed:.70 green:.14 blue:.53 alpha:1.]; + NSColor *attrNameColor = [NSColor colorWithDeviceRed:.33 green:.45 blue:.48 alpha:1.]; + NSColor *attrValueColor = [NSColor colorWithDeviceRed:.77 green:.18 blue:.20 alpha:1.]; + NSColor *commentColor = [NSColor colorWithDeviceRed:.24 green:.70 blue:.27 alpha:1.]; + NSColor *piColor = [NSColor colorWithDeviceRed:.09 green:.62 blue:.74 alpha:1.]; + + NSFont *monacoFont = [NSFont fontWithName:@"Monaco" size:11.]; + + self.defaultAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + textColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.objectAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + tagColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.propertyNameAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + attrNameColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.valueAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + attrValueColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.constantAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + piColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.arrayAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + commentColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + + self.displayString = [[[NSMutableAttributedString alloc] initWithString:@"" attributes:defaultAttrs] autorelease]; + + self.comma = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"," floatValue:0]; + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0]; + self.bracket = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"[" floatValue:0]; + } + return self; +} + + +- (void)dealloc { + self.displayString = nil; + self.defaultAttrs = nil; + self.objectAttrs = nil; + self.arrayAttrs = nil; + self.propertyNameAttrs = nil; + self.valueAttrs = nil; + self.constantAttrs = nil; + self.comma = nil; + self.curly = nil; + self.bracket = nil; + [super dealloc]; +} + + +- (void)appendAttributedStringForObjects:(NSArray *)objs withAttrs:(id)attrs { + for (id obj in objs) { + NSAttributedString *as = [[NSAttributedString alloc] initWithString:[obj stringValue] attributes:attrs]; + [displayString appendAttributedString:as]; + [as release]; + } +} + + +- (void)consumeWhitespaceFrom:(PKAssembly *)a { + NSMutableArray *whitespaceToks = [NSMutableArray array]; + PKToken *tok = nil; + while (1) { + tok = [a pop]; + if (PKTokenTypeWhitespace == tok.tokenType) { + [whitespaceToks addObject:tok]; + } else { + [a push:tok]; + break; + } + } + + if ([whitespaceToks count]) { + whitespaceToks = [whitespaceToks reversedMutableArray]; + [self appendAttributedStringForObjects:whitespaceToks withAttrs:defaultAttrs]; + } +} + + +- (void)didMatchSymbolChar:(PKAssembly *)a { + NSArray *objs = [NSArray arrayWithObject:[a pop]]; + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:objs withAttrs:objectAttrs]; +} + + +- (void)didMatchPropertyName:(PKAssembly *)a { + NSArray *objs = [NSArray arrayWithObject:[a pop]]; + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:objs withAttrs:propertyNameAttrs]; +} + + +- (void)didMatchString:(PKAssembly *)a { + NSArray *objs = [NSArray arrayWithObject:[a pop]]; + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:objs withAttrs:arrayAttrs]; +} + + +- (void)didMatchNumber:(PKAssembly *)a { + NSArray *objs = [NSArray arrayWithObject:[a pop]]; + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:objs withAttrs:valueAttrs]; +} + + +- (void)didMatchConstant:(PKAssembly *)a { + NSArray *objs = [NSArray arrayWithObject:[a pop]]; + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:objs withAttrs:constantAttrs]; +} + + +- (void)didMatchNull:(PKAssembly *)a { [self didMatchConstant:a]; } +- (void)didMatchTrue:(PKAssembly *)a { [self didMatchConstant:a]; } +- (void)didMatchFalse:(PKAssembly *)a { [self didMatchConstant:a]; } + +- (void)didMatchColon:(PKAssembly *)a { [self didMatchSymbolChar:a]; } +- (void)didMatchComma:(PKAssembly *)a { [self didMatchSymbolChar:a]; } +- (void)didMatchOpenCurly:(PKAssembly *)a { [self didMatchSymbolChar:a]; } +- (void)didMatchCloseCurly:(PKAssembly *)a { [self didMatchSymbolChar:a]; } +- (void)didMatchOpenBracket:(PKAssembly *)a { [self didMatchSymbolChar:a]; } +- (void)didMatchCloseBracket:(PKAssembly *)a { [self didMatchSymbolChar:a]; } + +@synthesize displayString; +@synthesize defaultAttrs; +@synthesize objectAttrs; +@synthesize arrayAttrs; +@synthesize propertyNameAttrs; +@synthesize valueAttrs; +@synthesize constantAttrs; +@synthesize comma; +@synthesize curly; +@synthesize bracket; +@end + diff --git a/debugapp/main.m b/debugapp/main.m new file mode 100644 index 0000000..ec133b9 --- /dev/null +++ b/debugapp/main.m @@ -0,0 +1,13 @@ +// +// main.m +// TestApp +// +// Created by Todd Ditchendorf on 7/12/08. +// Copyright Todd Ditchendorf 2008. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) { + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/demoapp/.svn/all-wcprops b/demoapp/.svn/all-wcprops new file mode 100644 index 0000000..7974b9e --- /dev/null +++ b/demoapp/.svn/all-wcprops @@ -0,0 +1,107 @@ +K 25 +svn:wc:ra_dav:version-url +V 32 +/svn/!svn/ver/1405/trunk/demoapp +END +TokensView.xib +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1282/trunk/demoapp/TokensView.xib +END +main.m +K 25 +svn:wc:ra_dav:version-url +V 38 +/svn/!svn/ver/583/trunk/demoapp/main.m +END +DemoTreesViewController.m +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1348/trunk/demoapp/DemoTreesViewController.m +END +TDGutterView.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1322/trunk/demoapp/TDGutterView.h +END +TDGutterView.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1405/trunk/demoapp/TDGutterView.m +END +DemoTokensViewController.h +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1282/trunk/demoapp/DemoTokensViewController.h +END +TreesView.xib +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1330/trunk/demoapp/TreesView.xib +END +DemoAppMainMenu.xib +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1323/trunk/demoapp/DemoAppMainMenu.xib +END +DemoTokensViewController.m +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1284/trunk/demoapp/DemoTokensViewController.m +END +PKParseTreeView.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1295/trunk/demoapp/PKParseTreeView.h +END +DemoAppDelegate.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1282/trunk/demoapp/DemoAppDelegate.h +END +DemoApp-Info.plist +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1173/trunk/demoapp/DemoApp-Info.plist +END +TDSourceCodeTextView.h +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1322/trunk/demoapp/TDSourceCodeTextView.h +END +PKParseTreeView.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1331/trunk/demoapp/PKParseTreeView.m +END +DemoAppDelegate.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1282/trunk/demoapp/DemoAppDelegate.m +END +DemoTreesViewController.h +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1322/trunk/demoapp/DemoTreesViewController.h +END +TDSourceCodeTextView.m +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1404/trunk/demoapp/TDSourceCodeTextView.m +END diff --git a/demoapp/.svn/entries b/demoapp/.svn/entries new file mode 100644 index 0000000..9b17a06 --- /dev/null +++ b/demoapp/.svn/entries @@ -0,0 +1,613 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/demoapp +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + + + + + + +0 + +TokensView.xib +file + + + + +2009-08-06T04:02:08.000000Z +2cd84f05eb50a266397423d58b777d5e +2009-08-03T01:24:15.042876Z +1282 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +43215 + +main.m +file + + + + +2009-06-16T06:56:28.000000Z +2b8110385b5152f3f87b6005c85a7250 +2009-01-11T01:15:32.782160Z +583 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +256 + +DemoTreesViewController.m +file + + + + +2009-08-23T05:07:14.000000Z +1db3e886ddce5529247489763790cf82 +2009-08-23T05:09:23.531641Z +1348 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +4623 + +TDGutterView.h +file + + + + +2009-08-06T04:02:08.000000Z +4d6ed8fafd8fac0db3399d7691d5304d +2009-08-09T20:08:21.181896Z +1322 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +572 + +TDGutterView.m +file + + + + +2009-11-13T07:14:30.000000Z +3b359cc9f431676758fe8d92590da62e +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2286 + +DemoTokensViewController.h +file + + + + +2009-08-06T04:02:08.000000Z +7aeebbdce1cd91ef2063b91673a8b776 +2009-08-03T01:24:15.042876Z +1282 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +704 + +TreesView.xib +file + + + + +2009-08-10T01:51:17.000000Z +12220e3ebdff009bb5f9bba2ea24c314 +2009-08-10T01:13:31.456566Z +1330 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +67091 + +DemoAppMainMenu.xib +file + + + + +2009-08-06T04:02:08.000000Z +017f7373162ae6b35ec9a85511382012 +2009-08-09T20:12:12.609875Z +1323 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +96408 + +DemoTokensViewController.m +file + + + + +2009-08-06T04:02:08.000000Z +6aa91ee77bf652e9884a4ada976df314 +2009-08-03T01:31:36.760537Z +1284 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2940 + +PKParseTreeView.h +file + + + + +2009-08-06T04:02:08.000000Z +75261580c22338ad475b87e8fa6b3026 +2009-08-08T22:00:40.590419Z +1295 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +446 + +DemoAppDelegate.h +file + + + + +2009-08-06T04:02:08.000000Z +0add112585e0b075f45776740af22712 +2009-08-03T01:24:15.042876Z +1282 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +580 + +DemoApp-Info.plist +file + + + + +2009-07-03T20:33:25.000000Z +bfd7805f8187cf108065bf963dfb9700 +2009-07-03T20:39:51.719779Z +1173 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +736 + +TDSourceCodeTextView.h +file + + + + +2009-08-06T04:02:08.000000Z +e8ad1f0e193a303514c5416b9197ee01 +2009-08-09T20:08:21.181896Z +1322 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +433 + +PKParseTreeView.m +file + + + + +2009-08-17T00:57:16.000000Z +483166fc9aea1e83c8c7e196f1bc9b62 +2009-08-17T01:06:48.172726Z +1331 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +5004 + +DemoAppDelegate.m +file + + + + +2009-08-06T04:02:08.000000Z +9c456063e3452d6b3477d4ebab3cc9f8 +2009-08-03T01:24:15.042876Z +1282 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +870 + +DemoTreesViewController.h +file + + + + +2009-08-06T04:02:08.000000Z +2ae1c78bddbb8adc8f94a90b51eabdb8 +2009-08-09T20:08:21.181896Z +1322 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +652 + +TDSourceCodeTextView.m +file + + + + +2009-11-13T07:14:30.000000Z +4fe67eb74ee9196427a59cccfdff6fd4 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3732 + diff --git a/demoapp/.svn/text-base/DemoApp-Info.plist.svn-base b/demoapp/.svn/text-base/DemoApp-Info.plist.svn-base new file mode 100644 index 0000000..0e08ed6 --- /dev/null +++ b/demoapp/.svn/text-base/DemoApp-Info.plist.svn-base @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.DemoApp + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + DemoAppMainMenu + NSPrincipalClass + NSApplication + + diff --git a/demoapp/.svn/text-base/DemoAppDelegate.h.svn-base b/demoapp/.svn/text-base/DemoAppDelegate.h.svn-base new file mode 100644 index 0000000..1abed1a --- /dev/null +++ b/demoapp/.svn/text-base/DemoAppDelegate.h.svn-base @@ -0,0 +1,23 @@ +// +// DemoAppDelegate.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/12/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class DemoTokensViewController; +@class DemoTreesViewController; + +@interface DemoAppDelegate : NSObject { + IBOutlet NSTabView *tabView; + + DemoTokensViewController *tokensViewController; + DemoTreesViewController *treesViewController; +} + +@property (nonatomic, retain) DemoTokensViewController *tokensViewController; +@property (nonatomic, retain) DemoTreesViewController *treesViewController; +@end diff --git a/demoapp/.svn/text-base/DemoAppDelegate.m.svn-base b/demoapp/.svn/text-base/DemoAppDelegate.m.svn-base new file mode 100644 index 0000000..6de9f3f --- /dev/null +++ b/demoapp/.svn/text-base/DemoAppDelegate.m.svn-base @@ -0,0 +1,35 @@ +// +// DemoAppDelegate.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/12/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "DemoAppDelegate.h" +#import "DemoTokensViewController.h" +#import "DemoTreesViewController.h" + +@implementation DemoAppDelegate + +- (void)dealloc { + self.tokensViewController = nil; + self.treesViewController = nil; + [super dealloc]; +} + + +- (void)awakeFromNib { + self.tokensViewController = [[[DemoTokensViewController alloc] init] autorelease]; + self.treesViewController = [[[DemoTreesViewController alloc] init] autorelease]; + + NSTabViewItem *item = [tabView tabViewItemAtIndex:0]; + [item setView:[tokensViewController view]]; + + item = [tabView tabViewItemAtIndex:1]; + [item setView:[treesViewController view]]; +} + +@synthesize tokensViewController; +@synthesize treesViewController; +@end diff --git a/demoapp/.svn/text-base/DemoAppMainMenu.xib.svn-base b/demoapp/.svn/text-base/DemoAppMainMenu.xib.svn-base new file mode 100644 index 0000000..fc37aa6 --- /dev/null +++ b/demoapp/.svn/text-base/DemoAppMainMenu.xib.svn-base @@ -0,0 +1,2268 @@ + + + + 1050 + 9J61 + 677 + 949.46 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + DemoApp + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + DemoApp + + YES + + + About DemoApp + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide DemoApp + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit DemoApp + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 1048576 + 2147483647 + + + submenuAction: + + Format + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Show Colors + C + 1179648 + 2147483647 + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 15 + 2 + {{43, 10}, {1146, 856}} + 611844096 + ParseKit Demo + NSWindow + + {3.40282e+38, 3.40282e+38} + {514, 622} + + + 256 + + YES + + + 18 + {{-12, -13}, {1170, 863}} + + + YES + + 1 + + + 256 + {{10, 33}, {508, 580}} + + Tokens + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + + + 2 + + + 256 + {{10, 33}, {1150, 817}} + + + Trees + + + + + + + LucidaGrande + 1.300000e+01 + 1044 + + 0 + YES + YES + + YES + + + + + {1146, 856} + + + {{0, 0}, {1440, 878}} + {514, 644} + {3.40282e+38, 3.40282e+38} + + + DemoAppDelegate + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + orderFrontColorPanel: + + + + 361 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 369 + + + + hideOtherApplications: + + + + 370 + + + + terminate: + + + + 371 + + + + unhideAllApplications: + + + + 372 + + + + delegate + + + + 374 + + + + tabView + + + + 438 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 299 + + + YES + + + + + + 300 + + + YES + + + + + + + 344 + + + + + 345 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 367 + + + YES + + + + + + 368 + + + YES + + + + + + 373 + + + + + 413 + + + YES + + + + + + + 414 + + + YES + + + + + + 415 + + + YES + + + + + 416 + + + YES + + + + + + 417 + + + YES + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 299.IBPluginDependency + 300.IBPluginDependency + 300.editorWindowContentRectSynchronizationRect + 344.IBPluginDependency + 345.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 367.IBEditorWindowLastContentRect + 367.IBWindowTemplateEditedContentRect + 367.NSWindowTemplate.visibleAtLaunch + 367.editorWindowContentRectSynchronizationRect + 367.windowTemplate.hasMinSize + 367.windowTemplate.minSize + 368.IBPluginDependency + 373.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{365, 632}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{0, 776}, {435, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{11, 727}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{409, 832}, {176, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{8, 0}, {1146, 856}} + {{8, 0}, {1146, 856}} + + {{11, 316}, {480, 370}} + + {514, 622} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{12, 593}, {206, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{101, 533}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{323, 672}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 438 + + + + YES + + DemoAppDelegate + NSObject + + tabView + NSTabView + + + IBProjectSource + demoapp/DemoAppDelegate.h + + + + DemoAppDelegate + NSObject + + IBUserSource + + + + + NSObject + + IBProjectSource + test/XMLReader.h + + + + + 0 + ../ParseKit.xcodeproj + 3 + + diff --git a/demoapp/.svn/text-base/DemoTokensViewController.h.svn-base b/demoapp/.svn/text-base/DemoTokensViewController.h.svn-base new file mode 100644 index 0000000..f8b405b --- /dev/null +++ b/demoapp/.svn/text-base/DemoTokensViewController.h.svn-base @@ -0,0 +1,32 @@ +// +// DemoTokensViewController.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKTokenizer; + +@interface DemoTokensViewController : NSViewController { + IBOutlet NSTokenField *tokenField; + + PKTokenizer *tokenizer; + NSString *inString; + NSString *outString; + NSString *tokString; + NSMutableArray *toks; + BOOL busy; +} + +- (IBAction)parse:(id)sender; + +@property (retain) PKTokenizer *tokenizer; +@property (retain) NSString *inString; +@property (retain) NSString *outString; +@property (retain) NSString *tokString; +@property (retain) NSMutableArray *toks; +@property BOOL busy; +@end diff --git a/demoapp/.svn/text-base/DemoTokensViewController.m.svn-base b/demoapp/.svn/text-base/DemoTokensViewController.m.svn-base new file mode 100644 index 0000000..20516de --- /dev/null +++ b/demoapp/.svn/text-base/DemoTokensViewController.m.svn-base @@ -0,0 +1,119 @@ +// +// DemoTokensViewController.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "DemoTokensViewController.h" +#import +#import "PKParseTreeView.h" + +@interface DemoTokensViewController () +- (void)doParse; +- (void)done; +@end + +@implementation DemoTokensViewController + +- (id)init { + return [self initWithNibName:@"TokensView" bundle:nil]; +} + + +- (id)initWithNibName:(NSString *)name bundle:(NSBundle *)b { + if (self = [super initWithNibName:name bundle:b]) { + self.tokenizer = [[[PKTokenizer alloc] init] autorelease]; + + [tokenizer.symbolState add:@"::"]; + [tokenizer.symbolState add:@"<="]; + [tokenizer.symbolState add:@">="]; + [tokenizer.symbolState add:@"=="]; + [tokenizer.symbolState add:@"!="]; + [tokenizer.symbolState add:@"+="]; + [tokenizer.symbolState add:@"-="]; + [tokenizer.symbolState add:@"*="]; + [tokenizer.symbolState add:@"/="]; + [tokenizer.symbolState add:@":="]; + [tokenizer.symbolState add:@"++"]; + [tokenizer.symbolState add:@"--"]; + [tokenizer.symbolState add:@"<>"]; + [tokenizer.symbolState add:@"=:="]; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.inString = nil; + self.outString = nil; + self.tokString = nil; + self.toks = nil; + [super dealloc]; +} + + +- (void)awakeFromNib { + NSString *s = [NSString stringWithFormat:@"%C", 0xab]; + NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString:s]; + [tokenField setTokenizingCharacterSet:set]; +} + + +- (IBAction)parse:(id)sender { + if (![inString length]) { + NSBeep(); + return; + } + + self.busy = YES; + + //[self doParse]; + [NSThread detachNewThreadSelector:@selector(doParse) toTarget:self withObject:nil]; +} + + +- (void)doParse { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + //self.tokenizer = [PKTokenizer tokenizer]; + self.tokenizer.string = self.inString; + + + self.toks = [NSMutableArray array]; + PKToken *tok = nil; + PKToken *eof = [PKToken EOFToken]; + while (eof != (tok = [tokenizer nextToken])) { + [toks addObject:tok]; + } + + [self performSelectorOnMainThread:@selector(done) withObject:nil waitUntilDone:NO]; + + [pool drain]; +} + + +- (void)done { + NSMutableString *s = [NSMutableString string]; + for (PKToken *tok in toks) { + [s appendFormat:@"%@ %C", tok.stringValue, 0xab]; + } + self.tokString = [[s copy] autorelease]; + + s = [NSMutableString string]; + for (PKToken *tok in toks) { + [s appendFormat:@"%@\n", [tok debugDescription]]; + } + self.outString = [[s copy] autorelease]; + self.busy = NO; +} + +@synthesize tokenizer; +@synthesize inString; +@synthesize outString; +@synthesize tokString; +@synthesize toks; +@synthesize busy; +@end diff --git a/demoapp/.svn/text-base/DemoTreesViewController.h.svn-base b/demoapp/.svn/text-base/DemoTreesViewController.h.svn-base new file mode 100644 index 0000000..ab3d958 --- /dev/null +++ b/demoapp/.svn/text-base/DemoTreesViewController.h.svn-base @@ -0,0 +1,29 @@ +// +// DemoTreesViewController.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKParseTreeView; +@class TDSourceCodeTextView; + +@interface DemoTreesViewController : NSViewController { + IBOutlet TDSourceCodeTextView *grammarTextView; + IBOutlet TDSourceCodeTextView *inputTextView; + IBOutlet PKParseTreeView *parseTreeView; + + NSString *grammarString; + NSString *inString; + BOOL busy; +} + +- (IBAction)parse:(id)sender; + +@property (retain) NSString *grammarString; +@property (retain) NSString *inString; +@property BOOL busy; +@end diff --git a/demoapp/.svn/text-base/DemoTreesViewController.m.svn-base b/demoapp/.svn/text-base/DemoTreesViewController.m.svn-base new file mode 100644 index 0000000..5e83392 --- /dev/null +++ b/demoapp/.svn/text-base/DemoTreesViewController.m.svn-base @@ -0,0 +1,157 @@ +// +// DemoTreesViewController.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "DemoTreesViewController.h" +#import "PKParseTreeView.h" +#import "TDSourceCodeTextView.h" +#import "PKParseTree.h" +#import "PKRuleNode.h" +#import "PKTokenNode.h" +#import "PKParseTreeAssembler.h" +#import + +@interface DemoTreesViewController () +- (void)renderGutters; +@end + +@implementation DemoTreesViewController + +- (id)init { + return [self initWithNibName:@"TreesView" bundle:nil]; +} + + +- (id)initWithNibName:(NSString *)name bundle:(NSBundle *)b { + if (self = [super initWithNibName:name bundle:b]) { + + } + return self; +} + + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + self.grammarString = nil; + self.inString = nil; + [super dealloc]; +} + + +- (void)awakeFromNib { +// self.grammarString = @"@allowsScientificNotation=YES;\n@start = expr;\nexpr = addExpr;\naddExpr = multExpr (('+'|'-') multExpr)*;\nmultExpr = atom (('*'|'/') atom)*;\natom = Number;"; +// self.grammarString = @"@start = array;array = '[' Number (commaNumber)* ']';commaNumber = ',' Number;"; +// self.grammarString = @"@start = array;array = foo | Word; foo = 'foo';"; + self.grammarString = @"@allowsScientificNotation = YES; @start = Empty | array | object; object = '{' (Empty | property (',' property)*) '}'; property = name ':' value; name = QuotedString; array = '[' (Empty | value (',' value)*) ']'; value = 'null' | boolean | array | object | number | string; string = QuotedString; number = Number; boolean = 'true' | 'false';"; + + +// self.inString = @"4.0*.4 + 2e-12/-47 +3"; +// self.inString = @"[1,2]"; +// self.inString = @"foo"; + self.inString = @"[42e-12, null,{'foo':false}]"; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:) name:NSWindowDidBecomeMainNotification object:[[self view] window]]; +} + + +- (void)windowDidBecomeMain:(NSNotification *)n { + [self renderGutters]; +} + + +- (void)renderGutters { + [grammarTextView renderGutter]; + [inputTextView renderGutter]; +} + + +- (IBAction)parse:(id)sender { + if (![inString length] || ![grammarString length]) { + NSBeep(); + return; + } + + self.busy = YES; + + [NSThread detachNewThreadSelector:@selector(doParse) toTarget:self withObject:nil]; +} + + +- (void)doParse { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + PKParseTreeAssembler *as = [[[PKParseTreeAssembler alloc] init] autorelease]; + PKParser *p = [[PKParserFactory factory] parserFromGrammar:grammarString assembler:as preassembler:as]; + PKParseTree *tr = [p parse:inString]; + [parseTreeView drawParseTree:tr]; + + // release + PKReleaseSubparserTree(p); + + [self performSelectorOnMainThread:@selector(done) withObject:nil waitUntilDone:NO]; + + [pool drain]; +} + + +- (void)done { + self.busy = NO; +} + + +#pragma mark - +#pragma mark NSSplitViewDelegate + +- (BOOL)splitView:(NSSplitView *)sv canCollapseSubview:(NSView *)v { + return v == [[sv subviews] objectAtIndex:1]; +} + + +- (BOOL)splitView:(NSSplitView *)sv shouldCollapseSubview:(NSView *)v forDoubleClickOnDividerAtIndex:(NSInteger)i { + return [self splitView:sv canCollapseSubview:v]; +} + + + +// maintain constant splitview width when resizing window +- (void)splitView:(NSSplitView *)sv resizeSubviewsWithOldSize:(NSSize)oldSize { + NSRect newFrame = [sv frame]; // get the new size of the whole splitView + NSView *top = [[sv subviews] objectAtIndex:0]; + NSRect topFrame = [top frame]; + NSView *bottom = [[sv subviews] objectAtIndex:1]; + NSRect bottomFrame = [bottom frame]; + + CGFloat dividerThickness = [sv dividerThickness]; + topFrame.size.width = newFrame.size.width; + + bottomFrame.size.height = newFrame.size.height - topFrame.size.height - dividerThickness; + bottomFrame.size.width = newFrame.size.width; + topFrame.origin.y = 0; + + [top setFrame:topFrame]; + [bottom setFrame:bottomFrame]; +} + + +- (CGFloat)splitView:(NSSplitView *)sv constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)i { + if (0 == i) { + return 200; + } else { + return proposedMin; + } +} + + +- (CGFloat)splitView:(NSSplitView *)sv constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)i { + return proposedMax; +} + +@synthesize grammarString; +@synthesize inString; +@synthesize busy; +@end + diff --git a/demoapp/.svn/text-base/PKParseTreeView.h.svn-base b/demoapp/.svn/text-base/PKParseTreeView.h.svn-base new file mode 100644 index 0000000..0a9babb --- /dev/null +++ b/demoapp/.svn/text-base/PKParseTreeView.h.svn-base @@ -0,0 +1,21 @@ +// +// PKParseTreeView.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKParseTree; + +@interface PKParseTreeView : NSView { + PKParseTree *parseTree; + NSDictionary *labelAttrs; +} +- (void)drawParseTree:(PKParseTree *)t; + +@property (nonatomic, retain) PKParseTree *parseTree; +@property (nonatomic, retain) NSDictionary *labelAttrs; +@end diff --git a/demoapp/.svn/text-base/PKParseTreeView.m.svn-base b/demoapp/.svn/text-base/PKParseTreeView.m.svn-base new file mode 100644 index 0000000..1cc0030 --- /dev/null +++ b/demoapp/.svn/text-base/PKParseTreeView.m.svn-base @@ -0,0 +1,184 @@ +// +// PKParseTreeView.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKParseTreeView.h" +#import +#import "PKParseTree.h" +#import "PKRuleNode.h" +#import "PKTokenNode.h" +#import "PKParseTreeAssembler.h" + +#define ROW_HEIGHT 50.0 +#define CELL_WIDTH 55.0 + +@interface PKParseTreeView () +- (void)drawTree:(PKParseTree *)n atPoint:(NSPoint)p; +- (void)drawParentNode:(PKParseTree *)n atPoint:(NSPoint)p; +- (void)drawLeafNode:(PKTokenNode *)n atPoint:(NSPoint)p; + +- (CGFloat)widthForNode:(PKParseTree *)n; +- (CGFloat)depthForNode:(PKParseTree *)n; +- (NSString *)labelFromNode:(PKParseTree *)n; +- (void)drawLabel:(NSString *)label atPoint:(NSPoint)p; +@end + +@implementation PKParseTreeView + +- (id)initWithFrame:(NSRect)frame { + if (self = [super initWithFrame:frame]) { + self.labelAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont boldSystemFontOfSize:10], NSFontAttributeName, + [NSColor blackColor], NSForegroundColorAttributeName, + nil]; + } + return self; +} + + +- (void)dealloc { + self.parseTree = nil; + self.labelAttrs = nil; + [super dealloc]; +} + + +- (BOOL)isFlipped { + return YES; +} + + +- (void)drawParseTree:(PKParseTree *)t { + self.parseTree = t; + + CGFloat w = [self widthForNode:parseTree] * CELL_WIDTH; + CGFloat h = [self depthForNode:parseTree] * ROW_HEIGHT + 120; + + NSSize minSize = [[self superview] bounds].size; + w = w < minSize.width ? minSize.width : w; + h = h < minSize.height ? minSize.height : h; + [self setFrame:NSMakeRect(0, 0, w, h)]; + + [self setNeedsDisplay:YES]; +} + + +- (void)drawRect:(NSRect)r { + [[NSColor whiteColor] set]; + NSRectFill(r); + + [self drawTree:parseTree atPoint:NSMakePoint(r.size.width / 2, 20)]; +} + + +- (void)drawTree:(PKParseTree *)n atPoint:(NSPoint)p { + if ([n isKindOfClass:[PKTokenNode class]]) { + [self drawLeafNode:(id)n atPoint:p]; + } else { + [self drawParentNode:n atPoint:p]; + } +} + + +- (void)drawParentNode:(PKParseTree *)n atPoint:(NSPoint)p { + // draw own label + [self drawLabel:[self labelFromNode:n] atPoint:NSMakePoint(p.x, p.y)]; + + NSUInteger i = 0; + NSUInteger c = [[n children] count]; + + // get total width + CGFloat widths[c]; + CGFloat totalWidth = 0; + for (PKParseTree *child in [n children]) { + widths[i] = [self widthForNode:child] * CELL_WIDTH; + totalWidth += widths[i++]; + } + + + // draw children + NSPoint points[c]; + if (1 == c) { + points[0] = NSMakePoint(p.x, p.y + ROW_HEIGHT); + [self drawTree:[[n children] objectAtIndex:0] atPoint:points[0]]; + } else { + CGFloat x = 0; + CGFloat buff = 0; + for (i = 0; i < c; i++) { + x = p.x - (totalWidth/2) + buff + widths[i]/2; + buff += widths[i]; + + points[i] = NSMakePoint(x, p.y + ROW_HEIGHT); + [self drawTree:[[n children] objectAtIndex:i] atPoint:points[i]]; + } + } + + // draw lines + CGContextRef ctx = [[NSGraphicsContext currentContext] graphicsPort]; + + for (i = 0; i < c; i++) { + CGContextBeginPath(ctx); + CGContextMoveToPoint(ctx, p.x, p.y + 15); + CGContextAddLineToPoint(ctx, points[i].x, points[i].y - 4); + CGContextClosePath(ctx); + CGContextStrokePath(ctx); + } +} + + +- (void)drawLeafNode:(PKTokenNode *)n atPoint:(NSPoint)p { + [self drawLabel:[self labelFromNode:n] atPoint:NSMakePoint(p.x, p.y)]; +} + + +- (CGFloat)widthForNode:(PKParseTree *)n { + CGFloat res = 0; + for (PKParseTree *child in [n children]) { + res += [self widthForNode:child]; + } + return res ? res : 1; +} + + +- (CGFloat)depthForNode:(PKParseTree *)n { + CGFloat res = 0; + for (PKParseTree *child in [n children]) { + CGFloat n = [self depthForNode:child]; + res = n > res ? n : res; + } + return res + 1; +} + + +- (NSString *)labelFromNode:(PKParseTree *)n { + if ([n isKindOfClass:[PKTokenNode class]]) { + return [[(PKTokenNode *)n token] stringValue]; + } else if ([n isKindOfClass:[PKRuleNode class]]) { + return [(PKRuleNode *)n name]; + } else { + return @"root"; + } +} + + +- (void)drawLabel:(NSString *)label atPoint:(NSPoint)p { + NSSize labelSize = [label sizeWithAttributes:labelAttrs]; + NSRect maxRect = NSMakeRect(p.x - CELL_WIDTH / 2, p.y, CELL_WIDTH, labelSize.height); + + if (!NSContainsRect(maxRect, NSMakeRect(maxRect.origin.x, maxRect.origin.y, labelSize.width, labelSize.height))) { + labelSize = maxRect.size; + } + + p.x -= labelSize.width / 2; + NSRect r = NSMakeRect(p.x, p.y, labelSize.width, labelSize.height); + NSUInteger opts = NSStringDrawingTruncatesLastVisibleLine|NSStringDrawingUsesLineFragmentOrigin; + [label drawWithRect:r options:opts attributes:labelAttrs]; +} + +@synthesize parseTree; +@synthesize labelAttrs; +@end diff --git a/demoapp/.svn/text-base/TDGutterView.h.svn-base b/demoapp/.svn/text-base/TDGutterView.h.svn-base new file mode 100644 index 0000000..d3a7b16 --- /dev/null +++ b/demoapp/.svn/text-base/TDGutterView.h.svn-base @@ -0,0 +1,25 @@ +// +// TDGutterView.h +// TextTest +// +// Created by Todd Ditchendorf on 9/9/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import + +@interface TDGutterView : NSView { + IBOutlet NSScrollView *sourceScrollView; + IBOutlet NSTextView *sourceTextView; + + NSArray *lineNumberRects; + NSUInteger startLineNumber; + + NSDictionary *attrs; +} +@property (retain) NSArray *lineNumberRects; +@property NSUInteger startLineNumber; + +@property (retain) NSScrollView *sourceScrollView; +@property (retain) NSTextView *sourceTextView; +@end diff --git a/demoapp/.svn/text-base/TDGutterView.m.svn-base b/demoapp/.svn/text-base/TDGutterView.m.svn-base new file mode 100644 index 0000000..88695f8 --- /dev/null +++ b/demoapp/.svn/text-base/TDGutterView.m.svn-base @@ -0,0 +1,92 @@ +// +// TDGutterView.m +// TextTest +// +// Created by Todd Ditchendorf on 9/9/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "TDGutterView.h" + +@interface TDGutterView () +@property (retain) NSDictionary *attrs; +@end + +@implementation TDGutterView + +- (void)awakeFromNib { + self.attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont userFixedPitchFontOfSize:11.], NSFontAttributeName, + [NSColor grayColor], NSForegroundColorAttributeName, + nil]; +} + + +- (void)dealloc { + self.sourceScrollView = nil; + self.sourceTextView = nil; + self.lineNumberRects = nil; + self.attrs = nil; + [super dealloc]; +} + + +- (BOOL)isFlipped { + return YES; +} + + +- (NSUInteger)autoresizingMask { + return NSViewHeightSizable; +} + + +- (void)drawRect:(NSRect)rect { + NSDrawWindowBackground(rect); + + CGFloat rectWidth = rect.size.width; + NSPoint p1 = NSMakePoint(rectWidth + 2., 0.); + NSPoint p2 = NSMakePoint(rectWidth + 2., rect.size.height); + [NSBezierPath strokeLineFromPoint:p1 toPoint:p2]; + + if (![lineNumberRects count]) { + return; + } + + NSUInteger i = startLineNumber; + NSUInteger count = i + [lineNumberRects count]; + + for ( ; i < count; i++) { + NSRect r = [[lineNumberRects objectAtIndex:i - startLineNumber] rectValue]; + + // set the x origin of the number according to the number of digits it contains + CGFloat x = 0.; + if (i < 9) { + x = rectWidth - 14.; + } else if (i < 99) { + x = rectWidth - 21.; + } else if (i < 999) { + x = rectWidth - 28.; + } else if (i < 9999) { + x = rectWidth - 35.; + } + r.origin.x = x; + + // center the number vertically for tall lines + if (r.origin.y) { + r.origin.y += r.size.height/2. - 7.; + } + + NSString *s = [[NSNumber numberWithInteger:i + 1] stringValue]; + NSAttributedString *as = [[NSAttributedString alloc] initWithString:s attributes:attrs]; + [as drawAtPoint:r.origin]; + [as release]; + } +} + +@synthesize sourceScrollView; +@synthesize sourceTextView; +@synthesize lineNumberRects; +@synthesize startLineNumber; +@synthesize attrs; +@end diff --git a/demoapp/.svn/text-base/TDSourceCodeTextView.h.svn-base b/demoapp/.svn/text-base/TDSourceCodeTextView.h.svn-base new file mode 100644 index 0000000..a746ce1 --- /dev/null +++ b/demoapp/.svn/text-base/TDSourceCodeTextView.h.svn-base @@ -0,0 +1,21 @@ +// +// TDSourceCodeTextView.h +// TextTest +// +// Created by Todd Ditchendorf on 9/9/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import + +@class TDGutterView; + +@interface TDSourceCodeTextView : NSTextView { + IBOutlet TDGutterView *gutterView; + IBOutlet NSScrollView *scrollView; + CGFloat sourceTextViewOffset; +} +- (void)renderGutter; + +@property (assign) TDGutterView *gutterView; +@end diff --git a/demoapp/.svn/text-base/TDSourceCodeTextView.m.svn-base b/demoapp/.svn/text-base/TDSourceCodeTextView.m.svn-base new file mode 100644 index 0000000..0b511b1 --- /dev/null +++ b/demoapp/.svn/text-base/TDSourceCodeTextView.m.svn-base @@ -0,0 +1,116 @@ +// +// TDSourceCodeTextView.m +// TextTest +// +// Created by Todd Ditchendorf on 9/9/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "TDSourceCodeTextView.h" +#import "TDGutterView.h" + +@interface TDSourceCodeTextView () +- (void)registerForNotifications; +- (void)getRectsOfVisibleLines:(NSArray **)outRects startingLineNumber:(NSUInteger *)outRect; +- (NSUInteger)lineNumberForIndex:(NSUInteger)inIndex; +@end + +@implementation TDSourceCodeTextView + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + self.gutterView = nil; + [super dealloc]; +} + + +- (void)awakeFromNib { + [self registerForNotifications]; + [self renderGutter]; +} + + +- (void)textDidChange:(NSNotification *)n { + [self renderGutter]; +} + + +- (void)viewBoundsChanged:(NSNotification *)n { + [self renderGutter]; +} + + +- (void)renderGutter { + if (![[self window] isVisible]) return; + NSArray *rects = nil; + NSUInteger start = 0; + [self getRectsOfVisibleLines:&rects startingLineNumber:&start]; + gutterView.lineNumberRects = rects; + gutterView.startLineNumber = start; + [gutterView setNeedsDisplay:YES]; +} + + +- (void)registerForNotifications { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(textDidChange:) + name:NSTextDidChangeNotification + object:self]; + + [scrollView.contentView setPostsBoundsChangedNotifications:YES]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(viewBoundsChanged:) + name:NSViewBoundsDidChangeNotification + object:scrollView.contentView]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(viewBoundsChanged:) + name:NSWindowDidResizeNotification + object:self.window]; +} + + +//- (void)showFindIndicatorForRange:(NSRange)charRange; + +- (void)getRectsOfVisibleLines:(NSArray **)outRects startingLineNumber:(NSUInteger *)outStart { + NSMutableArray *result = [NSMutableArray array]; + NSString *s = self.string; + + NSLayoutManager *layoutMgr = self.textContainer.layoutManager; + NSRect boundingRect = [scrollView.contentView documentVisibleRect]; + CGFloat scrollY = boundingRect.origin.y; + NSRange visibleGlyphRange = [layoutMgr glyphRangeForBoundingRect:boundingRect inTextContainer:self.textContainer]; + + NSUInteger index = visibleGlyphRange.location; + NSUInteger length = index + [visibleGlyphRange length]; + + (*outStart) = [self lineNumberForIndex:index + 1]; + + while (index < length) { + NSRange r = [s lineRangeForRange:NSMakeRange(index, 0)]; + index = NSMaxRange(r); + NSRect rect = [layoutMgr lineFragmentRectForGlyphAtIndex:r.location effectiveRange:NULL withoutAdditionalLayout:YES]; + rect.origin.y -= scrollY; + [result addObject:[NSValue valueWithRect:rect]]; + } + + (*outRects) = result; +} + + +- (NSUInteger)lineNumberForIndex:(NSUInteger)inIndex { + NSString *s = self.string; + NSUInteger numberOfLines, index, stringLength = [s length]; + + for (index = 0, numberOfLines = 0; index < stringLength; numberOfLines++) { + NSRange r = [s lineRangeForRange:NSMakeRange(index, 0)]; + index = NSMaxRange(r); + if (inIndex <= index) { + break; + } + } + + return numberOfLines; +} + +@synthesize gutterView; +@end diff --git a/demoapp/.svn/text-base/TokensView.xib.svn-base b/demoapp/.svn/text-base/TokensView.xib.svn-base new file mode 100644 index 0000000..7d15c41 --- /dev/null +++ b/demoapp/.svn/text-base/TokensView.xib.svn-base @@ -0,0 +1,939 @@ + + + + 1050 + 9J61 + 677 + 949.46 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + DemoTokensViewController + + + FirstResponder + + + NSApplication + + + + 268 + + YES + + + 274 + + YES + + + 2304 + + YES + + + 2322 + {457, 84} + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda + + + YES + + YES + + YES + NSFont + NSParagraphStyle + + + YES + + LucidaGrande + 1.000000e+01 + 2843 + + + 3 + + YES + + 0.000000e+00 + + + 5.600000e+01 + + + 1.120000e+02 + + + 1.680000e+02 + + + 2.240000e+02 + + + 2.800000e+02 + + + 3.360000e+02 + + + 3.920000e+02 + + + 4.480000e+02 + + + 5.040000e+02 + + + 5.600000e+02 + + + 6.160000e+02 + + + 6.720000e+02 + + + 7.280000e+02 + + + 7.840000e+02 + + + 8.400000e+02 + + + 8.960000e+02 + + + 9.520000e+02 + + + 1.008000e+03 + + + 1.064000e+03 + + + 1.120000e+03 + + + 1.176000e+03 + + + 1.232000e+03 + + + 1.288000e+03 + + + 1.344000e+03 + + + 1.400000e+03 + + + 1.456000e+03 + + + 1.512000e+03 + + + 1.568000e+03 + + + 1.624000e+03 + + + 1.680000e+03 + + + 1.736000e+03 + + + + + + + YES + + YES + NSFont + NSParagraphStyle + + + YES + + LucidaGrande-Bold + 1.000000e+01 + 16 + + + 3 + + YES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GQAEAQgADAEiAAcBhAQAA + + + + + YES + + + 6 + + + + 4.570000e+02 + 1 + + + 11009 + + 3 + MQA + + + 3 + MAA + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + 6 + System + selectedTextBackgroundColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + selectedTextColor + + + + + + + YES + + YES + NSColor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + + + + + 6 + {931, 1e+07} + {83, 0} + + + + {{1, 1}, {457, 236}} + + + + + + {4, -5} + 1 + + 4 + + + + 256 + {{458, 1}, {15, 236}} + + + _doScroller: + 2.835196e-01 + + + + 256 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 + + + {{21, 170}, {474, 238}} + + + 18 + + + + + + + 266 + {{18, 529}, {480, 51}} + + YES + + 67239424 + 272629760 + VGhpcyBhcHBsaWNhdGlvbiBnaXZlcyBhIGJhc2ljIHZpc3VhbCBkZW1vbnN0cmF0aW9uIG9mIHRoZSBU +T0RUb2tlbml6ZXIgY2xhc3MgaW5jbHVkZWQgaW4gdGhlIFRPRFBhcnNlS2l0IEZyYW1ld29yay4gUGxh +Y2UgYW55IHRleHQgaW4gdGhlIHRleHQgZmllbGQgZGlyZWN0bHkgYmVsb3cuIENsaWNrIHRoZSAiUGFy +c2UiIGJ1dHRvbiB0byBzZWUgdGhlIHRleHQgdG9rZW5pemVkLg + + LucidaGrande + 1.300000e+01 + 16 + + + + 6 + System + controlColor + + + + 6 + System + controlTextColor + + + + + + + 265 + {{405, 408}, {96, 32}} + + YES + + 67239424 + 134217728 + Parse + + LucidaGrande + 1.300000e+01 + 1044 + + + -2038284033 + 268435585 + + DQ + 200 + 25 + + + + + 290 + + YES + + YES + NSStringPboardType + + + {{21, 20}, {474, 142}} + + YES + + 341966336 + 0 + + LucidaGrande-Bold + 1.200000e+01 + 16 + + + YES + + 6 + System + textBackgroundColor + + + + + 0.000000e+00 + 0 + + 2 + + + + 266 + + YES + + + 2304 + + YES + + + 2322 + {457, 84} + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda + + + YES + + + + + GQAEAQgADAEiAAcBhAQAA + + + + + YES + + + 6 + + + + 4.570000e+02 + 1 + + + 11009 + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + + + + + + YES + + YES + NSColor + NSUnderline + + + YES + + + + + + + 6 + {931, 1e+07} + {83, 0} + + + + {{1, 1}, {457, 75}} + + + + + + 4 + + + + 256 + {{458, 1}, {15, 75}} + + YES + + _doScroller: + 8.928571e-01 + + + + 256 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 + + + {{21, 444}, {474, 77}} + + + 82 + + + + + + + 1289 + + {{387, 416}, {16, 16}} + + 28938 + 1.600000e+01 + 1.000000e+02 + + + {515, 593} + + NSView + + + + + YES + + + animate: busy + + + + + + animate: busy + animate + busy + 2 + + + 17 + + + + tokenField + + + + 18 + + + + view + + + + 19 + + + + parse: + + + + 20 + + + + value: inString + + + + + + value: inString + value + inString + + NSContinuouslyUpdatesValue + + + 2 + + + 22 + + + + value: outString + + + + + + value: outString + value + outString + + NSContinuouslyUpdatesValue + + + 2 + + + 24 + + + + value: tokString + + + + + + value: tokString + value + tokString + + NSContinuouslyUpdatesValue + + + 2 + + + 28 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + + + + + + 2 + + + YES + + + + + + + + 3 + + + YES + + + + + + 4 + + + YES + + + + + + 5 + + + YES + + + + + + 6 + + + YES + + + + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 2.IBPluginDependency + 3.IBPluginDependency + 4.IBPluginDependency + 5.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + {{227, 263}, {515, 593}} + com.apple.InterfaceBuilder.CocoaPlugin + {628, 654} + {{217, 442}, {480, 272}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 28 + + + + YES + + DemoTokensViewController + NSViewController + + parse: + id + + + tokenField + NSTokenField + + + IBProjectSource + demoapp/DemoTokensViewController.h + + + + NSObject + + IBProjectSource + test/XMLReader.h + + + + + 0 + ../ParseKit.xcodeproj + 3 + + diff --git a/demoapp/.svn/text-base/TreesView.xib.svn-base b/demoapp/.svn/text-base/TreesView.xib.svn-base new file mode 100644 index 0000000..1088d32 --- /dev/null +++ b/demoapp/.svn/text-base/TreesView.xib.svn-base @@ -0,0 +1,1391 @@ + + + + 1050 + 9J61 + 677 + 949.46 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + DemoTreesViewController + + + FirstResponder + + + NSApplication + + + + 268 + + YES + + + 274 + + YES + + + 274 + + YES + + + 1313 + + {{386, 5}, {16, 16}} + + 28938 + 1.600000e+01 + 1.000000e+02 + + + + 289 + {{404, -5}, {96, 32}} + + YES + + 67239424 + 134217728 + Parse + + LucidaGrande + 1.300000e+01 + 1044 + + + -2038284033 + 268435585 + + DQ + 200 + 25 + + + + + 274 + + YES + + + 278 + + YES + + + 268 + {{37, 223}, {67, 17}} + + YES + + 68288064 + 272630784 + Grammar: + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 276 + {{20, 2}, {40, 214}} + + TDGutterView + + + + 274 + + YES + + + 2304 + + YES + + + 2322 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + Apple URL pasteboard type + CorePasteboardFlavorType 0x6D6F6F76 + CorePasteboardFlavorType 0x75726C20 + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + NeXT font pasteboard type + NeXT ruler pasteboard type + WebURLsWithTitlesPboardType + + + {189, 432} + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda + + + YES + + YES + NSColor + NSFont + NSParagraphStyle + + + YES + + 3 + MQA + + + Monaco + 1.200000e+01 + 16 + + + 3 + + YES + + 0.000000e+00 + + + 5.600000e+01 + + + 1.120000e+02 + + + 1.680000e+02 + + + 2.240000e+02 + + + 2.800000e+02 + + + 3.360000e+02 + + + 3.920000e+02 + + + 4.480000e+02 + + + 5.040000e+02 + + + 5.600000e+02 + + + 6.160000e+02 + + + 6.720000e+02 + + + 7.280000e+02 + + + 7.840000e+02 + + + 8.400000e+02 + + + 8.960000e+02 + + + 9.520000e+02 + + + 1.008000e+03 + + + 1.064000e+03 + + + 1.120000e+03 + + + 1.176000e+03 + + + 1.232000e+03 + + + 1.288000e+03 + + + 1.344000e+03 + + + 1.400000e+03 + + + 1.456000e+03 + + + 1.512000e+03 + + + 1.568000e+03 + + + 1.624000e+03 + + + 1.680000e+03 + + + 1.736000e+03 + + + + + + + + + YES + + + 6 + + + + 1.890000e+02 + 1 + + + 12131 + + 2 + MC4xMTc2NDcwNyAwLjEyNTQ5MDIgMC4xNTY4NjI3NQA + + + 3 + MQA + + 2 + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + 6 + System + selectedTextBackgroundColor + + + + 6 + System + selectedTextColor + + + + + + + YES + + YES + NSColor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + + + + + 6 + {931, 1e+07} + {100, 0} + + + + {190, 214} + + + + + + {4, -5} + 1 + + 4 + + + + 256 + {{190, 0}, {15, 214}} + + YES + + _doScroller: + 4.953704e-01 + + + + 256 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 + + + {{60, 2}, {205, 214}} + + + 80 + + + + + + + 14 + {{20, 214}, {245, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + 6 + System + textBackgroundColor + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 38 + {{20, -1}, {245, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + {268, 260} + + NSView + + + + 275 + + YES + + + 268 + {{17, 224}, {67, 17}} + + YES + + 68288064 + 272630784 + Input: + + + + + + + + + 276 + {{0, 2}, {40, 214}} + + TDGutterView + + + + 274 + + YES + + + 2304 + + YES + + + 2322 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + Apple URL pasteboard type + CorePasteboardFlavorType 0x6D6F6F76 + CorePasteboardFlavorType 0x75726C20 + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + NeXT font pasteboard type + NeXT ruler pasteboard type + WebURLsWithTitlesPboardType + + + {201, 400} + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda + + + + + + YES + + + 6 + + + + 2.010000e+02 + 1 + + + 12131 + + 2 + MC4xMTc2NDcwNyAwLjEyNTQ5MDIgMC4xNTY4NjI3NQA + + + 3 + MQA + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + + + + + + YES + + YES + NSColor + NSUnderline + + + YES + + + + + + + 6 + {931, 1e+07} + {105, 0} + + + + {202, 214} + + + + + + 4 + + + + 256 + {{202, 0}, {15, 214}} + + YES + + _doScroller: + 5.350000e-01 + + + + 256 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 + + + {{40, 2}, {217, 214}} + + + 80 + + + + + + + 11 + {{0, 214}, {257, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 35 + {{0, -1}, {265, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + {{277, 0}, {257, 260}} + + NSView + + + {{-20, 34}, {534, 260}} + + YES + + + {514, 274} + + NSView + + + + 256 + + YES + + + 274 + + YES + + + 2304 + + YES + + + 274 + {496, 291} + + PKParseTreeView + + + {{1, 1}, {496, 291}} + + + + + 4 + + + + 256 + {{497, 1}, {15, 288}} + + + _doScroller: + 1.000000e+00 + 9.956332e-01 + + + + 256 + {{1, 292}, {496, 15}} + + 1 + + _doScroller: + 9.978166e-01 + + + {{0, -1}, {513, 308}} + + + 50 + + + + + + {{0, 283}, {514, 307}} + + NSView + + + {514, 590} + + + + {514, 590} + + NSView + + + + + YES + + + nextKeyView + + + + 114 + + + + nextKeyView + + + + 116 + + + + nextKeyView + + + + 119 + + + + delegate + + + + 122 + + + + scrollView + + + + 123 + + + + gutterView + + + + 124 + + + + scrollView + + + + 126 + + + + gutterView + + + + 127 + + + + view + + + + 129 + + + + parseTreeView + + + + 130 + + + + parse: + + + + 131 + + + + grammarTextView + + + + 132 + + + + inputTextView + + + + 133 + + + + value: inString + + + + + + value: inString + value + inString + + NSContinuouslyUpdatesValue + + + 2 + + + 136 + + + + value: grammarString + + + + + + value: grammarString + value + grammarString + + NSContinuouslyUpdatesValue + + + 2 + + + 137 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 60 + + + YES + + + + + + + 62 + + + YES + + + + + + 8 + + + YES + + + + + + bottomContainerView + + + 9 + + + YES + + + + + 10 + + + + + 11 + + + + + 92 + + + YES + + + + + + topContainerView + + + 102 + + + + + 104 + + + YES + + + + + + 105 + + + + + 141 + + + YES + + + + + + + 138 + + + YES + + + + + + + + leftContainerView + + + 100 + + + YES + + + + + + grammarScrollView + + + 98 + + + + + 99 + + + YES + + + + + + 96 + + + + + 113 + + + + + 110 + + + + + 111 + + + + + 112 + + + grammarTextView + + + 139 + + + YES + + + + + + + + rightContainerView + + + 95 + + + + + 94 + + + + + 103 + + + YES + + + + + + 93 + + + + + 101 + + + YES + + + + + + inputScrollView + + + 107 + + + inputTextView + + + 108 + + + + + 109 + + + + + 106 + + + + + 97 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 10.IBPluginDependency + 100.IBPluginDependency + 101.IBPluginDependency + 102.IBPluginDependency + 103.IBPluginDependency + 104.IBPluginDependency + 105.IBPluginDependency + 106.IBPluginDependency + 107.CustomClassName + 107.IBPluginDependency + 108.IBPluginDependency + 109.IBPluginDependency + 11.IBPluginDependency + 110.IBPluginDependency + 111.IBPluginDependency + 112.CustomClassName + 112.IBPluginDependency + 113.IBPluginDependency + 60.IBPluginDependency + 62.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + 93.IBPluginDependency + 94.IBPluginDependency + 95.IBPluginDependency + 96.IBPluginDependency + 97.IBPluginDependency + 98.IBPluginDependency + 99.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + {{32, 260}, {514, 590}} + com.apple.InterfaceBuilder.CocoaPlugin + {628, 654} + {{217, 442}, {480, 272}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + TDSourceCodeTextView + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + TDSourceCodeTextView + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 142 + + + + YES + + DemoTreesViewController + NSViewController + + parse: + id + + + YES + + YES + grammarTextView + inputTextView + parseTreeView + + + YES + TDSourceCodeTextView + TDSourceCodeTextView + PKParseTreeView + + + + IBProjectSource + demoapp/DemoTreesViewController.h + + + + NSObject + + IBProjectSource + test/XMLReader.h + + + + PKParseTreeView + NSView + + IBProjectSource + demoapp/PKParseTreeView.h + + + + TDGutterView + NSView + + YES + + YES + sourceScrollView + sourceTextView + + + YES + NSScrollView + NSTextView + + + + IBProjectSource + demoapp/TDGutterView.h + + + + TDSourceCodeTextView + NSTextView + + YES + + YES + gutterView + scrollView + + + YES + TDGutterView + NSScrollView + + + + IBProjectSource + demoapp/TDSourceCodeTextView.h + + + + + 0 + ../ParseKit.xcodeproj + 3 + + diff --git a/demoapp/.svn/text-base/main.m.svn-base b/demoapp/.svn/text-base/main.m.svn-base new file mode 100644 index 0000000..5fdddb1 --- /dev/null +++ b/demoapp/.svn/text-base/main.m.svn-base @@ -0,0 +1,13 @@ +// +// main.m +// DemoApp +// +// Created by Todd Ditchendorf on 7/12/08. +// Copyright Todd Ditchendorf 2008. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) { + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/demoapp/DemoApp-Info.plist b/demoapp/DemoApp-Info.plist new file mode 100644 index 0000000..0e08ed6 --- /dev/null +++ b/demoapp/DemoApp-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.DemoApp + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + DemoAppMainMenu + NSPrincipalClass + NSApplication + + diff --git a/demoapp/DemoAppDelegate.h b/demoapp/DemoAppDelegate.h new file mode 100644 index 0000000..129a75f --- /dev/null +++ b/demoapp/DemoAppDelegate.h @@ -0,0 +1,29 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class DemoTokensViewController; +@class DemoTreesViewController; + +@interface DemoAppDelegate : NSObject { + IBOutlet NSTabView *tabView; + + DemoTokensViewController *tokensViewController; + DemoTreesViewController *treesViewController; +} + +@property (nonatomic, retain) DemoTokensViewController *tokensViewController; +@property (nonatomic, retain) DemoTreesViewController *treesViewController; +@end diff --git a/demoapp/DemoAppDelegate.m b/demoapp/DemoAppDelegate.m new file mode 100644 index 0000000..8db8499 --- /dev/null +++ b/demoapp/DemoAppDelegate.m @@ -0,0 +1,41 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "DemoAppDelegate.h" +#import "DemoTokensViewController.h" +#import "DemoTreesViewController.h" + +@implementation DemoAppDelegate + +- (void)dealloc { + self.tokensViewController = nil; + self.treesViewController = nil; + [super dealloc]; +} + + +- (void)awakeFromNib { + self.tokensViewController = [[[DemoTokensViewController alloc] init] autorelease]; + self.treesViewController = [[[DemoTreesViewController alloc] init] autorelease]; + + NSTabViewItem *item = [tabView tabViewItemAtIndex:0]; + [item setView:[tokensViewController view]]; + + item = [tabView tabViewItemAtIndex:1]; + [item setView:[treesViewController view]]; +} + +@synthesize tokensViewController; +@synthesize treesViewController; +@end diff --git a/demoapp/DemoAppMainMenu.xib b/demoapp/DemoAppMainMenu.xib new file mode 100644 index 0000000..fc37aa6 --- /dev/null +++ b/demoapp/DemoAppMainMenu.xib @@ -0,0 +1,2268 @@ + + + + 1050 + 9J61 + 677 + 949.46 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + DemoApp + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + DemoApp + + YES + + + About DemoApp + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide DemoApp + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit DemoApp + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 1048576 + 2147483647 + + + submenuAction: + + Format + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Show Colors + C + 1179648 + 2147483647 + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 1048576 + 2147483647 + + + submenuAction: + + Help + + YES + + + NewApplication Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 15 + 2 + {{43, 10}, {1146, 856}} + 611844096 + ParseKit Demo + NSWindow + + {3.40282e+38, 3.40282e+38} + {514, 622} + + + 256 + + YES + + + 18 + {{-12, -13}, {1170, 863}} + + + YES + + 1 + + + 256 + {{10, 33}, {508, 580}} + + Tokens + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + + + 2 + + + 256 + {{10, 33}, {1150, 817}} + + + Trees + + + + + + + LucidaGrande + 1.300000e+01 + 1044 + + 0 + YES + YES + + YES + + + + + {1146, 856} + + + {{0, 0}, {1440, 878}} + {514, 644} + {3.40282e+38, 3.40282e+38} + + + DemoAppDelegate + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + orderFrontColorPanel: + + + + 361 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 369 + + + + hideOtherApplications: + + + + 370 + + + + terminate: + + + + 371 + + + + unhideAllApplications: + + + + 372 + + + + delegate + + + + 374 + + + + tabView + + + + 438 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 299 + + + YES + + + + + + 300 + + + YES + + + + + + + 344 + + + + + 345 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 367 + + + YES + + + + + + 368 + + + YES + + + + + + 373 + + + + + 413 + + + YES + + + + + + + 414 + + + YES + + + + + + 415 + + + YES + + + + + 416 + + + YES + + + + + + 417 + + + YES + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 299.IBPluginDependency + 300.IBPluginDependency + 300.editorWindowContentRectSynchronizationRect + 344.IBPluginDependency + 345.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 367.IBEditorWindowLastContentRect + 367.IBWindowTemplateEditedContentRect + 367.NSWindowTemplate.visibleAtLaunch + 367.editorWindowContentRectSynchronizationRect + 367.windowTemplate.hasMinSize + 367.windowTemplate.minSize + 368.IBPluginDependency + 373.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{365, 632}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{0, 776}, {435, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{11, 727}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{409, 832}, {176, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{8, 0}, {1146, 856}} + {{8, 0}, {1146, 856}} + + {{11, 316}, {480, 370}} + + {514, 622} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{12, 593}, {206, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{101, 533}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{323, 672}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 438 + + + + YES + + DemoAppDelegate + NSObject + + tabView + NSTabView + + + IBProjectSource + demoapp/DemoAppDelegate.h + + + + DemoAppDelegate + NSObject + + IBUserSource + + + + + NSObject + + IBProjectSource + test/XMLReader.h + + + + + 0 + ../ParseKit.xcodeproj + 3 + + diff --git a/demoapp/DemoTokensViewController.h b/demoapp/DemoTokensViewController.h new file mode 100644 index 0000000..d5cf329 --- /dev/null +++ b/demoapp/DemoTokensViewController.h @@ -0,0 +1,38 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKTokenizer; + +@interface DemoTokensViewController : NSViewController { + IBOutlet NSTokenField *tokenField; + + PKTokenizer *tokenizer; + NSString *inString; + NSString *outString; + NSString *tokString; + NSMutableArray *toks; + BOOL busy; +} + +- (IBAction)parse:(id)sender; + +@property (retain) PKTokenizer *tokenizer; +@property (retain) NSString *inString; +@property (retain) NSString *outString; +@property (retain) NSString *tokString; +@property (retain) NSMutableArray *toks; +@property BOOL busy; +@end diff --git a/demoapp/DemoTokensViewController.m b/demoapp/DemoTokensViewController.m new file mode 100644 index 0000000..7fa4fd2 --- /dev/null +++ b/demoapp/DemoTokensViewController.m @@ -0,0 +1,125 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "DemoTokensViewController.h" +#import +#import "PKParseTreeView.h" + +@interface DemoTokensViewController () +- (void)doParse; +- (void)done; +@end + +@implementation DemoTokensViewController + +- (id)init { + return [self initWithNibName:@"TokensView" bundle:nil]; +} + + +- (id)initWithNibName:(NSString *)name bundle:(NSBundle *)b { + if (self = [super initWithNibName:name bundle:b]) { + self.tokenizer = [[[PKTokenizer alloc] init] autorelease]; + + [tokenizer.symbolState add:@"::"]; + [tokenizer.symbolState add:@"<="]; + [tokenizer.symbolState add:@">="]; + [tokenizer.symbolState add:@"=="]; + [tokenizer.symbolState add:@"!="]; + [tokenizer.symbolState add:@"+="]; + [tokenizer.symbolState add:@"-="]; + [tokenizer.symbolState add:@"*="]; + [tokenizer.symbolState add:@"/="]; + [tokenizer.symbolState add:@":="]; + [tokenizer.symbolState add:@"++"]; + [tokenizer.symbolState add:@"--"]; + [tokenizer.symbolState add:@"<>"]; + [tokenizer.symbolState add:@"=:="]; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.inString = nil; + self.outString = nil; + self.tokString = nil; + self.toks = nil; + [super dealloc]; +} + + +- (void)awakeFromNib { + NSString *s = [NSString stringWithFormat:@"%C", 0xab]; + NSCharacterSet *set = [NSCharacterSet characterSetWithCharactersInString:s]; + [tokenField setTokenizingCharacterSet:set]; +} + + +- (IBAction)parse:(id)sender { + if (![inString length]) { + NSBeep(); + return; + } + + self.busy = YES; + + //[self doParse]; + [NSThread detachNewThreadSelector:@selector(doParse) toTarget:self withObject:nil]; +} + + +- (void)doParse { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + //self.tokenizer = [PKTokenizer tokenizer]; + self.tokenizer.string = self.inString; + + + self.toks = [NSMutableArray array]; + PKToken *tok = nil; + PKToken *eof = [PKToken EOFToken]; + while (eof != (tok = [tokenizer nextToken])) { + [toks addObject:tok]; + } + + [self performSelectorOnMainThread:@selector(done) withObject:nil waitUntilDone:NO]; + + [pool drain]; +} + + +- (void)done { + NSMutableString *s = [NSMutableString string]; + for (PKToken *tok in toks) { + [s appendFormat:@"%@ %C", tok.stringValue, 0xab]; + } + self.tokString = [[s copy] autorelease]; + + s = [NSMutableString string]; + for (PKToken *tok in toks) { + [s appendFormat:@"%@\n", [tok debugDescription]]; + } + self.outString = [[s copy] autorelease]; + self.busy = NO; +} + +@synthesize tokenizer; +@synthesize inString; +@synthesize outString; +@synthesize tokString; +@synthesize toks; +@synthesize busy; +@end diff --git a/demoapp/DemoTreesViewController.h b/demoapp/DemoTreesViewController.h new file mode 100644 index 0000000..be7dbee --- /dev/null +++ b/demoapp/DemoTreesViewController.h @@ -0,0 +1,35 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKParseTreeView; +@class TDSourceCodeTextView; + +@interface DemoTreesViewController : NSViewController { + IBOutlet TDSourceCodeTextView *grammarTextView; + IBOutlet TDSourceCodeTextView *inputTextView; + IBOutlet PKParseTreeView *parseTreeView; + + NSString *grammarString; + NSString *inString; + BOOL busy; +} + +- (IBAction)parse:(id)sender; + +@property (retain) NSString *grammarString; +@property (retain) NSString *inString; +@property BOOL busy; +@end diff --git a/demoapp/DemoTreesViewController.m b/demoapp/DemoTreesViewController.m new file mode 100644 index 0000000..4aaadc2 --- /dev/null +++ b/demoapp/DemoTreesViewController.m @@ -0,0 +1,163 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "DemoTreesViewController.h" +#import "PKParseTreeView.h" +#import "TDSourceCodeTextView.h" +#import "PKParseTree.h" +#import "PKRuleNode.h" +#import "PKTokenNode.h" +#import "PKParseTreeAssembler.h" +#import + +@interface DemoTreesViewController () +- (void)renderGutters; +@end + +@implementation DemoTreesViewController + +- (id)init { + return [self initWithNibName:@"TreesView" bundle:nil]; +} + + +- (id)initWithNibName:(NSString *)name bundle:(NSBundle *)b { + if (self = [super initWithNibName:name bundle:b]) { + + } + return self; +} + + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + self.grammarString = nil; + self.inString = nil; + [super dealloc]; +} + + +- (void)awakeFromNib { +// self.grammarString = @"@allowsScientificNotation=YES;\n@start = expr;\nexpr = addExpr;\naddExpr = multExpr (('+'|'-') multExpr)*;\nmultExpr = atom (('*'|'/') atom)*;\natom = Number;"; +// self.grammarString = @"@start = array;array = '[' Number (commaNumber)* ']';commaNumber = ',' Number;"; +// self.grammarString = @"@start = array;array = foo | Word; foo = 'foo';"; + self.grammarString = @"@allowsScientificNotation = YES; @start = Empty | array | object; object = '{' (Empty | property (',' property)*) '}'; property = name ':' value; name = QuotedString; array = '[' (Empty | value (',' value)*) ']'; value = 'null' | boolean | array | object | number | string; string = QuotedString; number = Number; boolean = 'true' | 'false';"; + + +// self.inString = @"4.0*.4 + 2e-12/-47 +3"; +// self.inString = @"[1,2]"; +// self.inString = @"foo"; + self.inString = @"[42e-12, null,{'foo':false}]"; + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:) name:NSWindowDidBecomeMainNotification object:[[self view] window]]; +} + + +- (void)windowDidBecomeMain:(NSNotification *)n { + [self renderGutters]; +} + + +- (void)renderGutters { + [grammarTextView renderGutter]; + [inputTextView renderGutter]; +} + + +- (IBAction)parse:(id)sender { + if (![inString length] || ![grammarString length]) { + NSBeep(); + return; + } + + self.busy = YES; + + [NSThread detachNewThreadSelector:@selector(doParse) toTarget:self withObject:nil]; +} + + +- (void)doParse { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + + PKParseTreeAssembler *as = [[[PKParseTreeAssembler alloc] init] autorelease]; + PKParser *p = [[PKParserFactory factory] parserFromGrammar:grammarString assembler:as preassembler:as]; + PKParseTree *tr = [p parse:inString]; + [parseTreeView drawParseTree:tr]; + + // release + PKReleaseSubparserTree(p); + + [self performSelectorOnMainThread:@selector(done) withObject:nil waitUntilDone:NO]; + + [pool drain]; +} + + +- (void)done { + self.busy = NO; +} + + +#pragma mark - +#pragma mark NSSplitViewDelegate + +- (BOOL)splitView:(NSSplitView *)sv canCollapseSubview:(NSView *)v { + return v == [[sv subviews] objectAtIndex:1]; +} + + +- (BOOL)splitView:(NSSplitView *)sv shouldCollapseSubview:(NSView *)v forDoubleClickOnDividerAtIndex:(NSInteger)i { + return [self splitView:sv canCollapseSubview:v]; +} + + + +// maintain constant splitview width when resizing window +- (void)splitView:(NSSplitView *)sv resizeSubviewsWithOldSize:(NSSize)oldSize { + NSRect newFrame = [sv frame]; // get the new size of the whole splitView + NSView *top = [[sv subviews] objectAtIndex:0]; + NSRect topFrame = [top frame]; + NSView *bottom = [[sv subviews] objectAtIndex:1]; + NSRect bottomFrame = [bottom frame]; + + CGFloat dividerThickness = [sv dividerThickness]; + topFrame.size.width = newFrame.size.width; + + bottomFrame.size.height = newFrame.size.height - topFrame.size.height - dividerThickness; + bottomFrame.size.width = newFrame.size.width; + topFrame.origin.y = 0; + + [top setFrame:topFrame]; + [bottom setFrame:bottomFrame]; +} + + +- (CGFloat)splitView:(NSSplitView *)sv constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)i { + if (0 == i) { + return 200; + } else { + return proposedMin; + } +} + + +- (CGFloat)splitView:(NSSplitView *)sv constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)i { + return proposedMax; +} + +@synthesize grammarString; +@synthesize inString; +@synthesize busy; +@end + diff --git a/demoapp/PKParseTreeView.h b/demoapp/PKParseTreeView.h new file mode 100644 index 0000000..e9d569b --- /dev/null +++ b/demoapp/PKParseTreeView.h @@ -0,0 +1,27 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKParseTree; + +@interface PKParseTreeView : NSView { + PKParseTree *parseTree; + NSDictionary *labelAttrs; +} +- (void)drawParseTree:(PKParseTree *)t; + +@property (nonatomic, retain) PKParseTree *parseTree; +@property (nonatomic, retain) NSDictionary *labelAttrs; +@end diff --git a/demoapp/PKParseTreeView.m b/demoapp/PKParseTreeView.m new file mode 100644 index 0000000..d7008f1 --- /dev/null +++ b/demoapp/PKParseTreeView.m @@ -0,0 +1,190 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKParseTreeView.h" +#import +#import "PKParseTree.h" +#import "PKRuleNode.h" +#import "PKTokenNode.h" +#import "PKParseTreeAssembler.h" + +#define ROW_HEIGHT 50.0 +#define CELL_WIDTH 55.0 + +@interface PKParseTreeView () +- (void)drawTree:(PKParseTree *)n atPoint:(NSPoint)p; +- (void)drawParentNode:(PKParseTree *)n atPoint:(NSPoint)p; +- (void)drawLeafNode:(PKTokenNode *)n atPoint:(NSPoint)p; + +- (CGFloat)widthForNode:(PKParseTree *)n; +- (CGFloat)depthForNode:(PKParseTree *)n; +- (NSString *)labelFromNode:(PKParseTree *)n; +- (void)drawLabel:(NSString *)label atPoint:(NSPoint)p; +@end + +@implementation PKParseTreeView + +- (id)initWithFrame:(NSRect)frame { + if (self = [super initWithFrame:frame]) { + self.labelAttrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont boldSystemFontOfSize:10], NSFontAttributeName, + [NSColor blackColor], NSForegroundColorAttributeName, + nil]; + } + return self; +} + + +- (void)dealloc { + self.parseTree = nil; + self.labelAttrs = nil; + [super dealloc]; +} + + +- (BOOL)isFlipped { + return YES; +} + + +- (void)drawParseTree:(PKParseTree *)t { + self.parseTree = t; + + CGFloat w = [self widthForNode:parseTree] * CELL_WIDTH; + CGFloat h = [self depthForNode:parseTree] * ROW_HEIGHT + 120; + + NSSize minSize = [[self superview] bounds].size; + w = w < minSize.width ? minSize.width : w; + h = h < minSize.height ? minSize.height : h; + [self setFrame:NSMakeRect(0, 0, w, h)]; + + [self setNeedsDisplay:YES]; +} + + +- (void)drawRect:(NSRect)r { + [[NSColor whiteColor] set]; + NSRectFill(r); + + [self drawTree:parseTree atPoint:NSMakePoint(r.size.width / 2, 20)]; +} + + +- (void)drawTree:(PKParseTree *)n atPoint:(NSPoint)p { + if ([n isKindOfClass:[PKTokenNode class]]) { + [self drawLeafNode:(id)n atPoint:p]; + } else { + [self drawParentNode:n atPoint:p]; + } +} + + +- (void)drawParentNode:(PKParseTree *)n atPoint:(NSPoint)p { + // draw own label + [self drawLabel:[self labelFromNode:n] atPoint:NSMakePoint(p.x, p.y)]; + + NSUInteger i = 0; + NSUInteger c = [[n children] count]; + + // get total width + CGFloat widths[c]; + CGFloat totalWidth = 0; + for (PKParseTree *child in [n children]) { + widths[i] = [self widthForNode:child] * CELL_WIDTH; + totalWidth += widths[i++]; + } + + + // draw children + NSPoint points[c]; + if (1 == c) { + points[0] = NSMakePoint(p.x, p.y + ROW_HEIGHT); + [self drawTree:[[n children] objectAtIndex:0] atPoint:points[0]]; + } else { + CGFloat x = 0; + CGFloat buff = 0; + for (i = 0; i < c; i++) { + x = p.x - (totalWidth/2) + buff + widths[i]/2; + buff += widths[i]; + + points[i] = NSMakePoint(x, p.y + ROW_HEIGHT); + [self drawTree:[[n children] objectAtIndex:i] atPoint:points[i]]; + } + } + + // draw lines + CGContextRef ctx = [[NSGraphicsContext currentContext] graphicsPort]; + + for (i = 0; i < c; i++) { + CGContextBeginPath(ctx); + CGContextMoveToPoint(ctx, p.x, p.y + 15); + CGContextAddLineToPoint(ctx, points[i].x, points[i].y - 4); + CGContextClosePath(ctx); + CGContextStrokePath(ctx); + } +} + + +- (void)drawLeafNode:(PKTokenNode *)n atPoint:(NSPoint)p { + [self drawLabel:[self labelFromNode:n] atPoint:NSMakePoint(p.x, p.y)]; +} + + +- (CGFloat)widthForNode:(PKParseTree *)n { + CGFloat res = 0; + for (PKParseTree *child in [n children]) { + res += [self widthForNode:child]; + } + return res ? res : 1; +} + + +- (CGFloat)depthForNode:(PKParseTree *)n { + CGFloat res = 0; + for (PKParseTree *child in [n children]) { + CGFloat n = [self depthForNode:child]; + res = n > res ? n : res; + } + return res + 1; +} + + +- (NSString *)labelFromNode:(PKParseTree *)n { + if ([n isKindOfClass:[PKTokenNode class]]) { + return [[(PKTokenNode *)n token] stringValue]; + } else if ([n isKindOfClass:[PKRuleNode class]]) { + return [(PKRuleNode *)n name]; + } else { + return @"root"; + } +} + + +- (void)drawLabel:(NSString *)label atPoint:(NSPoint)p { + NSSize labelSize = [label sizeWithAttributes:labelAttrs]; + NSRect maxRect = NSMakeRect(p.x - CELL_WIDTH / 2, p.y, CELL_WIDTH, labelSize.height); + + if (!NSContainsRect(maxRect, NSMakeRect(maxRect.origin.x, maxRect.origin.y, labelSize.width, labelSize.height))) { + labelSize = maxRect.size; + } + + p.x -= labelSize.width / 2; + NSRect r = NSMakeRect(p.x, p.y, labelSize.width, labelSize.height); + NSUInteger opts = NSStringDrawingTruncatesLastVisibleLine|NSStringDrawingUsesLineFragmentOrigin; + [label drawWithRect:r options:opts attributes:labelAttrs]; +} + +@synthesize parseTree; +@synthesize labelAttrs; +@end diff --git a/demoapp/TDGutterView.h b/demoapp/TDGutterView.h new file mode 100644 index 0000000..d3a7b16 --- /dev/null +++ b/demoapp/TDGutterView.h @@ -0,0 +1,25 @@ +// +// TDGutterView.h +// TextTest +// +// Created by Todd Ditchendorf on 9/9/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import + +@interface TDGutterView : NSView { + IBOutlet NSScrollView *sourceScrollView; + IBOutlet NSTextView *sourceTextView; + + NSArray *lineNumberRects; + NSUInteger startLineNumber; + + NSDictionary *attrs; +} +@property (retain) NSArray *lineNumberRects; +@property NSUInteger startLineNumber; + +@property (retain) NSScrollView *sourceScrollView; +@property (retain) NSTextView *sourceTextView; +@end diff --git a/demoapp/TDGutterView.m b/demoapp/TDGutterView.m new file mode 100644 index 0000000..88695f8 --- /dev/null +++ b/demoapp/TDGutterView.m @@ -0,0 +1,92 @@ +// +// TDGutterView.m +// TextTest +// +// Created by Todd Ditchendorf on 9/9/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "TDGutterView.h" + +@interface TDGutterView () +@property (retain) NSDictionary *attrs; +@end + +@implementation TDGutterView + +- (void)awakeFromNib { + self.attrs = [NSDictionary dictionaryWithObjectsAndKeys: + [NSFont userFixedPitchFontOfSize:11.], NSFontAttributeName, + [NSColor grayColor], NSForegroundColorAttributeName, + nil]; +} + + +- (void)dealloc { + self.sourceScrollView = nil; + self.sourceTextView = nil; + self.lineNumberRects = nil; + self.attrs = nil; + [super dealloc]; +} + + +- (BOOL)isFlipped { + return YES; +} + + +- (NSUInteger)autoresizingMask { + return NSViewHeightSizable; +} + + +- (void)drawRect:(NSRect)rect { + NSDrawWindowBackground(rect); + + CGFloat rectWidth = rect.size.width; + NSPoint p1 = NSMakePoint(rectWidth + 2., 0.); + NSPoint p2 = NSMakePoint(rectWidth + 2., rect.size.height); + [NSBezierPath strokeLineFromPoint:p1 toPoint:p2]; + + if (![lineNumberRects count]) { + return; + } + + NSUInteger i = startLineNumber; + NSUInteger count = i + [lineNumberRects count]; + + for ( ; i < count; i++) { + NSRect r = [[lineNumberRects objectAtIndex:i - startLineNumber] rectValue]; + + // set the x origin of the number according to the number of digits it contains + CGFloat x = 0.; + if (i < 9) { + x = rectWidth - 14.; + } else if (i < 99) { + x = rectWidth - 21.; + } else if (i < 999) { + x = rectWidth - 28.; + } else if (i < 9999) { + x = rectWidth - 35.; + } + r.origin.x = x; + + // center the number vertically for tall lines + if (r.origin.y) { + r.origin.y += r.size.height/2. - 7.; + } + + NSString *s = [[NSNumber numberWithInteger:i + 1] stringValue]; + NSAttributedString *as = [[NSAttributedString alloc] initWithString:s attributes:attrs]; + [as drawAtPoint:r.origin]; + [as release]; + } +} + +@synthesize sourceScrollView; +@synthesize sourceTextView; +@synthesize lineNumberRects; +@synthesize startLineNumber; +@synthesize attrs; +@end diff --git a/demoapp/TDSourceCodeTextView.h b/demoapp/TDSourceCodeTextView.h new file mode 100644 index 0000000..a746ce1 --- /dev/null +++ b/demoapp/TDSourceCodeTextView.h @@ -0,0 +1,21 @@ +// +// TDSourceCodeTextView.h +// TextTest +// +// Created by Todd Ditchendorf on 9/9/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import + +@class TDGutterView; + +@interface TDSourceCodeTextView : NSTextView { + IBOutlet TDGutterView *gutterView; + IBOutlet NSScrollView *scrollView; + CGFloat sourceTextViewOffset; +} +- (void)renderGutter; + +@property (assign) TDGutterView *gutterView; +@end diff --git a/demoapp/TDSourceCodeTextView.m b/demoapp/TDSourceCodeTextView.m new file mode 100644 index 0000000..0b511b1 --- /dev/null +++ b/demoapp/TDSourceCodeTextView.m @@ -0,0 +1,116 @@ +// +// TDSourceCodeTextView.m +// TextTest +// +// Created by Todd Ditchendorf on 9/9/08. +// Copyright 2008 __MyCompanyName__. All rights reserved. +// + +#import "TDSourceCodeTextView.h" +#import "TDGutterView.h" + +@interface TDSourceCodeTextView () +- (void)registerForNotifications; +- (void)getRectsOfVisibleLines:(NSArray **)outRects startingLineNumber:(NSUInteger *)outRect; +- (NSUInteger)lineNumberForIndex:(NSUInteger)inIndex; +@end + +@implementation TDSourceCodeTextView + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + self.gutterView = nil; + [super dealloc]; +} + + +- (void)awakeFromNib { + [self registerForNotifications]; + [self renderGutter]; +} + + +- (void)textDidChange:(NSNotification *)n { + [self renderGutter]; +} + + +- (void)viewBoundsChanged:(NSNotification *)n { + [self renderGutter]; +} + + +- (void)renderGutter { + if (![[self window] isVisible]) return; + NSArray *rects = nil; + NSUInteger start = 0; + [self getRectsOfVisibleLines:&rects startingLineNumber:&start]; + gutterView.lineNumberRects = rects; + gutterView.startLineNumber = start; + [gutterView setNeedsDisplay:YES]; +} + + +- (void)registerForNotifications { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(textDidChange:) + name:NSTextDidChangeNotification + object:self]; + + [scrollView.contentView setPostsBoundsChangedNotifications:YES]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(viewBoundsChanged:) + name:NSViewBoundsDidChangeNotification + object:scrollView.contentView]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(viewBoundsChanged:) + name:NSWindowDidResizeNotification + object:self.window]; +} + + +//- (void)showFindIndicatorForRange:(NSRange)charRange; + +- (void)getRectsOfVisibleLines:(NSArray **)outRects startingLineNumber:(NSUInteger *)outStart { + NSMutableArray *result = [NSMutableArray array]; + NSString *s = self.string; + + NSLayoutManager *layoutMgr = self.textContainer.layoutManager; + NSRect boundingRect = [scrollView.contentView documentVisibleRect]; + CGFloat scrollY = boundingRect.origin.y; + NSRange visibleGlyphRange = [layoutMgr glyphRangeForBoundingRect:boundingRect inTextContainer:self.textContainer]; + + NSUInteger index = visibleGlyphRange.location; + NSUInteger length = index + [visibleGlyphRange length]; + + (*outStart) = [self lineNumberForIndex:index + 1]; + + while (index < length) { + NSRange r = [s lineRangeForRange:NSMakeRange(index, 0)]; + index = NSMaxRange(r); + NSRect rect = [layoutMgr lineFragmentRectForGlyphAtIndex:r.location effectiveRange:NULL withoutAdditionalLayout:YES]; + rect.origin.y -= scrollY; + [result addObject:[NSValue valueWithRect:rect]]; + } + + (*outRects) = result; +} + + +- (NSUInteger)lineNumberForIndex:(NSUInteger)inIndex { + NSString *s = self.string; + NSUInteger numberOfLines, index, stringLength = [s length]; + + for (index = 0, numberOfLines = 0; index < stringLength; numberOfLines++) { + NSRange r = [s lineRangeForRange:NSMakeRange(index, 0)]; + index = NSMaxRange(r); + if (inIndex <= index) { + break; + } + } + + return numberOfLines; +} + +@synthesize gutterView; +@end diff --git a/demoapp/TokensView.xib b/demoapp/TokensView.xib new file mode 100644 index 0000000..7d15c41 --- /dev/null +++ b/demoapp/TokensView.xib @@ -0,0 +1,939 @@ + + + + 1050 + 9J61 + 677 + 949.46 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + DemoTokensViewController + + + FirstResponder + + + NSApplication + + + + 268 + + YES + + + 274 + + YES + + + 2304 + + YES + + + 2322 + {457, 84} + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda + + + YES + + YES + + YES + NSFont + NSParagraphStyle + + + YES + + LucidaGrande + 1.000000e+01 + 2843 + + + 3 + + YES + + 0.000000e+00 + + + 5.600000e+01 + + + 1.120000e+02 + + + 1.680000e+02 + + + 2.240000e+02 + + + 2.800000e+02 + + + 3.360000e+02 + + + 3.920000e+02 + + + 4.480000e+02 + + + 5.040000e+02 + + + 5.600000e+02 + + + 6.160000e+02 + + + 6.720000e+02 + + + 7.280000e+02 + + + 7.840000e+02 + + + 8.400000e+02 + + + 8.960000e+02 + + + 9.520000e+02 + + + 1.008000e+03 + + + 1.064000e+03 + + + 1.120000e+03 + + + 1.176000e+03 + + + 1.232000e+03 + + + 1.288000e+03 + + + 1.344000e+03 + + + 1.400000e+03 + + + 1.456000e+03 + + + 1.512000e+03 + + + 1.568000e+03 + + + 1.624000e+03 + + + 1.680000e+03 + + + 1.736000e+03 + + + + + + + YES + + YES + NSFont + NSParagraphStyle + + + YES + + LucidaGrande-Bold + 1.000000e+01 + 16 + + + 3 + + YES + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GQAEAQgADAEiAAcBhAQAA + + + + + YES + + + 6 + + + + 4.570000e+02 + 1 + + + 11009 + + 3 + MQA + + + 3 + MAA + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + 6 + System + selectedTextBackgroundColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + selectedTextColor + + + + + + + YES + + YES + NSColor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + + + + + 6 + {931, 1e+07} + {83, 0} + + + + {{1, 1}, {457, 236}} + + + + + + {4, -5} + 1 + + 4 + + + + 256 + {{458, 1}, {15, 236}} + + + _doScroller: + 2.835196e-01 + + + + 256 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 + + + {{21, 170}, {474, 238}} + + + 18 + + + + + + + 266 + {{18, 529}, {480, 51}} + + YES + + 67239424 + 272629760 + VGhpcyBhcHBsaWNhdGlvbiBnaXZlcyBhIGJhc2ljIHZpc3VhbCBkZW1vbnN0cmF0aW9uIG9mIHRoZSBU +T0RUb2tlbml6ZXIgY2xhc3MgaW5jbHVkZWQgaW4gdGhlIFRPRFBhcnNlS2l0IEZyYW1ld29yay4gUGxh +Y2UgYW55IHRleHQgaW4gdGhlIHRleHQgZmllbGQgZGlyZWN0bHkgYmVsb3cuIENsaWNrIHRoZSAiUGFy +c2UiIGJ1dHRvbiB0byBzZWUgdGhlIHRleHQgdG9rZW5pemVkLg + + LucidaGrande + 1.300000e+01 + 16 + + + + 6 + System + controlColor + + + + 6 + System + controlTextColor + + + + + + + 265 + {{405, 408}, {96, 32}} + + YES + + 67239424 + 134217728 + Parse + + LucidaGrande + 1.300000e+01 + 1044 + + + -2038284033 + 268435585 + + DQ + 200 + 25 + + + + + 290 + + YES + + YES + NSStringPboardType + + + {{21, 20}, {474, 142}} + + YES + + 341966336 + 0 + + LucidaGrande-Bold + 1.200000e+01 + 16 + + + YES + + 6 + System + textBackgroundColor + + + + + 0.000000e+00 + 0 + + 2 + + + + 266 + + YES + + + 2304 + + YES + + + 2322 + {457, 84} + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda + + + YES + + + + + GQAEAQgADAEiAAcBhAQAA + + + + + YES + + + 6 + + + + 4.570000e+02 + 1 + + + 11009 + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + + + + + + YES + + YES + NSColor + NSUnderline + + + YES + + + + + + + 6 + {931, 1e+07} + {83, 0} + + + + {{1, 1}, {457, 75}} + + + + + + 4 + + + + 256 + {{458, 1}, {15, 75}} + + YES + + _doScroller: + 8.928571e-01 + + + + 256 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 + + + {{21, 444}, {474, 77}} + + + 82 + + + + + + + 1289 + + {{387, 416}, {16, 16}} + + 28938 + 1.600000e+01 + 1.000000e+02 + + + {515, 593} + + NSView + + + + + YES + + + animate: busy + + + + + + animate: busy + animate + busy + 2 + + + 17 + + + + tokenField + + + + 18 + + + + view + + + + 19 + + + + parse: + + + + 20 + + + + value: inString + + + + + + value: inString + value + inString + + NSContinuouslyUpdatesValue + + + 2 + + + 22 + + + + value: outString + + + + + + value: outString + value + outString + + NSContinuouslyUpdatesValue + + + 2 + + + 24 + + + + value: tokString + + + + + + value: tokString + value + tokString + + NSContinuouslyUpdatesValue + + + 2 + + + 28 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + + + + + + 2 + + + YES + + + + + + + + 3 + + + YES + + + + + + 4 + + + YES + + + + + + 5 + + + YES + + + + + + 6 + + + YES + + + + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 10.IBPluginDependency + 11.IBPluginDependency + 12.IBPluginDependency + 13.IBPluginDependency + 14.IBPluginDependency + 15.IBPluginDependency + 16.IBPluginDependency + 2.IBPluginDependency + 3.IBPluginDependency + 4.IBPluginDependency + 5.IBPluginDependency + 6.IBPluginDependency + 7.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + {{227, 263}, {515, 593}} + com.apple.InterfaceBuilder.CocoaPlugin + {628, 654} + {{217, 442}, {480, 272}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 28 + + + + YES + + DemoTokensViewController + NSViewController + + parse: + id + + + tokenField + NSTokenField + + + IBProjectSource + demoapp/DemoTokensViewController.h + + + + NSObject + + IBProjectSource + test/XMLReader.h + + + + + 0 + ../ParseKit.xcodeproj + 3 + + diff --git a/demoapp/TreesView.xib b/demoapp/TreesView.xib new file mode 100644 index 0000000..1088d32 --- /dev/null +++ b/demoapp/TreesView.xib @@ -0,0 +1,1391 @@ + + + + 1050 + 9J61 + 677 + 949.46 + 353.00 + + YES + + + + YES + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + DemoTreesViewController + + + FirstResponder + + + NSApplication + + + + 268 + + YES + + + 274 + + YES + + + 274 + + YES + + + 1313 + + {{386, 5}, {16, 16}} + + 28938 + 1.600000e+01 + 1.000000e+02 + + + + 289 + {{404, -5}, {96, 32}} + + YES + + 67239424 + 134217728 + Parse + + LucidaGrande + 1.300000e+01 + 1044 + + + -2038284033 + 268435585 + + DQ + 200 + 25 + + + + + 274 + + YES + + + 278 + + YES + + + 268 + {{37, 223}, {67, 17}} + + YES + + 68288064 + 272630784 + Grammar: + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2OQA + + + + 6 + System + controlTextColor + + 3 + MAA + + + + + + + 276 + {{20, 2}, {40, 214}} + + TDGutterView + + + + 274 + + YES + + + 2304 + + YES + + + 2322 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + Apple URL pasteboard type + CorePasteboardFlavorType 0x6D6F6F76 + CorePasteboardFlavorType 0x75726C20 + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + NeXT font pasteboard type + NeXT ruler pasteboard type + WebURLsWithTitlesPboardType + + + {189, 432} + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda + + + YES + + YES + NSColor + NSFont + NSParagraphStyle + + + YES + + 3 + MQA + + + Monaco + 1.200000e+01 + 16 + + + 3 + + YES + + 0.000000e+00 + + + 5.600000e+01 + + + 1.120000e+02 + + + 1.680000e+02 + + + 2.240000e+02 + + + 2.800000e+02 + + + 3.360000e+02 + + + 3.920000e+02 + + + 4.480000e+02 + + + 5.040000e+02 + + + 5.600000e+02 + + + 6.160000e+02 + + + 6.720000e+02 + + + 7.280000e+02 + + + 7.840000e+02 + + + 8.400000e+02 + + + 8.960000e+02 + + + 9.520000e+02 + + + 1.008000e+03 + + + 1.064000e+03 + + + 1.120000e+03 + + + 1.176000e+03 + + + 1.232000e+03 + + + 1.288000e+03 + + + 1.344000e+03 + + + 1.400000e+03 + + + 1.456000e+03 + + + 1.512000e+03 + + + 1.568000e+03 + + + 1.624000e+03 + + + 1.680000e+03 + + + 1.736000e+03 + + + + + + + + + YES + + + 6 + + + + 1.890000e+02 + 1 + + + 12131 + + 2 + MC4xMTc2NDcwNyAwLjEyNTQ5MDIgMC4xNTY4NjI3NQA + + + 3 + MQA + + 2 + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + 6 + System + selectedTextBackgroundColor + + + + 6 + System + selectedTextColor + + + + + + + YES + + YES + NSColor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + + + + + 6 + {931, 1e+07} + {100, 0} + + + + {190, 214} + + + + + + {4, -5} + 1 + + 4 + + + + 256 + {{190, 0}, {15, 214}} + + YES + + _doScroller: + 4.953704e-01 + + + + 256 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 + + + {{60, 2}, {205, 214}} + + + 80 + + + + + + + 14 + {{20, 214}, {245, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + 6 + System + textBackgroundColor + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 38 + {{20, -1}, {245, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + {268, 260} + + NSView + + + + 275 + + YES + + + 268 + {{17, 224}, {67, 17}} + + YES + + 68288064 + 272630784 + Input: + + + + + + + + + 276 + {{0, 2}, {40, 214}} + + TDGutterView + + + + 274 + + YES + + + 2304 + + YES + + + 2322 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple PNG pasteboard type + Apple URL pasteboard type + CorePasteboardFlavorType 0x6D6F6F76 + CorePasteboardFlavorType 0x75726C20 + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT Encapsulated PostScript v1.2 pasteboard type + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + NeXT font pasteboard type + NeXT ruler pasteboard type + WebURLsWithTitlesPboardType + + + {201, 400} + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum Et harumd und lookum like Greek to me, dereud facilis est er expedit distinct. Nam liber te conscient to factor tum poen legum odioque civiuda + + + + + + YES + + + 6 + + + + 2.010000e+02 + 1 + + + 12131 + + 2 + MC4xMTc2NDcwNyAwLjEyNTQ5MDIgMC4xNTY4NjI3NQA + + + 3 + MQA + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + + + + + + YES + + YES + NSColor + NSUnderline + + + YES + + + + + + + 6 + {931, 1e+07} + {105, 0} + + + + {202, 214} + + + + + + 4 + + + + 256 + {{202, 0}, {15, 214}} + + YES + + _doScroller: + 5.350000e-01 + + + + 256 + {{-100, -100}, {87, 18}} + + 1 + + _doScroller: + 1.000000e+00 + 9.456522e-01 + + + {{40, 2}, {217, 214}} + + + 80 + + + + + + + 11 + {{0, 214}, {257, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 35 + {{0, -1}, {265, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + {{277, 0}, {257, 260}} + + NSView + + + {{-20, 34}, {534, 260}} + + YES + + + {514, 274} + + NSView + + + + 256 + + YES + + + 274 + + YES + + + 2304 + + YES + + + 274 + {496, 291} + + PKParseTreeView + + + {{1, 1}, {496, 291}} + + + + + 4 + + + + 256 + {{497, 1}, {15, 288}} + + + _doScroller: + 1.000000e+00 + 9.956332e-01 + + + + 256 + {{1, 292}, {496, 15}} + + 1 + + _doScroller: + 9.978166e-01 + + + {{0, -1}, {513, 308}} + + + 50 + + + + + + {{0, 283}, {514, 307}} + + NSView + + + {514, 590} + + + + {514, 590} + + NSView + + + + + YES + + + nextKeyView + + + + 114 + + + + nextKeyView + + + + 116 + + + + nextKeyView + + + + 119 + + + + delegate + + + + 122 + + + + scrollView + + + + 123 + + + + gutterView + + + + 124 + + + + scrollView + + + + 126 + + + + gutterView + + + + 127 + + + + view + + + + 129 + + + + parseTreeView + + + + 130 + + + + parse: + + + + 131 + + + + grammarTextView + + + + 132 + + + + inputTextView + + + + 133 + + + + value: inString + + + + + + value: inString + value + inString + + NSContinuouslyUpdatesValue + + + 2 + + + 136 + + + + value: grammarString + + + + + + value: grammarString + value + grammarString + + NSContinuouslyUpdatesValue + + + 2 + + + 137 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 60 + + + YES + + + + + + + 62 + + + YES + + + + + + 8 + + + YES + + + + + + bottomContainerView + + + 9 + + + YES + + + + + 10 + + + + + 11 + + + + + 92 + + + YES + + + + + + topContainerView + + + 102 + + + + + 104 + + + YES + + + + + + 105 + + + + + 141 + + + YES + + + + + + + 138 + + + YES + + + + + + + + leftContainerView + + + 100 + + + YES + + + + + + grammarScrollView + + + 98 + + + + + 99 + + + YES + + + + + + 96 + + + + + 113 + + + + + 110 + + + + + 111 + + + + + 112 + + + grammarTextView + + + 139 + + + YES + + + + + + + + rightContainerView + + + 95 + + + + + 94 + + + + + 103 + + + YES + + + + + + 93 + + + + + 101 + + + YES + + + + + + inputScrollView + + + 107 + + + inputTextView + + + 108 + + + + + 109 + + + + + 106 + + + + + 97 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 10.IBPluginDependency + 100.IBPluginDependency + 101.IBPluginDependency + 102.IBPluginDependency + 103.IBPluginDependency + 104.IBPluginDependency + 105.IBPluginDependency + 106.IBPluginDependency + 107.CustomClassName + 107.IBPluginDependency + 108.IBPluginDependency + 109.IBPluginDependency + 11.IBPluginDependency + 110.IBPluginDependency + 111.IBPluginDependency + 112.CustomClassName + 112.IBPluginDependency + 113.IBPluginDependency + 60.IBPluginDependency + 62.IBPluginDependency + 8.IBPluginDependency + 9.IBPluginDependency + 93.IBPluginDependency + 94.IBPluginDependency + 95.IBPluginDependency + 96.IBPluginDependency + 97.IBPluginDependency + 98.IBPluginDependency + 99.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + {{32, 260}, {514, 590}} + com.apple.InterfaceBuilder.CocoaPlugin + {628, 654} + {{217, 442}, {480, 272}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + TDSourceCodeTextView + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + TDSourceCodeTextView + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 142 + + + + YES + + DemoTreesViewController + NSViewController + + parse: + id + + + YES + + YES + grammarTextView + inputTextView + parseTreeView + + + YES + TDSourceCodeTextView + TDSourceCodeTextView + PKParseTreeView + + + + IBProjectSource + demoapp/DemoTreesViewController.h + + + + NSObject + + IBProjectSource + test/XMLReader.h + + + + PKParseTreeView + NSView + + IBProjectSource + demoapp/PKParseTreeView.h + + + + TDGutterView + NSView + + YES + + YES + sourceScrollView + sourceTextView + + + YES + NSScrollView + NSTextView + + + + IBProjectSource + demoapp/TDGutterView.h + + + + TDSourceCodeTextView + NSTextView + + YES + + YES + gutterView + scrollView + + + YES + TDGutterView + NSScrollView + + + + IBProjectSource + demoapp/TDSourceCodeTextView.h + + + + + 0 + ../ParseKit.xcodeproj + 3 + + diff --git a/demoapp/main.m b/demoapp/main.m new file mode 100644 index 0000000..5fdddb1 --- /dev/null +++ b/demoapp/main.m @@ -0,0 +1,13 @@ +// +// main.m +// DemoApp +// +// Created by Todd Ditchendorf on 7/12/08. +// Copyright Todd Ditchendorf 2008. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) { + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/docs/.svn/all-wcprops b/docs/.svn/all-wcprops new file mode 100644 index 0000000..3c0e1db --- /dev/null +++ b/docs/.svn/all-wcprops @@ -0,0 +1,17 @@ +K 25 +svn:wc:ra_dav:version-url +V 29 +/svn/!svn/ver/1396/trunk/docs +END +Doxyfile +K 25 +svn:wc:ra_dav:version-url +V 38 +/svn/!svn/ver/1242/trunk/docs/Doxyfile +END +ParseKit.key +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1389/trunk/docs/ParseKit.key +END diff --git a/docs/.svn/dir-prop-base b/docs/.svn/dir-prop-base new file mode 100644 index 0000000..8387a00 --- /dev/null +++ b/docs/.svn/dir-prop-base @@ -0,0 +1,6 @@ +K 10 +svn:ignore +V 8 +doxygen + +END diff --git a/docs/.svn/entries b/docs/.svn/entries new file mode 100644 index 0000000..c2c40ac --- /dev/null +++ b/docs/.svn/entries @@ -0,0 +1,106 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/docs +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-09-18T01:37:04.877278Z +1396 +todd.ditchendorf +has-props + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + + + + + + +0 + +Doxyfile +file + + + + +2009-07-19T19:57:58.000000Z +f653467bf611906c2458a7d4096d1442 +2009-07-19T19:43:23.316366Z +1242 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +10715 + +ParseKit.key +file + + + + +2009-09-18T00:47:09.000000Z +9507a262a0d49d6a9e52e51a2445aec3 +2009-09-18T00:47:16.771792Z +1389 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +557092 + +web +dir + diff --git a/docs/.svn/prop-base/ParseKit.key.svn-base b/docs/.svn/prop-base/ParseKit.key.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/.svn/prop-base/ParseKit.key.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/.svn/text-base/Doxyfile.svn-base b/docs/.svn/text-base/Doxyfile.svn-base new file mode 100644 index 0000000..1f3b885 --- /dev/null +++ b/docs/.svn/text-base/Doxyfile.svn-base @@ -0,0 +1,291 @@ +# Doxyfile 1.5.7 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = ParseKit +PROJECT_NUMBER = 1.4 +OUTPUT_DIRECTORY = /Users/itod/work/tpk/trunk/docs/doxygen +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = /Applications/ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +TYPEDEF_HIDES_STRUCT = NO +SYMBOL_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = /Users/itod/work/tpk/trunk/src +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.vhd \ + *.vhdl +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = NO +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +HTML_DYNAMIC_SECTIONS = NO +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHG_LOCATION = +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = ALL +TREEVIEW_WIDTH = 250 +FORMULA_FONTSIZE = 10 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = YES +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +MSCGEN_PATH = /Applications/Doxygen.app/Contents/Resources/ +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +DOT_FONTNAME = FreeSans +DOT_FONTPATH = +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = YES +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = /Applications/Doxygen.app/Contents/Resources/ +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/docs/.svn/text-base/ParseKit.key.svn-base b/docs/.svn/text-base/ParseKit.key.svn-base new file mode 100644 index 0000000..1211fb2 Binary files /dev/null and b/docs/.svn/text-base/ParseKit.key.svn-base differ diff --git a/docs/.svn/tmp/tempfile.2.tmp b/docs/.svn/tmp/tempfile.2.tmp new file mode 100644 index 0000000..bcac5d8 --- /dev/null +++ b/docs/.svn/tmp/tempfile.2.tmp @@ -0,0 +1,1546 @@ +# Doxyfile 1.5.8 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# http://www.gnu.org/software/libiconv for the list of possible encodings. + +DOXYFILE_ENCODING = UTF-8 +<<<<<<< .mine +PROJECT_NAME = ParseKit +PROJECT_NUMBER = 1.4 +======= + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = ParseKit + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 1.4 + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +>>>>>>> .r1241 +OUTPUT_DIRECTORY = /Users/itod/work/tpk/trunk/docs/doxygen + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of +# source files, where putting all generated files in the same directory would +# otherwise cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, +# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek, +# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish, +# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene, +# Spanish, Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is +# used as the annotated text. Otherwise, the brief description is used as-is. +# If left blank, the following values are used ("$name" is automatically +# replaced with the name of the entity): "The $name class" "The $name widget" +# "The $name file" "is" "provides" "specifies" "contains" +# "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = /Applications/ + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like regular Qt-style comments +# (thus requiring an explicit @brief command for a brief description.) + +JAVADOC_AUTOBRIEF = NO + +# If the QT_AUTOBRIEF tag is set to YES then Doxygen will +# interpret the first line (until the first dot) of a Qt-style +# comment as the brief description. If set to NO, the comments +# will behave just like regular Qt-style comments (thus requiring +# an explicit \brief command for a brief description.) + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce +# a new page for each member. If set to NO, the documentation of a member will +# be part of the file/class/namespace that contains it. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C +# sources only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java +# sources only. Doxygen will then generate output that is more tailored for +# Java. For instance, namespaces will be presented as packages, qualified +# scopes will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources only. Doxygen will then generate output that is more tailored for +# Fortran. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for +# VHDL. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it parses. +# With this tag you can assign which parser to use for a given extension. +# Doxygen has a built-in mapping, but you can override or extend it using this tag. +# The format is ext=language, where ext is a file extension, and language is one of +# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, +# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat +# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C + +EXTENSION_MAPPING = + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should +# set this tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. +# func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. +# Doxygen will parse them like normal C++ but will assume all classes use public +# instead of private inheritance when no explicit protection keyword is present. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate getter +# and setter methods for a property. Setting this option to YES (the default) +# will make doxygen to replace the get and set methods by a property in the +# documentation. This will only work if the methods are indeed getting or +# setting a simple type. If this is not the case, or you want to show the +# methods anyway, you should set this option to NO. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum +# is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically +# be useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. + +TYPEDEF_HIDES_STRUCT = NO + +# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to +# determine which symbols to keep in memory and which to flush to disk. +# When the cache is full, less often used symbols will be written to disk. +# For small to medium size projects (<1000 input files) the default value is +# probably good enough. For larger projects a too small cache size can cause +# doxygen to be busy swapping symbols to and from disk most of the time +# causing a significant performance penality. +# If the system has enough physical memory increasing the cache will improve the +# performance by keeping more symbols in memory. Note that the value works on +# a logarithmic scale so increasing the size by one will rougly double the +# memory usage. The cache size is given by this formula: +# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, +# corresponding to a cache size of 2^16 = 65536 symbols + +SYMBOL_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base +# name of the file that contains the anonymous namespace. By default +# anonymous namespace are hidden. + +EXTRACT_ANON_NSPACES = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = YES + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = YES + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = NO + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = YES + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the +# hierarchy of group names into alphabetical order. If set to NO (the default) +# the group names will appear in their defined order. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = YES + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. The default is NO. + +SHOW_DIRECTORIES = NO + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. +# This will remove the Files entry from the Quick Index and from the +# Folder Tree View (if specified). The default is YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the +# Namespaces page. This will remove the Namespaces entry from the Quick Index +# and from the Folder Tree View (if specified). The default is YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command , where is the value of +# the FILE_VERSION_FILTER tag, and is the name of an input file +# provided by doxygen. Whatever the program writes to standard output +# is used as the file version. See the manual for examples. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by +# doxygen. The layout file controls the global structure of the generated output files +# in an output format independent way. The create the layout file that represents +# doxygen's defaults, run doxygen with the -l option. You can optionally specify a +# file name after the option, if omitted DoxygenLayout.xml will be used as the name +# of the layout file. + +LAYOUT_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be abled to get warnings for +# functions that are documented, but have no documentation for their parameters +# or return value. If set to NO (the default) doxygen will only warn about +# wrong or incomplete parameter documentation, but not about the absence of +# documentation. + +WARN_NO_PARAMDOC = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. Optionally the format may contain +# $version, which will be replaced by the version of the file (if it could +# be obtained via FILE_VERSION_FILTER) + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = /Users/itod/work/tpk/trunk/src + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is +# also the default input encoding. Doxygen uses libiconv (or the iconv built +# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for +# the list of possible encodings. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx +# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.vhd \ + *.vhdl + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = YES + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or +# directories that are symbolic links (a Unix filesystem feature) are excluded +# from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. Note that the wildcards are matched +# against the file with absolute path, so to exclude all test directories +# for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) +# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from +# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will +# link to the source code. Otherwise they will link to the documentation. + +REFERENCES_LINK_SOURCE = YES + +# If the USE_HTAGS tag is set to YES then the references to source code +# will point to the HTML generated by the htags(1) tool instead of doxygen +# built-in source browser. The htags tool is part of GNU's global source +# tagging system (see http://www.gnu.org/software/global/global.html). You +# will need version 4.8.6 or higher. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = NO + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +HTML_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. For this to work a browser that supports +# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox +# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). + +HTML_DYNAMIC_SECTIONS = NO + +# If the GENERATE_DOCSET tag is set to YES, additional index files +# will be generated that can be used as input for Apple's Xcode 3 +# integrated development environment, introduced with OSX 10.5 (Leopard). +# To create a documentation set, doxygen will generate a Makefile in the +# HTML output directory. Running make will produce the docset in that +# directory and running "make install" will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find +# it at startup. +# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. + +GENERATE_DOCSET = NO + +# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the +# feed. A documentation feed provides an umbrella under which multiple +# documentation sets from a single provider (such as a company or product suite) +# can be grouped. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that +# should uniquely identify the documentation set bundle. This should be a +# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen +# will append .docset to the name. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING +# is used to encode HtmlHelp index (hhk), content (hhc) and project file +# content. + +CHM_INDEX_ENCODING = + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER +# are set, an additional index file will be generated that can be used as input for +# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated +# HTML documentation. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can +# be used to specify the file name of the resulting .qch file. +# The path specified is relative to the HTML output folder. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#namespace + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating +# Qt Help Project output. For more information please see +# http://doc.trolltech.com/qthelpproject.html#virtual-folders + +QHP_VIRTUAL_FOLDER = doc + +# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. +# For more information please see +# http://doc.trolltech.com/qthelpproject.html#custom-filters + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see +# Qt Help Project / Custom Filters. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's +# filter section matches. +# Qt Help Project / Filter Attributes. + +QHP_SECT_FILTER_ATTRS = + +# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can +# be used to specify the location of Qt's qhelpgenerator. +# If non-empty doxygen will try to run qhelpgenerator on the generated +# .qhp file. + +QHG_LOCATION = + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to FRAME, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. Other possible values +# for this tag are: HIERARCHIES, which will generate the Groups, Directories, +# and Class Hierarchy pages using a tree view instead of an ordered list; +# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which +# disables this behavior completely. For backwards compatibility with previous +# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE +# respectively. + +GENERATE_TREEVIEW = ALL + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +# Use this tag to change the font size of Latex formulas included +# as images in the HTML documentation. The default is 10. Note that +# when you change the font size after a successful doxygen run you need +# to manually remove any form_*.png images from the HTML output directory +# to force them to be regenerated. + +FORMULA_FONTSIZE = 10 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = NO + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = YES + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = NO + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_DEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse +# the parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base +# or super classes. Setting the tag to NO turns the diagrams off. Note that +# this option is superseded by the HAVE_DOT option below. This is only a +# fallback. It is recommended to install and use dot, since it yields more +# powerful graphs. + +CLASS_DIAGRAMS = NO + +# You can define message sequence charts within doxygen comments using the \msc +# command. Doxygen will then run the mscgen tool (see +# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the +# documentation. The MSCGEN_PATH tag allows you to specify the directory where +# the mscgen tool resides. If left empty the tool is assumed to be found in the +# default search path. + +MSCGEN_PATH = /Applications/Doxygen.app/Contents/Resources/ + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = YES + +# By default doxygen will write a font called FreeSans.ttf to the output +# directory and reference it in all dot files that doxygen generates. This +# font does not include all possible unicode characters however, so when you need +# these (or just want a differently looking font) you can specify the font name +# using DOT_FONTNAME. You need need to make sure dot is able to find the font, +# which can be done by putting it in a standard location or by setting the +# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory +# containing the font. + +DOT_FONTNAME = FreeSans + +# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. +# The default size is 10pt. + +DOT_FONTSIZE = 10 + +# By default doxygen will tell dot to use the output directory to look for the +# FreeSans.ttf font (which doxygen will put there itself). If you specify a +# different font using DOT_FONTNAME you can set the path where dot +# can find it using this tag. + +DOT_FONTPATH = + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for groups, showing the direct groups dependencies + +GROUP_GRAPHS = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT options are set to YES then +# doxygen will generate a call dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable call graphs +# for selected functions only using the \callgraph command. + +CALL_GRAPH = YES + +# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then +# doxygen will generate a caller dependency graph for every global function +# or class method. Note that enabling this option will significantly increase +# the time of a run. So in most cases it will be better to enable caller +# graphs for selected functions only using the \callergraph command. + +CALLER_GRAPH = NO + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES +# then doxygen will show the dependencies a directory has on other directories +# in a graphical way. The dependency relations are determined by the #include +# relations between the files in the directories. + +DIRECTORY_GRAPH = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found in the path. + +DOT_PATH = /Applications/Doxygen.app/Contents/Resources/ + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of +# nodes that will be shown in the graph. If the number of nodes in a graph +# becomes larger than this value, doxygen will truncate the graph, which is +# visualized by representing a node as a red box. Note that doxygen if the +# number of direct children of the root node in a graph is already larger than +# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note +# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. + +DOT_GRAPH_MAX_NODES = 50 + +# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the +# graphs generated by dot. A depth value of 3 means that only nodes reachable +# from the root by following a path via at most 3 edges will be shown. Nodes +# that lay further from the root node will be omitted. Note that setting this +# option to 1 or 2 may greatly reduce the computation time needed for large +# code bases. Also note that the size of a graph can be further restricted by +# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. + +MAX_DOT_GRAPH_DEPTH = 1000 + +# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent +# background. This is disabled by default, because dot on Windows does not +# seem to support this out of the box. Warning: Depending on the platform used, +# enabling this option may lead to badly anti-aliased labels on the edges of +# a graph (i.e. they become hard to read). + +DOT_TRANSPARENT = NO + +# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output +# files in one run (i.e. multiple -o and -T options on the command line). This +# makes dot run faster, but since only newer versions of dot (>1.8.10) +# support this, this feature is disabled by default. + +DOT_MULTI_TARGETS = NO + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Options related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/docs/Doxyfile b/docs/Doxyfile new file mode 100644 index 0000000..1f3b885 --- /dev/null +++ b/docs/Doxyfile @@ -0,0 +1,291 @@ +# Doxyfile 1.5.7 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = ParseKit +PROJECT_NUMBER = 1.4 +OUTPUT_DIRECTORY = /Users/itod/work/tpk/trunk/docs/doxygen +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = YES +STRIP_FROM_PATH = /Applications/ +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +TYPEDEF_HIDES_STRUCT = NO +SYMBOL_CACHE_SIZE = 0 +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = YES +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = NO +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = NO +HIDE_SCOPE_NAMES = NO +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_GROUP_NAMES = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +SHOW_FILES = YES +SHOW_NAMESPACES = YES +FILE_VERSION_FILTER = +LAYOUT_FILE = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = YES +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = /Users/itod/work/tpk/trunk/src +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.f90 \ + *.f \ + *.vhd \ + *.vhdl +RECURSIVE = YES +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = NO +REFERENCES_RELATION = NO +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = NO +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +HTML_DYNAMIC_SECTIONS = NO +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +GENERATE_HTMLHELP = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +CHM_INDEX_ENCODING = +BINARY_TOC = NO +TOC_EXPAND = NO +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHG_LOCATION = +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = ALL +TREEVIEW_WIDTH = 250 +FORMULA_FONTSIZE = 10 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = NO +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = YES +USE_PDFLATEX = YES +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = YES +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = NO +MSCGEN_PATH = /Applications/Doxygen.app/Contents/Resources/ +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +DOT_FONTNAME = FreeSans +DOT_FONTPATH = +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = YES +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = /Applications/Doxygen.app/Contents/Resources/ +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/docs/web/.svn/all-wcprops b/docs/web/.svn/all-wcprops new file mode 100644 index 0000000..4e65fec --- /dev/null +++ b/docs/web/.svn/all-wcprops @@ -0,0 +1,53 @@ +K 25 +svn:wc:ra_dav:version-url +V 33 +/svn/!svn/ver/1396/trunk/docs/web +END +tokenization.html +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1388/trunk/docs/web/tokenization.html +END +common-nav.inc +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1388/trunk/docs/web/common-nav.inc +END +iphone.html +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1390/trunk/docs/web/iphone.html +END +common-header.inc +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1388/trunk/docs/web/common-header.inc +END +index.html +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1396/trunk/docs/web/index.html +END +common-footer.inc +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1388/trunk/docs/web/common-footer.inc +END +grammars.html +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1388/trunk/docs/web/grammars.html +END +htaccess +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1388/trunk/docs/web/htaccess +END diff --git a/docs/web/.svn/entries b/docs/web/.svn/entries new file mode 100644 index 0000000..4cba904 --- /dev/null +++ b/docs/web/.svn/entries @@ -0,0 +1,346 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/docs/web +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-09-18T01:37:04.877278Z +1396 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +tokenization.html +file + + + + +2009-09-18T00:46:34.000000Z +231833577a2aac8d91acdb40171aeef0 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +18423 + +common-nav.inc +file + + + + +2009-09-18T00:46:27.000000Z +303dc91898ec9ff6bed3be6d4f7b11f4 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +502 + +iphone.html +file + + + + +2009-09-18T00:47:57.000000Z +cc43bbfb050c326fabdce0b543f626a7 +2009-09-18T00:48:13.680423Z +1390 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3259 + +common-header.inc +file + + + + +2009-09-18T00:46:26.000000Z +d6e41f5fe6ece66c354975e61e0ce6e0 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +315 + +css +dir + + + + + + + + + + + + + + + + + + +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/docs/css +1385 + +index.html +file + + + + +2009-09-18T00:53:41.000000Z +082d349d133c41c842c52ea8a9cb942c +2009-09-18T01:37:04.877278Z +1396 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +12295 + +common-footer.inc +file + + + + +2009-09-18T00:46:25.000000Z +7a4cfbd7ab01793f625d133a0cb1691d +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +420 + +grammars.html +file + + + + +2009-09-18T00:46:29.000000Z +a0e9bdb1d3fceaafd7db8bf58bd7ebee +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +7512 + +img +dir + + + + + + + + + + + + + + + + + + +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/docs/img +1385 + +htaccess +file + + + + +2009-09-18T00:46:30.000000Z +6fd4f2f185f03a39c0e85f3a9f0cc041 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +172 + diff --git a/docs/web/.svn/text-base/common-footer.inc.svn-base b/docs/web/.svn/text-base/common-footer.inc.svn-base new file mode 100644 index 0000000..594ae23 --- /dev/null +++ b/docs/web/.svn/text-base/common-footer.inc.svn-base @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/docs/web/.svn/text-base/common-header.inc.svn-base b/docs/web/.svn/text-base/common-header.inc.svn-base new file mode 100644 index 0000000..16d80ec --- /dev/null +++ b/docs/web/.svn/text-base/common-header.inc.svn-base @@ -0,0 +1,6 @@ + + + + + diff --git a/docs/web/.svn/text-base/common-nav.inc.svn-base b/docs/web/.svn/text-base/common-nav.inc.svn-base new file mode 100644 index 0000000..d44c86b --- /dev/null +++ b/docs/web/.svn/text-base/common-nav.inc.svn-base @@ -0,0 +1,16 @@ + + + + +
diff --git a/docs/web/.svn/text-base/grammars.html.svn-base b/docs/web/.svn/text-base/grammars.html.svn-base new file mode 100644 index 0000000..27fc36b --- /dev/null +++ b/docs/web/.svn/text-base/grammars.html.svn-base @@ -0,0 +1,167 @@ + + ParseKit Objective-C Parser Generation via Grammars + + +

ParseKit Documentation

+
+ +

Objective-C Parser Generation via Grammars

+ + + + +

Basic Grammar Syntax

+ +

ParseKit allows users to build parsers for custom languages from a declarative, BNF-style grammar without writing any code (well, ok.. a single line of code). Under the hood, grammar support is implemented using the ParseKit Objective-C API, so the grammar syntax closely mirrors the features of the Objective-C API.

+ +

The grammar below describes a simple toy language called Cold Beer and will serve as a quick introduction to the ParseKit grammar syntax. The rules of the Cold Beer language are as follows. The language consists of a sequence of one or more sentences beginning with the word «cold» followed by a repetition of either «cold» or «freezing» followed by «beer» and terminated by the symbol «.».

+ +

For example, each of the following lines are valid instances of the Cold Beer language (as is the example as a whole):

+ +
+
+    cold cold cold freezing cold freezing cold beer.
+    cold cold freezing cold beer.
+    cold freezing beer.
+    cold beer.
+
+ +

The following lines are not valid Cold Beer statements:

+ +
+
+    freezing cold beer.
+    cold freezing beer
+    beer.
+
+ +

Here is a complete ParseKit grammar for the Cold Beer language.

+ +
+
+    @start = sentence+;
+    sentence = adjectives 'beer' '.';
+    adjectives = cold adjective*;
+    adjective = cold | freezing;
+    cold = 'cold';
+    freezing = 'freezing';
+
+ +

As shown above, the ParseKit grammar syntax consists of individual language production declarations separated by «;». Whitespace is ignored, so the productions can be formatted liberally with whitespace as the programmer prefers. Comments are also allowed and resemble the comment style of Objective-C. So a commented Cold Beer grammar may appear as:

+ +
+
+    /*
+        A Grammar for the Cold Beer Language
+        by Todd Ditchendorf
+    */
+    @start = sentence+;     // outermost production
+    sentence = adjectives 'beer' '.';
+    adjectives = cold adjective*;
+    adjective = cold | 'freezing';
+    cold = 'cold';
+    freezing = 'freezing';
+
+ + +

Individual Grammar Production Syntax

+ +

Every ParseKit grammar must contain one and only one production named @start. This will be the highest-level or outermost production rule in the language. For Cold Beer, the outermost production is:

+ +
+
+    @start = sentence+;
+
+ +

Which states that the outermost production of this language consists of a sequence of one or more («+») instances of the sentence production.

+ +
+
+    sentence = adjectives 'beer' '.';
+
+ +

The sentence production states that sentences are a sequence of the adjective production followed by the literal strings beer and .

+ +
+
+    adjectives = cold adjective*;
+
+ +

In turn, adjectives is a sequence of a single instance of the cold production followed by a repetition («*» read as 'zero or more') of the adjective production.

+ +
+
+    adjective = cold | freezing;
+    cold = 'cold';
+    freezing = 'freezing';
+
+ +

The adjective production is an alternation of either an instance of the cold or the freezing production. The cold production is the literal string cold and freezing the literal string freezing.

+ + +

Grouping

+ +

A language may be expressed in many different, yet equivalent grammars. Productions may be referenced in any order (even before they are defined) and grouped using parentheses («(» and «)»).

+ +

For example, the Cold Beer language could also be represented by the following grammar:

+ +
+
+    @start = ('cold' ('cold' | 'freezing')* 'beer' '.')+;
+
+ + +

Instantiating Grammar Parsers in Objective-C

+ +

Create an Objective-C PKParser object by providing the grammar as an NSString and an assembler object (in this example, self).

+ +
+
+  NSString *g = ... // fetch your grammar from a file on disk
+  
+  PKParser *parser = nil;
+  parser = [[PKParserFactory factory] parserFromGrammar:g assembler:self];
+  
+  NSString *s = @"cold freezing cold beer.";
+  [parser parse:s];
+
+ +

The provided assembler object will receive callbacks whenever one of the language grammar productions is matched -- if the callback method is implemented in the assembler object.

+ +

For example, an assembler for the Cold Beer language grammar above will receive the following callbacks if implemented:

+ +
+
+    - (void)didMatchSentence:(PKAssembly *)a;
+    - (void)didMatchAdjectives:(PKAssembly *)a;
+    - (void)didMatchAdjective:(PKAssembly *)a;
+    - (void)didMatchCold:(PKAssembly *)a;
+    - (void)didMatchFreezing:(PKAssembly *)a;
+
+ +

The PKAssembly argument will have the most-recently matched tokens on the top of its stack.

+ +

To prevent leaks when releasing a PKParser created via PKParserFactory, one final step is required:

+ +
+
+          PKParser *parser = nil;
+          parser = [[PKParserFactory factory] parserFromGrammar:g assembler:self];
+
+          ... // do parsing
+          
+          // when you are done with the parser, this function must be called before releasing
+          PKReleaseSubparserTree(parser);
+          [p release]
+
+ +

Most non-trivial language grammars define circular relationships in their production rules. The call to PKReleaseSubparserTree() is required to prevent Objective-C retain cycle leaks where the PKParser objects representing different rules in your grammar have strong references to one another.

+ +
+ + diff --git a/docs/web/.svn/text-base/htaccess.svn-base b/docs/web/.svn/text-base/htaccess.svn-base new file mode 100644 index 0000000..5eafa7f --- /dev/null +++ b/docs/web/.svn/text-base/htaccess.svn-base @@ -0,0 +1,5 @@ +# let's enable php (non-cgi, aka. 'module') for EVERYTHING..' +# AddType application/x-httpd-php5 .htm .html .php + +# better yet.. +AddHandler php5-script .php .html .htm .inc \ No newline at end of file diff --git a/docs/web/.svn/text-base/index.html.svn-base b/docs/web/.svn/text-base/index.html.svn-base new file mode 100644 index 0000000..0fb4e46 --- /dev/null +++ b/docs/web/.svn/text-base/index.html.svn-base @@ -0,0 +1,257 @@ + + ParseKit - Cocoa Objective-C Framework for parsing, tokenizing and language processing + + +

ParseKit Documentation

+
+

ParseKit

+ +

ParseKit is a Mac OS X Framework written by Todd Ditchendorf in Objective-C 2.0 and released under the MIT Open Source License. ParseKit is suitable for use on Mac OS X Leopard, Snow Leopard or iPhone OS. ParseKit is an Objective-C implementation of the tools described in "Building Parsers with Java" by Steven John Metsker. ParseKit includes additional features beyond the designs from the book and also some changes to match common Cocoa/Objective-C conventions. These changes are relatively superficial, however, and Metsker's book is the best documentation available for ParseKit.

+ +

The ParseKit Framework offers 3 basic services of general interest to Cocoa developers:

+ +
    +
  1. String Tokenization via the Objective-C PKTokenizer and PKToken classes.
  2. +
  3. High-Level Language Parsing via Objective-C - An Objective-C parser-building API (the PKParser class and sublcasses).
  4. +
  5. Objective-C Parser Generation via Grammars - Generate an Objective-C parser for your custom language using a BNF-style grammar syntax (similar to yacc or ANTLR). While parsing, the parser will provide callbacks to your Objective-C code.
  6. +
+ +

The ParseKit source code is available from the Subversion repository at the Google Code project page. The latest tagged (stable) version is recommended.

svn co http://todparsekit.googlecode.com/svn/tags/release-1.5-tag

+ +

More documentation:

+ + +

Projects using ParseKit:

+
    +
  • Spike: A Rails log file viewer/analyzer by Matt Mower
  • +
  • JSTalk: Interprocess Cocoa scripting with JavaScript by Gus Mueller
  • +
  • Objective-J Port of ParseKit by Ross Boucher
  • +
  • HTTP Client: HTTP debugging/testing tool
  • +
  • Fluid: Site-Specific Browser for Mac OS X
  • +
  • Cruz: Social Browser for Mac OS X
  • +
  • OkudaKit: Syntax Highlighting Framework for Mac OS X
  • +
  • Exedore: XPath 1.0 implemented in Cocoa (ported from Saxon)
  • +
+ +

Xcode Project

+

The ParseKit Xcode project consists of 6 targets:

+ +
    +
  1. ParseKit : the ParseKit Objective-C framework. The central feature/codebase of this project.
  2. +
  3. Tests : a UnitTest Bundle containing hundreds of unit tests (actually, more correctly, interaction tests) for the framework as well as some example classes that serve as real-world uses of the framework.
  4. +
  5. DemoApp : A simple Cocoa demo app that gives a visual presentation of the results of tokenizing text using the PKTokenizer class.
  6. +
  7. DebugApp : A simple Cocoa app that exists only to run arbitrary test code thru GDB with breakpoints for debugging (I was not able to do that with the UnitTest bundle).
  8. +
  9. JSParseKit : A JavaScriptCore-based scripting interface to ParseKit which can be used to expose the entire framework to JavaScript environments.
  10. +
  11. JSDemoApp: A simple Cocoa application used for exercising the JavaScript interface provided by JSParseKit. Note that this is the only target which links to the WebKit framework. Neither ParseKit nor JSParseKit requires WebKit.
  12. +
+ + + +

ParseKit Framework

+ +
+

Tokenization

+ +

The API for tokenization is provided by the PKTokenizer class. Cocoa developers will be familiar with the NSScanner class provided by the Foundation Framework which provides a similar service. However, the PKTokenizer class is simpler and more powerful for many use cases.

+ +

Example usage:

+ +
+
+NSString *s = @"\"It's 123 blast-off!\", she said, // watch out!\n"
+              @"and <= 3.5 'ticks' later /* wince */, it's blast-off!";
+PKTokenizer *t = [PKTokenizer tokenizerWithString:s];
+
+PKToken *eof = [PKToken EOFToken];
+PKToken *tok = nil;
+
+while ((tok = [t nextToken]) != eof) {
+    NSLog(@" (%@)", tok);
+}
+
+
+ +

outputs:

+
+
 ("It's 123 blast-off!")
+ (,)
+ (she)
+ (said)
+ (,)
+ (and)
+ (<=)
+ (3.5)
+ ('ticks')
+ (later)
+ (,)
+ (it's)
+ (blast-off)
+ (!)
+
+
+ +

Each token produced is an object of class PKToken. PKTokens have a tokenType (Word, Symbol, Num, QuotedString, etc.) and both a stringValue and a floatValue.

+ +

More information about a token can be easily discovered using the -debugDescription method instead of the default -description. Replace the line containing NSLog above with this line:

+ +
+
+NSLog(@" (%@)", [tok debugDescription]);
+
+
+ +

and each token's type will be printed as well:

+ +
+
 <Quoted String «"It's 123 blast-off!"»>
+ <Symbol «,»>
+ <Word «she»>
+ <Word «said»>
+ <Symbol «,»>
+ <Word «and»>
+ <Symbol «<=»>
+ <Number «3.5»>
+ <Quoted String «'ticks'»>
+ <Word «later»>
+ <Symbol «,»>
+ <Word «it's»>
+ <Word «blast-off»>
+ <Symbol «!»>
+
+
+ + +

As you can see from the output, PKTokenzier is configured by default to properly group characters into tokens including:

+ +
    +
  • single- and double-quoted string tokens
  • +
  • common multiple character symbols (<=)
  • +
  • apostrophes, dashes and other symbol chars that should not signal the start of a new Symbol token, but rather be included in the current Word or Num token (it's, blast-off, 3.5)
  • +
  • silently ignoring C- and C++-style comments
  • +
  • silently ignoring whitespace
  • +
+ + +

The PKTokenizer class is very flexible, and all of those features are configurable. PKTokenizer may be configured to:

+ +
    +
  • recognize more (or fewer) multi-char symbols. ex:
    [t.symbolState add:@"!="];
    +

    allows != to be recognized as a single Symbol token rather than two adjacent Symbol tokens

    +
  • + +
  • add new internal symbol chars to be included in the current Word token OR recognize internal symbols like apostrophe and dash to actually signal a new Symbol token rather than being part of the current Word token. ex: +
    [t.wordState setWordChars:YES from:'_' to:'_'];
    +

    allows Word tokens to contain internal underscores

    +
    [t.wordState setWordChars:NO from:'-' to:'-'];
    +

    disallows Word tokens from containing internal dashes.

    +
  • + + +
  • change which chars singnal the start of a token of any given type. ex: +
    [t setTokenizerState:t.wordState from:'_' to:'_'];
    +

    allows Word tokens to start with underscore

    +
    [t setTokenizerState:t.quoteState from:'*' to:'*'];
    +

    allows Quoted String tokens to start with an asterisk, effectively making * a new quote symbol (like " or ')

    +
  • + +
  • turn off recognition of single-line "slash-slash" (//) comments. ex: +
    [t setTokenizerState:t.symbolState from:'/' to:'/'];
    +

    slash chars now produce individual Symbol tokens rather than causing the tokenizer to strip text until the next newline char or begin striping for a multiline comment if appropriate (/*)

    +
  • + +
  • turn on recognition of "hash" (#) single-line comments. ex: +
    +
    [t setTokenizerState:t.commentState from:'#' to:'#'];
    +[t.commentState addSingleLineStartSymbol:@"#"];
    +
    +
  • + +
  • turn on recognition of "XML/HTML" (<!-- -->) multi-line comments. ex: +
    +
    [t setTokenizerState:t.commentState from:'<' to:'<'];
    +[t.commentState addMultiLineStartSymbol:@"<!--" endSymbol:@"-->"];
    +
    +
  • + +
  • report (rather than silently consume) Comment tokens. ex: +
    +
    t.commentState.reportsCommentTokens = YES; // default is NO
    +
    +
  • + +
  • report (rather than silently consume) Whitespace tokens. ex: +
    +
    t.whitespaceState.reportsWhitespaceTokens = YES; // default is NO
    +
    +
  • + +
  • turn on recognition of any characters (say, digits) as whitespace to be silently ignored. ex: +
    +
    [t setTokenizerState:t.whitespaceState from:'0' to:'9'];
    +
    +
  • + +
+ +
+

Parsing

+ +

ParseKit also includes a collection of token parser subclasses (of the abstract PKParser class) including collection parsers such as PKAlternation, PKSequence, and PKRepetition as well as terminal parsers including PKWord, PKNum, PKSymbol, PKQuotedString, etc. Also included are parser subclasses which work in individual chars such as PKChar, PKDigit, and PKSpecificChar. These char parsers are useful for things like RegEx parsing. Generally speaking though, the token parsers will be more useful and interesting.

+ +

The parser classes represent a Composite pattern. Programs can build a composite parser, in Objective-C (rather than a separate language like with lex&yacc), from a collection of terminal parsers composed into alternations, sequences, and repetitions to represent an infinite number of languages.

+ +

Parsers built from ParseKit are non-deterministic, recursive descent parsers, which basically means they trade some performance for ease of user programming and simplicity of implementation.

+ +

Here is an example of how one might build a parser for a simple voice-search command language (note: ParseKit does not include any kind of speech recognition technology). The language consists of:

+ +
+
search google for? <search-term>
+
+ +
+
+...
+
+	[self parseString:@"search google 'iphone'"];
+...
+	
+- (void)parseString:(NSString *)s {
+	PKSequence *parser = [PKSequence sequence];
+
+	[parser add:[[PKLiteral literalWithString:@"search"] discard]];
+	[parser add:[[PKLiteral literalWithString:@"google"] discard]];
+
+	PKAlternation *optionalFor = [PKAlternation alternation];
+	[optionalFor add:[PKEmpty empty]];
+	[optionalFor add:[PKLiteral literalWithString:@"for"]];
+
+	[parser add:[optionalFor discard]];
+
+	PKParser *searchTerm = [PKQuotedString quotedString];
+	[searchTerm setAssembler:self selector:@selector(workOnSearchTermAssembly:)];
+	[parser add:searchTerm];
+
+	PKAssembly *result = [parser bestMatchFor:[PKTokenAssembly assmeblyWithString:s]];
+	
+	NSLog(@" %@", result);
+
+	// output:
+	//  ['iphone']search/google/'iphone'^
+}
+
+...
+
+- (void)workOnSearchTermAssembly:(PKAssembly *)a {
+	PKToken *t = [a pop]; // a QuotedString token with a stringValue of 'iphone'
+	[self doGoogleSearchForTerm:t.stringValue];
+}
+
+
+
+ +
+ + diff --git a/docs/web/.svn/text-base/iphone.html.svn-base b/docs/web/.svn/text-base/iphone.html.svn-base new file mode 100644 index 0000000..3432a97 --- /dev/null +++ b/docs/web/.svn/text-base/iphone.html.svn-base @@ -0,0 +1,59 @@ + + ParseKit - Cocoa parsing, tokenizing and language processing on iPhone + + +

ParseKit Documentation

+
+ +

ParseKit for iPhone OS Applications

+ +

Including ParseKit in your iPhone OS applications is easy. Follow the steps below.

+ +
    +
  1. +
    Check out the ParseKit sourcecode from Google Code. The latest tagged (stable) version is recommended.
    +

    svn co http://todparsekit.googlecode.com/svn/tags/release-1.5-tag

    +
  2. +
  3. +
    Open your iPhone app Xcode project. Drag the ParseKit.xcodeproj file from the finder and drop it at the top of the Groups & Files tree in your app's Xcode project window. In the confirmation dialog that appears, click Add.
    +

    +

    +
  4. + +
  5. +
    Click and expand the disclosure triangle next to the blue ParseKit.xcodeproj icon to reveal all of the potential products of the ParseKit project.
    +

    +
  6. +
  7. +
    Click and expand the disclosure triangle next to your app's Target. Drag the parsekit.a product under ParseKit.xcodeproj to your Target's Link Binary With Libraries build phase.
    +

    +
  8. +
  9. +
    Double-click your Target (MyApp shown here) to edit it. In the General tab of the Target Info window, click the square + button below the Direct Dependencies list. In the sheet that appears, select ParseKitMobile and click Add Target.
    +

    +
    You will now see the ParseKitMobile target appearing as a dependency under your app's Target.
    +

    +
  10. +
  11. +

    Next click the + button below the Linked Libraries list in the same window. Select libicucore.dylib and click Add. (This is for regular expression features in the PKPattern class.)

    +

    +
  12. +
  13. +
    Under the Build tab of your app's Target Info window, edit the Header Search Paths Setting to include the path to the include folder inside of the ParseKit folder you checked out. Make sure you edit this for All Configurations, not just the active one.
    +

    +
  14. + +
  15. +
    Finally, in the same window, edit the Other Linker Flags Setting to include the following flags: -ObjC -all_load. (This is needed for code in Objective-C categories in the ParseKit static library to execute successfully.)
    +

    +
  16. + +
  17. Ship it!
  18. + +
+ +
+ + + + diff --git a/docs/web/.svn/text-base/tokenization.html.svn-base b/docs/web/.svn/text-base/tokenization.html.svn-base new file mode 100644 index 0000000..f7f3dcd --- /dev/null +++ b/docs/web/.svn/text-base/tokenization.html.svn-base @@ -0,0 +1,366 @@ + + ParseKit - String Tokenization in Objective-C, Cocoa + + + +

ParseKit Documentation

+
+ +

Tokenization

+ + + + +

Basic Usage of PKTokenizer

+ +

ParseKit provides general-purpose string tokenization services through the PKTokenizer and PKToken classes. Cocoa developers will be familiar with the NSScanner class provided by the Foundation Framework which provides a similar service. However, the PKTokenizer class is much easier to use for many common tokenization tasks, and offers powerful configuration options if the default tokenization behavior doesn't match your needs.

+ + + + + + + + +
PKTokenizer
+

+ + (id)tokenizerWithString:(NSString *)s;
+

+

+ - (PKToken *)nextToken;
+ ...
+

+
+ +

To use PKTokenizer, create an instance with an NSString object and retrieve a series of PKToken objects as you repeatedly call the -nextToken method. The EOFToken singleton signals the end.

+ +
+
+NSString *s = @"2 != -47. /* comment */ Blast-off!! 'Woo-hoo!' // comment";
+PKTokenizer *t = [PKTokenizer tokenizerWithString:s];
+
+PKToken *eof = [PKToken EOFToken];
+PKToken *tok = nil;
+
+while ((tok = [t nextToken]) != eof) {
+    NSLog(@"(%@) (%.1f) : %@", 
+        tok.stringValue, tok.floatValue, [tok debugDescription]);
+}
+
+
+ +

Outputs:

+ +
+
+(2) (2.0) : <Number «2»>
+(!=) (0.0) : <Symbol «!=»>
+(-47) (-47.0) : <Number «-47»>
+(.) (0.0) : <Symbol «.»>
+(Blast-off) (0.0) : <Word «Blast-off»>
+(!) (0.0) : <Symbol «!»>
+(!) (0.0) : <Symbol «!»>
+('Woo-hoo!') (0.0) : <Quoted String «'Woo-hoo!'»>
+
+
+ +

Each PKToken object returned has a stringValue, a floatValue and a tokenType. The tokenType is and enum value type called PKTokenType with possible values of:

+ +
    +
  • PKTokenTypeWord
  • +
  • PKTokenTypeNumber
  • +
  • PKTokenTypeQuotedString
  • +
  • PKTokenTypeSymbol
  • +
  • PKTokenTypeWhitespace
  • +
  • PKTokenTypeComment
  • +
  • PKTokenTypeDelimitedString
  • +
+ +

PKTokens also have corresponding BOOL properties for convenience (isWord, isNumber, etc.)

+ + + + + + + + +
PKToken
+

+ + (PKToken *)EOFToken;
+

+

+ @property (readonly) PKTokenType tokenType;
+

+

+ @property (readonly) CGFloat floatValue;
+ @property (readonly, copy) NSString *stringValue;
+

+

+ @property (readonly) BOOL isNumber;
+ @property (readonly) BOOL isSymbol;
+ @property (readonly) BOOL isWord;
+ @property (readonly) BOOL isQuotedString;
+ @property (readonly) BOOL isWhitespace;
+ @property (readonly) BOOL isComment;
+ @property (readonly) BOOL isDelimitedString;
+

+

+ ...
+

+
+ + +

Default Behavior of PKTokenizer

+ +

The default behavior of PKTokenizer is correct for most common situations and will fit many tokenization needs without additional configuration.

+ +

Number

+ +

Sequences of digits («2» «42» «1054») are recognized as Number tokens. Floating point numbers containing a dot («3.14») are recognized as single Number tokens as you'd expect (rather than two Number tokens separated by a «.» Symbol token). By default, PKTokenizer will recognize a «-» symbol followed immediately by digits («-47») as a number token with a negative value. However, «+» characters are always seen as the beginning of a Symbol token by default, even when followed immediately by digits, so "explicitly-positive" Number tokens are not recognized by default (this behavior can be configured, see below).

+ +

Symbol

+ +

Most symbol characters («.» «!») are recognized as single-character Symbol tokens (even when sequential such as «!»«!»). However, notice that PKTokenizer recognizes common multi-character symbols («!=») as a single Symbol token by default. In fact, PKTokenizer can be configured to recognize any given string as a multi-character symbol. Alternatively, it can be configured to always recognize each symbol character as an individual Symbol token (no mulit-character symbols). The default multi-character symbols recognized by PKTokenizer are: «<=», «>=», «!=», «==».

+ +

Word

+

«Blast-off» is recognized as a single Word token despite containing a symbol character («-») that would normally signal the start of a new Symbol token. By default, PKTokenzier allows Word tokens to contain (but not start with) several symbol and number characters: «-», «_», «'», «0»-«9». The consequence of this behavior is that PKTokenizer will recognize the follwing strings as individual Word tokens by default: «it's», «first_name», «sat-yr-9» «Rodham-Clinton». Again, you can configure PKTokenizer to alter this default behavior.

+ +

Quoted String

+

PKTokenizer produces Quoted String tokens for substrings enclosed in quote delimiter characters. The default delimiters are single- or double-quotes («'» or «"»). The quote delimiter characters may be changed (see below), but must be a single character. Note that the stringValue of Quoted String tokens include the quote delimiter characters («'Woo-hoo!'»).

+ +

Whitespace

+

By default, whitespace characters are silently consumed by PKTokenizer, and Whitespace tokens are never emitted. However, you can configure which characters are considered Whitespace characters or even ask PKTokenizer to return Whitespace tokens containing the literal whitespace stringValues by setting: t.whitespaceState.reportsWhitespaceTokens = YES.

+ +

Comment

+

By default, PKTokenizer recognizes C-style («//») and C++-style («/*» «*/») comments and silently removes the associated comments from the output rather than producing Comment tokens. See below for steps to either change comment delimiting markers, report Comment tokens, or to turn off comments recognition altogether.

+ +

Delimited String

+

The Delimited String token type is a powerful feature of ParseKit which can be used much like a regular expression. Use the Delimited String token type to ask PKTokenizer to recognize tokens with arbitrary start and end symbol strings much like a Quoted String but with more power:

+ +
    +
  • The start and end symbols may be multi-char (e.g. «<#» «#>»)
  • +
  • The start and end symbols need not match (e.g. «<?=» «?>»)
  • +
  • The characters allowed within the delimited string may be specified using an NSCharacterSet
  • +
+ + + +

Customizing PKTokenizer behavior

+ +

There are two basic types of decisions PKTokenizer must make when tokenizing strings:

+ +
    +
  1. Which token type should be created for a given start character?
  2. +
  3. Which characters are allowed within the current token being created?
  4. +
+ + +

PKTokenizer's behavior with respect to these two types of decisions is totally configurable. Let's tackle them, starting with the second question first.

+ +

Changing which characters are allowed within a token of a particular type

+ +

Once PKTokenizer has decided which token type to create for a given start character (see below), it temporarily passes control to one of its "state" helper objects to finish consumption of characters for the current token. Therefore, the logic for deciding which characters are allowed within a token of a given type is controlled by the "state" objects which are instances of subclasses of the abstract PKTokenizerState class: PKWordState, PKNumberState, PKQuoteState, PKSymbolState, PKWhitespaceState, PKCommentState, and PKDelimitState. The state objects are accessible via properties of the PKTokenizer object.

+ + + + + + + + +
PKTokenizer
+

+ ...
+ @property (readonly, retain) PKWordState *wordState;
+ @property (readonly, retain) PKNumberState *numberState;
+ @property (readonly, retain) PKQuoteState *quoteState;
+ @property (readonly, retain) PKSymbolState *symbolState;
+ @property (readonly, retain) PKWhitespaceState *whitespaceState;
+ @property (readonly, retain) PKCommentState *commentState;
+ @property (readonly, retain) PKDelimitState *delimitState;
+

+
+ +

Some of the PKTokenizerState subclasses have methods that alter which characters are allowed within tokens of their associated token type.

+ +

For example, if you want to add a new multiple-character symbol like «===»:

+ +
+
+...
+PKTokenizer *t = [PKTokenizer tokenizerWithString:s];
+[t.symbolState add:@"==="];
+...
+
+ +

Now «===» strings will be recognized as a single Symbol token with a stringValue of «===». There is a corresponding -[PKSymbolState remove:] method for removing recognition of given multi-char symbols.

+ +

If you don't want to allow digits within Word tokens (digits are allowed within Words by default):

+ +
+
+...
+[t.wordState setWordChars:NO from:'0' to:'9'];
+...
+
+ +

Say you want to allow floating-point Number tokens to end with a «.», sans trailing «0». In other words, you want «49.» to be recognized as a single Number token with a floatValue of «49.0» rather than a Number token followed by a Symbol token with a stringValue of «.»:

+ +
+
+...
+t.numberState.allowsTrailingDot = YES;
+...
+
+ +

Recognition of scientific notation (exponential numbers) can be enabled to recognize numbers like «10e+100», «6.626068E-34» and «6.0221415e23». The resulting PKToken objects will have floatValues which represent the full value of the exponential number, yet retain the original exponential representation as their stringValues.

+ +
+
+...
+t.numberState.allowsScentificNotation = YES;
+...
+
+ +

Similarly, recognition of common octal and hexadecimal number notation can be enabled to recognize numbers like «020» (octal 16) and «0x20» (hex 32).

+ +
+
+...
+t.numberState.allowsOctalNotation = YES;
+t.numberState.allowsHexadecimalNotation = YES;
+...
+
+ +

The resulting PKToken objects will have a tokenType of PKTokenTypeNumber and a stringValue matching the original source notation («020» or «0x20»). Their floatValues will represent the normal decimal value of the number (in this case 16 and 32).

+ +

You can also configure which characters are recognized as whitespace within a whitespace token. To treat digits as whitespace characters within whitespace tokens:

+ +
+
+...
+[t.whitespaceState setWhitespaceChars:YES from:'0' to:'9'];
+...
+
+ +

By default, whitespace chars are silently consumed by a tokenizer's PKWhitespaceState. To force reporting of PKTokens of type PKTokenTypeWhitespace containing the encountered whitespace chars as their stringValues (e.g. this would be necessary for a typical XML parser in which significant whitespace must be reported):

+ +
+
+...
+t.whitespaceState.reportsWhitespaceTokens = YES;
+...
+
+ +

Similarly, comments are also silently consumed by default. To report Comment tokens instead:

+ +
+
+...
+t.commentState.reportsCommentTokens = YES;
+...
+
+ + +

Changing which token type is created for a given start character

+ +

PKTokenizer controls the logic for deciding which token type should be created for a given start character before passing the responsibility for completing tokens to its "state" helper objects. To change which token type is created for a given start character, you must call a method of the PKTokenizer object itself: -[PKTokenizer setTokenizerState:from:to:].

+ + + + + + + + +
PKTokenizer
+

+ ... +

- (void)setTokenizerState:(PKTokenizerState *)state 
+                     from:(PKUniChar)start 
+                       to:(PKUniChar)end;
+ ...
+

+
+ +

For example, suppose you want to turn off support for Number tokens altogether. To recognize digits as signaling the start of Word tokens:

+ +
+
+...
+PKTokenizer *t = [PKTokenizerWithString:s];
+[t setTokenizerState:t.wordState from:'0' to:'9'];
+...
+
+ +

This will cause PKTokenizer to begin creating a Word token (rather than a Number token) whenever a digit («0», «1», «2», «3»,«4», «5», «6», «7», «8», «9», «0» ) is encountered.

+ +

As another example, say you want to add support for new Quoted String token delimiters, such as «#». This would cause a string like #oh hai# to be recognized as a Quoted String token rather than a Symbol, two Words, and a Symbol. Here's how:

+ +
+
+...
+[t setTokenizerState:t.quoteState from:'#' to:'#'];
+...
+
+ +

Note that if the from: and to: arguments are the same char, only behavior for that single char is affected.

+ +

Alternatively, say you want to recognize «+» characters followed immediately by digits as explicitly positive Number tokens rather than as a Symbol token followed by a Number token:

+ +
+
+...
+[t setTokenizerState:t.numberState from:'+' to:'+'];
+...
+
+ +

Finally, customization of comments recognition may be necessary. By default, PKTokenizer passes control to its commentState object which silently consumes the comment text found after «//» or between «/*» «*/». This default behavior is achieved with the sequence:

+ +
+
+...
+[t setTokenizerState:t.commentState from:'/' to:'/'];
+[t.commentState addSingleLineStartSymbol:@"//"];
+[t.commentState addMultiLineStartSymbol:@"/*" endSymbol:@"*/"];
+...
+
+ +

To recognize single-line comments starting with #:

+ +
+
+...
+[t setTokenizerState:t.commentState from:'#' to:'#'];
+[t.commentState addSingleLineStartSymbol:@"#"];
+...
+
+ +

To recognize multi-line "XML"- or "HTML"-style comments:

+ +
+
+...
+[t setTokenizerState:t.commentState from:'<' to:'<'];
+[t.commentState addMultiLineStartSymbol:@"<!--" endSymbol:@"-->"];
+...
+
+ +

To disable comments recognition altogether, tell PKTokenizer to pass control to its symbolState instead of its commentState.

+ +
+
+...
+[t setTokenizerState:t.symbolState from:'/' to:'/'];
+...
+
+ +

Now PKTokenizer will return individual Symbol tokens for all «/» and «*» characters, as well as any other characters set as part of a comment start or end symbol.

+ +
+ diff --git a/docs/web/common-footer.inc b/docs/web/common-footer.inc new file mode 100644 index 0000000..594ae23 --- /dev/null +++ b/docs/web/common-footer.inc @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/docs/web/common-header.inc b/docs/web/common-header.inc new file mode 100644 index 0000000..16d80ec --- /dev/null +++ b/docs/web/common-header.inc @@ -0,0 +1,6 @@ + + + + + diff --git a/docs/web/common-nav.inc b/docs/web/common-nav.inc new file mode 100644 index 0000000..d44c86b --- /dev/null +++ b/docs/web/common-nav.inc @@ -0,0 +1,16 @@ + + + + +
diff --git a/docs/web/css/.svn/all-wcprops b/docs/web/css/.svn/all-wcprops new file mode 100644 index 0000000..b6f6f98 --- /dev/null +++ b/docs/web/css/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/!svn/ver/1388/trunk/docs/web/css +END diff --git a/docs/web/css/.svn/entries b/docs/web/css/.svn/entries new file mode 100644 index 0000000..c67750f --- /dev/null +++ b/docs/web/css/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/docs/web/css +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +master.css +file + + + + +2009-09-18T00:46:28.000000Z +525b6a2cb506e733672d77378381ea0f +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1306 + diff --git a/docs/web/css/.svn/text-base/master.css.svn-base b/docs/web/css/.svn/text-base/master.css.svn-base new file mode 100644 index 0000000..9b7bbea --- /dev/null +++ b/docs/web/css/.svn/text-base/master.css.svn-base @@ -0,0 +1,88 @@ +#content { + width:675px; + margin:60px auto 30px; + text-align:justify; +} + +body, html { + margin:0; + padding:0; + font:14px/1.5 "Lucida Grande", Lucida Grande, LucidaGrande, Helvetica, sans-serif; +} + +body { + min-width:980px; +} + +tt, pre { + font:12px Monaco; +} + +table { + border:1px solid silver; + background:#eeeeff; + margin:25px 5px; +} + +th, td { + border:1px solid silver; + padding:5px 10px; +} + +.code { + border:2px solid silver; + background:#eee; + padding:5px 10px; + margin:25px 5px; +} + +h1 { + position:fixed; + left:0; top:0; right:0; + margin:0; + border-bottom:1px solid silver; + padding:3px 10px; + background:#eeeeec; + font:bold 16px "Lucida Grande", Lucida Grande, LucidaGrande, Helvetica, sans-serif; +} + +#home-title { + font-size:32px; +} + +h3 { + border-bottom:1px solid silver; + padding:3px; + background:#eeeeff; +} + +a[name] { + display:block; + margin-bottom:60px; +} + +a:hover { + text-decoration:none; +} + +#nav { + position:fixed; + left:10px; top:60px; + border:2px solid silver; + background:#eee; + padding:5px 10px; +} + +#nav ul { + margin:10px 0; padding:0; +} + +#nav li { + list-style-type:none; + margin:0 8px; padding:0; + font-size:smaller; +} + +img { + border:4px solid silver; +} diff --git a/docs/web/css/master.css b/docs/web/css/master.css new file mode 100644 index 0000000..9b7bbea --- /dev/null +++ b/docs/web/css/master.css @@ -0,0 +1,88 @@ +#content { + width:675px; + margin:60px auto 30px; + text-align:justify; +} + +body, html { + margin:0; + padding:0; + font:14px/1.5 "Lucida Grande", Lucida Grande, LucidaGrande, Helvetica, sans-serif; +} + +body { + min-width:980px; +} + +tt, pre { + font:12px Monaco; +} + +table { + border:1px solid silver; + background:#eeeeff; + margin:25px 5px; +} + +th, td { + border:1px solid silver; + padding:5px 10px; +} + +.code { + border:2px solid silver; + background:#eee; + padding:5px 10px; + margin:25px 5px; +} + +h1 { + position:fixed; + left:0; top:0; right:0; + margin:0; + border-bottom:1px solid silver; + padding:3px 10px; + background:#eeeeec; + font:bold 16px "Lucida Grande", Lucida Grande, LucidaGrande, Helvetica, sans-serif; +} + +#home-title { + font-size:32px; +} + +h3 { + border-bottom:1px solid silver; + padding:3px; + background:#eeeeff; +} + +a[name] { + display:block; + margin-bottom:60px; +} + +a:hover { + text-decoration:none; +} + +#nav { + position:fixed; + left:10px; top:60px; + border:2px solid silver; + background:#eee; + padding:5px 10px; +} + +#nav ul { + margin:10px 0; padding:0; +} + +#nav li { + list-style-type:none; + margin:0 8px; padding:0; + font-size:smaller; +} + +img { + border:4px solid silver; +} diff --git a/docs/web/grammars.html b/docs/web/grammars.html new file mode 100644 index 0000000..27fc36b --- /dev/null +++ b/docs/web/grammars.html @@ -0,0 +1,167 @@ + + ParseKit Objective-C Parser Generation via Grammars + + +

ParseKit Documentation

+
+ +

Objective-C Parser Generation via Grammars

+ + + + +

Basic Grammar Syntax

+ +

ParseKit allows users to build parsers for custom languages from a declarative, BNF-style grammar without writing any code (well, ok.. a single line of code). Under the hood, grammar support is implemented using the ParseKit Objective-C API, so the grammar syntax closely mirrors the features of the Objective-C API.

+ +

The grammar below describes a simple toy language called Cold Beer and will serve as a quick introduction to the ParseKit grammar syntax. The rules of the Cold Beer language are as follows. The language consists of a sequence of one or more sentences beginning with the word «cold» followed by a repetition of either «cold» or «freezing» followed by «beer» and terminated by the symbol «.».

+ +

For example, each of the following lines are valid instances of the Cold Beer language (as is the example as a whole):

+ +
+
+    cold cold cold freezing cold freezing cold beer.
+    cold cold freezing cold beer.
+    cold freezing beer.
+    cold beer.
+
+ +

The following lines are not valid Cold Beer statements:

+ +
+
+    freezing cold beer.
+    cold freezing beer
+    beer.
+
+ +

Here is a complete ParseKit grammar for the Cold Beer language.

+ +
+
+    @start = sentence+;
+    sentence = adjectives 'beer' '.';
+    adjectives = cold adjective*;
+    adjective = cold | freezing;
+    cold = 'cold';
+    freezing = 'freezing';
+
+ +

As shown above, the ParseKit grammar syntax consists of individual language production declarations separated by «;». Whitespace is ignored, so the productions can be formatted liberally with whitespace as the programmer prefers. Comments are also allowed and resemble the comment style of Objective-C. So a commented Cold Beer grammar may appear as:

+ +
+
+    /*
+        A Grammar for the Cold Beer Language
+        by Todd Ditchendorf
+    */
+    @start = sentence+;     // outermost production
+    sentence = adjectives 'beer' '.';
+    adjectives = cold adjective*;
+    adjective = cold | 'freezing';
+    cold = 'cold';
+    freezing = 'freezing';
+
+ + +

Individual Grammar Production Syntax

+ +

Every ParseKit grammar must contain one and only one production named @start. This will be the highest-level or outermost production rule in the language. For Cold Beer, the outermost production is:

+ +
+
+    @start = sentence+;
+
+ +

Which states that the outermost production of this language consists of a sequence of one or more («+») instances of the sentence production.

+ +
+
+    sentence = adjectives 'beer' '.';
+
+ +

The sentence production states that sentences are a sequence of the adjective production followed by the literal strings beer and .

+ +
+
+    adjectives = cold adjective*;
+
+ +

In turn, adjectives is a sequence of a single instance of the cold production followed by a repetition («*» read as 'zero or more') of the adjective production.

+ +
+
+    adjective = cold | freezing;
+    cold = 'cold';
+    freezing = 'freezing';
+
+ +

The adjective production is an alternation of either an instance of the cold or the freezing production. The cold production is the literal string cold and freezing the literal string freezing.

+ + +

Grouping

+ +

A language may be expressed in many different, yet equivalent grammars. Productions may be referenced in any order (even before they are defined) and grouped using parentheses («(» and «)»).

+ +

For example, the Cold Beer language could also be represented by the following grammar:

+ +
+
+    @start = ('cold' ('cold' | 'freezing')* 'beer' '.')+;
+
+ + +

Instantiating Grammar Parsers in Objective-C

+ +

Create an Objective-C PKParser object by providing the grammar as an NSString and an assembler object (in this example, self).

+ +
+
+  NSString *g = ... // fetch your grammar from a file on disk
+  
+  PKParser *parser = nil;
+  parser = [[PKParserFactory factory] parserFromGrammar:g assembler:self];
+  
+  NSString *s = @"cold freezing cold beer.";
+  [parser parse:s];
+
+ +

The provided assembler object will receive callbacks whenever one of the language grammar productions is matched -- if the callback method is implemented in the assembler object.

+ +

For example, an assembler for the Cold Beer language grammar above will receive the following callbacks if implemented:

+ +
+
+    - (void)didMatchSentence:(PKAssembly *)a;
+    - (void)didMatchAdjectives:(PKAssembly *)a;
+    - (void)didMatchAdjective:(PKAssembly *)a;
+    - (void)didMatchCold:(PKAssembly *)a;
+    - (void)didMatchFreezing:(PKAssembly *)a;
+
+ +

The PKAssembly argument will have the most-recently matched tokens on the top of its stack.

+ +

To prevent leaks when releasing a PKParser created via PKParserFactory, one final step is required:

+ +
+
+          PKParser *parser = nil;
+          parser = [[PKParserFactory factory] parserFromGrammar:g assembler:self];
+
+          ... // do parsing
+          
+          // when you are done with the parser, this function must be called before releasing
+          PKReleaseSubparserTree(parser);
+          [p release]
+
+ +

Most non-trivial language grammars define circular relationships in their production rules. The call to PKReleaseSubparserTree() is required to prevent Objective-C retain cycle leaks where the PKParser objects representing different rules in your grammar have strong references to one another.

+ +
+ + diff --git a/docs/web/htaccess b/docs/web/htaccess new file mode 100644 index 0000000..5eafa7f --- /dev/null +++ b/docs/web/htaccess @@ -0,0 +1,5 @@ +# let's enable php (non-cgi, aka. 'module') for EVERYTHING..' +# AddType application/x-httpd-php5 .htm .html .php + +# better yet.. +AddHandler php5-script .php .html .htm .inc \ No newline at end of file diff --git a/docs/web/img/.svn/all-wcprops b/docs/web/img/.svn/all-wcprops new file mode 100644 index 0000000..1903897 --- /dev/null +++ b/docs/web/img/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/!svn/ver/1388/trunk/docs/web/img +END diff --git a/docs/web/img/.svn/entries b/docs/web/img/.svn/entries new file mode 100644 index 0000000..2475b4a --- /dev/null +++ b/docs/web/img/.svn/entries @@ -0,0 +1,538 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/docs/web/img +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +step1a.png +file + + + + +2009-09-18T00:46:31.000000Z +2a844235c536b4f437dfcc4bcb53c507 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +57243 + +step1b.png +file + + + + +2009-09-18T00:46:31.000000Z +6db1abc20711e5e61af4acbbf18361a9 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +59744 + +step2a.png +file + + + + +2009-09-18T00:46:31.000000Z +79fe4753bd148bb371f7e122a1dfdf0c +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +79730 + +step1a.psd +file + + + + +2009-09-18T00:46:31.000000Z +71cf7fe891d325faa24c583be658f897 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +146999 + +step3a.png +file + + + + +2009-09-18T00:46:31.000000Z +38299814d2e693a738e4210e54ce0c59 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +66069 + +step1b.psd +file + + + + +2009-09-18T00:46:31.000000Z +8293419c0eeafbc094881fab11d8990a +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +144527 + +step2a.psd +file + + + + +2009-09-18T00:46:31.000000Z +e99eb879ede85b57e66b1e731381a57b +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +166898 + +step4a.png +file + + + + +2009-09-18T00:46:31.000000Z +097a5b52c0f45c3c181d8bb9b122b100 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +65076 + +step3a.psd +file + + + + +2009-09-18T00:46:31.000000Z +1cc85a6e0713ffeb7982de2b2a65def4 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +164750 + +step4b.png +file + + + + +2009-09-18T00:46:31.000000Z +fe6e11e4bb71a92b57a1a0becb41ac6d +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +25070 + +step5a.png +file + + + + +2009-09-18T00:46:31.000000Z +da7d878d4ab7a1f0722232057b68c713 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +45296 + +step6a.png +file + + + + +2009-09-18T00:46:31.000000Z +7404d6fd3ae33499a218c6d1146e72e1 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +49927 + +step4a.psd +file + + + + +2009-09-18T00:46:31.000000Z +c6ee94d039827440008bcb598f7f8bf7 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +203007 + +step7a.png +file + + + + +2009-09-18T00:46:31.000000Z +d672ec90617930798159626a8ea8e613 +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +41304 + +step4b.psd +file + + + + +2009-09-18T00:46:31.000000Z +11da870de6119c77b93e8e5aca8e72bd +2009-09-18T00:46:54.438360Z +1388 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +85694 + diff --git a/docs/web/img/.svn/prop-base/step1a.png.svn-base b/docs/web/img/.svn/prop-base/step1a.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step1a.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step1a.psd.svn-base b/docs/web/img/.svn/prop-base/step1a.psd.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step1a.psd.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step1b.png.svn-base b/docs/web/img/.svn/prop-base/step1b.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step1b.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step1b.psd.svn-base b/docs/web/img/.svn/prop-base/step1b.psd.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step1b.psd.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step2a.png.svn-base b/docs/web/img/.svn/prop-base/step2a.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step2a.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step2a.psd.svn-base b/docs/web/img/.svn/prop-base/step2a.psd.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step2a.psd.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step3a.png.svn-base b/docs/web/img/.svn/prop-base/step3a.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step3a.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step3a.psd.svn-base b/docs/web/img/.svn/prop-base/step3a.psd.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step3a.psd.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step4a.png.svn-base b/docs/web/img/.svn/prop-base/step4a.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step4a.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step4a.psd.svn-base b/docs/web/img/.svn/prop-base/step4a.psd.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step4a.psd.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step4b.png.svn-base b/docs/web/img/.svn/prop-base/step4b.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step4b.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step4b.psd.svn-base b/docs/web/img/.svn/prop-base/step4b.psd.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step4b.psd.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step5a.png.svn-base b/docs/web/img/.svn/prop-base/step5a.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step5a.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step6a.png.svn-base b/docs/web/img/.svn/prop-base/step6a.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step6a.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/prop-base/step7a.png.svn-base b/docs/web/img/.svn/prop-base/step7a.png.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/docs/web/img/.svn/prop-base/step7a.png.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/docs/web/img/.svn/text-base/step1a.png.svn-base b/docs/web/img/.svn/text-base/step1a.png.svn-base new file mode 100644 index 0000000..88aedf6 Binary files /dev/null and b/docs/web/img/.svn/text-base/step1a.png.svn-base differ diff --git a/docs/web/img/.svn/text-base/step1a.psd.svn-base b/docs/web/img/.svn/text-base/step1a.psd.svn-base new file mode 100644 index 0000000..078555a Binary files /dev/null and b/docs/web/img/.svn/text-base/step1a.psd.svn-base differ diff --git a/docs/web/img/.svn/text-base/step1b.png.svn-base b/docs/web/img/.svn/text-base/step1b.png.svn-base new file mode 100644 index 0000000..75eb7c9 Binary files /dev/null and b/docs/web/img/.svn/text-base/step1b.png.svn-base differ diff --git a/docs/web/img/.svn/text-base/step1b.psd.svn-base b/docs/web/img/.svn/text-base/step1b.psd.svn-base new file mode 100644 index 0000000..f96ffaa Binary files /dev/null and b/docs/web/img/.svn/text-base/step1b.psd.svn-base differ diff --git a/docs/web/img/.svn/text-base/step2a.png.svn-base b/docs/web/img/.svn/text-base/step2a.png.svn-base new file mode 100644 index 0000000..d0365dc Binary files /dev/null and b/docs/web/img/.svn/text-base/step2a.png.svn-base differ diff --git a/docs/web/img/.svn/text-base/step2a.psd.svn-base b/docs/web/img/.svn/text-base/step2a.psd.svn-base new file mode 100644 index 0000000..3373f49 Binary files /dev/null and b/docs/web/img/.svn/text-base/step2a.psd.svn-base differ diff --git a/docs/web/img/.svn/text-base/step3a.png.svn-base b/docs/web/img/.svn/text-base/step3a.png.svn-base new file mode 100644 index 0000000..b243a98 Binary files /dev/null and b/docs/web/img/.svn/text-base/step3a.png.svn-base differ diff --git a/docs/web/img/.svn/text-base/step3a.psd.svn-base b/docs/web/img/.svn/text-base/step3a.psd.svn-base new file mode 100644 index 0000000..01958f3 Binary files /dev/null and b/docs/web/img/.svn/text-base/step3a.psd.svn-base differ diff --git a/docs/web/img/.svn/text-base/step4a.png.svn-base b/docs/web/img/.svn/text-base/step4a.png.svn-base new file mode 100644 index 0000000..2e66426 Binary files /dev/null and b/docs/web/img/.svn/text-base/step4a.png.svn-base differ diff --git a/docs/web/img/.svn/text-base/step4a.psd.svn-base b/docs/web/img/.svn/text-base/step4a.psd.svn-base new file mode 100644 index 0000000..0d7b72d Binary files /dev/null and b/docs/web/img/.svn/text-base/step4a.psd.svn-base differ diff --git a/docs/web/img/.svn/text-base/step4b.png.svn-base b/docs/web/img/.svn/text-base/step4b.png.svn-base new file mode 100644 index 0000000..63c4288 Binary files /dev/null and b/docs/web/img/.svn/text-base/step4b.png.svn-base differ diff --git a/docs/web/img/.svn/text-base/step4b.psd.svn-base b/docs/web/img/.svn/text-base/step4b.psd.svn-base new file mode 100644 index 0000000..dceeaba Binary files /dev/null and b/docs/web/img/.svn/text-base/step4b.psd.svn-base differ diff --git a/docs/web/img/.svn/text-base/step5a.png.svn-base b/docs/web/img/.svn/text-base/step5a.png.svn-base new file mode 100644 index 0000000..c50d231 Binary files /dev/null and b/docs/web/img/.svn/text-base/step5a.png.svn-base differ diff --git a/docs/web/img/.svn/text-base/step6a.png.svn-base b/docs/web/img/.svn/text-base/step6a.png.svn-base new file mode 100644 index 0000000..dbee4ef Binary files /dev/null and b/docs/web/img/.svn/text-base/step6a.png.svn-base differ diff --git a/docs/web/img/.svn/text-base/step7a.png.svn-base b/docs/web/img/.svn/text-base/step7a.png.svn-base new file mode 100644 index 0000000..554615d Binary files /dev/null and b/docs/web/img/.svn/text-base/step7a.png.svn-base differ diff --git a/docs/web/img/step1a.png b/docs/web/img/step1a.png new file mode 100644 index 0000000..88aedf6 Binary files /dev/null and b/docs/web/img/step1a.png differ diff --git a/docs/web/img/step1a.psd b/docs/web/img/step1a.psd new file mode 100644 index 0000000..078555a Binary files /dev/null and b/docs/web/img/step1a.psd differ diff --git a/docs/web/img/step1b.png b/docs/web/img/step1b.png new file mode 100644 index 0000000..75eb7c9 Binary files /dev/null and b/docs/web/img/step1b.png differ diff --git a/docs/web/img/step1b.psd b/docs/web/img/step1b.psd new file mode 100644 index 0000000..f96ffaa Binary files /dev/null and b/docs/web/img/step1b.psd differ diff --git a/docs/web/img/step2a.png b/docs/web/img/step2a.png new file mode 100644 index 0000000..d0365dc Binary files /dev/null and b/docs/web/img/step2a.png differ diff --git a/docs/web/img/step2a.psd b/docs/web/img/step2a.psd new file mode 100644 index 0000000..3373f49 Binary files /dev/null and b/docs/web/img/step2a.psd differ diff --git a/docs/web/img/step3a.png b/docs/web/img/step3a.png new file mode 100644 index 0000000..b243a98 Binary files /dev/null and b/docs/web/img/step3a.png differ diff --git a/docs/web/img/step3a.psd b/docs/web/img/step3a.psd new file mode 100644 index 0000000..01958f3 Binary files /dev/null and b/docs/web/img/step3a.psd differ diff --git a/docs/web/img/step4a.png b/docs/web/img/step4a.png new file mode 100644 index 0000000..2e66426 Binary files /dev/null and b/docs/web/img/step4a.png differ diff --git a/docs/web/img/step4a.psd b/docs/web/img/step4a.psd new file mode 100644 index 0000000..0d7b72d Binary files /dev/null and b/docs/web/img/step4a.psd differ diff --git a/docs/web/img/step4b.png b/docs/web/img/step4b.png new file mode 100644 index 0000000..63c4288 Binary files /dev/null and b/docs/web/img/step4b.png differ diff --git a/docs/web/img/step4b.psd b/docs/web/img/step4b.psd new file mode 100644 index 0000000..dceeaba Binary files /dev/null and b/docs/web/img/step4b.psd differ diff --git a/docs/web/img/step5a.png b/docs/web/img/step5a.png new file mode 100644 index 0000000..c50d231 Binary files /dev/null and b/docs/web/img/step5a.png differ diff --git a/docs/web/img/step6a.png b/docs/web/img/step6a.png new file mode 100644 index 0000000..dbee4ef Binary files /dev/null and b/docs/web/img/step6a.png differ diff --git a/docs/web/img/step7a.png b/docs/web/img/step7a.png new file mode 100644 index 0000000..554615d Binary files /dev/null and b/docs/web/img/step7a.png differ diff --git a/docs/web/index.html b/docs/web/index.html new file mode 100644 index 0000000..0fb4e46 --- /dev/null +++ b/docs/web/index.html @@ -0,0 +1,257 @@ + + ParseKit - Cocoa Objective-C Framework for parsing, tokenizing and language processing + + +

ParseKit Documentation

+
+

ParseKit

+ +

ParseKit is a Mac OS X Framework written by Todd Ditchendorf in Objective-C 2.0 and released under the MIT Open Source License. ParseKit is suitable for use on Mac OS X Leopard, Snow Leopard or iPhone OS. ParseKit is an Objective-C implementation of the tools described in "Building Parsers with Java" by Steven John Metsker. ParseKit includes additional features beyond the designs from the book and also some changes to match common Cocoa/Objective-C conventions. These changes are relatively superficial, however, and Metsker's book is the best documentation available for ParseKit.

+ +

The ParseKit Framework offers 3 basic services of general interest to Cocoa developers:

+ +
    +
  1. String Tokenization via the Objective-C PKTokenizer and PKToken classes.
  2. +
  3. High-Level Language Parsing via Objective-C - An Objective-C parser-building API (the PKParser class and sublcasses).
  4. +
  5. Objective-C Parser Generation via Grammars - Generate an Objective-C parser for your custom language using a BNF-style grammar syntax (similar to yacc or ANTLR). While parsing, the parser will provide callbacks to your Objective-C code.
  6. +
+ +

The ParseKit source code is available from the Subversion repository at the Google Code project page. The latest tagged (stable) version is recommended.

svn co http://todparsekit.googlecode.com/svn/tags/release-1.5-tag

+ +

More documentation:

+ + +

Projects using ParseKit:

+
    +
  • Spike: A Rails log file viewer/analyzer by Matt Mower
  • +
  • JSTalk: Interprocess Cocoa scripting with JavaScript by Gus Mueller
  • +
  • Objective-J Port of ParseKit by Ross Boucher
  • +
  • HTTP Client: HTTP debugging/testing tool
  • +
  • Fluid: Site-Specific Browser for Mac OS X
  • +
  • Cruz: Social Browser for Mac OS X
  • +
  • OkudaKit: Syntax Highlighting Framework for Mac OS X
  • +
  • Exedore: XPath 1.0 implemented in Cocoa (ported from Saxon)
  • +
+ +

Xcode Project

+

The ParseKit Xcode project consists of 6 targets:

+ +
    +
  1. ParseKit : the ParseKit Objective-C framework. The central feature/codebase of this project.
  2. +
  3. Tests : a UnitTest Bundle containing hundreds of unit tests (actually, more correctly, interaction tests) for the framework as well as some example classes that serve as real-world uses of the framework.
  4. +
  5. DemoApp : A simple Cocoa demo app that gives a visual presentation of the results of tokenizing text using the PKTokenizer class.
  6. +
  7. DebugApp : A simple Cocoa app that exists only to run arbitrary test code thru GDB with breakpoints for debugging (I was not able to do that with the UnitTest bundle).
  8. +
  9. JSParseKit : A JavaScriptCore-based scripting interface to ParseKit which can be used to expose the entire framework to JavaScript environments.
  10. +
  11. JSDemoApp: A simple Cocoa application used for exercising the JavaScript interface provided by JSParseKit. Note that this is the only target which links to the WebKit framework. Neither ParseKit nor JSParseKit requires WebKit.
  12. +
+ + + +

ParseKit Framework

+ +
+

Tokenization

+ +

The API for tokenization is provided by the PKTokenizer class. Cocoa developers will be familiar with the NSScanner class provided by the Foundation Framework which provides a similar service. However, the PKTokenizer class is simpler and more powerful for many use cases.

+ +

Example usage:

+ +
+
+NSString *s = @"\"It's 123 blast-off!\", she said, // watch out!\n"
+              @"and <= 3.5 'ticks' later /* wince */, it's blast-off!";
+PKTokenizer *t = [PKTokenizer tokenizerWithString:s];
+
+PKToken *eof = [PKToken EOFToken];
+PKToken *tok = nil;
+
+while ((tok = [t nextToken]) != eof) {
+    NSLog(@" (%@)", tok);
+}
+
+
+ +

outputs:

+
+
 ("It's 123 blast-off!")
+ (,)
+ (she)
+ (said)
+ (,)
+ (and)
+ (<=)
+ (3.5)
+ ('ticks')
+ (later)
+ (,)
+ (it's)
+ (blast-off)
+ (!)
+
+
+ +

Each token produced is an object of class PKToken. PKTokens have a tokenType (Word, Symbol, Num, QuotedString, etc.) and both a stringValue and a floatValue.

+ +

More information about a token can be easily discovered using the -debugDescription method instead of the default -description. Replace the line containing NSLog above with this line:

+ +
+
+NSLog(@" (%@)", [tok debugDescription]);
+
+
+ +

and each token's type will be printed as well:

+ +
+
 <Quoted String «"It's 123 blast-off!"»>
+ <Symbol «,»>
+ <Word «she»>
+ <Word «said»>
+ <Symbol «,»>
+ <Word «and»>
+ <Symbol «<=»>
+ <Number «3.5»>
+ <Quoted String «'ticks'»>
+ <Word «later»>
+ <Symbol «,»>
+ <Word «it's»>
+ <Word «blast-off»>
+ <Symbol «!»>
+
+
+ + +

As you can see from the output, PKTokenzier is configured by default to properly group characters into tokens including:

+ +
    +
  • single- and double-quoted string tokens
  • +
  • common multiple character symbols (<=)
  • +
  • apostrophes, dashes and other symbol chars that should not signal the start of a new Symbol token, but rather be included in the current Word or Num token (it's, blast-off, 3.5)
  • +
  • silently ignoring C- and C++-style comments
  • +
  • silently ignoring whitespace
  • +
+ + +

The PKTokenizer class is very flexible, and all of those features are configurable. PKTokenizer may be configured to:

+ +
    +
  • recognize more (or fewer) multi-char symbols. ex:
    [t.symbolState add:@"!="];
    +

    allows != to be recognized as a single Symbol token rather than two adjacent Symbol tokens

    +
  • + +
  • add new internal symbol chars to be included in the current Word token OR recognize internal symbols like apostrophe and dash to actually signal a new Symbol token rather than being part of the current Word token. ex: +
    [t.wordState setWordChars:YES from:'_' to:'_'];
    +

    allows Word tokens to contain internal underscores

    +
    [t.wordState setWordChars:NO from:'-' to:'-'];
    +

    disallows Word tokens from containing internal dashes.

    +
  • + + +
  • change which chars singnal the start of a token of any given type. ex: +
    [t setTokenizerState:t.wordState from:'_' to:'_'];
    +

    allows Word tokens to start with underscore

    +
    [t setTokenizerState:t.quoteState from:'*' to:'*'];
    +

    allows Quoted String tokens to start with an asterisk, effectively making * a new quote symbol (like " or ')

    +
  • + +
  • turn off recognition of single-line "slash-slash" (//) comments. ex: +
    [t setTokenizerState:t.symbolState from:'/' to:'/'];
    +

    slash chars now produce individual Symbol tokens rather than causing the tokenizer to strip text until the next newline char or begin striping for a multiline comment if appropriate (/*)

    +
  • + +
  • turn on recognition of "hash" (#) single-line comments. ex: +
    +
    [t setTokenizerState:t.commentState from:'#' to:'#'];
    +[t.commentState addSingleLineStartSymbol:@"#"];
    +
    +
  • + +
  • turn on recognition of "XML/HTML" (<!-- -->) multi-line comments. ex: +
    +
    [t setTokenizerState:t.commentState from:'<' to:'<'];
    +[t.commentState addMultiLineStartSymbol:@"<!--" endSymbol:@"-->"];
    +
    +
  • + +
  • report (rather than silently consume) Comment tokens. ex: +
    +
    t.commentState.reportsCommentTokens = YES; // default is NO
    +
    +
  • + +
  • report (rather than silently consume) Whitespace tokens. ex: +
    +
    t.whitespaceState.reportsWhitespaceTokens = YES; // default is NO
    +
    +
  • + +
  • turn on recognition of any characters (say, digits) as whitespace to be silently ignored. ex: +
    +
    [t setTokenizerState:t.whitespaceState from:'0' to:'9'];
    +
    +
  • + +
+ +
+

Parsing

+ +

ParseKit also includes a collection of token parser subclasses (of the abstract PKParser class) including collection parsers such as PKAlternation, PKSequence, and PKRepetition as well as terminal parsers including PKWord, PKNum, PKSymbol, PKQuotedString, etc. Also included are parser subclasses which work in individual chars such as PKChar, PKDigit, and PKSpecificChar. These char parsers are useful for things like RegEx parsing. Generally speaking though, the token parsers will be more useful and interesting.

+ +

The parser classes represent a Composite pattern. Programs can build a composite parser, in Objective-C (rather than a separate language like with lex&yacc), from a collection of terminal parsers composed into alternations, sequences, and repetitions to represent an infinite number of languages.

+ +

Parsers built from ParseKit are non-deterministic, recursive descent parsers, which basically means they trade some performance for ease of user programming and simplicity of implementation.

+ +

Here is an example of how one might build a parser for a simple voice-search command language (note: ParseKit does not include any kind of speech recognition technology). The language consists of:

+ +
+
search google for? <search-term>
+
+ +
+
+...
+
+	[self parseString:@"search google 'iphone'"];
+...
+	
+- (void)parseString:(NSString *)s {
+	PKSequence *parser = [PKSequence sequence];
+
+	[parser add:[[PKLiteral literalWithString:@"search"] discard]];
+	[parser add:[[PKLiteral literalWithString:@"google"] discard]];
+
+	PKAlternation *optionalFor = [PKAlternation alternation];
+	[optionalFor add:[PKEmpty empty]];
+	[optionalFor add:[PKLiteral literalWithString:@"for"]];
+
+	[parser add:[optionalFor discard]];
+
+	PKParser *searchTerm = [PKQuotedString quotedString];
+	[searchTerm setAssembler:self selector:@selector(workOnSearchTermAssembly:)];
+	[parser add:searchTerm];
+
+	PKAssembly *result = [parser bestMatchFor:[PKTokenAssembly assmeblyWithString:s]];
+	
+	NSLog(@" %@", result);
+
+	// output:
+	//  ['iphone']search/google/'iphone'^
+}
+
+...
+
+- (void)workOnSearchTermAssembly:(PKAssembly *)a {
+	PKToken *t = [a pop]; // a QuotedString token with a stringValue of 'iphone'
+	[self doGoogleSearchForTerm:t.stringValue];
+}
+
+
+
+ +
+ + diff --git a/docs/web/iphone.html b/docs/web/iphone.html new file mode 100644 index 0000000..3432a97 --- /dev/null +++ b/docs/web/iphone.html @@ -0,0 +1,59 @@ + + ParseKit - Cocoa parsing, tokenizing and language processing on iPhone + + +

ParseKit Documentation

+
+ +

ParseKit for iPhone OS Applications

+ +

Including ParseKit in your iPhone OS applications is easy. Follow the steps below.

+ +
    +
  1. +
    Check out the ParseKit sourcecode from Google Code. The latest tagged (stable) version is recommended.
    +

    svn co http://todparsekit.googlecode.com/svn/tags/release-1.5-tag

    +
  2. +
  3. +
    Open your iPhone app Xcode project. Drag the ParseKit.xcodeproj file from the finder and drop it at the top of the Groups & Files tree in your app's Xcode project window. In the confirmation dialog that appears, click Add.
    +

    +

    +
  4. + +
  5. +
    Click and expand the disclosure triangle next to the blue ParseKit.xcodeproj icon to reveal all of the potential products of the ParseKit project.
    +

    +
  6. +
  7. +
    Click and expand the disclosure triangle next to your app's Target. Drag the parsekit.a product under ParseKit.xcodeproj to your Target's Link Binary With Libraries build phase.
    +

    +
  8. +
  9. +
    Double-click your Target (MyApp shown here) to edit it. In the General tab of the Target Info window, click the square + button below the Direct Dependencies list. In the sheet that appears, select ParseKitMobile and click Add Target.
    +

    +
    You will now see the ParseKitMobile target appearing as a dependency under your app's Target.
    +

    +
  10. +
  11. +

    Next click the + button below the Linked Libraries list in the same window. Select libicucore.dylib and click Add. (This is for regular expression features in the PKPattern class.)

    +

    +
  12. +
  13. +
    Under the Build tab of your app's Target Info window, edit the Header Search Paths Setting to include the path to the include folder inside of the ParseKit folder you checked out. Make sure you edit this for All Configurations, not just the active one.
    +

    +
  14. + +
  15. +
    Finally, in the same window, edit the Other Linker Flags Setting to include the following flags: -ObjC -all_load. (This is needed for code in Objective-C categories in the ParseKit static library to execute successfully.)
    +

    +
  16. + +
  17. Ship it!
  18. + +
+ +
+ + + + diff --git a/docs/web/tokenization.html b/docs/web/tokenization.html new file mode 100644 index 0000000..f7f3dcd --- /dev/null +++ b/docs/web/tokenization.html @@ -0,0 +1,366 @@ + + ParseKit - String Tokenization in Objective-C, Cocoa + + + +

ParseKit Documentation

+
+ +

Tokenization

+ + + + +

Basic Usage of PKTokenizer

+ +

ParseKit provides general-purpose string tokenization services through the PKTokenizer and PKToken classes. Cocoa developers will be familiar with the NSScanner class provided by the Foundation Framework which provides a similar service. However, the PKTokenizer class is much easier to use for many common tokenization tasks, and offers powerful configuration options if the default tokenization behavior doesn't match your needs.

+ + + + + + + + +
PKTokenizer
+

+ + (id)tokenizerWithString:(NSString *)s;
+

+

+ - (PKToken *)nextToken;
+ ...
+

+
+ +

To use PKTokenizer, create an instance with an NSString object and retrieve a series of PKToken objects as you repeatedly call the -nextToken method. The EOFToken singleton signals the end.

+ +
+
+NSString *s = @"2 != -47. /* comment */ Blast-off!! 'Woo-hoo!' // comment";
+PKTokenizer *t = [PKTokenizer tokenizerWithString:s];
+
+PKToken *eof = [PKToken EOFToken];
+PKToken *tok = nil;
+
+while ((tok = [t nextToken]) != eof) {
+    NSLog(@"(%@) (%.1f) : %@", 
+        tok.stringValue, tok.floatValue, [tok debugDescription]);
+}
+
+
+ +

Outputs:

+ +
+
+(2) (2.0) : <Number «2»>
+(!=) (0.0) : <Symbol «!=»>
+(-47) (-47.0) : <Number «-47»>
+(.) (0.0) : <Symbol «.»>
+(Blast-off) (0.0) : <Word «Blast-off»>
+(!) (0.0) : <Symbol «!»>
+(!) (0.0) : <Symbol «!»>
+('Woo-hoo!') (0.0) : <Quoted String «'Woo-hoo!'»>
+
+
+ +

Each PKToken object returned has a stringValue, a floatValue and a tokenType. The tokenType is and enum value type called PKTokenType with possible values of:

+ +
    +
  • PKTokenTypeWord
  • +
  • PKTokenTypeNumber
  • +
  • PKTokenTypeQuotedString
  • +
  • PKTokenTypeSymbol
  • +
  • PKTokenTypeWhitespace
  • +
  • PKTokenTypeComment
  • +
  • PKTokenTypeDelimitedString
  • +
+ +

PKTokens also have corresponding BOOL properties for convenience (isWord, isNumber, etc.)

+ + + + + + + + +
PKToken
+

+ + (PKToken *)EOFToken;
+

+

+ @property (readonly) PKTokenType tokenType;
+

+

+ @property (readonly) CGFloat floatValue;
+ @property (readonly, copy) NSString *stringValue;
+

+

+ @property (readonly) BOOL isNumber;
+ @property (readonly) BOOL isSymbol;
+ @property (readonly) BOOL isWord;
+ @property (readonly) BOOL isQuotedString;
+ @property (readonly) BOOL isWhitespace;
+ @property (readonly) BOOL isComment;
+ @property (readonly) BOOL isDelimitedString;
+

+

+ ...
+

+
+ + +

Default Behavior of PKTokenizer

+ +

The default behavior of PKTokenizer is correct for most common situations and will fit many tokenization needs without additional configuration.

+ +

Number

+ +

Sequences of digits («2» «42» «1054») are recognized as Number tokens. Floating point numbers containing a dot («3.14») are recognized as single Number tokens as you'd expect (rather than two Number tokens separated by a «.» Symbol token). By default, PKTokenizer will recognize a «-» symbol followed immediately by digits («-47») as a number token with a negative value. However, «+» characters are always seen as the beginning of a Symbol token by default, even when followed immediately by digits, so "explicitly-positive" Number tokens are not recognized by default (this behavior can be configured, see below).

+ +

Symbol

+ +

Most symbol characters («.» «!») are recognized as single-character Symbol tokens (even when sequential such as «!»«!»). However, notice that PKTokenizer recognizes common multi-character symbols («!=») as a single Symbol token by default. In fact, PKTokenizer can be configured to recognize any given string as a multi-character symbol. Alternatively, it can be configured to always recognize each symbol character as an individual Symbol token (no mulit-character symbols). The default multi-character symbols recognized by PKTokenizer are: «<=», «>=», «!=», «==».

+ +

Word

+

«Blast-off» is recognized as a single Word token despite containing a symbol character («-») that would normally signal the start of a new Symbol token. By default, PKTokenzier allows Word tokens to contain (but not start with) several symbol and number characters: «-», «_», «'», «0»-«9». The consequence of this behavior is that PKTokenizer will recognize the follwing strings as individual Word tokens by default: «it's», «first_name», «sat-yr-9» «Rodham-Clinton». Again, you can configure PKTokenizer to alter this default behavior.

+ +

Quoted String

+

PKTokenizer produces Quoted String tokens for substrings enclosed in quote delimiter characters. The default delimiters are single- or double-quotes («'» or «"»). The quote delimiter characters may be changed (see below), but must be a single character. Note that the stringValue of Quoted String tokens include the quote delimiter characters («'Woo-hoo!'»).

+ +

Whitespace

+

By default, whitespace characters are silently consumed by PKTokenizer, and Whitespace tokens are never emitted. However, you can configure which characters are considered Whitespace characters or even ask PKTokenizer to return Whitespace tokens containing the literal whitespace stringValues by setting: t.whitespaceState.reportsWhitespaceTokens = YES.

+ +

Comment

+

By default, PKTokenizer recognizes C-style («//») and C++-style («/*» «*/») comments and silently removes the associated comments from the output rather than producing Comment tokens. See below for steps to either change comment delimiting markers, report Comment tokens, or to turn off comments recognition altogether.

+ +

Delimited String

+

The Delimited String token type is a powerful feature of ParseKit which can be used much like a regular expression. Use the Delimited String token type to ask PKTokenizer to recognize tokens with arbitrary start and end symbol strings much like a Quoted String but with more power:

+ +
    +
  • The start and end symbols may be multi-char (e.g. «<#» «#>»)
  • +
  • The start and end symbols need not match (e.g. «<?=» «?>»)
  • +
  • The characters allowed within the delimited string may be specified using an NSCharacterSet
  • +
+ + + +

Customizing PKTokenizer behavior

+ +

There are two basic types of decisions PKTokenizer must make when tokenizing strings:

+ +
    +
  1. Which token type should be created for a given start character?
  2. +
  3. Which characters are allowed within the current token being created?
  4. +
+ + +

PKTokenizer's behavior with respect to these two types of decisions is totally configurable. Let's tackle them, starting with the second question first.

+ +

Changing which characters are allowed within a token of a particular type

+ +

Once PKTokenizer has decided which token type to create for a given start character (see below), it temporarily passes control to one of its "state" helper objects to finish consumption of characters for the current token. Therefore, the logic for deciding which characters are allowed within a token of a given type is controlled by the "state" objects which are instances of subclasses of the abstract PKTokenizerState class: PKWordState, PKNumberState, PKQuoteState, PKSymbolState, PKWhitespaceState, PKCommentState, and PKDelimitState. The state objects are accessible via properties of the PKTokenizer object.

+ + + + + + + + +
PKTokenizer
+

+ ...
+ @property (readonly, retain) PKWordState *wordState;
+ @property (readonly, retain) PKNumberState *numberState;
+ @property (readonly, retain) PKQuoteState *quoteState;
+ @property (readonly, retain) PKSymbolState *symbolState;
+ @property (readonly, retain) PKWhitespaceState *whitespaceState;
+ @property (readonly, retain) PKCommentState *commentState;
+ @property (readonly, retain) PKDelimitState *delimitState;
+

+
+ +

Some of the PKTokenizerState subclasses have methods that alter which characters are allowed within tokens of their associated token type.

+ +

For example, if you want to add a new multiple-character symbol like «===»:

+ +
+
+...
+PKTokenizer *t = [PKTokenizer tokenizerWithString:s];
+[t.symbolState add:@"==="];
+...
+
+ +

Now «===» strings will be recognized as a single Symbol token with a stringValue of «===». There is a corresponding -[PKSymbolState remove:] method for removing recognition of given multi-char symbols.

+ +

If you don't want to allow digits within Word tokens (digits are allowed within Words by default):

+ +
+
+...
+[t.wordState setWordChars:NO from:'0' to:'9'];
+...
+
+ +

Say you want to allow floating-point Number tokens to end with a «.», sans trailing «0». In other words, you want «49.» to be recognized as a single Number token with a floatValue of «49.0» rather than a Number token followed by a Symbol token with a stringValue of «.»:

+ +
+
+...
+t.numberState.allowsTrailingDot = YES;
+...
+
+ +

Recognition of scientific notation (exponential numbers) can be enabled to recognize numbers like «10e+100», «6.626068E-34» and «6.0221415e23». The resulting PKToken objects will have floatValues which represent the full value of the exponential number, yet retain the original exponential representation as their stringValues.

+ +
+
+...
+t.numberState.allowsScentificNotation = YES;
+...
+
+ +

Similarly, recognition of common octal and hexadecimal number notation can be enabled to recognize numbers like «020» (octal 16) and «0x20» (hex 32).

+ +
+
+...
+t.numberState.allowsOctalNotation = YES;
+t.numberState.allowsHexadecimalNotation = YES;
+...
+
+ +

The resulting PKToken objects will have a tokenType of PKTokenTypeNumber and a stringValue matching the original source notation («020» or «0x20»). Their floatValues will represent the normal decimal value of the number (in this case 16 and 32).

+ +

You can also configure which characters are recognized as whitespace within a whitespace token. To treat digits as whitespace characters within whitespace tokens:

+ +
+
+...
+[t.whitespaceState setWhitespaceChars:YES from:'0' to:'9'];
+...
+
+ +

By default, whitespace chars are silently consumed by a tokenizer's PKWhitespaceState. To force reporting of PKTokens of type PKTokenTypeWhitespace containing the encountered whitespace chars as their stringValues (e.g. this would be necessary for a typical XML parser in which significant whitespace must be reported):

+ +
+
+...
+t.whitespaceState.reportsWhitespaceTokens = YES;
+...
+
+ +

Similarly, comments are also silently consumed by default. To report Comment tokens instead:

+ +
+
+...
+t.commentState.reportsCommentTokens = YES;
+...
+
+ + +

Changing which token type is created for a given start character

+ +

PKTokenizer controls the logic for deciding which token type should be created for a given start character before passing the responsibility for completing tokens to its "state" helper objects. To change which token type is created for a given start character, you must call a method of the PKTokenizer object itself: -[PKTokenizer setTokenizerState:from:to:].

+ + + + + + + + +
PKTokenizer
+

+ ... +

- (void)setTokenizerState:(PKTokenizerState *)state 
+                     from:(PKUniChar)start 
+                       to:(PKUniChar)end;
+ ...
+

+
+ +

For example, suppose you want to turn off support for Number tokens altogether. To recognize digits as signaling the start of Word tokens:

+ +
+
+...
+PKTokenizer *t = [PKTokenizerWithString:s];
+[t setTokenizerState:t.wordState from:'0' to:'9'];
+...
+
+ +

This will cause PKTokenizer to begin creating a Word token (rather than a Number token) whenever a digit («0», «1», «2», «3»,«4», «5», «6», «7», «8», «9», «0» ) is encountered.

+ +

As another example, say you want to add support for new Quoted String token delimiters, such as «#». This would cause a string like #oh hai# to be recognized as a Quoted String token rather than a Symbol, two Words, and a Symbol. Here's how:

+ +
+
+...
+[t setTokenizerState:t.quoteState from:'#' to:'#'];
+...
+
+ +

Note that if the from: and to: arguments are the same char, only behavior for that single char is affected.

+ +

Alternatively, say you want to recognize «+» characters followed immediately by digits as explicitly positive Number tokens rather than as a Symbol token followed by a Number token:

+ +
+
+...
+[t setTokenizerState:t.numberState from:'+' to:'+'];
+...
+
+ +

Finally, customization of comments recognition may be necessary. By default, PKTokenizer passes control to its commentState object which silently consumes the comment text found after «//» or between «/*» «*/». This default behavior is achieved with the sequence:

+ +
+
+...
+[t setTokenizerState:t.commentState from:'/' to:'/'];
+[t.commentState addSingleLineStartSymbol:@"//"];
+[t.commentState addMultiLineStartSymbol:@"/*" endSymbol:@"*/"];
+...
+
+ +

To recognize single-line comments starting with #:

+ +
+
+...
+[t setTokenizerState:t.commentState from:'#' to:'#'];
+[t.commentState addSingleLineStartSymbol:@"#"];
+...
+
+ +

To recognize multi-line "XML"- or "HTML"-style comments:

+ +
+
+...
+[t setTokenizerState:t.commentState from:'<' to:'<'];
+[t.commentState addMultiLineStartSymbol:@"<!--" endSymbol:@"-->"];
+...
+
+ +

To disable comments recognition altogether, tell PKTokenizer to pass control to its symbolState instead of its commentState.

+ +
+
+...
+[t setTokenizerState:t.symbolState from:'/' to:'/'];
+...
+
+ +

Now PKTokenizer will return individual Symbol tokens for all «/» and «*» characters, as well as any other characters set as part of a comment start or end symbol.

+ +
+ diff --git a/frameworks/.svn/all-wcprops b/frameworks/.svn/all-wcprops new file mode 100644 index 0000000..0b6342e --- /dev/null +++ b/frameworks/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 34 +/svn/!svn/ver/351/trunk/frameworks +END diff --git a/frameworks/.svn/entries b/frameworks/.svn/entries new file mode 100644 index 0000000..e5a3e67 --- /dev/null +++ b/frameworks/.svn/entries @@ -0,0 +1,31 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/frameworks +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +OCMock.framework +dir + diff --git a/frameworks/OCMock.framework/.svn/all-wcprops b/frameworks/OCMock.framework/.svn/all-wcprops new file mode 100644 index 0000000..5078038 --- /dev/null +++ b/frameworks/OCMock.framework/.svn/all-wcprops @@ -0,0 +1,23 @@ +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework +END +Resources +K 25 +svn:wc:ra_dav:version-url +V 61 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Resources +END +Headers +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Headers +END +OCMock +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/OCMock +END diff --git a/frameworks/OCMock.framework/.svn/entries b/frameworks/OCMock.framework/.svn/entries new file mode 100644 index 0000000..6e61228 --- /dev/null +++ b/frameworks/OCMock.framework/.svn/entries @@ -0,0 +1,133 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/frameworks/OCMock.framework +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +Versions +dir + +Resources +file + + + + +2009-01-13T13:52:45.000000Z +8a6539acc25a583ce7a88f6573bf4687 +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf +has-props + + +svn:special + + + + + + + + + + + + + + + + + +26 + +Headers +file + + + + +2009-01-13T13:52:45.000000Z +574393f6f6e7d44c9dfa3c805bbefb99 +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf +has-props + + +svn:special + + + + + + + + + + + + + + + + + +24 + +OCMock +file + + + + +2009-01-13T13:52:45.000000Z +9b928bf344b4fa0c6323309d37a04c09 +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf +has-props + + +svn:special + + + + + + + + + + + + + + + + + +23 + diff --git a/frameworks/OCMock.framework/.svn/prop-base/Headers.svn-base b/frameworks/OCMock.framework/.svn/prop-base/Headers.svn-base new file mode 100644 index 0000000..d222469 --- /dev/null +++ b/frameworks/OCMock.framework/.svn/prop-base/Headers.svn-base @@ -0,0 +1,5 @@ +K 11 +svn:special +V 1 +* +END diff --git a/frameworks/OCMock.framework/.svn/prop-base/OCMock.svn-base b/frameworks/OCMock.framework/.svn/prop-base/OCMock.svn-base new file mode 100644 index 0000000..d222469 --- /dev/null +++ b/frameworks/OCMock.framework/.svn/prop-base/OCMock.svn-base @@ -0,0 +1,5 @@ +K 11 +svn:special +V 1 +* +END diff --git a/frameworks/OCMock.framework/.svn/prop-base/Resources.svn-base b/frameworks/OCMock.framework/.svn/prop-base/Resources.svn-base new file mode 100644 index 0000000..d222469 --- /dev/null +++ b/frameworks/OCMock.framework/.svn/prop-base/Resources.svn-base @@ -0,0 +1,5 @@ +K 11 +svn:special +V 1 +* +END diff --git a/frameworks/OCMock.framework/.svn/text-base/Headers.svn-base b/frameworks/OCMock.framework/.svn/text-base/Headers.svn-base new file mode 100644 index 0000000..45bda20 --- /dev/null +++ b/frameworks/OCMock.framework/.svn/text-base/Headers.svn-base @@ -0,0 +1 @@ +link Versions/Current/Headers \ No newline at end of file diff --git a/frameworks/OCMock.framework/.svn/text-base/OCMock.svn-base b/frameworks/OCMock.framework/.svn/text-base/OCMock.svn-base new file mode 100644 index 0000000..bf7a568 --- /dev/null +++ b/frameworks/OCMock.framework/.svn/text-base/OCMock.svn-base @@ -0,0 +1 @@ +link Versions/Current/OCMock \ No newline at end of file diff --git a/frameworks/OCMock.framework/.svn/text-base/Resources.svn-base b/frameworks/OCMock.framework/.svn/text-base/Resources.svn-base new file mode 100644 index 0000000..0af1f07 --- /dev/null +++ b/frameworks/OCMock.framework/.svn/text-base/Resources.svn-base @@ -0,0 +1 @@ +link Versions/Current/Resources \ No newline at end of file diff --git a/frameworks/OCMock.framework/Headers b/frameworks/OCMock.framework/Headers new file mode 120000 index 0000000..a177d2a --- /dev/null +++ b/frameworks/OCMock.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/frameworks/OCMock.framework/OCMock b/frameworks/OCMock.framework/OCMock new file mode 120000 index 0000000..c388ea8 --- /dev/null +++ b/frameworks/OCMock.framework/OCMock @@ -0,0 +1 @@ +Versions/Current/OCMock \ No newline at end of file diff --git a/frameworks/OCMock.framework/Resources b/frameworks/OCMock.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/frameworks/OCMock.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/frameworks/OCMock.framework/Versions/.svn/all-wcprops b/frameworks/OCMock.framework/Versions/.svn/all-wcprops new file mode 100644 index 0000000..efd9d52 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 60 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions +END +Current +K 25 +svn:wc:ra_dav:version-url +V 68 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/Current +END diff --git a/frameworks/OCMock.framework/Versions/.svn/entries b/frameworks/OCMock.framework/Versions/.svn/entries new file mode 100644 index 0000000..ebeca48 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/.svn/entries @@ -0,0 +1,65 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/frameworks/OCMock.framework/Versions +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +A +dir + +Current +file + + + + +2009-01-13T13:52:45.000000Z +654580f41818cd6f51408c7cbd313728 +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf +has-props + + +svn:special + + + + + + + + + + + + + + + + + +1 + diff --git a/frameworks/OCMock.framework/Versions/.svn/prop-base/Current.svn-base b/frameworks/OCMock.framework/Versions/.svn/prop-base/Current.svn-base new file mode 100644 index 0000000..d222469 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/.svn/prop-base/Current.svn-base @@ -0,0 +1,5 @@ +K 11 +svn:special +V 1 +* +END diff --git a/frameworks/OCMock.framework/Versions/.svn/text-base/Current.svn-base b/frameworks/OCMock.framework/Versions/.svn/text-base/Current.svn-base new file mode 100644 index 0000000..613feee --- /dev/null +++ b/frameworks/OCMock.framework/Versions/.svn/text-base/Current.svn-base @@ -0,0 +1 @@ +link A \ No newline at end of file diff --git a/frameworks/OCMock.framework/Versions/A/.svn/all-wcprops b/frameworks/OCMock.framework/Versions/A/.svn/all-wcprops new file mode 100644 index 0000000..ff6a7e6 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 62 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A +END +OCMock +K 25 +svn:wc:ra_dav:version-url +V 69 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/OCMock +END diff --git a/frameworks/OCMock.framework/Versions/A/.svn/entries b/frameworks/OCMock.framework/Versions/A/.svn/entries new file mode 100644 index 0000000..f6543c5 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/.svn/entries @@ -0,0 +1,68 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/frameworks/OCMock.framework/Versions/A +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +Resources +dir + +Headers +dir + +OCMock +file + + + + +2008-12-15T21:27:02.000000Z +153105d53d245f56054269b4b05b1dba +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +182272 + diff --git a/frameworks/OCMock.framework/Versions/A/.svn/prop-base/OCMock.svn-base b/frameworks/OCMock.framework/Versions/A/.svn/prop-base/OCMock.svn-base new file mode 100644 index 0000000..dbc918b --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/.svn/prop-base/OCMock.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/frameworks/OCMock.framework/Versions/A/.svn/text-base/OCMock.svn-base b/frameworks/OCMock.framework/Versions/A/.svn/text-base/OCMock.svn-base new file mode 100644 index 0000000..10ba928 Binary files /dev/null and b/frameworks/OCMock.framework/Versions/A/.svn/text-base/OCMock.svn-base differ diff --git a/frameworks/OCMock.framework/Versions/A/Headers/.svn/all-wcprops b/frameworks/OCMock.framework/Versions/A/Headers/.svn/all-wcprops new file mode 100644 index 0000000..c2e3419 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Headers/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25 +svn:wc:ra_dav:version-url +V 70 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/Headers +END +OCMock.h +K 25 +svn:wc:ra_dav:version-url +V 79 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/Headers/OCMock.h +END +OCMockRecorder.h +K 25 +svn:wc:ra_dav:version-url +V 87 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/Headers/OCMockRecorder.h +END +OCMockObject.h +K 25 +svn:wc:ra_dav:version-url +V 85 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/Headers/OCMockObject.h +END +OCMConstraint.h +K 25 +svn:wc:ra_dav:version-url +V 86 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/Headers/OCMConstraint.h +END diff --git a/frameworks/OCMock.framework/Versions/A/Headers/.svn/entries b/frameworks/OCMock.framework/Versions/A/Headers/.svn/entries new file mode 100644 index 0000000..efb07b0 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Headers/.svn/entries @@ -0,0 +1,164 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/frameworks/OCMock.framework/Versions/A/Headers +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +OCMock.h +file + + + + +2008-12-15T21:27:02.000000Z +558e04dfa5041cfbdb2977ccba06cb5c +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +408 + +OCMockRecorder.h +file + + + + +2008-12-15T21:27:02.000000Z +760697636267668accf0effdbb5f4bb9 +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1061 + +OCMockObject.h +file + + + + +2008-12-15T21:27:02.000000Z +bff6241b999132630cff6c4e4cd1456e +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +721 + +OCMConstraint.h +file + + + + +2008-12-15T21:27:02.000000Z +5bbf007d5921fb89d4fd7fcf5405de54 +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +842 + diff --git a/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMConstraint.h.svn-base b/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMConstraint.h.svn-base new file mode 100644 index 0000000..e5ec2b1 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMConstraint.h.svn-base @@ -0,0 +1,28 @@ +//--------------------------------------------------------------------------------------- +// $Id: $ +// Copyright (c) 2007-2008 by Mulle Kybernetik. See License file for details. +//--------------------------------------------------------------------------------------- + +#import + + +@interface OCMConstraint : NSObject +{ +} + ++ (id)constraint; + ++ (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; ++ (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue; + ++ (id)any; ++ (id)isNil; ++ (id)isNotNil; ++ (id)isNotEqual:(id)value; + +- (BOOL)evaluate:(id)value; + +@end + +#define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self] +#define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)] diff --git a/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMock.h.svn-base b/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMock.h.svn-base new file mode 100644 index 0000000..6e9ec41 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMock.h.svn-base @@ -0,0 +1,8 @@ +//--------------------------------------------------------------------------------------- +// $Id: OCMock.h 21 2008-01-24 18:59:39Z erik $ +// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. +//--------------------------------------------------------------------------------------- + +#import +#import +#import diff --git a/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMockObject.h.svn-base b/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMockObject.h.svn-base new file mode 100644 index 0000000..1d97dc2 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMockObject.h.svn-base @@ -0,0 +1,29 @@ +//--------------------------------------------------------------------------------------- +// $Id: OCMockObject.h 21 2008-01-24 18:59:39Z erik $ +// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. +//--------------------------------------------------------------------------------------- + +#import + +@interface OCMockObject : NSProxy +{ + BOOL isNice; + NSMutableArray *recorders; + NSMutableSet *expectations; + NSMutableArray *exceptions; +} + ++ (id)mockForClass:(Class)aClass; ++ (id)mockForProtocol:(Protocol *)aProtocol; + ++ (id)niceMockForClass:(Class)aClass; ++ (id)niceMockForProtocol:(Protocol *)aProtocol; + +- (id)init; + +- (id)stub; +- (id)expect; + +- (void)verify; + +@end diff --git a/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMockRecorder.h.svn-base b/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMockRecorder.h.svn-base new file mode 100644 index 0000000..5142729 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Headers/.svn/text-base/OCMockRecorder.h.svn-base @@ -0,0 +1,33 @@ +//--------------------------------------------------------------------------------------- +// $Id: OCMockRecorder.h 28 2008-06-19 22:37:17Z erik $ +// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. +//--------------------------------------------------------------------------------------- + +#import + +@class OCMConstraint; // reference for backwards compatibility OCMOCK_ANY macro + + +@interface OCMockRecorder : NSProxy +{ + id signatureResolver; + id returnValue; + BOOL returnValueIsBoxed; + BOOL returnValueShouldBeThrown; + NSInvocation *recordedInvocation; +} + +- (id)initWithSignatureResolver:(id)anObject; + +- (id)andReturn:(id)anObject; +- (id)andReturnValue:(NSValue *)aValue; +- (id)andThrow:(NSException *)anException; + +- (BOOL)matchesInvocation:(NSInvocation *)anInvocation; +- (void)setUpReturnValue:(NSInvocation *)anInvocation; +- (void)releaseInvocation; + +@end + +#define OCMOCK_ANY [OCMConstraint any] +#define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(typeof(variable))] diff --git a/frameworks/OCMock.framework/Versions/A/Headers/OCMConstraint.h b/frameworks/OCMock.framework/Versions/A/Headers/OCMConstraint.h new file mode 100644 index 0000000..e5ec2b1 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Headers/OCMConstraint.h @@ -0,0 +1,28 @@ +//--------------------------------------------------------------------------------------- +// $Id: $ +// Copyright (c) 2007-2008 by Mulle Kybernetik. See License file for details. +//--------------------------------------------------------------------------------------- + +#import + + +@interface OCMConstraint : NSObject +{ +} + ++ (id)constraint; + ++ (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject; ++ (id)constraintWithSelector:(SEL)aSelector onObject:(id)anObject withValue:(id)aValue; + ++ (id)any; ++ (id)isNil; ++ (id)isNotNil; ++ (id)isNotEqual:(id)value; + +- (BOOL)evaluate:(id)value; + +@end + +#define CONSTRAINT(aSelector) [OCMConstraint constraintWithSelector:aSelector onObject:self] +#define CONSTRAINTV(aSelector, aValue) [OCMConstraint constraintWithSelector:aSelector onObject:self withValue:(aValue)] diff --git a/frameworks/OCMock.framework/Versions/A/Headers/OCMock.h b/frameworks/OCMock.framework/Versions/A/Headers/OCMock.h new file mode 100644 index 0000000..6e9ec41 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Headers/OCMock.h @@ -0,0 +1,8 @@ +//--------------------------------------------------------------------------------------- +// $Id: OCMock.h 21 2008-01-24 18:59:39Z erik $ +// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. +//--------------------------------------------------------------------------------------- + +#import +#import +#import diff --git a/frameworks/OCMock.framework/Versions/A/Headers/OCMockObject.h b/frameworks/OCMock.framework/Versions/A/Headers/OCMockObject.h new file mode 100644 index 0000000..1d97dc2 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Headers/OCMockObject.h @@ -0,0 +1,29 @@ +//--------------------------------------------------------------------------------------- +// $Id: OCMockObject.h 21 2008-01-24 18:59:39Z erik $ +// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. +//--------------------------------------------------------------------------------------- + +#import + +@interface OCMockObject : NSProxy +{ + BOOL isNice; + NSMutableArray *recorders; + NSMutableSet *expectations; + NSMutableArray *exceptions; +} + ++ (id)mockForClass:(Class)aClass; ++ (id)mockForProtocol:(Protocol *)aProtocol; + ++ (id)niceMockForClass:(Class)aClass; ++ (id)niceMockForProtocol:(Protocol *)aProtocol; + +- (id)init; + +- (id)stub; +- (id)expect; + +- (void)verify; + +@end diff --git a/frameworks/OCMock.framework/Versions/A/Headers/OCMockRecorder.h b/frameworks/OCMock.framework/Versions/A/Headers/OCMockRecorder.h new file mode 100644 index 0000000..5142729 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Headers/OCMockRecorder.h @@ -0,0 +1,33 @@ +//--------------------------------------------------------------------------------------- +// $Id: OCMockRecorder.h 28 2008-06-19 22:37:17Z erik $ +// Copyright (c) 2004-2008 by Mulle Kybernetik. See License file for details. +//--------------------------------------------------------------------------------------- + +#import + +@class OCMConstraint; // reference for backwards compatibility OCMOCK_ANY macro + + +@interface OCMockRecorder : NSProxy +{ + id signatureResolver; + id returnValue; + BOOL returnValueIsBoxed; + BOOL returnValueShouldBeThrown; + NSInvocation *recordedInvocation; +} + +- (id)initWithSignatureResolver:(id)anObject; + +- (id)andReturn:(id)anObject; +- (id)andReturnValue:(NSValue *)aValue; +- (id)andThrow:(NSException *)anException; + +- (BOOL)matchesInvocation:(NSInvocation *)anInvocation; +- (void)setUpReturnValue:(NSInvocation *)anInvocation; +- (void)releaseInvocation; + +@end + +#define OCMOCK_ANY [OCMConstraint any] +#define OCMOCK_VALUE(variable) [NSValue value:&variable withObjCType:@encode(typeof(variable))] diff --git a/frameworks/OCMock.framework/Versions/A/OCMock b/frameworks/OCMock.framework/Versions/A/OCMock new file mode 100755 index 0000000..10ba928 Binary files /dev/null and b/frameworks/OCMock.framework/Versions/A/OCMock differ diff --git a/frameworks/OCMock.framework/Versions/A/Resources/.svn/all-wcprops b/frameworks/OCMock.framework/Versions/A/Resources/.svn/all-wcprops new file mode 100644 index 0000000..3944d51 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Resources/.svn/all-wcprops @@ -0,0 +1,17 @@ +K 25 +svn:wc:ra_dav:version-url +V 72 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/Resources +END +License.txt +K 25 +svn:wc:ra_dav:version-url +V 84 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/Resources/License.txt +END +Info.plist +K 25 +svn:wc:ra_dav:version-url +V 83 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/Resources/Info.plist +END diff --git a/frameworks/OCMock.framework/Versions/A/Resources/.svn/entries b/frameworks/OCMock.framework/Versions/A/Resources/.svn/entries new file mode 100644 index 0000000..a762e55 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Resources/.svn/entries @@ -0,0 +1,99 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/frameworks/OCMock.framework/Versions/A/Resources +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +License.txt +file + + + + +2008-12-15T21:27:02.000000Z +97f46e0407438a578d0a4e0cc8cdab8c +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +929 + +Info.plist +file + + + + +2008-12-15T21:27:02.000000Z +f2dc4947c2c6c52bdef8ee53d51a670d +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +607 + +English.lproj +dir + diff --git a/frameworks/OCMock.framework/Versions/A/Resources/.svn/text-base/Info.plist.svn-base b/frameworks/OCMock.framework/Versions/A/Resources/.svn/text-base/Info.plist.svn-base new file mode 100644 index 0000000..7a68a46 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Resources/.svn/text-base/Info.plist.svn-base @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + OCMock + CFBundleIdentifier + com.mulle-kybernetik.OCMock + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/frameworks/OCMock.framework/Versions/A/Resources/.svn/text-base/License.txt.svn-base b/frameworks/OCMock.framework/Versions/A/Resources/.svn/text-base/License.txt.svn-base new file mode 100644 index 0000000..96f7069 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Resources/.svn/text-base/License.txt.svn-base @@ -0,0 +1,15 @@ + + Copyright (c) 2004-2008 by Mulle Kybernetik. All rights reserved. + + Permission to use, copy, modify and distribute this software and its documentation + is hereby granted, provided that both the copyright notice and this permission + notice appear in all copies of the software, derivative works or modified versions, + and any portions thereof, and that both notices appear in supporting documentation, + and that credit is given to Mulle Kybernetik in all documents and publicity + pertaining to direct or indirect use of this code or its derivatives. + + THIS IS EXPERIMENTAL SOFTWARE AND IT IS KNOWN TO HAVE BUGS, SOME OF WHICH MAY HAVE + SERIOUS CONSEQUENCES. THE COPYRIGHT HOLDER ALLOWS FREE USE OF THIS SOFTWARE IN ITS + "AS IS" CONDITION. THE COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY + DAMAGES WHATSOEVER RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE + OR OF ANY DERIVATIVE WORK. \ No newline at end of file diff --git a/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/all-wcprops b/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/all-wcprops new file mode 100644 index 0000000..18d1995 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/all-wcprops @@ -0,0 +1,11 @@ +K 25 +svn:wc:ra_dav:version-url +V 86 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/Resources/English.lproj +END +InfoPlist.strings +K 25 +svn:wc:ra_dav:version-url +V 104 +/svn/!svn/ver/351/trunk/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/InfoPlist.strings +END diff --git a/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/entries b/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/entries new file mode 100644 index 0000000..529186b --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/entries @@ -0,0 +1,62 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/frameworks/OCMock.framework/Versions/A/Resources/English.lproj +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +InfoPlist.strings +file + + + + +2008-12-15T21:27:01.000000Z +29f16bb8859c933409fdf8046edfcc74 +2008-12-15T01:37:32.818725Z +351 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +534 + diff --git a/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/prop-base/InfoPlist.strings.svn-base b/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/prop-base/InfoPlist.strings.svn-base new file mode 100644 index 0000000..5e9587e --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/prop-base/InfoPlist.strings.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mime-type +V 24 +application/octet-stream +END diff --git a/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/text-base/InfoPlist.strings.svn-base b/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/text-base/InfoPlist.strings.svn-base new file mode 100644 index 0000000..a98e11d Binary files /dev/null and b/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/.svn/text-base/InfoPlist.strings.svn-base differ diff --git a/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/InfoPlist.strings b/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..a98e11d Binary files /dev/null and b/frameworks/OCMock.framework/Versions/A/Resources/English.lproj/InfoPlist.strings differ diff --git a/frameworks/OCMock.framework/Versions/A/Resources/Info.plist b/frameworks/OCMock.framework/Versions/A/Resources/Info.plist new file mode 100644 index 0000000..7a68a46 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Resources/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + OCMock + CFBundleIdentifier + com.mulle-kybernetik.OCMock + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/frameworks/OCMock.framework/Versions/A/Resources/License.txt b/frameworks/OCMock.framework/Versions/A/Resources/License.txt new file mode 100644 index 0000000..96f7069 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/A/Resources/License.txt @@ -0,0 +1,15 @@ + + Copyright (c) 2004-2008 by Mulle Kybernetik. All rights reserved. + + Permission to use, copy, modify and distribute this software and its documentation + is hereby granted, provided that both the copyright notice and this permission + notice appear in all copies of the software, derivative works or modified versions, + and any portions thereof, and that both notices appear in supporting documentation, + and that credit is given to Mulle Kybernetik in all documents and publicity + pertaining to direct or indirect use of this code or its derivatives. + + THIS IS EXPERIMENTAL SOFTWARE AND IT IS KNOWN TO HAVE BUGS, SOME OF WHICH MAY HAVE + SERIOUS CONSEQUENCES. THE COPYRIGHT HOLDER ALLOWS FREE USE OF THIS SOFTWARE IN ITS + "AS IS" CONDITION. THE COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY + DAMAGES WHATSOEVER RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE + OR OF ANY DERIVATIVE WORK. \ No newline at end of file diff --git a/frameworks/OCMock.framework/Versions/Current b/frameworks/OCMock.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/frameworks/OCMock.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/include/.svn/all-wcprops b/include/.svn/all-wcprops new file mode 100644 index 0000000..92aa727 --- /dev/null +++ b/include/.svn/all-wcprops @@ -0,0 +1,5 @@ +K 25 +svn:wc:ra_dav:version-url +V 32 +/svn/!svn/ver/1403/trunk/include +END diff --git a/include/.svn/entries b/include/.svn/entries new file mode 100644 index 0000000..311d8ba --- /dev/null +++ b/include/.svn/entries @@ -0,0 +1,38 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/include +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-09-26T19:12:29.746961Z +1403 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + + + + + + +0 + +ParseKit +dir + diff --git a/include/ParseKit/.svn/all-wcprops b/include/ParseKit/.svn/all-wcprops new file mode 100644 index 0000000..cf3e62f --- /dev/null +++ b/include/ParseKit/.svn/all-wcprops @@ -0,0 +1,311 @@ +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1403/trunk/include/ParseKit +END +PKEmpty.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1171/trunk/include/ParseKit/PKEmpty.h +END +PKLetter.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1171/trunk/include/ParseKit/PKLetter.h +END +PKDigit.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKDigit.h +END +PKTokenArraySource.h +K 25 +svn:wc:ra_dav:version-url +V 62 +/svn/!svn/ver/1171/trunk/include/ParseKit/PKTokenArraySource.h +END +PKReader.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1171/trunk/include/ParseKit/PKReader.h +END +PKSymbol.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKSymbol.h +END +PKIntersection.h +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1238/trunk/include/ParseKit/PKIntersection.h +END +PKCaseInsensitiveLiteral.h +K 25 +svn:wc:ra_dav:version-url +V 68 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKCaseInsensitiveLiteral.h +END +PKTokenizer.h +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1401/trunk/include/ParseKit/PKTokenizer.h +END +PKSymbolNode.h +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKSymbolNode.h +END +PKTokenizerState.h +K 25 +svn:wc:ra_dav:version-url +V 60 +/svn/!svn/ver/1401/trunk/include/ParseKit/PKTokenizerState.h +END +PKWordState.h +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKWordState.h +END +PKPattern.h +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1179/trunk/include/ParseKit/PKPattern.h +END +PKSymbolRootNode.h +K 25 +svn:wc:ra_dav:version-url +V 60 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKSymbolRootNode.h +END +PKAssembly.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1403/trunk/include/ParseKit/PKAssembly.h +END +PKToken.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1177/trunk/include/ParseKit/PKToken.h +END +PKAlternation.h +K 25 +svn:wc:ra_dav:version-url +V 57 +/svn/!svn/ver/1238/trunk/include/ParseKit/PKAlternation.h +END +PKUppercaseWord.h +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKUppercaseWord.h +END +PKTrackException.h +K 25 +svn:wc:ra_dav:version-url +V 60 +/svn/!svn/ver/1171/trunk/include/ParseKit/PKTrackException.h +END +PKSpecificChar.h +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1171/trunk/include/ParseKit/PKSpecificChar.h +END +PKNumber.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1177/trunk/include/ParseKit/PKNumber.h +END +PKDelimitState.h +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1167/trunk/include/ParseKit/PKDelimitState.h +END +PKQuotedString.h +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKQuotedString.h +END +PKNumberState.h +K 25 +svn:wc:ra_dav:version-url +V 57 +/svn/!svn/ver/1259/trunk/include/ParseKit/PKNumberState.h +END +PKQuoteState.h +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKQuoteState.h +END +PKComment.h +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKComment.h +END +PKCommentState.h +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKCommentState.h +END +PKNegation.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1238/trunk/include/ParseKit/PKNegation.h +END +PKTypes.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1167/trunk/include/ParseKit/PKTypes.h +END +PKTrack.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1225/trunk/include/ParseKit/PKTrack.h +END +PKSymbolState.h +K 25 +svn:wc:ra_dav:version-url +V 57 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKSymbolState.h +END +PKSequence.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1225/trunk/include/ParseKit/PKSequence.h +END +PKCollectionParser.h +K 25 +svn:wc:ra_dav:version-url +V 62 +/svn/!svn/ver/1225/trunk/include/ParseKit/PKCollectionParser.h +END +PKTerminal.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1171/trunk/include/ParseKit/PKTerminal.h +END +PKWord.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKWord.h +END +PKChar.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKChar.h +END +PKSingleLineCommentState.h +K 25 +svn:wc:ra_dav:version-url +V 68 +/svn/!svn/ver/1171/trunk/include/ParseKit/PKSingleLineCommentState.h +END +PKLowercaseWord.h +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKLowercaseWord.h +END +PKTokenAssembly.h +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1171/trunk/include/ParseKit/PKTokenAssembly.h +END +PKRepetition.h +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1268/trunk/include/ParseKit/PKRepetition.h +END +PKParserFactory.h +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1268/trunk/include/ParseKit/PKParserFactory.h +END +PKMultiLineCommentState.h +K 25 +svn:wc:ra_dav:version-url +V 67 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKMultiLineCommentState.h +END +PKAny.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKAny.h +END +PKDelimitedString.h +K 25 +svn:wc:ra_dav:version-url +V 61 +/svn/!svn/ver/1167/trunk/include/ParseKit/PKDelimitedString.h +END +ParseKit.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1331/trunk/include/ParseKit/ParseKit.h +END +PKDifference.h +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1238/trunk/include/ParseKit/PKDifference.h +END +PKParser.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1400/trunk/include/ParseKit/PKParser.h +END +PKLiteral.h +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKLiteral.h +END +PKCharacterAssembly.h +K 25 +svn:wc:ra_dav:version-url +V 63 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKCharacterAssembly.h +END +PKWhitespace.h +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1167/trunk/include/ParseKit/PKWhitespace.h +END +PKWhitespaceState.h +K 25 +svn:wc:ra_dav:version-url +V 61 +/svn/!svn/ver/1170/trunk/include/ParseKit/PKWhitespaceState.h +END diff --git a/include/ParseKit/.svn/entries b/include/ParseKit/.svn/entries new file mode 100644 index 0000000..6f439ce --- /dev/null +++ b/include/ParseKit/.svn/entries @@ -0,0 +1,1769 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/include/ParseKit +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-09-26T19:12:29.746961Z +1403 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + + + + + + +0 + +PKEmpty.h +file + + + + +2009-07-03T19:31:17.000000Z +dfa07f81beb7dd730872063386c5cb40 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +863 + +PKLetter.h +file + + + + +2009-07-03T19:31:17.000000Z +3d56e3668a7ebb4e9bf40eddf1d80142 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +629 + +PKDigit.h +file + + + + +2009-07-03T19:31:15.000000Z +f900c4391df6393c4c90340f3a137771 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +613 + +PKTokenArraySource.h +file + + + + +2009-07-03T19:31:17.000000Z +f77ad1a196ccaa1989f26cfc5d18f868 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1795 + +PKReader.h +file + + + + +2009-07-03T19:48:43.000000Z +69b6fac4dde3a1415de3bf78de9e71ce +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1436 + +PKSymbol.h +file + + + + +2009-07-03T19:31:14.000000Z +733c68b7b025828c6f565f13a807dfd2 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1064 + +PKIntersection.h +file + + + + +2009-07-19T19:15:26.000000Z +c67dc76f9cc5d837d2ac5cf16a671b1e +2009-07-19T19:15:40.768901Z +1238 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1254 + +PKCaseInsensitiveLiteral.h +file + + + + +2009-07-03T19:31:15.000000Z +9ff99901dd7cade0d5b2bcd2eee6404a +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +450 + +PKTokenizer.h +file + + + + +2009-09-26T04:03:30.000000Z +7f0ae17e58b442ae5ad6c1c037cbd958 +2009-09-26T04:04:19.519010Z +1401 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +5451 + +PKSymbolNode.h +file + + + + +2009-07-03T19:42:56.000000Z +31e49911253772af1d2c515492407e70 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2773 + +PKTokenizerState.h +file + + + + +2009-09-26T04:04:07.000000Z +073db2ce68b9bca6dcf3e8a7fafaac90 +2009-09-26T04:04:19.519010Z +1401 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2217 + +PKWordState.h +file + + + + +2009-07-03T19:31:13.000000Z +83a32c3f77b2dcb5e76ed801fcd4214e +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1966 + +PKPattern.h +file + + + + +2009-07-03T22:30:14.000000Z +c0741cc0d7550615d8d9c1f4a143be38 +2009-07-03T22:34:56.929029Z +1179 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +857 + +PKSymbolRootNode.h +file + + + + +2009-07-03T19:31:14.000000Z +c4d2b3b347f7c8a3f1c22cd0e05ae529 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1397 + +PKAssembly.h +file + + + + +2009-09-26T05:49:28.000000Z +2648905aaf62272f91e1746c9bcd0b02 +2009-09-26T19:12:29.746961Z +1403 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +3283 + +PKAlternation.h +file + + + + +2009-07-19T19:15:06.000000Z +ae421cb08ab1b61d83e2e6eadc2fefdc +2009-07-19T19:15:40.768901Z +1238 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +770 + +PKToken.h +file + + + + +2009-07-03T22:16:26.000000Z +f9ebb39c9f4089c0b2ff9036f078923b +2009-07-03T22:22:49.496142Z +1177 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +5775 + +PKSpecificChar.h +file + + + + +2009-07-03T19:31:16.000000Z +e9ad98a58dd1c42b86a19a043fcb18d5 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1096 + +PKTrackException.h +file + + + + +2009-07-03T19:31:18.000000Z +16166635b1bfab48ec5a979735072f01 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +874 + +PKUppercaseWord.h +file + + + + +2009-07-03T19:31:12.000000Z +06339383c80eced073430fd8afdd1006 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +257 + +PKNumber.h +file + + + + +2009-07-03T22:05:22.000000Z +56f9eced2537dbeaf3de246bd1f6877d +2009-07-03T22:22:49.496142Z +1177 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +551 + +PKQuotedString.h +file + + + + +2009-07-03T19:31:14.000000Z +ae2c032dd20afb5d3839b914eadfe7f2 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +618 + +PKDelimitState.h +file + + + + +2009-07-03T19:42:56.000000Z +60790892814c160ebc75bb5f2d51db4a +2009-07-03T19:25:24.801046Z +1167 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2238 + +PKNumberState.h +file + + + + +2009-07-20T00:28:10.000000Z +358308ef6c9ac424088be5ed53ceca93 +2009-07-20T00:28:22.181007Z +1259 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2141 + +PKQuoteState.h +file + + + + +2009-07-03T19:42:56.000000Z +f32e3441610857d0d8bced2d9a03b007 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1000 + +PKComment.h +file + + + + +2009-07-03T19:31:15.000000Z +686c12831bd2299679bc4395b7a04527 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +560 + +PKCommentState.h +file + + + + +2009-07-03T19:42:56.000000Z +6eb57f2fb9243dcadf0e23803dd69588 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3510 + +PKTrack.h +file + + + + +2009-07-14T02:47:26.000000Z +d110bc0de561d3dd7eede6ab0e880b77 +2009-07-14T03:32:39.769371Z +1225 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +771 + +PKNegation.h +file + + + + +2009-07-19T19:10:18.000000Z +7ca3f7013bf46b4aaa22df7576557c04 +2009-07-19T19:15:40.768901Z +1238 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1450 + +PKTypes.h +file + + + + +2009-07-03T18:54:13.000000Z +4c577c71d8e7407c30cdf58e3b9a0a95 +2009-07-03T19:25:24.801046Z +1167 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +274 + +PKSymbolState.h +file + + + + +2009-07-03T19:31:13.000000Z +c92157ca740d4029dd48f105bf6f1b86 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2100 + +PKCollectionParser.h +file + + + + +2009-07-14T03:21:55.000000Z +1a504479cac452da1f9415e94b26f654 +2009-07-14T03:32:39.769371Z +1225 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1064 + +PKSequence.h +file + + + + +2009-07-14T02:43:44.000000Z +6e194945f5c59253362a582493df7cae +2009-07-14T03:32:39.769371Z +1225 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +720 + +PKTerminal.h +file + + + + +2009-07-03T19:42:56.000000Z +e4a26c8dc04dc0b68deabe51b7b63e5f +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1281 + +PKWord.h +file + + + + +2009-07-03T19:31:12.000000Z +c3ec07e1221bfd2aea835f8803d2b34a +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +536 + +PKChar.h +file + + + + +2009-07-03T19:31:15.000000Z +e933cba48a9dff152ea2fb91b82a6b27 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +662 + +PKSingleLineCommentState.h +file + + + + +2009-07-03T19:31:16.000000Z +4245b800e78749e9a0e258fc336620e4 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +363 + +PKTokenAssembly.h +file + + + + +2009-07-03T19:42:56.000000Z +77cea4bf4e3e2391ad912e3c935e4399 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1957 + +PKLowercaseWord.h +file + + + + +2009-07-03T19:31:12.000000Z +30a4f1e95046d48b3a3d4cb3f805355f +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +257 + +PKRepetition.h +file + + + + +2009-08-06T04:02:00.000000Z +61cf193c874b978ddf4ef805a8a487f2 +2009-08-02T20:08:09.420177Z +1268 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1371 + +PKParserFactory.h +file + + + + +2009-08-06T04:02:00.000000Z +3b344223fa9f4caef35f2940aab81cba +2009-08-02T20:08:09.420177Z +1268 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1360 + +PKMultiLineCommentState.h +file + + + + +2009-07-03T19:31:14.000000Z +310e2b37531739322c09a5577b9016a3 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +393 + +ParseKit.h +file + + + + +2009-08-17T00:38:12.000000Z +053924396601a25a082c0535a9251875 +2009-08-17T01:06:48.172726Z +1331 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +3194 + +PKDelimitedString.h +file + + + + +2009-07-03T18:53:37.000000Z +e00259d9e64efb9409d1573a90f89c1b +2009-07-03T19:25:24.801046Z +1167 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +815 + +PKAny.h +file + + + + +2009-07-03T19:31:15.000000Z +f25bdd980e9ed437bdb92b8165ff27b6 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +533 + +PKDifference.h +file + + + + +2009-07-19T19:07:31.000000Z +b6e03a03c25ffacd02d7a6b386f81b29 +2009-07-19T19:15:40.768901Z +1238 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2032 + +PKLiteral.h +file + + + + +2009-07-03T19:31:14.000000Z +2a825195d2b3163362abc1074984314d +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +722 + +PKCharacterAssembly.h +file + + + + +2009-07-03T19:31:15.000000Z +dbce70762bb36d2c3ef9c8319aea19b3 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +386 + +PKParser.h +file + + + + +2009-09-26T03:40:29.000000Z +235507561b01acef816875a11c17c15f +2009-09-26T03:50:36.795525Z +1400 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +8753 + +PKWhitespace.h +file + + + + +2009-07-03T18:54:15.000000Z +069cd2ac8c34945ba9f37b5351ee4ad2 +2009-07-03T19:25:24.801046Z +1167 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +579 + +PKWhitespaceState.h +file + + + + +2009-07-03T19:42:56.000000Z +176a2e92ea53ec53558e3e3d041cdafe +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1552 + diff --git a/include/ParseKit/.svn/prop-base/PKAlternation.h.svn-base b/include/ParseKit/.svn/prop-base/PKAlternation.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKAlternation.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKAssembly.h.svn-base b/include/ParseKit/.svn/prop-base/PKAssembly.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKAssembly.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKCaseInsensitiveLiteral.h.svn-base b/include/ParseKit/.svn/prop-base/PKCaseInsensitiveLiteral.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKCaseInsensitiveLiteral.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKChar.h.svn-base b/include/ParseKit/.svn/prop-base/PKChar.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKChar.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKCharacterAssembly.h.svn-base b/include/ParseKit/.svn/prop-base/PKCharacterAssembly.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKCharacterAssembly.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKCollectionParser.h.svn-base b/include/ParseKit/.svn/prop-base/PKCollectionParser.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKCollectionParser.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKDigit.h.svn-base b/include/ParseKit/.svn/prop-base/PKDigit.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKDigit.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKEmpty.h.svn-base b/include/ParseKit/.svn/prop-base/PKEmpty.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKEmpty.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKLetter.h.svn-base b/include/ParseKit/.svn/prop-base/PKLetter.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKLetter.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKLiteral.h.svn-base b/include/ParseKit/.svn/prop-base/PKLiteral.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKLiteral.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKLowercaseWord.h.svn-base b/include/ParseKit/.svn/prop-base/PKLowercaseWord.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKLowercaseWord.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKNumberState.h.svn-base b/include/ParseKit/.svn/prop-base/PKNumberState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKNumberState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKParser.h.svn-base b/include/ParseKit/.svn/prop-base/PKParser.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKParser.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKParserFactory.h.svn-base b/include/ParseKit/.svn/prop-base/PKParserFactory.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKParserFactory.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKQuoteState.h.svn-base b/include/ParseKit/.svn/prop-base/PKQuoteState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKQuoteState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKQuotedString.h.svn-base b/include/ParseKit/.svn/prop-base/PKQuotedString.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKQuotedString.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKReader.h.svn-base b/include/ParseKit/.svn/prop-base/PKReader.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKReader.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKRepetition.h.svn-base b/include/ParseKit/.svn/prop-base/PKRepetition.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKRepetition.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKSequence.h.svn-base b/include/ParseKit/.svn/prop-base/PKSequence.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKSequence.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKSpecificChar.h.svn-base b/include/ParseKit/.svn/prop-base/PKSpecificChar.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKSpecificChar.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKSymbol.h.svn-base b/include/ParseKit/.svn/prop-base/PKSymbol.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKSymbol.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKSymbolNode.h.svn-base b/include/ParseKit/.svn/prop-base/PKSymbolNode.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKSymbolNode.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKSymbolRootNode.h.svn-base b/include/ParseKit/.svn/prop-base/PKSymbolRootNode.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKSymbolRootNode.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKSymbolState.h.svn-base b/include/ParseKit/.svn/prop-base/PKSymbolState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKSymbolState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKTerminal.h.svn-base b/include/ParseKit/.svn/prop-base/PKTerminal.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKTerminal.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKToken.h.svn-base b/include/ParseKit/.svn/prop-base/PKToken.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKToken.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKTokenArraySource.h.svn-base b/include/ParseKit/.svn/prop-base/PKTokenArraySource.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKTokenArraySource.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKTokenAssembly.h.svn-base b/include/ParseKit/.svn/prop-base/PKTokenAssembly.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKTokenAssembly.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKTokenizer.h.svn-base b/include/ParseKit/.svn/prop-base/PKTokenizer.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKTokenizer.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKTokenizerState.h.svn-base b/include/ParseKit/.svn/prop-base/PKTokenizerState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKTokenizerState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKTrack.h.svn-base b/include/ParseKit/.svn/prop-base/PKTrack.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKTrack.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKUppercaseWord.h.svn-base b/include/ParseKit/.svn/prop-base/PKUppercaseWord.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKUppercaseWord.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKWhitespaceState.h.svn-base b/include/ParseKit/.svn/prop-base/PKWhitespaceState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKWhitespaceState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKWord.h.svn-base b/include/ParseKit/.svn/prop-base/PKWord.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKWord.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/PKWordState.h.svn-base b/include/ParseKit/.svn/prop-base/PKWordState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/PKWordState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/prop-base/ParseKit.h.svn-base b/include/ParseKit/.svn/prop-base/ParseKit.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/include/ParseKit/.svn/prop-base/ParseKit.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/include/ParseKit/.svn/text-base/PKAlternation.h.svn-base b/include/ParseKit/.svn/text-base/PKAlternation.h.svn-base new file mode 100644 index 0000000..464fd59 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKAlternation.h.svn-base @@ -0,0 +1,27 @@ +// +// PKAlternation.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKAlternation + @brief A PKAlternation object is a collection of parsers, any one of which can successfully match against an assembly. It is basically a representation of "Logical Or" or "|". +*/ +@interface PKAlternation : PKCollectionParser { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKAlternation parser. + @result an initialized autoreleased PKAlternation parser. +*/ ++ (id)alternation; + ++ (id)alternationWithSubparsers:(PKParser *)p1, ...; +@end diff --git a/include/ParseKit/.svn/text-base/PKAny.h.svn-base b/include/ParseKit/.svn/text-base/PKAny.h.svn-base new file mode 100644 index 0000000..64e6cab --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKAny.h.svn-base @@ -0,0 +1,25 @@ +// +// PKAny.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKAny + @brief A PKAny matches any token from a token assembly. +*/ +@interface PKAny : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKAny object. + @result an initialized autoreleased PKAny object +*/ ++ (id)any; +@end diff --git a/include/ParseKit/.svn/text-base/PKAssembly.h.svn-base b/include/ParseKit/.svn/text-base/PKAssembly.h.svn-base new file mode 100644 index 0000000..8722577 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKAssembly.h.svn-base @@ -0,0 +1,80 @@ +// +// PKAssembly.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +/*! + @class PKAssembly + @brief An Abstract class. A PKAssembly maintains a stream of language elements along with stack and target objects. + @details

Parsers use assemblers to record progress at recognizing language elements from assembly's string.

+

Note that PKAssembly is an abstract class and may not be instantiated directly. Subclasses include PKTokenAssembly and PKCharAssembly.

+*/ +@interface PKAssembly : NSObject { + NSMutableArray *stack; + id target; + NSUInteger index; + NSString *string; + NSString *defaultDelimiter; +} + +/*! + @brief Convenience factory method for initializing an autoreleased assembly. + @param s string to be worked on + @result an initialized autoreleased assembly +*/ ++ (id)assemblyWithString:(NSString *)s; + +/*! + @brief Designated Initializer. Initializes an assembly with a given string. + @details Designated Initializer. + @param s string to be worked on + @result an initialized assembly +*/ +- (id)initWithString:(NSString *)s; + +/*! + @brief Removes the object at the top of this assembly's stack and returns it. + @details Note this returns an object from this assembly's stack, not from its stream of elements (tokens or chars depending on the type of concrete PKAssembly subclass of this object). + @result the object at the top of this assembly's stack +*/ +- (id)pop; + +/*! + @brief Pushes an object onto the top of this assembly's stack. + @param object object to push +*/ +- (void)push:(id)object; + +/*! + @brief Returns true if this assembly's stack is empty. + @result true, if this assembly's stack is empty +*/ +- (BOOL)isStackEmpty; + +/*! + @brief Returns a vector of the elements on this assembly's stack that appear before a specified fence. + @details

Returns a vector of the elements on this assembly's stack that appear before a specified fence.

+

Sometimes a parser will recognize a list from within a pair of parentheses or brackets. The parser can mark the beginning of the list with a fence, and then retrieve all the items that come after the fence with this method.

+ @param fence object that indicates the limit of elements returned from this assembly's stack + @result Array of the elements above the specified fence +*/ +- (NSArray *)objectsAbove:(id)fence; + +/*! + @property stack + @brief This assembly's stack. +*/ +@property (nonatomic, readonly, retain) NSMutableArray *stack; + +/*! + @property target + @brief This assembly's target. + @details The object identified as this assembly's "target". Clients can set and retrieve a target, which can be a convenient supplement as a place to work, in addition to the assembly's stack. For example, a parser for an HTML file might use a web page object as its "target". As the parser recognizes markup commands like <head>, it could apply its findings to the target. +*/ +@property (nonatomic, retain) id target; +@end diff --git a/include/ParseKit/.svn/text-base/PKCaseInsensitiveLiteral.h.svn-base b/include/ParseKit/.svn/text-base/PKCaseInsensitiveLiteral.h.svn-base new file mode 100644 index 0000000..1700c2d --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKCaseInsensitiveLiteral.h.svn-base @@ -0,0 +1,20 @@ +// +// PKCaseInsensitiveLiteral.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKCaseInsensitiveLiteral + @brief A PKCaselessLiteral matches a specified NSString from an assembly, disregarding case. +*/ +@interface PKCaseInsensitiveLiteral : PKLiteral { + +} + +@end diff --git a/include/ParseKit/.svn/text-base/PKChar.h.svn-base b/include/ParseKit/.svn/text-base/PKChar.h.svn-base new file mode 100644 index 0000000..e6e3035 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKChar.h.svn-base @@ -0,0 +1,25 @@ +// +// PKChar.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +/*! + @class PKChar + @brief A PKChar matches a character from a character assembly. + @details -[PKChar qualifies:] returns true every time, since this class assumes it is working against a PKCharacterAssembly. +*/ +@interface PKChar : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKChar parser. + @result an initialized autoreleased PKChar parser. +*/ ++ (id)char; +@end diff --git a/include/ParseKit/.svn/text-base/PKCharacterAssembly.h.svn-base b/include/ParseKit/.svn/text-base/PKCharacterAssembly.h.svn-base new file mode 100644 index 0000000..6462e14 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKCharacterAssembly.h.svn-base @@ -0,0 +1,19 @@ +// +// PKCharacterAssembly.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +/*! + @class PKCharacterAssembly + @brief A PKCharacterAssembly is a PKAssembly whose elements are characters. +*/ +@interface PKCharacterAssembly : PKAssembly { + +} + +@end diff --git a/include/ParseKit/.svn/text-base/PKCollectionParser.h.svn-base b/include/ParseKit/.svn/text-base/PKCollectionParser.h.svn-base new file mode 100644 index 0000000..6388f42 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKCollectionParser.h.svn-base @@ -0,0 +1,38 @@ +// +// PKCollectionParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKCollectionParser + @brief An Abstract class. This class abstracts the behavior common to parsers that consist of a series of other parsers. +*/ +@interface PKCollectionParser : PKParser { + NSMutableArray *subparsers; +} + +/*! + @brief Designated Initializer. Initialize an instance of a PKCollectionParser subclass. + @param p1, ... A comma-separated list of parser objects ending with nil + @result an initialized instance of a PKCollectionParser subclass. +*/ +- (id)initWithSubparsers:(PKParser *)p1, ...; + +/*! + @brief Adds a parser to the collection. + @param p parser to add +*/ +- (void)add:(PKParser *)p; + +/*! + @property subparsers + @brief This parser's subparsers. +*/ +@property (nonatomic, readonly, retain) NSMutableArray *subparsers; +@end diff --git a/include/ParseKit/.svn/text-base/PKComment.h.svn-base b/include/ParseKit/.svn/text-base/PKComment.h.svn-base new file mode 100644 index 0000000..3d81709 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKComment.h.svn-base @@ -0,0 +1,25 @@ +// +// PKComment.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/31/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKComment + @brief A PKComment matches a comment from a token assembly. +*/ +@interface PKComment : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKComment object. + @result an initialized autoreleased PKComment object +*/ ++ (id)comment; +@end diff --git a/include/ParseKit/.svn/text-base/PKCommentState.h.svn-base b/include/ParseKit/.svn/text-base/PKCommentState.h.svn-base new file mode 100644 index 0000000..703c31f --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKCommentState.h.svn-base @@ -0,0 +1,71 @@ +// +// PKCommentState.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/28/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class PKSymbolRootNode; +@class PKSingleLineCommentState; +@class PKMultiLineCommentState; + +/*! + @class PKCommentState + @brief This state will either delegate to a comment-handling state, or return a PKSymbol token with just the first char in it. + @details By default, C and C++ style comments. (// to end of line and /&0x002A; &0x002A;/) +*/ +@interface PKCommentState : PKTokenizerState { + PKSymbolRootNode *rootNode; + PKSingleLineCommentState *singleLineState; + PKMultiLineCommentState *multiLineState; + BOOL reportsCommentTokens; + BOOL balancesEOFTerminatedComments; +} + +/*! + @brief Adds the given string as a single-line comment start marker. may be multi-char. + @details single line comments begin with start and continue until the next new line character. e.g. C-style comments (// comment text) + @param start a single- or multi-character marker that should be recognized as the start of a single-line comment +*/ +- (void)addSingleLineStartMarker:(NSString *)start; + +/*! + @brief Removes the given string as a single-line comment start marker. may be multi-char. + @details If start was never added as a single-line comment start marker, this has no effect. + @param start a single- or multi-character marker that should no longer be recognized as the start of a single-line comment +*/ +- (void)removeSingleLineStartMarker:(NSString *)start; + +/*! + @brief Adds the given strings as a multi-line comment start and end markers. both may be multi-char + @details start and end may be different strings. e.g. /&0x002A; and &0x002A;/. Also, the actual comment may or may not be multi-line. + @param start a single- or multi-character marker that should be recognized as the start of a multi-line comment + @param end a single- or multi-character marker that should be recognized as the end of a multi-line comment that began with start +*/ +- (void)addMultiLineStartMarker:(NSString *)start endMarker:(NSString *)end; + +/*! + @brief Removes start and its orignal end counterpart as a multi-line comment start and end markers. + @details If start was never added as a multi-line comment start marker, this has no effect. + @param start a single- or multi-character marker that should no longer be recognized as the start of a multi-line comment +*/ +- (void)removeMultiLineStartMarker:(NSString *)start; + +/*! + @property reportsCommentTokens + @brief if true, the tokenizer associated with this state will report comment tokens, otherwise it silently consumes comments + @details if true, this state will return PKTokens of type PKTokenTypeComment. + Otherwise, it will silently consume comment text and return the next token from another of the tokenizer's states +*/ +@property (nonatomic) BOOL reportsCommentTokens; + +/*! + @property balancesEOFTerminatedComments + @brief if true, this state will append a matching comment string (&0x002A;/ [C++] or :) [XQuery]) to quotes terminated by EOF. Default is NO. +*/ +@property (nonatomic) BOOL balancesEOFTerminatedComments; +@end diff --git a/include/ParseKit/.svn/text-base/PKDelimitState.h.svn-base b/include/ParseKit/.svn/text-base/PKDelimitState.h.svn-base new file mode 100644 index 0000000..ce99b78 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKDelimitState.h.svn-base @@ -0,0 +1,51 @@ +// +// PKDelimitState.h +// ParseKit +// +// Created by Todd Ditchendorf on 5/21/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKSymbolRootNode; + +/*! + @class PKDelimitState + @brief A delimit state returns a delimited string token from a reader + @details This state will collect characters until it sees a match to the end marker that corresponds to the start marker the tokenizer used to switch to this state. +*/ +@interface PKDelimitState : PKTokenizerState { + PKSymbolRootNode *rootNode; + BOOL balancesEOFTerminatedStrings; + BOOL allowsUnbalancedStrings; + + NSMutableArray *startMarkers; + NSMutableArray *endMarkers; + NSMutableArray *characterSets; +} + +/*! + @brief Adds the given strings as a delimited string start and end markers. both may be multi-char + @details start and end may be different strings. e.g. <# and #>. + @param start a single- or multi-character marker that should be recognized as the start of a multi-line comment + @param end a single- or multi-character marker that should be recognized as the end of a multi-line comment that began with start + @param set of characters allowed to appear within the delimited string or nil to allow any non-newline characters +*/ +- (void)addStartMarker:(NSString *)start endMarker:(NSString *)end allowedCharacterSet:(NSCharacterSet *)set; + +/*! + @brief Removes start and its orignal end counterpart as a delimited string start and end markers. + @details If start was never added as a delimited string start marker, this has no effect. + @param start a single- or multi-character marker that should no longer be recognized as the start of a delimited string +*/ +- (void)removeStartMarker:(NSString *)start; + +/*! + @property balancesEOFTerminatedStrings + @brief if true, this state will append a matching end delimiter marker (e.g. --> or %>) to strings terminated by EOF. Default is NO. +*/ +@property (nonatomic) BOOL balancesEOFTerminatedStrings; + +@property (nonatomic) BOOL allowsUnbalancedStrings; +@end diff --git a/include/ParseKit/.svn/text-base/PKDelimitedString.h.svn-base b/include/ParseKit/.svn/text-base/PKDelimitedString.h.svn-base new file mode 100644 index 0000000..a062ab5 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKDelimitedString.h.svn-base @@ -0,0 +1,30 @@ +// +// PKDelimitedString.h +// ParseKit +// +// Created by Todd Ditchendorf on 5/21/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKDelimitedString + @brief A PKDelimitedString matches a delimited string from a token assembly. +*/ +@interface PKDelimitedString : PKTerminal { + NSString *startMarker; + NSString *endMarker; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKDelimitedString object. + @result an initialized autoreleased PKDelimitedString object +*/ ++ (id)delimitedString; + ++ (id)delimitedStringWithStartMarker:(NSString *)start; + ++ (id)delimitedStringWithStartMarker:(NSString *)start endMarker:(NSString *)end; +@end diff --git a/include/ParseKit/.svn/text-base/PKDifference.h.svn-base b/include/ParseKit/.svn/text-base/PKDifference.h.svn-base new file mode 100644 index 0000000..9778eda --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKDifference.h.svn-base @@ -0,0 +1,57 @@ +// +// PKDifference.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/26/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKDifference + @brief A PKDifference matches anything its subparser would match except for anything its minus parser would match. + @details The example below would match any Word token except for true or false. + +@code + PKParser *trueParser = [PKLiteral literalWithString:@"true"]; + PKParser *falseParser = [PKLiteral literalWithString:@"false"]; + PKAlternation *reservedWords = [PKAlternation alternationWithSubparsers:trueParser, falseParser, nil]; + + PKDifference *diff = [PKDifference differenceWithSubparser:[PKWord word] minus:reservedWords]; +@endcode +*/ +@interface PKDifference : PKParser { + PKParser *subparser; + PKParser *minus; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKDifference parser. + @param subparser the parser this parser uses for matching + @param minus the parser whose matches will be exluded + @result an initialized autoreleased PKDifference parser. +*/ ++ (id)differenceWithSubparser:(PKParser *)s minus:(PKParser *)m; + +/*! + @brief Designated initializer + @param subparser the parser this parser uses for matching + @param minus the parser whose matches will be exluded + @result an initialized PKDifference parser. +*/ +- (id)initWithSubparser:(PKParser *)s minus:(PKParser *)m; + +/*! + @property subparser + @brief this parser's subparser which it will initially match against +*/ +@property (nonatomic, retain, readonly) PKParser *subparser; + +/*! + @property minus + @brief after a successful match against subparser, matches against minus will not be matched by this parser +*/ +@property (nonatomic, retain, readonly) PKParser *minus; +@end diff --git a/include/ParseKit/.svn/text-base/PKDigit.h.svn-base b/include/ParseKit/.svn/text-base/PKDigit.h.svn-base new file mode 100644 index 0000000..60642c6 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKDigit.h.svn-base @@ -0,0 +1,25 @@ +// +// PKDigit.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +/*! + @class PKDigit + @brief A PKDigit matches a digit from a character assembly. + @details -[PKDitgit qualifies:] returns true if an assembly's next element is a digit. +*/ +@interface PKDigit : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKDigit parser. + @result an initialized autoreleased PKDigit parser. +*/ ++ (id)digit; +@end diff --git a/include/ParseKit/.svn/text-base/PKEmpty.h.svn-base b/include/ParseKit/.svn/text-base/PKEmpty.h.svn-base new file mode 100644 index 0000000..5b882cf --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKEmpty.h.svn-base @@ -0,0 +1,26 @@ +// +// PKEmpty.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKEmpty + @brief A PKEmpty parser matches any assembly once, and applies its assembler that one time. + @details

Language elements often contain empty parts. For example, a language may at some point allow a list of parameters in parentheses, and may allow an empty list. An empty parser makes it easy to match, within the parenthesis, either a list of parameters or "empty".

+*/ +@interface PKEmpty : PKParser { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKEmpty parser. + @result an initialized autoreleased PKEmpty parser. +*/ ++ (id)empty; +@end diff --git a/include/ParseKit/.svn/text-base/PKIntersection.h.svn-base b/include/ParseKit/.svn/text-base/PKIntersection.h.svn-base new file mode 100644 index 0000000..034b764 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKIntersection.h.svn-base @@ -0,0 +1,35 @@ +// +// PKIntersection.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/27/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKIntersection + @brief A PKIntersection matches input that matches all of its subparsers. It is basically a representation of "Logical And" or "&". + @details The example below would match any token which is both a word and matches the given regular expression pattern. + Using a PKIntersection in this case would improve performance over using just a PKPattern parser as the regular expression would be evaluated fewer times. + +@code + PKParser *pattern = [PKPattern patternWithString:@"_.+"]; + + PKIntersection *wordStartingWithUnderscore = [PKIntersection intersectionWithSubparsers:[PKWord word], pattern, nil]; +@endcode +*/ +@interface PKIntersection : PKCollectionParser { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKIntersection parser. + @result an initialized autoreleased PKIntersection parser. +*/ ++ (id)intersection; + ++ (id)intersectionWithSubparsers:(PKParser *)p1, ...; +@end diff --git a/include/ParseKit/.svn/text-base/PKLetter.h.svn-base b/include/ParseKit/.svn/text-base/PKLetter.h.svn-base new file mode 100644 index 0000000..3c06290 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKLetter.h.svn-base @@ -0,0 +1,25 @@ +// +// PKLetter.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +/*! + @class PKLetter + @brief A PKLetter matches any letter from a character assembly. + @details -[PKLetter qualifies:] returns true if an assembly's next element is a letter. +*/ +@interface PKLetter : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKLetter parser. + @result an initialized autoreleased PKLetter parser. +*/ ++ (id)letter; +@end diff --git a/include/ParseKit/.svn/text-base/PKLiteral.h.svn-base b/include/ParseKit/.svn/text-base/PKLiteral.h.svn-base new file mode 100644 index 0000000..2f71582 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKLiteral.h.svn-base @@ -0,0 +1,28 @@ +// +// PKLiteral.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class PKToken; + +/*! + @class PKLiteral + @brief A PKLiteral matches a specific word from an assembly. +*/ +@interface PKLiteral : PKTerminal { + PKToken *literal; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKLiteral object with a given string. + @param s the word represented by this literal + @result an initialized autoreleased PKLiteral object representing s +*/ ++ (id)literalWithString:(NSString *)s; +@end diff --git a/include/ParseKit/.svn/text-base/PKLowercaseWord.h.svn-base b/include/ParseKit/.svn/text-base/PKLowercaseWord.h.svn-base new file mode 100644 index 0000000..11bd30d --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKLowercaseWord.h.svn-base @@ -0,0 +1,16 @@ +// +// PKLowercaseWord.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKLowercaseWord : PKWord { + +} + +@end diff --git a/include/ParseKit/.svn/text-base/PKMultiLineCommentState.h.svn-base b/include/ParseKit/.svn/text-base/PKMultiLineCommentState.h.svn-base new file mode 100644 index 0000000..b1c58af --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKMultiLineCommentState.h.svn-base @@ -0,0 +1,18 @@ +// +// PKMultiLineCommentState.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/28/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKMultiLineCommentState : PKTokenizerState { + NSMutableArray *startMarkers; + NSMutableArray *endMarkers; + NSString *currentStartMarker; +} + +@end diff --git a/include/ParseKit/.svn/text-base/PKNegation.h.svn-base b/include/ParseKit/.svn/text-base/PKNegation.h.svn-base new file mode 100644 index 0000000..a12ee8f --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKNegation.h.svn-base @@ -0,0 +1,46 @@ +// +// PKNegation.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +/*! + @class PKNegation + @brief A PKNegation negates the matching logic of its subparser. It matches anything its subparser would not. + @details The example below would match any token except for a ?> symbol token. This could be useful for matching all tokens until an end marker (in this case a PHP end marker) is found. + +@code + PKParser *question = [PKSymbol symbolWithString:@"?>"]; + + PKNegation *n = [PKNegation negationWithSubparser:question]; +@endcode +*/ +@interface PKNegation : PKParser { + PKParser *subparser; + PKParser *difference; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKNegation parser. + @param subparser the parser whose matching logic is negated + @result an initialized autoreleased PKNegation parser. +*/ ++ (id)negationWithSubparser:(PKParser *)s; + +/*! + @brief Designated initializer + @param subparser the parser whose matching logic is negated + @result an initialized PKNegation parser. +*/ +- (id)initWithSubparser:(PKParser *)s; + +/*! + @property subparser + @brief this parser's subparser whose matching logic is negated +*/ +@property (nonatomic, retain, readonly) PKParser *subparser; +@end diff --git a/include/ParseKit/.svn/text-base/PKNumber.h.svn-base b/include/ParseKit/.svn/text-base/PKNumber.h.svn-base new file mode 100644 index 0000000..7ffdee1 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKNumber.h.svn-base @@ -0,0 +1,25 @@ +// +// PKNumber.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKNumber + @brief A PKNumber matches a number from a token assembly. +*/ +@interface PKNumber : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKNumber object. + @result an initialized autoreleased PKNumber object +*/ ++ (id)number; +@end diff --git a/include/ParseKit/.svn/text-base/PKNumberState.h.svn-base b/include/ParseKit/.svn/text-base/PKNumberState.h.svn-base new file mode 100644 index 0000000..1b1871f --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKNumberState.h.svn-base @@ -0,0 +1,65 @@ +// +// PKNumberState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKNumberState + @brief A number state returns a number from a reader. + @details This state's idea of a number allows an optional, initial minus sign, followed by one or more digits. A decimal point and another string of digits may follow these digits. + If allowsScientificNotation is YES (default is NO) this state allows 'e' or 'E' followed by an (optionally explicityly positive or negative) integer to represent 10 to the indicated power. For example, this state will recognize 1e2 as equaling 100.

+*/ +@interface PKNumberState : PKTokenizerState { + BOOL allowsTrailingDot; + BOOL allowsScientificNotation; + BOOL allowsOctalNotation; + BOOL allowsHexadecimalNotation; + BOOL isDecimal; + BOOL isFraction; + BOOL isNegative; + BOOL isHex; + BOOL gotADigit; + NSUInteger len; + CGFloat base; + PKUniChar originalCin; + PKUniChar firstNum; + PKUniChar c; + CGFloat floatValue; + CGFloat exp; + BOOL isNegativeExp; +} + +/*! + @property allowsTrailingDot + @brief If YES, numbers are allowed to end with a trialing dot, e.g. 42. + @details default is NO +*/ +@property (nonatomic) BOOL allowsTrailingDot; + +/*! + @property allowsScientificNotation + @brief If YES, supports exponential numbers like 42.0e2, 2E+6, or 5.1e-6 + @details default is NO +*/ +@property (nonatomic) BOOL allowsScientificNotation; + +/*! + @property allowsOctalNotation + @brief If YES, supports octal numbers like 020 (16), or 0102 (66) + @details default is NO +*/ +@property (nonatomic) BOOL allowsOctalNotation; + +/*! + @property allowsHexidecimalNotation + @brief If YES, supports hex numbers like 0x20 (32), or 0xB7 (183) + @details default is NO +*/ +@property (nonatomic) BOOL allowsHexadecimalNotation; +@end diff --git a/include/ParseKit/.svn/text-base/PKParser.h.svn-base b/include/ParseKit/.svn/text-base/PKParser.h.svn-base new file mode 100644 index 0000000..b5e3ce0 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKParser.h.svn-base @@ -0,0 +1,167 @@ +// +// PKParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKAssembly; +@class PKTokenizer; + +/*! + @class PKParser + @brief An Abstract class. A PKParser is an object that recognizes the elements of a language. + @details

Each PKParser object is either a PKTerminal or a composition of other parsers. The PKTerminal class is a subclass of Parser, and is itself a hierarchy of parsers that recognize specific patterns of text. For example, a PKWord recognizes any word, and a PKLiteral matches a specific string.

+

In addition to PKTerminal, other subclasses of PKParser provide composite parsers, describing sequences, alternations, and repetitions of other parsers. For example, the following PKParser objects culminate in a good parser that recognizes a description of good coffee.

+@code + PKAlternation *adjective = [PKAlternation alternation]; + [adjective add:[PKLiteral literalWithString:@"steaming"]]; + [adjective add:[PKLiteral literalWithString:@"hot"]]; + PKSequence *good = [PKSequence sequence]; + [good add:[PKRepetition repetitionWithSubparser:adjective]]; + [good add:[PKLiteral literalWithString:@"coffee"]]; + NSString *s = @"hot hot steaming hot coffee"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + NSLog([good bestMatchFor:a]); +@endcode +

This prints out:

+@code + [hot, hot, steaming, hot, coffee] + hot/hot/steaming/hot/coffee^ +@endcode +

The parser does not match directly against a string, it matches against a PKAssembly. The resulting assembly shows its stack, with four words on it, along with its sequence of tokens, and the index at the end of these. In practice, parsers will do some work on an assembly, based on the text they recognize.

+*/ +@interface PKParser : NSObject { +#ifdef TARGET_OS_SNOW_LEOPARD + void (^assemblerBlock)(PKAssembly *); + void (^preassemblerBlock)(PKAssembly *); +#endif + id assembler; + SEL assemblerSelector; + id preassembler; + SEL preassemblerSelector; + NSString *name; + PKTokenizer *tokenizer; // PKParserFactoryAdditions ivar +} + +/*! + @brief Convenience factory method for initializing an autoreleased parser. + @result an initialized autoreleased parser. +*/ ++ (id)parser; + +/*! + @brief Sets the object and method that will work on an assembly whenever this parser successfully matches against the assembly. + @details The method represented by sel must accept a single PKAssembly argument. The signature of sel should be similar to: - (void)didMatchAssembly:(PKAssembly *)a. + @param a the assembler this parser will use to work on an assembly + @param sel a selector that assembler a responds to which will work on an assembly +*/ +- (void)setAssembler:(id)a selector:(SEL)sel; + +/*! + @brief Sets the object that will work on every assembly before matching against it. + @details Setting a preassembler is entirely optional, but sometimes useful for repetition parsers to do work on an assembly before matching against it. + @param a the assembler this parser will use to work on an assembly before matching against it. + @param sel a selector that assembler a responds to which will work on an assembly +*/ +- (void)setPreassembler:(id)a selector:(SEL)sel; + +/*! + @brief Returns the most-matched assembly in a collection. + @param inAssembly the assembly for which to find the best match + @result an assembly with the greatest possible number of elements consumed by this parser +*/ +- (PKAssembly *)bestMatchFor:(PKAssembly *)inAssembly; + +/*! + @brief Returns either nil, or a completely matched version of the supplied assembly. + @param inAssembly the assembly for which to find the complete match + @result either nil, or a completely matched version of the supplied assembly +*/ +- (PKAssembly *)completeMatchFor:(PKAssembly *)inAssembly; + +/*! + @brief Given a set of assemblies, this method matches this parser against all of them, and returns a new set of the assemblies that result from the matches. + @details

Given a set of assemblies, this method matches this parser against all of them, and returns a new set of the assemblies that result from the matches.

+

For example, consider matching the regular expression a* against the string aaab. The initial set of states is {^aaab}, where the ^ indicates how far along the assembly is. When a* matches against this initial state, it creates a new set {^aaab, a^aab, aa^ab, aaa^b}.

+ @param inAssemblies set of assemblies to match against + @result a set of assemblies that result from matching against a beginning set of assemblies +*/ +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; + +/*! + @brief Find a parser with the given name + @details Performs a depth-first recursive search (starting with this parser) for a parser or subparser with the given name. If this parser's name is name, it will be returned. + @param name of the parser to be found + @result the parser with the given name or nil if not found + */ +- (PKParser *)parserNamed:(NSString *)name; + +#ifdef TARGET_OS_SNOW_LEOPARD +/*! + @property assemblerBlock + @brief Set a block which should be executed after this parser is matched + @details

This is an alternative to calling -setAssembler:selector:.

+

Passing a block to this method will cause this parser to execute the given block after it is matched (rather than sending assembler the assemblerSelector message.

+

Using a block as the assembler will sometimes be more convient than setting an assembler object.

+ @param block of code to be executed after a parser is matched. +*/ +@property (nonatomic, retain) void (^assemblerBlock)(PKAssembly *); + +/*! + @property preassemblerBlock + @brief Set a block which should be executed before this parser is matched + @details

This is an alternative to calling -setPreassembler:selector:.

+

Passing a block to this method will cause this parser to execute the given block before it is matched (rather than sending preassembler the preassemblerSelector message.

+

Using a block as the preassembler will sometimes be more convient than setting an preassembler object.

+ @param block of code to be executed before a parser is matched. + */ +@property (nonatomic, retain) void (^preassemblerBlock)(PKAssembly *); +#endif + +/*! + @property assembler + @brief The assembler this parser will use to work on a matched assembly. + @details assembler should respond to the selector held by this parser's selector property. +*/ +@property (nonatomic, assign) id assembler; + +/*! + @property assemblerSelector + @brief The method of assembler this parser will call to work on a matched assembly. + @details The method represented by assemblerSelector must accept a single PKAssembly argument. The signature of assemblerSelector should be similar to: - (void)didMatchFoo:(PKAssembly *)a. +*/ +@property (nonatomic, assign) SEL assemblerSelector; + +/*! + @property preassembler + @brief The assembler this parser will use to work on an assembly before matching against it. + @discussion preassembler should respond to the selector held by this parser's preassemblerSelector property. +*/ +@property (nonatomic, assign) id preassembler; + +/*! + @property preAssemlerSelector + @brief The method of preassembler this parser will call to work on an assembly. + @details The method represented by preassemblerSelector must accept a single PKAssembly argument. The signature of preassemblerSelector should be similar to: - (void)didMatchAssembly:(PKAssembly *)a. +*/ +@property (nonatomic, assign) SEL preassemblerSelector; + +/*! + @property name + @brief The name of this parser. + @discussion Use this property to help in identifying a parser or for debugging purposes. +*/ +@property (nonatomic, copy) NSString *name; +@end + +@interface PKParser (PKParserFactoryAdditions) + +- (id)parse:(NSString *)s; + +- (PKTokenizer *)tokenizer; +@end + diff --git a/include/ParseKit/.svn/text-base/PKParserFactory.h.svn-base b/include/ParseKit/.svn/text-base/PKParserFactory.h.svn-base new file mode 100644 index 0000000..8024df6 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKParserFactory.h.svn-base @@ -0,0 +1,47 @@ +// +// PKParserFactory.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2009 Todd Ditchendorf All rights reserved. +// + +#import + +@class PKGrammarParser; +@class PKToken; +@class PKTokenizer; +@class PKParser; +@class PKCollectionParser; + +void PKReleaseSubparserTree(PKParser *p); + +typedef enum { + PKParserFactoryAssemblerSettingBehaviorOnAll = 1 << 1, // Default + PKParserFactoryAssemblerSettingBehaviorOnTerminals = 1 << 2, + PKParserFactoryAssemblerSettingBehaviorOnExplicit = 1 << 3, + PKParserFactoryAssemblerSettingBehaviorOnNone = 1 << 4 +} PKParserFactoryAssemblerSettingBehavior; + +@interface PKParserFactory : NSObject { + PKParserFactoryAssemblerSettingBehavior assemblerSettingBehavior; + PKGrammarParser *grammarParser; + id assembler; + id preassembler; + NSMutableDictionary *parserTokensTable; + NSMutableDictionary *parserClassTable; + NSMutableDictionary *selectorTable; + PKToken *equals; + PKToken *curly; + PKToken *paren; + BOOL isGatheringClasses; +} ++ (id)factory; + +- (PKParser *)parserFromGrammar:(NSString *)s assembler:(id)a; +- (PKParser *)parserFromGrammar:(NSString *)s assembler:(id)a preassembler:(id)pa; + +- (PKCollectionParser *)exprParser; + +@property (nonatomic) PKParserFactoryAssemblerSettingBehavior assemblerSettingBehavior; +@end diff --git a/include/ParseKit/.svn/text-base/PKPattern.h.svn-base b/include/ParseKit/.svn/text-base/PKPattern.h.svn-base new file mode 100644 index 0000000..75ca2d5 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKPattern.h.svn-base @@ -0,0 +1,32 @@ +// +// PKPattern.h +// ParseKit +// +// Created by Todd Ditchendorf on 5/31/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import + +typedef enum { + PKPatternOptionsNone = 0, + PKPatternOptionsIgnoreCase = 2, + PKPatternOptionsComments = 4, + PKPatternOptionsMultiline = 8, + PKPatternOptionsDotAll = 32, + PKPatternOptionsUnicodeWordBoundaries = 256 +} PKPatternOptions; + +@interface PKPattern : PKTerminal { + PKPatternOptions options; +} ++ (id)patternWithString:(NSString *)s; + ++ (id)patternWithString:(NSString *)s options:(PKPatternOptions)opts; + +- (id)initWithString:(NSString *)s; + +- (id)initWithString:(NSString *)s options:(PKPatternOptions)opts; +@end diff --git a/include/ParseKit/.svn/text-base/PKQuoteState.h.svn-base b/include/ParseKit/.svn/text-base/PKQuoteState.h.svn-base new file mode 100644 index 0000000..33c6d3f --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKQuoteState.h.svn-base @@ -0,0 +1,26 @@ +// +// PKQuoteState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKQuoteState + @brief A quote state returns a quoted string token from a reader + @details This state will collect characters until it sees a match to the character that the tokenizer used to switch to this state. For example, if a tokenizer uses a double- quote character to enter this state, then -nextToken will search for another double-quote until it finds one or finds the end of the reader. +*/ +@interface PKQuoteState : PKTokenizerState { + BOOL balancesEOFTerminatedQuotes; +} + +/*! + @property balancesEOFTerminatedQuotes + @brief if true, this state will append a matching quote char (' or ") to strings terminated by EOF. Default is NO. +*/ +@property (nonatomic) BOOL balancesEOFTerminatedQuotes; +@end diff --git a/include/ParseKit/.svn/text-base/PKQuotedString.h.svn-base b/include/ParseKit/.svn/text-base/PKQuotedString.h.svn-base new file mode 100644 index 0000000..6785932 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKQuotedString.h.svn-base @@ -0,0 +1,25 @@ +// +// PKQuotedString.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKQuotedString + @brief A PKQuotedString matches a quoted string, like "this one" from a token assembly. +*/ +@interface PKQuotedString : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKQuotedString object. + @result an initialized autoreleased PKQuotedString object +*/ ++ (id)quotedString; +@end diff --git a/include/ParseKit/.svn/text-base/PKReader.h.svn-base b/include/ParseKit/.svn/text-base/PKReader.h.svn-base new file mode 100644 index 0000000..35409df --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKReader.h.svn-base @@ -0,0 +1,60 @@ +// +// PKReader.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/21/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKReader + @brief A character-stream reader that allows characters to be pushed back into the stream. +*/ +@interface PKReader : NSObject { + NSString *string; + NSUInteger offset; + NSUInteger length; +} + +/*! + @brief Designated Initializer. Initializes a reader with a given string. + @details Designated Initializer. + @param s string from which to read + @result an initialized reader +*/ +- (id)initWithString:(NSString *)s; + +/*! + @brief Read a single UTF-16 unicode character + @result The character read, or PKEOF (-1) if the end of the stream has been reached +*/ +- (PKUniChar)read; + +/*! + @brief Push back a single character + @details moves the offset back one position +*/ +- (void)unread; + +/*! + @brief Push back count characters + @param count of characters to push back + @details moves the offset back count positions +*/ +- (void)unread:(NSUInteger)count; + +/*! + @property string + @brief This reader's string. +*/ +@property (nonatomic, copy) NSString *string; + +/*! + @property offset + @brief This reader's current offset in string +*/ +@property (nonatomic, readonly) NSUInteger offset; +@end diff --git a/include/ParseKit/.svn/text-base/PKRepetition.h.svn-base b/include/ParseKit/.svn/text-base/PKRepetition.h.svn-base new file mode 100644 index 0000000..f0edcea --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKRepetition.h.svn-base @@ -0,0 +1,40 @@ +// +// PKRepetition.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKRepetition + @brief A PKRepetition matches its underlying parser repeatedly against a assembly. +*/ +@interface PKRepetition : PKParser { + PKParser *subparser; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKRepetition parser to repeatedly match against subparser p. + @param p the subparser against wich to repeatedly match + @result an initialized autoreleased PKRepetition parser. +*/ ++ (id)repetitionWithSubparser:(PKParser *)p; + +/*! + @brief Designated Initializer. Initialize a PKRepetition parser to repeatedly match against subparser p. + @details Designated Initializer. Initialize a PKRepetition parser to repeatedly match against subparser p. + @param p the subparser against wich to repeatedly match + @result an initialized PKRepetition parser. +*/ +- (id)initWithSubparser:(PKParser *)p; + +/*! + @property subparser + @brief this parser's subparser against which it repeatedly matches +*/ +@property (nonatomic, readonly, retain) PKParser *subparser; +@end diff --git a/include/ParseKit/.svn/text-base/PKSequence.h.svn-base b/include/ParseKit/.svn/text-base/PKSequence.h.svn-base new file mode 100644 index 0000000..931dc13 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKSequence.h.svn-base @@ -0,0 +1,27 @@ +// +// PKSequence.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKSequence + @brief A PKSequence object is a collection of parsers, all of which must in turn match against an assembly for this parser to successfully match. +*/ +@interface PKSequence : PKCollectionParser { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKSequence parser. + @result an initialized autoreleased PKSequence parser. +*/ ++ (id)sequence; + ++ (id)sequenceWithSubparsers:(PKParser *)p1, ...; +@end diff --git a/include/ParseKit/.svn/text-base/PKSingleLineCommentState.h.svn-base b/include/ParseKit/.svn/text-base/PKSingleLineCommentState.h.svn-base new file mode 100644 index 0000000..2781129 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKSingleLineCommentState.h.svn-base @@ -0,0 +1,17 @@ +// +// PKSingleLineCommentState.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/28/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKSingleLineCommentState : PKTokenizerState { + NSMutableArray *startMarkers; + NSString *currentStartMarker; +} + +@end diff --git a/include/ParseKit/.svn/text-base/PKSpecificChar.h.svn-base b/include/ParseKit/.svn/text-base/PKSpecificChar.h.svn-base new file mode 100644 index 0000000..08e5ced --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKSpecificChar.h.svn-base @@ -0,0 +1,34 @@ +// +// PKSpecificChar.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKSpecificChar + @brief A PKSpecificChar matches a specified character from a character assembly. + @details -[PKSpecificChar qualifies:] returns true if an assembly's next element is equal to the character this object was constructed with. +*/ +@interface PKSpecificChar : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKSpecificChar parser. + @param c the character this object should match + @result an initialized autoreleased PKSpecificChar parser. +*/ ++ (id)specificCharWithChar:(PKUniChar)c; + +/*! + @brief Designated Initializer. Initializes a PKSpecificChar parser. + @param c the character this object should match + @result an initialized PKSpecificChar parser. +*/ +- (id)initWithSpecificChar:(PKUniChar)c; +@end diff --git a/include/ParseKit/.svn/text-base/PKSymbol.h.svn-base b/include/ParseKit/.svn/text-base/PKSymbol.h.svn-base new file mode 100644 index 0000000..41611e8 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKSymbol.h.svn-base @@ -0,0 +1,34 @@ +// +// PKSymbol.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class PKToken; + +/*! + @class PKSymbol + @brief A PKSymbol matches a specific sequence, such as <, or <= that a tokenizer returns as a symbol. +*/ +@interface PKSymbol : PKTerminal { + PKToken *symbol; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKSymbol object with a nil string value. + @result an initialized autoreleased PKSymbol object with a nil string value +*/ ++ (id)symbol; + +/*! + @brief Convenience factory method for initializing an autoreleased PKSymbol object with s as a string value. + @param s the string represented by this symbol + @result an initialized autoreleased PKSymbol object with s as a string value +*/ ++ (id)symbolWithString:(NSString *)s; +@end diff --git a/include/ParseKit/.svn/text-base/PKSymbolNode.h.svn-base b/include/ParseKit/.svn/text-base/PKSymbolNode.h.svn-base new file mode 100644 index 0000000..bc17a47 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKSymbolNode.h.svn-base @@ -0,0 +1,38 @@ +// +// PKSymbolNode.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKSymbolNode + @brief A PKSymbolNode object is a member of a tree that contains all possible prefixes of allowable symbols. + @details A PKSymbolNode object is a member of a tree that contains all possible prefixes of allowable symbols. Multi-character symbols appear in a PKSymbolNode tree with one node for each character. For example, the symbol =:~ will appear in a tree as three nodes. The first node contains an equals sign, and has a child; that child contains a colon and has a child; this third child contains a tilde, and has no children of its own. If the colon node had another child for a dollar sign character, then the tree would contain the symbol =:$. A tree of PKSymbolNode objects collaborate to read a (potentially multi-character) symbol from an input stream. A root node with no character of its own finds an initial node that represents the first character in the input. This node looks to see if the next character in the stream matches one of its children. If so, the node delegates its reading task to its child. This approach walks down the tree, pulling symbols from the input that match the path down the tree. When a node does not have a child that matches the next character, we will have read the longest possible symbol prefix. This prefix may or may not be a valid symbol. Consider a tree that has had =:~ added and has not had =: added. In this tree, of the three nodes that contain =:~, only the first and third contain complete symbols. If, say, the input contains =:a, the colon node will not have a child that matches the 'a' and so it will stop reading. The colon node has to "unread": it must push back its character, and ask its parent to unread. Unreading continues until it reaches an ancestor that represents a valid symbol. +*/ +@interface PKSymbolNode : NSObject { + NSString *ancestry; + PKSymbolNode *parent; + NSMutableDictionary *children; + PKUniChar character; + NSString *string; +} + +/*! + @brief Initializes a PKSymbolNode with the given parent, representing the given character. + @param p the parent of this node + @param c the character for this node + @result An initialized PKSymbolNode +*/ +- (id)initWithParent:(PKSymbolNode *)p character:(PKUniChar)c; + +/*! + @property ancestry + @brief The string of the mulit-character symbol this node represents. +*/ +@property (nonatomic, readonly, retain) NSString *ancestry; +@end diff --git a/include/ParseKit/.svn/text-base/PKSymbolRootNode.h.svn-base b/include/ParseKit/.svn/text-base/PKSymbolRootNode.h.svn-base new file mode 100644 index 0000000..346ce87 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKSymbolRootNode.h.svn-base @@ -0,0 +1,42 @@ +// +// PKSymbolRootNode.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class PKReader; + +/*! + @class PKSymbolRootNode + @brief This class is a special case of a PKSymbolNode. + @details This class is a special case of a PKSymbolNode. A PKSymbolRootNode object has no symbol of its own, but has children that represent all possible symbols. +*/ +@interface PKSymbolRootNode : PKSymbolNode { +} + +/*! + @brief Adds the given string as a multi-character symbol. + @param s a multi-character symbol that should be recognized as a single symbol token by this state +*/ +- (void)add:(NSString *)s; + +/*! + @brief Removes the given string as a multi-character symbol. + @param s a multi-character symbol that should no longer be recognized as a single symbol token by this state + @details if s was never added as a multi-character symbol, this has no effect +*/ +- (void)remove:(NSString *)s; + +/*! + @brief Return a symbol string from a reader. + @param r the reader from which to read + @param cin the character from witch to start + @result a symbol string from a reader +*/ +- (NSString *)nextSymbol:(PKReader *)r startingWith:(PKUniChar)cin; +@end diff --git a/include/ParseKit/.svn/text-base/PKSymbolState.h.svn-base b/include/ParseKit/.svn/text-base/PKSymbolState.h.svn-base new file mode 100644 index 0000000..d53e32a --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKSymbolState.h.svn-base @@ -0,0 +1,38 @@ +// +// PKSymbolState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class PKSymbolRootNode; + +/*! + @class PKSymbolState + @brief The idea of a symbol is a character that stands on its own, such as an ampersand or a parenthesis. + @details

The idea of a symbol is a character that stands on its own, such as an ampersand or a parenthesis. For example, when tokenizing the expression (isReady)& (isWilling) , a typical tokenizer would return 7 tokens, including one for each parenthesis and one for the ampersand. Thus a series of symbols such as )&( becomes three tokens, while a series of letters such as isReady becomes a single word token.

+

Multi-character symbols are an exception to the rule that a symbol is a standalone character. For example, a tokenizer may want less-than-or-equals to tokenize as a single token. This class provides a method for establishing which multi-character symbols an object of this class should treat as single symbols. This allows, for example, "cat <= dog" to tokenize as three tokens, rather than splitting the less-than and equals symbols into separate tokens.

+

By default, this state recognizes the following multi- character symbols: !=, :-, <=, >=

+*/ +@interface PKSymbolState : PKTokenizerState { + PKSymbolRootNode *rootNode; + NSMutableArray *addedSymbols; +} + +/*! + @brief Adds the given string as a multi-character symbol. + @param s a multi-character symbol that should be recognized as a single symbol token by this state +*/ +- (void)add:(NSString *)s; + +/*! + @brief Removes the given string as a multi-character symbol. + @details If s was never added as a multi-character symbol, this has no effect. + @param s a multi-character symbol that should no longer be recognized as a single symbol token by this state +*/ +- (void)remove:(NSString *)s; +@end diff --git a/include/ParseKit/.svn/text-base/PKTerminal.h.svn-base b/include/ParseKit/.svn/text-base/PKTerminal.h.svn-base new file mode 100644 index 0000000..1697a1b --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKTerminal.h.svn-base @@ -0,0 +1,43 @@ +// +// PKTerminal.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class PKToken; + +/*! + @class PKTerminal + @brief An Abstract Class. A PKTerminal is a parser that is not a composition of other parsers. +*/ +@interface PKTerminal : PKParser { + NSString *string; + BOOL discardFlag; +} + +/*! + @brief Designated Initializer for all concrete PKTerminal subclasses. + @details Note this is an abtract class and this method must be called on a concrete subclass. + @param s the string matched by this parser + @result an initialized PKTerminal subclass object +*/ +- (id)initWithString:(NSString *)s; + +/*! + @brief By default, terminals push themselves upon a assembly's stack, after a successful match. This method will turn off that behavior. + @details This method returns this parser as a convenience for chainging-style usage. + @result this parser, returned for chaining/convenience +*/ +- (PKTerminal *)discard; + +/*! + @property string + @brief the string matched by this parser. +*/ +@property (nonatomic, readonly, copy) NSString *string; +@end diff --git a/include/ParseKit/.svn/text-base/PKToken.h.svn-base b/include/ParseKit/.svn/text-base/PKToken.h.svn-base new file mode 100644 index 0000000..747618c --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKToken.h.svn-base @@ -0,0 +1,166 @@ +// +// PKToken.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +/*! + @typedef enum PKTokenType + @brief Indicates the type of a PKToken + @var PKTokenTypeEOF A constant indicating that the endo fo the stream has been read. + @var PKTokenTypeNumber A constant indicating that a token is a number, like 3.14. + @var PKTokenTypeQuotedString A constant indicating that a token is a quoted string, like "Launch Mi". + @var PKTokenTypeSymbol A constant indicating that a token is a symbol, like "<=". + @var PKTokenTypeWord A constant indicating that a token is a word, like cat. + @var PKTokenTypeWhitespace A constant indicating that a token is whitespace, like \t. + @var PKTokenTypeComment A constant indicating that a token is a comment, like // this is a hack. + @var PKTokenTypeDelimtedString A constant indicating that a token is a delimitedString, like <#foo>. +*/ +typedef enum { + PKTokenTypeEOF, + PKTokenTypeNumber, + PKTokenTypeQuotedString, + PKTokenTypeSymbol, + PKTokenTypeWord, + PKTokenTypeWhitespace, + PKTokenTypeComment, + PKTokenTypeDelimitedString, + PKTokenTypeAny +} PKTokenType; + +/*! + @class PKToken + @brief A token represents a logical chunk of a string. + @details For example, a typical tokenizer would break the string "1.23 <= 12.3" into three tokens: the number 1.23, a less-than-or-equal symbol, and the number 12.3. A token is a receptacle, and relies on a tokenizer to decide precisely how to divide a string into tokens. +*/ +@interface PKToken : NSObject { + CGFloat floatValue; + NSString *stringValue; + PKTokenType tokenType; + + BOOL number; + BOOL quotedString; + BOOL symbol; + BOOL word; + BOOL whitespace; + BOOL comment; + BOOL delimitedString; + + id value; + NSUInteger offset; +} + +/*! + @brief Factory method for creating a singleton PKToken used to indicate that there are no more tokens. + @result A singleton used to indicate that there are no more tokens. +*/ ++ (PKToken *)EOFToken; + +/*! + @brief Factory convenience method for creating an autoreleased token. + @param t the type of this token. + @param s the string value of this token. + @param n the number falue of this token. + @result an autoreleased initialized token. +*/ ++ (id)tokenWithTokenType:(PKTokenType)t stringValue:(NSString *)s floatValue:(CGFloat)n; + +/*! + @brief Designated initializer. Constructs a token of the indicated type and associated string or numeric values. + @param t the type of this token. + @param s the string value of this token. + @param n the number falue of this token. + @result an autoreleased initialized token. +*/ +- (id)initWithTokenType:(PKTokenType)t stringValue:(NSString *)s floatValue:(CGFloat)n; + +/*! + @brief Returns true if the supplied object is an equivalent PKToken, ignoring differences in case. + @param obj the object to compare this token to. + @result true if obj is an equivalent PKToken, ignoring differences in case. +*/ +- (BOOL)isEqualIgnoringCase:(id)obj; + +/*! + @brief Returns more descriptive textual representation than -description which may be useful for debugging puposes only. + @details Usually of format similar to: <QuotedString "Launch Mi">, <Word cat>, or <Number 3.14> + @result A textual representation including more descriptive information than -description. +*/ +- (NSString *)debugDescription; + +/*! + @property number + @brief True if this token is a number. getter=isNumber +*/ +@property (nonatomic, readonly, getter=isNumber) BOOL number; + +/*! + @property quotedString + @brief True if this token is a quoted string. getter=isQuotedString +*/ +@property (nonatomic, readonly, getter=isQuotedString) BOOL quotedString; + +/*! + @property symbol + @brief True if this token is a symbol. getter=isSymbol +*/ +@property (nonatomic, readonly, getter=isSymbol) BOOL symbol; + +/*! + @property word + @brief True if this token is a word. getter=isWord +*/ +@property (nonatomic, readonly, getter=isWord) BOOL word; + +/*! + @property whitespace + @brief True if this token is whitespace. getter=isWhitespace +*/ +@property (nonatomic, readonly, getter=isWhitespace) BOOL whitespace; + +/*! + @property comment + @brief True if this token is a comment. getter=isComment +*/ +@property (nonatomic, readonly, getter=isComment) BOOL comment; + +/*! + @property delimitedString + @brief True if this token is a delimited string. getter=isDelimitedString +*/ +@property (nonatomic, readonly, getter=isDelimitedString) BOOL delimitedString; + +/*! + @property tokenType + @brief The type of this token. +*/ +@property (nonatomic, readonly) PKTokenType tokenType; + +/*! + @property floatValue + @brief The numeric value of this token. +*/ +@property (nonatomic, readonly) CGFloat floatValue; + +/*! + @property stringValue + @brief The string value of this token. +*/ +@property (nonatomic, readonly, copy) NSString *stringValue; + +/*! + @property value + @brief Returns an object that represents the value of this token. +*/ +@property (nonatomic, readonly, copy) id value; + +/*! + @property offset + @brief The character offset of this token in the original source string. +*/ +@property (nonatomic, readonly) NSUInteger offset; +@end diff --git a/include/ParseKit/.svn/text-base/PKTokenArraySource.h.svn-base b/include/ParseKit/.svn/text-base/PKTokenArraySource.h.svn-base new file mode 100644 index 0000000..e4b63cf --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKTokenArraySource.h.svn-base @@ -0,0 +1,62 @@ +// +// PKTokenArraySource.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/11/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKTokenizer; +@class PKToken; + +/*! + @class PKTokenArraySource + @brief A TokenArraySource is a handy utility that enumerates over a specified reader, returning NSArrays of PKTokens delimited by a specified delimiter. + @details For example, + +@code + NSString *s = @"I came; I saw; I left in peace;"; + + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKTokenArraySource *src = [[[PKTokenArraySource alloc] initWithTokenizer:t delimiter:@";"] autorelease]; + + while ([src hasMore]) { + NSLog(@"%@", [src nextTokenArray]); + } +@endcode + + prints out: + +@code + I came + I saw + I left in peace +@endcode +*/ +@interface PKTokenArraySource : NSObject { + PKTokenizer *tokenizer; + NSString *delimiter; + PKToken *nextToken; +} + +/*! + @brief Constructs a PKTokenArraySource that will read an NSArrays of PKTokens using the specified tokenizer, delimited by the specified delimiter. + @param tokenizer a tokenizer to read tokens from + @param delimiter the character(s) that fences off where one array of tokens ends and the next begins +*/ +- (id)initWithTokenizer:(PKTokenizer *)t delimiter:(NSString *)s; + +/*! + @brief true if the source has more arrays of tokens. + @result true, if the source has more arrays of tokens that have not yet been popped with -nextTokenArray +*/ +- (BOOL)hasMore; + +/*! + @brief Returns the next array of tokens from the source. + @result the next array of tokens from the source +*/ +- (NSArray *)nextTokenArray; +@end diff --git a/include/ParseKit/.svn/text-base/PKTokenAssembly.h.svn-base b/include/ParseKit/.svn/text-base/PKTokenAssembly.h.svn-base new file mode 100644 index 0000000..04dc038 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKTokenAssembly.h.svn-base @@ -0,0 +1,57 @@ +// +// PKTokenAssembly.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKTokenizer; + +/*! + @class PKTokenAssembly + @brief A PKTokenAssembly is a PKAssembly whose elements are PKTokens. + @details PKTokens are, roughly, the chunks of text that a PKTokenizer returns. +*/ +@interface PKTokenAssembly : PKAssembly { + PKTokenizer *tokenizer; + NSArray *tokens; + BOOL preservesWhitespaceTokens; +} + +/*! + @brief Convenience factory method for initializing an autoreleased assembly with the tokenizer t and its string + @param t tokenizer whose string will be worked on + @result an initialized autoreleased assembly +*/ ++ (id)assemblyWithTokenizer:(PKTokenizer *)t; + +/*! + @brief Convenience factory method for initializing an autoreleased assembly with the token array a and its string + @param a token array whose string will be worked on + @result an initialized autoreleased assembly +*/ ++ (id)assemblyWithTokenArray:(NSArray *)a; + +/*! + @brief Initializes an assembly with the tokenizer t and its string + @param t tokenizer whose string will be worked on + @result an initialized assembly +*/ +- (id)initWithTokenzier:(PKTokenizer *)t; + +/*! + @brief Initializes an assembly with the token array a and its string + @param a token array whose string will be worked on + @result an initialized assembly +*/ +- (id)initWithTokenArray:(NSArray *)a; + +/*! + @property preservesWhitespaceTokens + @brief If true, whitespace tokens retreived from this assembly's tokenizier will be silently placed on this assembly's stack without being reported by -next or -peek. Default is false. +*/ +@property (nonatomic) BOOL preservesWhitespaceTokens; +@end diff --git a/include/ParseKit/.svn/text-base/PKTokenizer.h.svn-base b/include/ParseKit/.svn/text-base/PKTokenizer.h.svn-base new file mode 100644 index 0000000..647d9bd --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKTokenizer.h.svn-base @@ -0,0 +1,150 @@ +// +// ParseKit.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class PKToken; +@class PKTokenizerState; +@class PKNumberState; +@class PKQuoteState; +@class PKCommentState; +@class PKSymbolState; +@class PKWhitespaceState; +@class PKWordState; +@class PKDelimitState; +@class PKReader; + +/*! + @class PKTokenizer + @brief A tokenizer divides a string into tokens. + @details

This class is highly customizable with regard to exactly how this division occurs, but it also has defaults that are suitable for many languages. This class assumes that the character values read from the string lie in the range 0-MAXINT. For example, the Unicode value of a capital A is 65, so NSLog(@"%C", (unichar)65); prints out a capital A.

+

The behavior of a tokenizer depends on its character state table. This table is an array of 256 PKTokenizerState states. The state table decides which state to enter upon reading a character from the input string.

+

For example, by default, upon reading an 'A', a tokenizer will enter a "word" state. This means the tokenizer will ask a PKWordState object to consume the 'A', along with the characters after the 'A' that form a word. The state's responsibility is to consume characters and return a complete token.

+

The default table sets a PKSymbolState for every character from 0 to 255, and then overrides this with:

+@code + From To State + 0 ' ' whitespaceState + 'a' 'z' wordState + 'A' 'Z' wordState + 160 255 wordState + '0' '9' numberState + '-' '-' numberState + '.' '.' numberState + '"' '"' quoteState + '\'' '\'' quoteState + '/' '/' commentState +@endcode +

In addition to allowing modification of the state table, this class makes each of the states above available. Some of these states are customizable. For example, wordState allows customization of what characters can be part of a word, after the first character.

+*/ +@interface PKTokenizer : NSObject { + NSString *string; + PKReader *reader; + + NSMutableArray *tokenizerStates; + + PKNumberState *numberState; + PKQuoteState *quoteState; + PKCommentState *commentState; + PKSymbolState *symbolState; + PKWhitespaceState *whitespaceState; + PKWordState *wordState; + PKDelimitState *delimitState; +} + +/*! + @brief Convenience factory method. Sets string from which to to read to nil. + @result An initialized tokenizer. +*/ ++ (id)tokenizer; + +/*! + @brief Convenience factory method. + @param s string to read from. + @result An autoreleased initialized tokenizer. +*/ ++ (id)tokenizerWithString:(NSString *)s; + +/*! + @brief Designated Initializer. Constructs a tokenizer to read from the supplied string. + @param s string to read from. + @result An initialized tokenizer. +*/ +- (id)initWithString:(NSString *)s; + +/*! + @brief Returns the next token. + @result the next token. +*/ +- (PKToken *)nextToken; + +#ifdef TARGET_OS_SNOW_LEOPARD +/*! + @brief Enumerate tokens in this tokenizer using block + @details repeatedly executes block by passing the token returned from calling -nextToken on this tokenizer + @param block the code to execute with every token returned by calling -nextToken on this tokenizer +*/ +- (void)enumerateTokensUsingBlock:(void (^)(PKToken *tok, BOOL *stop))block; +#endif + +/*! + @brief Change the state the tokenizer will enter upon reading any character between "start" and "end". + @param state the state for this character range + @param start the "start" character. e.g. 'a' or 65. + @param end the "end" character. 'z' or 90. +*/ +- (void)setTokenizerState:(PKTokenizerState *)state from:(PKUniChar)start to:(PKUniChar)end; + +/*! + @property string + @brief The string to read from. +*/ +@property (nonatomic, retain) NSString *string; + +/*! + @property numberState + @brief The state this tokenizer uses to build numbers. +*/ +@property (nonatomic, retain) PKNumberState *numberState; + +/*! + @property quoteState + @brief The state this tokenizer uses to build quoted strings. +*/ +@property (nonatomic, retain) PKQuoteState *quoteState; + +/*! + @property commentState + @brief The state this tokenizer uses to recognize (and possibly ignore) comments. +*/ +@property (nonatomic, retain) PKCommentState *commentState; + +/*! + @property symbolState + @brief The state this tokenizer uses to recognize symbols. +*/ +@property (nonatomic, retain) PKSymbolState *symbolState; + +/*! + @property whitespaceState + @brief The state this tokenizer uses to recognize (and possibly ignore) whitespace. +*/ +@property (nonatomic, retain) PKWhitespaceState *whitespaceState; + +/*! + @property wordState + @brief The state this tokenizer uses to build words. +*/ +@property (nonatomic, retain) PKWordState *wordState; + +/*! + @property delimitState + @brief The state this tokenizer uses to build delimited strings. +*/ +@property (nonatomic, retain) PKDelimitState *delimitState; +@end diff --git a/include/ParseKit/.svn/text-base/PKTokenizerState.h.svn-base b/include/ParseKit/.svn/text-base/PKTokenizerState.h.svn-base new file mode 100644 index 0000000..820240d --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKTokenizerState.h.svn-base @@ -0,0 +1,50 @@ +// +// ParseKitState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class PKToken; +@class PKTokenizer; +@class PKReader; + +/*! + @class PKTokenizerState + @brief A PKTokenizerState returns a token, given a reader, an initial character read from the reader, and a tokenizer that is conducting an overall tokenization of the reader. + @details The tokenizer will typically have a character state table that decides which state to use, depending on an initial character. If a single character is insufficient, a state such as PKCommentState will read a second character, and may delegate to another state, such as PKSingleLineState. This prospect of delegation is the reason that the -nextToken method has a tokenizer argument. +*/ +@interface PKTokenizerState : NSObject { + NSMutableString *stringbuf; + NSUInteger offset; + PKTokenizerState *fallbackState; + NSMutableArray *fallbackStates; +} + +/*! + @brief Return a token that represents a logical piece of a reader. + @param r the reader from which to read additional characters + @param cin the character that a tokenizer used to determine to use this state + @param t the tokenizer currently powering the tokenization + @result a token that represents a logical piece of the reader +*/ +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t; + +/*! + @brief Change the state this state will defer to upon reading any character between "start" and "end". + @param state the fallback state for this character range + @param start the "start" character. e.g. 'a' or 65. + @param end the "end" character. 'z' or 90. +*/ +- (void)setFallbackState:(PKTokenizerState *)state from:(PKUniChar)start to:(PKUniChar)end; + +/*! + @property fallbackState + @brief The state this tokenizer defers to if it starts, but ultimately aborts recognizing a token +*/ +@property (nonatomic, retain) PKTokenizerState *fallbackState; +@end diff --git a/include/ParseKit/.svn/text-base/PKTrack.h.svn-base b/include/ParseKit/.svn/text-base/PKTrack.h.svn-base new file mode 100644 index 0000000..fc0005a --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKTrack.h.svn-base @@ -0,0 +1,28 @@ +// +// PKTrack.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKTrack + @brief A PKTrack is a sequence that throws a PKTrackException if the sequence begins but does not complete. + @details If -[PKTrack allMatchesFor:] begins but does not complete, it throws a PKTrackException. +*/ +@interface PKTrack : PKSequence { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKTrack parser. + @result an initialized autoreleased PKTrack parser. +*/ ++ (id)track; + ++ (id)trackWithSubparsers:(PKParser *)p1, ...; +@end diff --git a/include/ParseKit/.svn/text-base/PKTrackException.h.svn-base b/include/ParseKit/.svn/text-base/PKTrackException.h.svn-base new file mode 100644 index 0000000..8ab3d4d --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKTrackException.h.svn-base @@ -0,0 +1,25 @@ +// +// PKTrackException.h +// ParseKit +// +// Created by Todd Ditchendorf on 10/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +extern NSString * const PKTrackExceptionName; + +/*! + @class PKTrackException + @brief Signals that a parser could not match text after a specific point. + @details The userInfo for this exception contains the following keys:
+            after (NSString *) - some indication of what text was interpretable before this exception occurred
+            expected (NSString *) - some indication of what kind of thing was expected, such as a ')' token
+            found (NSString *) - the text element the thrower actually found when it expected something else
+*/ +@interface PKTrackException : NSException { + +} + +@end diff --git a/include/ParseKit/.svn/text-base/PKTypes.h.svn-base b/include/ParseKit/.svn/text-base/PKTypes.h.svn-base new file mode 100644 index 0000000..9cac91b --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKTypes.h.svn-base @@ -0,0 +1,13 @@ +/* + * PKTypes.h + * ParseKit + * + * Created by Todd Ditchendorf on 3/15/09. + * Copyright 2009 Todd Ditchendorf. All rights reserved. + * + */ + +// a UTF-16 character. signed so that it may represent -1 as well +typedef SInt32 PKUniChar; + +#define PKEOF (PKUniChar)-1 \ No newline at end of file diff --git a/include/ParseKit/.svn/text-base/PKUppercaseWord.h.svn-base b/include/ParseKit/.svn/text-base/PKUppercaseWord.h.svn-base new file mode 100644 index 0000000..24533cb --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKUppercaseWord.h.svn-base @@ -0,0 +1,16 @@ +// +// PKUppercaseWord.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKUppercaseWord : PKWord { + +} + +@end diff --git a/include/ParseKit/.svn/text-base/PKWhitespace.h.svn-base b/include/ParseKit/.svn/text-base/PKWhitespace.h.svn-base new file mode 100644 index 0000000..0bea0c1 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKWhitespace.h.svn-base @@ -0,0 +1,25 @@ +// +// PKWhitespace.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/19/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKWhitespace + @brief A PKWhitespace matches a number from a token assembly. +*/ +@interface PKWhitespace : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKWhitespace object. + @result an initialized autoreleased PKWhitespace object +*/ ++ (id)whitespace; +@end diff --git a/include/ParseKit/.svn/text-base/PKWhitespaceState.h.svn-base b/include/ParseKit/.svn/text-base/PKWhitespaceState.h.svn-base new file mode 100644 index 0000000..e780e13 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKWhitespaceState.h.svn-base @@ -0,0 +1,42 @@ +// +// PKWhitespaceState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKWhitespaceState + @brief A whitespace state ignores whitespace (such as blanks and tabs), and returns the tokenizer's next token. + @details By default, all characters from 0 to 32 are whitespace. +*/ +@interface PKWhitespaceState : PKTokenizerState { + NSMutableArray *whitespaceChars; + BOOL reportsWhitespaceTokens; +} + +/*! + @brief Informs whether the given character is recognized as whitespace (and therefore ignored) by this state. + @param cin the character to check + @result true if the given chracter is recognized as whitespace +*/ +- (BOOL)isWhitespaceChar:(PKUniChar)cin; + +/*! + @brief Establish the given character range as whitespace to ignore. + @param yn true if the given character range is whitespace + @param start the "start" character. e.g. 'a' or 65. + @param end the "end" character. 'z' or 90. +*/ +- (void)setWhitespaceChars:(BOOL)yn from:(PKUniChar)start to:(PKUniChar)end; + +/*! + @property reportsWhitespaceTokens + @brief determines whether a PKTokenizer associated with this state reports or silently consumes whitespace tokens. default is NO which causes silent consumption of whitespace chars +*/ +@property (nonatomic) BOOL reportsWhitespaceTokens; +@end diff --git a/include/ParseKit/.svn/text-base/PKWord.h.svn-base b/include/ParseKit/.svn/text-base/PKWord.h.svn-base new file mode 100644 index 0000000..2e94aa7 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKWord.h.svn-base @@ -0,0 +1,25 @@ +// +// PKWord.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKWord + @brief A PKWord matches a word from a token assembly. +*/ +@interface PKWord : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKWord object. + @result an initialized autoreleased PKWord object +*/ ++ (id)word; +@end diff --git a/include/ParseKit/.svn/text-base/PKWordState.h.svn-base b/include/ParseKit/.svn/text-base/PKWordState.h.svn-base new file mode 100644 index 0000000..7b9b0a8 --- /dev/null +++ b/include/ParseKit/.svn/text-base/PKWordState.h.svn-base @@ -0,0 +1,43 @@ +// +// PKWordState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKWordState + @brief A word state returns a word from a reader. + @details

Like other states, a tokenizer transfers the job of reading to this state, depending on an initial character. Thus, the tokenizer decides which characters may begin a word, and this state determines which characters may appear as a second or later character in a word. These are typically different sets of characters; in particular, it is typical for digits to appear as parts of a word, but not as the initial character of a word.

+

By default, the following characters may appear in a word. The method setWordChars() allows customizing this.

+@code + From To + 'a' 'z' + 'A' 'Z' + '0' '9' +@endcode +

as well as: minus sign -, underscore _, and apostrophe '.

+*/ +@interface PKWordState : PKTokenizerState { + NSMutableArray *wordChars; +} + +/*! + @brief Establish characters in the given range as valid characters for part of a word after the first character. Note that the tokenizer must determine which characters are valid as the beginning character of a word. + @param yn true if characters in the given range are word characters + @param start the "start" character. e.g. 'a' or 65. + @param end the "end" character. 'z' or 90. +*/ +- (void)setWordChars:(BOOL)yn from:(PKUniChar)start to:(PKUniChar)end; + +/*! + @brief Informs whether the given character is recognized as a word character by this state. + @param cin the character to check + @result true if the given chracter is recognized as a word character +*/ +- (BOOL)isWordChar:(PKUniChar)c; +@end diff --git a/include/ParseKit/.svn/text-base/ParseKit.h.svn-base b/include/ParseKit/.svn/text-base/ParseKit.h.svn-base new file mode 100644 index 0000000..926783f --- /dev/null +++ b/include/ParseKit/.svn/text-base/ParseKit.h.svn-base @@ -0,0 +1,82 @@ +// +// ParseKit.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/21/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +/*! + @mainpage ParseKit + ParseKit is a Mac OS X Framework written by Todd Ditchendorf in Objective-C 2.0 and released under the MIT Open Source License. + The framework is an Objective-C implementation of the tools described in "Building Parsers with Java" by Steven John Metsker. + ParseKit includes some significant additions beyond the designs from the book (many of them hinted at in the book itself) in order to enhance the framework's feature set, usefulness and ease-of-use. Other changes have been made to the designs in the book to match common Cocoa/Objective-C design patterns and conventions. + However, these changes are relatively superficial, and Metsker's book is the best documentation available for this framework. + + Classes in the ParseKit Framework offer 2 basic services of general use to Cocoa developers: + @li Tokenization via a tokenizer class + @li Parsing via a high-level parser-building toolkit + Learn more on the project site +*/ + +#import + +// io +#import +#import + +// parse +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +//chars +#import +#import +#import +#import +#import + +// tokens +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +// grammar +#import diff --git a/include/ParseKit/PKAlternation.h b/include/ParseKit/PKAlternation.h new file mode 100644 index 0000000..4545774 --- /dev/null +++ b/include/ParseKit/PKAlternation.h @@ -0,0 +1,33 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKAlternation + @brief A PKAlternation object is a collection of parsers, any one of which can successfully match against an assembly. It is basically a representation of "Logical Or" or "|". +*/ +@interface PKAlternation : PKCollectionParser { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKAlternation parser. + @result an initialized autoreleased PKAlternation parser. +*/ ++ (id)alternation; + ++ (id)alternationWithSubparsers:(PKParser *)p1, ...; +@end diff --git a/include/ParseKit/PKAny.h b/include/ParseKit/PKAny.h new file mode 100644 index 0000000..656e0cd --- /dev/null +++ b/include/ParseKit/PKAny.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKAny + @brief A PKAny matches any token from a token assembly. +*/ +@interface PKAny : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKAny object. + @result an initialized autoreleased PKAny object +*/ ++ (id)any; +@end diff --git a/include/ParseKit/PKAssembly.h b/include/ParseKit/PKAssembly.h new file mode 100644 index 0000000..274e062 --- /dev/null +++ b/include/ParseKit/PKAssembly.h @@ -0,0 +1,86 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +/*! + @class PKAssembly + @brief An Abstract class. A PKAssembly maintains a stream of language elements along with stack and target objects. + @details

Parsers use assemblers to record progress at recognizing language elements from assembly's string.

+

Note that PKAssembly is an abstract class and may not be instantiated directly. Subclasses include PKTokenAssembly and PKCharAssembly.

+*/ +@interface PKAssembly : NSObject { + NSMutableArray *stack; + id target; + NSUInteger index; + NSString *string; + NSString *defaultDelimiter; +} + +/*! + @brief Convenience factory method for initializing an autoreleased assembly. + @param s string to be worked on + @result an initialized autoreleased assembly +*/ ++ (id)assemblyWithString:(NSString *)s; + +/*! + @brief Designated Initializer. Initializes an assembly with a given string. + @details Designated Initializer. + @param s string to be worked on + @result an initialized assembly +*/ +- (id)initWithString:(NSString *)s; + +/*! + @brief Removes the object at the top of this assembly's stack and returns it. + @details Note this returns an object from this assembly's stack, not from its stream of elements (tokens or chars depending on the type of concrete PKAssembly subclass of this object). + @result the object at the top of this assembly's stack +*/ +- (id)pop; + +/*! + @brief Pushes an object onto the top of this assembly's stack. + @param object object to push +*/ +- (void)push:(id)object; + +/*! + @brief Returns true if this assembly's stack is empty. + @result true, if this assembly's stack is empty +*/ +- (BOOL)isStackEmpty; + +/*! + @brief Returns a vector of the elements on this assembly's stack that appear before a specified fence. + @details

Returns a vector of the elements on this assembly's stack that appear before a specified fence.

+

Sometimes a parser will recognize a list from within a pair of parentheses or brackets. The parser can mark the beginning of the list with a fence, and then retrieve all the items that come after the fence with this method.

+ @param fence object that indicates the limit of elements returned from this assembly's stack + @result Array of the elements above the specified fence +*/ +- (NSArray *)objectsAbove:(id)fence; + +/*! + @property stack + @brief This assembly's stack. +*/ +@property (nonatomic, readonly, retain) NSMutableArray *stack; + +/*! + @property target + @brief This assembly's target. + @details The object identified as this assembly's "target". Clients can set and retrieve a target, which can be a convenient supplement as a place to work, in addition to the assembly's stack. For example, a parser for an HTML file might use a web page object as its "target". As the parser recognizes markup commands like <head>, it could apply its findings to the target. +*/ +@property (nonatomic, retain) id target; +@end diff --git a/include/ParseKit/PKCaseInsensitiveLiteral.h b/include/ParseKit/PKCaseInsensitiveLiteral.h new file mode 100644 index 0000000..f621b3a --- /dev/null +++ b/include/ParseKit/PKCaseInsensitiveLiteral.h @@ -0,0 +1,26 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKCaseInsensitiveLiteral + @brief A PKCaselessLiteral matches a specified NSString from an assembly, disregarding case. +*/ +@interface PKCaseInsensitiveLiteral : PKLiteral { + +} + +@end diff --git a/include/ParseKit/PKChar.h b/include/ParseKit/PKChar.h new file mode 100644 index 0000000..fd48647 --- /dev/null +++ b/include/ParseKit/PKChar.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +/*! + @class PKChar + @brief A PKChar matches a character from a character assembly. + @details -[PKChar qualifies:] returns true every time, since this class assumes it is working against a PKCharacterAssembly. +*/ +@interface PKChar : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKChar parser. + @result an initialized autoreleased PKChar parser. +*/ ++ (id)char; +@end diff --git a/include/ParseKit/PKCharacterAssembly.h b/include/ParseKit/PKCharacterAssembly.h new file mode 100644 index 0000000..e34c9cb --- /dev/null +++ b/include/ParseKit/PKCharacterAssembly.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +/*! + @class PKCharacterAssembly + @brief A PKCharacterAssembly is a PKAssembly whose elements are characters. +*/ +@interface PKCharacterAssembly : PKAssembly { + +} + +@end diff --git a/include/ParseKit/PKCollectionParser.h b/include/ParseKit/PKCollectionParser.h new file mode 100644 index 0000000..488fd93 --- /dev/null +++ b/include/ParseKit/PKCollectionParser.h @@ -0,0 +1,44 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKCollectionParser + @brief An Abstract class. This class abstracts the behavior common to parsers that consist of a series of other parsers. +*/ +@interface PKCollectionParser : PKParser { + NSMutableArray *subparsers; +} + +/*! + @brief Designated Initializer. Initialize an instance of a PKCollectionParser subclass. + @param p1, ... A comma-separated list of parser objects ending with nil + @result an initialized instance of a PKCollectionParser subclass. +*/ +- (id)initWithSubparsers:(PKParser *)p1, ...; + +/*! + @brief Adds a parser to the collection. + @param p parser to add +*/ +- (void)add:(PKParser *)p; + +/*! + @property subparsers + @brief This parser's subparsers. +*/ +@property (nonatomic, readonly, retain) NSMutableArray *subparsers; +@end diff --git a/include/ParseKit/PKComment.h b/include/ParseKit/PKComment.h new file mode 100644 index 0000000..4763e04 --- /dev/null +++ b/include/ParseKit/PKComment.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKComment + @brief A PKComment matches a comment from a token assembly. +*/ +@interface PKComment : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKComment object. + @result an initialized autoreleased PKComment object +*/ ++ (id)comment; +@end diff --git a/include/ParseKit/PKCommentState.h b/include/ParseKit/PKCommentState.h new file mode 100644 index 0000000..b7c49ca --- /dev/null +++ b/include/ParseKit/PKCommentState.h @@ -0,0 +1,77 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class PKSymbolRootNode; +@class PKSingleLineCommentState; +@class PKMultiLineCommentState; + +/*! + @class PKCommentState + @brief This state will either delegate to a comment-handling state, or return a PKSymbol token with just the first char in it. + @details By default, C and C++ style comments. (// to end of line and /&0x002A; &0x002A;/) +*/ +@interface PKCommentState : PKTokenizerState { + PKSymbolRootNode *rootNode; + PKSingleLineCommentState *singleLineState; + PKMultiLineCommentState *multiLineState; + BOOL reportsCommentTokens; + BOOL balancesEOFTerminatedComments; +} + +/*! + @brief Adds the given string as a single-line comment start marker. may be multi-char. + @details single line comments begin with start and continue until the next new line character. e.g. C-style comments (// comment text) + @param start a single- or multi-character marker that should be recognized as the start of a single-line comment +*/ +- (void)addSingleLineStartMarker:(NSString *)start; + +/*! + @brief Removes the given string as a single-line comment start marker. may be multi-char. + @details If start was never added as a single-line comment start marker, this has no effect. + @param start a single- or multi-character marker that should no longer be recognized as the start of a single-line comment +*/ +- (void)removeSingleLineStartMarker:(NSString *)start; + +/*! + @brief Adds the given strings as a multi-line comment start and end markers. both may be multi-char + @details start and end may be different strings. e.g. /&0x002A; and &0x002A;/. Also, the actual comment may or may not be multi-line. + @param start a single- or multi-character marker that should be recognized as the start of a multi-line comment + @param end a single- or multi-character marker that should be recognized as the end of a multi-line comment that began with start +*/ +- (void)addMultiLineStartMarker:(NSString *)start endMarker:(NSString *)end; + +/*! + @brief Removes start and its orignal end counterpart as a multi-line comment start and end markers. + @details If start was never added as a multi-line comment start marker, this has no effect. + @param start a single- or multi-character marker that should no longer be recognized as the start of a multi-line comment +*/ +- (void)removeMultiLineStartMarker:(NSString *)start; + +/*! + @property reportsCommentTokens + @brief if true, the tokenizer associated with this state will report comment tokens, otherwise it silently consumes comments + @details if true, this state will return PKTokens of type PKTokenTypeComment. + Otherwise, it will silently consume comment text and return the next token from another of the tokenizer's states +*/ +@property (nonatomic) BOOL reportsCommentTokens; + +/*! + @property balancesEOFTerminatedComments + @brief if true, this state will append a matching comment string (&0x002A;/ [C++] or :) [XQuery]) to quotes terminated by EOF. Default is NO. +*/ +@property (nonatomic) BOOL balancesEOFTerminatedComments; +@end diff --git a/include/ParseKit/PKDelimitState.h b/include/ParseKit/PKDelimitState.h new file mode 100644 index 0000000..212053f --- /dev/null +++ b/include/ParseKit/PKDelimitState.h @@ -0,0 +1,57 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKSymbolRootNode; + +/*! + @class PKDelimitState + @brief A delimit state returns a delimited string token from a reader + @details This state will collect characters until it sees a match to the end marker that corresponds to the start marker the tokenizer used to switch to this state. +*/ +@interface PKDelimitState : PKTokenizerState { + PKSymbolRootNode *rootNode; + BOOL balancesEOFTerminatedStrings; + BOOL allowsUnbalancedStrings; + + NSMutableArray *startMarkers; + NSMutableArray *endMarkers; + NSMutableArray *characterSets; +} + +/*! + @brief Adds the given strings as a delimited string start and end markers. both may be multi-char + @details start and end may be different strings. e.g. <# and #>. + @param start a single- or multi-character marker that should be recognized as the start of a multi-line comment + @param end a single- or multi-character marker that should be recognized as the end of a multi-line comment that began with start + @param set of characters allowed to appear within the delimited string or nil to allow any non-newline characters +*/ +- (void)addStartMarker:(NSString *)start endMarker:(NSString *)end allowedCharacterSet:(NSCharacterSet *)set; + +/*! + @brief Removes start and its orignal end counterpart as a delimited string start and end markers. + @details If start was never added as a delimited string start marker, this has no effect. + @param start a single- or multi-character marker that should no longer be recognized as the start of a delimited string +*/ +- (void)removeStartMarker:(NSString *)start; + +/*! + @property balancesEOFTerminatedStrings + @brief if true, this state will append a matching end delimiter marker (e.g. --> or %>) to strings terminated by EOF. Default is NO. +*/ +@property (nonatomic) BOOL balancesEOFTerminatedStrings; + +@property (nonatomic) BOOL allowsUnbalancedStrings; +@end diff --git a/include/ParseKit/PKDelimitedString.h b/include/ParseKit/PKDelimitedString.h new file mode 100644 index 0000000..6830c22 --- /dev/null +++ b/include/ParseKit/PKDelimitedString.h @@ -0,0 +1,36 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKDelimitedString + @brief A PKDelimitedString matches a delimited string from a token assembly. +*/ +@interface PKDelimitedString : PKTerminal { + NSString *startMarker; + NSString *endMarker; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKDelimitedString object. + @result an initialized autoreleased PKDelimitedString object +*/ ++ (id)delimitedString; + ++ (id)delimitedStringWithStartMarker:(NSString *)start; + ++ (id)delimitedStringWithStartMarker:(NSString *)start endMarker:(NSString *)end; +@end diff --git a/include/ParseKit/PKDifference.h b/include/ParseKit/PKDifference.h new file mode 100644 index 0000000..2be9547 --- /dev/null +++ b/include/ParseKit/PKDifference.h @@ -0,0 +1,63 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKDifference + @brief A PKDifference matches anything its subparser would match except for anything its minus parser would match. + @details The example below would match any Word token except for true or false. + +@code + PKParser *trueParser = [PKLiteral literalWithString:@"true"]; + PKParser *falseParser = [PKLiteral literalWithString:@"false"]; + PKAlternation *reservedWords = [PKAlternation alternationWithSubparsers:trueParser, falseParser, nil]; + + PKDifference *diff = [PKDifference differenceWithSubparser:[PKWord word] minus:reservedWords]; +@endcode +*/ +@interface PKDifference : PKParser { + PKParser *subparser; + PKParser *minus; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKDifference parser. + @param subparser the parser this parser uses for matching + @param minus the parser whose matches will be exluded + @result an initialized autoreleased PKDifference parser. +*/ ++ (id)differenceWithSubparser:(PKParser *)s minus:(PKParser *)m; + +/*! + @brief Designated initializer + @param subparser the parser this parser uses for matching + @param minus the parser whose matches will be exluded + @result an initialized PKDifference parser. +*/ +- (id)initWithSubparser:(PKParser *)s minus:(PKParser *)m; + +/*! + @property subparser + @brief this parser's subparser which it will initially match against +*/ +@property (nonatomic, retain, readonly) PKParser *subparser; + +/*! + @property minus + @brief after a successful match against subparser, matches against minus will not be matched by this parser +*/ +@property (nonatomic, retain, readonly) PKParser *minus; +@end diff --git a/include/ParseKit/PKDigit.h b/include/ParseKit/PKDigit.h new file mode 100644 index 0000000..e981fa9 --- /dev/null +++ b/include/ParseKit/PKDigit.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +/*! + @class PKDigit + @brief A PKDigit matches a digit from a character assembly. + @details -[PKDitgit qualifies:] returns true if an assembly's next element is a digit. +*/ +@interface PKDigit : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKDigit parser. + @result an initialized autoreleased PKDigit parser. +*/ ++ (id)digit; +@end diff --git a/include/ParseKit/PKEmpty.h b/include/ParseKit/PKEmpty.h new file mode 100644 index 0000000..d615c05 --- /dev/null +++ b/include/ParseKit/PKEmpty.h @@ -0,0 +1,32 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKEmpty + @brief A PKEmpty parser matches any assembly once, and applies its assembler that one time. + @details

Language elements often contain empty parts. For example, a language may at some point allow a list of parameters in parentheses, and may allow an empty list. An empty parser makes it easy to match, within the parenthesis, either a list of parameters or "empty".

+*/ +@interface PKEmpty : PKParser { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKEmpty parser. + @result an initialized autoreleased PKEmpty parser. +*/ ++ (id)empty; +@end diff --git a/include/ParseKit/PKIntersection.h b/include/ParseKit/PKIntersection.h new file mode 100644 index 0000000..6eac3a5 --- /dev/null +++ b/include/ParseKit/PKIntersection.h @@ -0,0 +1,41 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKIntersection + @brief A PKIntersection matches input that matches all of its subparsers. It is basically a representation of "Logical And" or "&". + @details The example below would match any token which is both a word and matches the given regular expression pattern. + Using a PKIntersection in this case would improve performance over using just a PKPattern parser as the regular expression would be evaluated fewer times. + +@code + PKParser *pattern = [PKPattern patternWithString:@"_.+"]; + + PKIntersection *wordStartingWithUnderscore = [PKIntersection intersectionWithSubparsers:[PKWord word], pattern, nil]; +@endcode +*/ +@interface PKIntersection : PKCollectionParser { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKIntersection parser. + @result an initialized autoreleased PKIntersection parser. +*/ ++ (id)intersection; + ++ (id)intersectionWithSubparsers:(PKParser *)p1, ...; +@end diff --git a/include/ParseKit/PKLetter.h b/include/ParseKit/PKLetter.h new file mode 100644 index 0000000..596e1e1 --- /dev/null +++ b/include/ParseKit/PKLetter.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +/*! + @class PKLetter + @brief A PKLetter matches any letter from a character assembly. + @details -[PKLetter qualifies:] returns true if an assembly's next element is a letter. +*/ +@interface PKLetter : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKLetter parser. + @result an initialized autoreleased PKLetter parser. +*/ ++ (id)letter; +@end diff --git a/include/ParseKit/PKLiteral.h b/include/ParseKit/PKLiteral.h new file mode 100644 index 0000000..ae297b4 --- /dev/null +++ b/include/ParseKit/PKLiteral.h @@ -0,0 +1,34 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class PKToken; + +/*! + @class PKLiteral + @brief A PKLiteral matches a specific word from an assembly. +*/ +@interface PKLiteral : PKTerminal { + PKToken *literal; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKLiteral object with a given string. + @param s the word represented by this literal + @result an initialized autoreleased PKLiteral object representing s +*/ ++ (id)literalWithString:(NSString *)s; +@end diff --git a/include/ParseKit/PKLowercaseWord.h b/include/ParseKit/PKLowercaseWord.h new file mode 100644 index 0000000..59c91cc --- /dev/null +++ b/include/ParseKit/PKLowercaseWord.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKLowercaseWord : PKWord { + +} + +@end diff --git a/include/ParseKit/PKMultiLineCommentState.h b/include/ParseKit/PKMultiLineCommentState.h new file mode 100644 index 0000000..053f93b --- /dev/null +++ b/include/ParseKit/PKMultiLineCommentState.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKMultiLineCommentState : PKTokenizerState { + NSMutableArray *startMarkers; + NSMutableArray *endMarkers; + NSString *currentStartMarker; +} + +@end diff --git a/include/ParseKit/PKNegation.h b/include/ParseKit/PKNegation.h new file mode 100644 index 0000000..b81f70c --- /dev/null +++ b/include/ParseKit/PKNegation.h @@ -0,0 +1,52 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +/*! + @class PKNegation + @brief A PKNegation negates the matching logic of its subparser. It matches anything its subparser would not. + @details The example below would match any token except for a ?> symbol token. This could be useful for matching all tokens until an end marker (in this case a PHP end marker) is found. + +@code + PKParser *question = [PKSymbol symbolWithString:@"?>"]; + + PKNegation *n = [PKNegation negationWithSubparser:question]; +@endcode +*/ +@interface PKNegation : PKParser { + PKParser *subparser; + PKParser *difference; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKNegation parser. + @param subparser the parser whose matching logic is negated + @result an initialized autoreleased PKNegation parser. +*/ ++ (id)negationWithSubparser:(PKParser *)s; + +/*! + @brief Designated initializer + @param subparser the parser whose matching logic is negated + @result an initialized PKNegation parser. +*/ +- (id)initWithSubparser:(PKParser *)s; + +/*! + @property subparser + @brief this parser's subparser whose matching logic is negated +*/ +@property (nonatomic, retain, readonly) PKParser *subparser; +@end diff --git a/include/ParseKit/PKNumber.h b/include/ParseKit/PKNumber.h new file mode 100644 index 0000000..6aefc73 --- /dev/null +++ b/include/ParseKit/PKNumber.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKNumber + @brief A PKNumber matches a number from a token assembly. +*/ +@interface PKNumber : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKNumber object. + @result an initialized autoreleased PKNumber object +*/ ++ (id)number; +@end diff --git a/include/ParseKit/PKNumberState.h b/include/ParseKit/PKNumberState.h new file mode 100644 index 0000000..eba4a3b --- /dev/null +++ b/include/ParseKit/PKNumberState.h @@ -0,0 +1,71 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKNumberState + @brief A number state returns a number from a reader. + @details This state's idea of a number allows an optional, initial minus sign, followed by one or more digits. A decimal point and another string of digits may follow these digits. + If allowsScientificNotation is YES (default is NO) this state allows 'e' or 'E' followed by an (optionally explicityly positive or negative) integer to represent 10 to the indicated power. For example, this state will recognize 1e2 as equaling 100.

+*/ +@interface PKNumberState : PKTokenizerState { + BOOL allowsTrailingDot; + BOOL allowsScientificNotation; + BOOL allowsOctalNotation; + BOOL allowsHexadecimalNotation; + BOOL isDecimal; + BOOL isFraction; + BOOL isNegative; + BOOL isHex; + BOOL gotADigit; + NSUInteger len; + CGFloat base; + PKUniChar originalCin; + PKUniChar firstNum; + PKUniChar c; + CGFloat floatValue; + CGFloat exp; + BOOL isNegativeExp; +} + +/*! + @property allowsTrailingDot + @brief If YES, numbers are allowed to end with a trialing dot, e.g. 42. + @details default is NO +*/ +@property (nonatomic) BOOL allowsTrailingDot; + +/*! + @property allowsScientificNotation + @brief If YES, supports exponential numbers like 42.0e2, 2E+6, or 5.1e-6 + @details default is NO +*/ +@property (nonatomic) BOOL allowsScientificNotation; + +/*! + @property allowsOctalNotation + @brief If YES, supports octal numbers like 020 (16), or 0102 (66) + @details default is NO +*/ +@property (nonatomic) BOOL allowsOctalNotation; + +/*! + @property allowsHexidecimalNotation + @brief If YES, supports hex numbers like 0x20 (32), or 0xB7 (183) + @details default is NO +*/ +@property (nonatomic) BOOL allowsHexadecimalNotation; +@end diff --git a/include/ParseKit/PKParser.h b/include/ParseKit/PKParser.h new file mode 100644 index 0000000..5d70478 --- /dev/null +++ b/include/ParseKit/PKParser.h @@ -0,0 +1,173 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKAssembly; +@class PKTokenizer; + +/*! + @class PKParser + @brief An Abstract class. A PKParser is an object that recognizes the elements of a language. + @details

Each PKParser object is either a PKTerminal or a composition of other parsers. The PKTerminal class is a subclass of Parser, and is itself a hierarchy of parsers that recognize specific patterns of text. For example, a PKWord recognizes any word, and a PKLiteral matches a specific string.

+

In addition to PKTerminal, other subclasses of PKParser provide composite parsers, describing sequences, alternations, and repetitions of other parsers. For example, the following PKParser objects culminate in a good parser that recognizes a description of good coffee.

+@code + PKAlternation *adjective = [PKAlternation alternation]; + [adjective add:[PKLiteral literalWithString:@"steaming"]]; + [adjective add:[PKLiteral literalWithString:@"hot"]]; + PKSequence *good = [PKSequence sequence]; + [good add:[PKRepetition repetitionWithSubparser:adjective]]; + [good add:[PKLiteral literalWithString:@"coffee"]]; + NSString *s = @"hot hot steaming hot coffee"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + NSLog([good bestMatchFor:a]); +@endcode +

This prints out:

+@code + [hot, hot, steaming, hot, coffee] + hot/hot/steaming/hot/coffee^ +@endcode +

The parser does not match directly against a string, it matches against a PKAssembly. The resulting assembly shows its stack, with four words on it, along with its sequence of tokens, and the index at the end of these. In practice, parsers will do some work on an assembly, based on the text they recognize.

+*/ +@interface PKParser : NSObject { +#ifdef TARGET_OS_SNOW_LEOPARD + void (^assemblerBlock)(PKAssembly *); + void (^preassemblerBlock)(PKAssembly *); +#endif + id assembler; + SEL assemblerSelector; + id preassembler; + SEL preassemblerSelector; + NSString *name; + PKTokenizer *tokenizer; // PKParserFactoryAdditions ivar +} + +/*! + @brief Convenience factory method for initializing an autoreleased parser. + @result an initialized autoreleased parser. +*/ ++ (id)parser; + +/*! + @brief Sets the object and method that will work on an assembly whenever this parser successfully matches against the assembly. + @details The method represented by sel must accept a single PKAssembly argument. The signature of sel should be similar to: - (void)didMatchAssembly:(PKAssembly *)a. + @param a the assembler this parser will use to work on an assembly + @param sel a selector that assembler a responds to which will work on an assembly +*/ +- (void)setAssembler:(id)a selector:(SEL)sel; + +/*! + @brief Sets the object that will work on every assembly before matching against it. + @details Setting a preassembler is entirely optional, but sometimes useful for repetition parsers to do work on an assembly before matching against it. + @param a the assembler this parser will use to work on an assembly before matching against it. + @param sel a selector that assembler a responds to which will work on an assembly +*/ +- (void)setPreassembler:(id)a selector:(SEL)sel; + +/*! + @brief Returns the most-matched assembly in a collection. + @param inAssembly the assembly for which to find the best match + @result an assembly with the greatest possible number of elements consumed by this parser +*/ +- (PKAssembly *)bestMatchFor:(PKAssembly *)inAssembly; + +/*! + @brief Returns either nil, or a completely matched version of the supplied assembly. + @param inAssembly the assembly for which to find the complete match + @result either nil, or a completely matched version of the supplied assembly +*/ +- (PKAssembly *)completeMatchFor:(PKAssembly *)inAssembly; + +/*! + @brief Given a set of assemblies, this method matches this parser against all of them, and returns a new set of the assemblies that result from the matches. + @details

Given a set of assemblies, this method matches this parser against all of them, and returns a new set of the assemblies that result from the matches.

+

For example, consider matching the regular expression a* against the string aaab. The initial set of states is {^aaab}, where the ^ indicates how far along the assembly is. When a* matches against this initial state, it creates a new set {^aaab, a^aab, aa^ab, aaa^b}.

+ @param inAssemblies set of assemblies to match against + @result a set of assemblies that result from matching against a beginning set of assemblies +*/ +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; + +/*! + @brief Find a parser with the given name + @details Performs a depth-first recursive search (starting with this parser) for a parser or subparser with the given name. If this parser's name is name, it will be returned. + @param name of the parser to be found + @result the parser with the given name or nil if not found + */ +- (PKParser *)parserNamed:(NSString *)name; + +#ifdef TARGET_OS_SNOW_LEOPARD +/*! + @property assemblerBlock + @brief Set a block which should be executed after this parser is matched + @details

This is an alternative to calling -setAssembler:selector:.

+

Passing a block to this method will cause this parser to execute the given block after it is matched (rather than sending assembler the assemblerSelector message.

+

Using a block as the assembler will sometimes be more convient than setting an assembler object.

+ @param block of code to be executed after a parser is matched. +*/ +@property (nonatomic, retain) void (^assemblerBlock)(PKAssembly *); + +/*! + @property preassemblerBlock + @brief Set a block which should be executed before this parser is matched + @details

This is an alternative to calling -setPreassembler:selector:.

+

Passing a block to this method will cause this parser to execute the given block before it is matched (rather than sending preassembler the preassemblerSelector message.

+

Using a block as the preassembler will sometimes be more convient than setting an preassembler object.

+ @param block of code to be executed before a parser is matched. + */ +@property (nonatomic, retain) void (^preassemblerBlock)(PKAssembly *); +#endif + +/*! + @property assembler + @brief The assembler this parser will use to work on a matched assembly. + @details assembler should respond to the selector held by this parser's selector property. +*/ +@property (nonatomic, assign) id assembler; + +/*! + @property assemblerSelector + @brief The method of assembler this parser will call to work on a matched assembly. + @details The method represented by assemblerSelector must accept a single PKAssembly argument. The signature of assemblerSelector should be similar to: - (void)didMatchFoo:(PKAssembly *)a. +*/ +@property (nonatomic, assign) SEL assemblerSelector; + +/*! + @property preassembler + @brief The assembler this parser will use to work on an assembly before matching against it. + @discussion preassembler should respond to the selector held by this parser's preassemblerSelector property. +*/ +@property (nonatomic, assign) id preassembler; + +/*! + @property preAssemlerSelector + @brief The method of preassembler this parser will call to work on an assembly. + @details The method represented by preassemblerSelector must accept a single PKAssembly argument. The signature of preassemblerSelector should be similar to: - (void)didMatchAssembly:(PKAssembly *)a. +*/ +@property (nonatomic, assign) SEL preassemblerSelector; + +/*! + @property name + @brief The name of this parser. + @discussion Use this property to help in identifying a parser or for debugging purposes. +*/ +@property (nonatomic, copy) NSString *name; +@end + +@interface PKParser (PKParserFactoryAdditions) + +- (id)parse:(NSString *)s; + +- (PKTokenizer *)tokenizer; +@end + diff --git a/include/ParseKit/PKParserFactory.h b/include/ParseKit/PKParserFactory.h new file mode 100644 index 0000000..8024df6 --- /dev/null +++ b/include/ParseKit/PKParserFactory.h @@ -0,0 +1,47 @@ +// +// PKParserFactory.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2009 Todd Ditchendorf All rights reserved. +// + +#import + +@class PKGrammarParser; +@class PKToken; +@class PKTokenizer; +@class PKParser; +@class PKCollectionParser; + +void PKReleaseSubparserTree(PKParser *p); + +typedef enum { + PKParserFactoryAssemblerSettingBehaviorOnAll = 1 << 1, // Default + PKParserFactoryAssemblerSettingBehaviorOnTerminals = 1 << 2, + PKParserFactoryAssemblerSettingBehaviorOnExplicit = 1 << 3, + PKParserFactoryAssemblerSettingBehaviorOnNone = 1 << 4 +} PKParserFactoryAssemblerSettingBehavior; + +@interface PKParserFactory : NSObject { + PKParserFactoryAssemblerSettingBehavior assemblerSettingBehavior; + PKGrammarParser *grammarParser; + id assembler; + id preassembler; + NSMutableDictionary *parserTokensTable; + NSMutableDictionary *parserClassTable; + NSMutableDictionary *selectorTable; + PKToken *equals; + PKToken *curly; + PKToken *paren; + BOOL isGatheringClasses; +} ++ (id)factory; + +- (PKParser *)parserFromGrammar:(NSString *)s assembler:(id)a; +- (PKParser *)parserFromGrammar:(NSString *)s assembler:(id)a preassembler:(id)pa; + +- (PKCollectionParser *)exprParser; + +@property (nonatomic) PKParserFactoryAssemblerSettingBehavior assemblerSettingBehavior; +@end diff --git a/include/ParseKit/PKPattern.h b/include/ParseKit/PKPattern.h new file mode 100644 index 0000000..8511ff7 --- /dev/null +++ b/include/ParseKit/PKPattern.h @@ -0,0 +1,38 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import + +typedef enum { + PKPatternOptionsNone = 0, + PKPatternOptionsIgnoreCase = 2, + PKPatternOptionsComments = 4, + PKPatternOptionsMultiline = 8, + PKPatternOptionsDotAll = 32, + PKPatternOptionsUnicodeWordBoundaries = 256 +} PKPatternOptions; + +@interface PKPattern : PKTerminal { + PKPatternOptions options; +} ++ (id)patternWithString:(NSString *)s; + ++ (id)patternWithString:(NSString *)s options:(PKPatternOptions)opts; + +- (id)initWithString:(NSString *)s; + +- (id)initWithString:(NSString *)s options:(PKPatternOptions)opts; +@end diff --git a/include/ParseKit/PKQuoteState.h b/include/ParseKit/PKQuoteState.h new file mode 100644 index 0000000..580f835 --- /dev/null +++ b/include/ParseKit/PKQuoteState.h @@ -0,0 +1,32 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKQuoteState + @brief A quote state returns a quoted string token from a reader + @details This state will collect characters until it sees a match to the character that the tokenizer used to switch to this state. For example, if a tokenizer uses a double- quote character to enter this state, then -nextToken will search for another double-quote until it finds one or finds the end of the reader. +*/ +@interface PKQuoteState : PKTokenizerState { + BOOL balancesEOFTerminatedQuotes; +} + +/*! + @property balancesEOFTerminatedQuotes + @brief if true, this state will append a matching quote char (' or ") to strings terminated by EOF. Default is NO. +*/ +@property (nonatomic) BOOL balancesEOFTerminatedQuotes; +@end diff --git a/include/ParseKit/PKQuotedString.h b/include/ParseKit/PKQuotedString.h new file mode 100644 index 0000000..e1d1f4d --- /dev/null +++ b/include/ParseKit/PKQuotedString.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKQuotedString + @brief A PKQuotedString matches a quoted string, like "this one" from a token assembly. +*/ +@interface PKQuotedString : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKQuotedString object. + @result an initialized autoreleased PKQuotedString object +*/ ++ (id)quotedString; +@end diff --git a/include/ParseKit/PKReader.h b/include/ParseKit/PKReader.h new file mode 100644 index 0000000..cf9b9d1 --- /dev/null +++ b/include/ParseKit/PKReader.h @@ -0,0 +1,66 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKReader + @brief A character-stream reader that allows characters to be pushed back into the stream. +*/ +@interface PKReader : NSObject { + NSString *string; + NSUInteger offset; + NSUInteger length; +} + +/*! + @brief Designated Initializer. Initializes a reader with a given string. + @details Designated Initializer. + @param s string from which to read + @result an initialized reader +*/ +- (id)initWithString:(NSString *)s; + +/*! + @brief Read a single UTF-16 unicode character + @result The character read, or PKEOF (-1) if the end of the stream has been reached +*/ +- (PKUniChar)read; + +/*! + @brief Push back a single character + @details moves the offset back one position +*/ +- (void)unread; + +/*! + @brief Push back count characters + @param count of characters to push back + @details moves the offset back count positions +*/ +- (void)unread:(NSUInteger)count; + +/*! + @property string + @brief This reader's string. +*/ +@property (nonatomic, copy) NSString *string; + +/*! + @property offset + @brief This reader's current offset in string +*/ +@property (nonatomic, readonly) NSUInteger offset; +@end diff --git a/include/ParseKit/PKRepetition.h b/include/ParseKit/PKRepetition.h new file mode 100644 index 0000000..275f8ef --- /dev/null +++ b/include/ParseKit/PKRepetition.h @@ -0,0 +1,46 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKRepetition + @brief A PKRepetition matches its underlying parser repeatedly against a assembly. +*/ +@interface PKRepetition : PKParser { + PKParser *subparser; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKRepetition parser to repeatedly match against subparser p. + @param p the subparser against wich to repeatedly match + @result an initialized autoreleased PKRepetition parser. +*/ ++ (id)repetitionWithSubparser:(PKParser *)p; + +/*! + @brief Designated Initializer. Initialize a PKRepetition parser to repeatedly match against subparser p. + @details Designated Initializer. Initialize a PKRepetition parser to repeatedly match against subparser p. + @param p the subparser against wich to repeatedly match + @result an initialized PKRepetition parser. +*/ +- (id)initWithSubparser:(PKParser *)p; + +/*! + @property subparser + @brief this parser's subparser against which it repeatedly matches +*/ +@property (nonatomic, readonly, retain) PKParser *subparser; +@end diff --git a/include/ParseKit/PKSequence.h b/include/ParseKit/PKSequence.h new file mode 100644 index 0000000..1eb199e --- /dev/null +++ b/include/ParseKit/PKSequence.h @@ -0,0 +1,33 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKSequence + @brief A PKSequence object is a collection of parsers, all of which must in turn match against an assembly for this parser to successfully match. +*/ +@interface PKSequence : PKCollectionParser { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKSequence parser. + @result an initialized autoreleased PKSequence parser. +*/ ++ (id)sequence; + ++ (id)sequenceWithSubparsers:(PKParser *)p1, ...; +@end diff --git a/include/ParseKit/PKSingleLineCommentState.h b/include/ParseKit/PKSingleLineCommentState.h new file mode 100644 index 0000000..bd71c73 --- /dev/null +++ b/include/ParseKit/PKSingleLineCommentState.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKSingleLineCommentState : PKTokenizerState { + NSMutableArray *startMarkers; + NSString *currentStartMarker; +} + +@end diff --git a/include/ParseKit/PKSpecificChar.h b/include/ParseKit/PKSpecificChar.h new file mode 100644 index 0000000..22219ce --- /dev/null +++ b/include/ParseKit/PKSpecificChar.h @@ -0,0 +1,40 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKSpecificChar + @brief A PKSpecificChar matches a specified character from a character assembly. + @details -[PKSpecificChar qualifies:] returns true if an assembly's next element is equal to the character this object was constructed with. +*/ +@interface PKSpecificChar : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKSpecificChar parser. + @param c the character this object should match + @result an initialized autoreleased PKSpecificChar parser. +*/ ++ (id)specificCharWithChar:(PKUniChar)c; + +/*! + @brief Designated Initializer. Initializes a PKSpecificChar parser. + @param c the character this object should match + @result an initialized PKSpecificChar parser. +*/ +- (id)initWithSpecificChar:(PKUniChar)c; +@end diff --git a/include/ParseKit/PKSymbol.h b/include/ParseKit/PKSymbol.h new file mode 100644 index 0000000..32c0819 --- /dev/null +++ b/include/ParseKit/PKSymbol.h @@ -0,0 +1,40 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class PKToken; + +/*! + @class PKSymbol + @brief A PKSymbol matches a specific sequence, such as <, or <= that a tokenizer returns as a symbol. +*/ +@interface PKSymbol : PKTerminal { + PKToken *symbol; +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKSymbol object with a nil string value. + @result an initialized autoreleased PKSymbol object with a nil string value +*/ ++ (id)symbol; + +/*! + @brief Convenience factory method for initializing an autoreleased PKSymbol object with s as a string value. + @param s the string represented by this symbol + @result an initialized autoreleased PKSymbol object with s as a string value +*/ ++ (id)symbolWithString:(NSString *)s; +@end diff --git a/include/ParseKit/PKSymbolNode.h b/include/ParseKit/PKSymbolNode.h new file mode 100644 index 0000000..a0f0b2d --- /dev/null +++ b/include/ParseKit/PKSymbolNode.h @@ -0,0 +1,44 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKSymbolNode + @brief A PKSymbolNode object is a member of a tree that contains all possible prefixes of allowable symbols. + @details A PKSymbolNode object is a member of a tree that contains all possible prefixes of allowable symbols. Multi-character symbols appear in a PKSymbolNode tree with one node for each character. For example, the symbol =:~ will appear in a tree as three nodes. The first node contains an equals sign, and has a child; that child contains a colon and has a child; this third child contains a tilde, and has no children of its own. If the colon node had another child for a dollar sign character, then the tree would contain the symbol =:$. A tree of PKSymbolNode objects collaborate to read a (potentially multi-character) symbol from an input stream. A root node with no character of its own finds an initial node that represents the first character in the input. This node looks to see if the next character in the stream matches one of its children. If so, the node delegates its reading task to its child. This approach walks down the tree, pulling symbols from the input that match the path down the tree. When a node does not have a child that matches the next character, we will have read the longest possible symbol prefix. This prefix may or may not be a valid symbol. Consider a tree that has had =:~ added and has not had =: added. In this tree, of the three nodes that contain =:~, only the first and third contain complete symbols. If, say, the input contains =:a, the colon node will not have a child that matches the 'a' and so it will stop reading. The colon node has to "unread": it must push back its character, and ask its parent to unread. Unreading continues until it reaches an ancestor that represents a valid symbol. +*/ +@interface PKSymbolNode : NSObject { + NSString *ancestry; + PKSymbolNode *parent; + NSMutableDictionary *children; + PKUniChar character; + NSString *string; +} + +/*! + @brief Initializes a PKSymbolNode with the given parent, representing the given character. + @param p the parent of this node + @param c the character for this node + @result An initialized PKSymbolNode +*/ +- (id)initWithParent:(PKSymbolNode *)p character:(PKUniChar)c; + +/*! + @property ancestry + @brief The string of the mulit-character symbol this node represents. +*/ +@property (nonatomic, readonly, retain) NSString *ancestry; +@end diff --git a/include/ParseKit/PKSymbolRootNode.h b/include/ParseKit/PKSymbolRootNode.h new file mode 100644 index 0000000..d225e80 --- /dev/null +++ b/include/ParseKit/PKSymbolRootNode.h @@ -0,0 +1,48 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class PKReader; + +/*! + @class PKSymbolRootNode + @brief This class is a special case of a PKSymbolNode. + @details This class is a special case of a PKSymbolNode. A PKSymbolRootNode object has no symbol of its own, but has children that represent all possible symbols. +*/ +@interface PKSymbolRootNode : PKSymbolNode { +} + +/*! + @brief Adds the given string as a multi-character symbol. + @param s a multi-character symbol that should be recognized as a single symbol token by this state +*/ +- (void)add:(NSString *)s; + +/*! + @brief Removes the given string as a multi-character symbol. + @param s a multi-character symbol that should no longer be recognized as a single symbol token by this state + @details if s was never added as a multi-character symbol, this has no effect +*/ +- (void)remove:(NSString *)s; + +/*! + @brief Return a symbol string from a reader. + @param r the reader from which to read + @param cin the character from witch to start + @result a symbol string from a reader +*/ +- (NSString *)nextSymbol:(PKReader *)r startingWith:(PKUniChar)cin; +@end diff --git a/include/ParseKit/PKSymbolState.h b/include/ParseKit/PKSymbolState.h new file mode 100644 index 0000000..747be8c --- /dev/null +++ b/include/ParseKit/PKSymbolState.h @@ -0,0 +1,44 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class PKSymbolRootNode; + +/*! + @class PKSymbolState + @brief The idea of a symbol is a character that stands on its own, such as an ampersand or a parenthesis. + @details

The idea of a symbol is a character that stands on its own, such as an ampersand or a parenthesis. For example, when tokenizing the expression (isReady)& (isWilling) , a typical tokenizer would return 7 tokens, including one for each parenthesis and one for the ampersand. Thus a series of symbols such as )&( becomes three tokens, while a series of letters such as isReady becomes a single word token.

+

Multi-character symbols are an exception to the rule that a symbol is a standalone character. For example, a tokenizer may want less-than-or-equals to tokenize as a single token. This class provides a method for establishing which multi-character symbols an object of this class should treat as single symbols. This allows, for example, "cat <= dog" to tokenize as three tokens, rather than splitting the less-than and equals symbols into separate tokens.

+

By default, this state recognizes the following multi- character symbols: !=, :-, <=, >=

+*/ +@interface PKSymbolState : PKTokenizerState { + PKSymbolRootNode *rootNode; + NSMutableArray *addedSymbols; +} + +/*! + @brief Adds the given string as a multi-character symbol. + @param s a multi-character symbol that should be recognized as a single symbol token by this state +*/ +- (void)add:(NSString *)s; + +/*! + @brief Removes the given string as a multi-character symbol. + @details If s was never added as a multi-character symbol, this has no effect. + @param s a multi-character symbol that should no longer be recognized as a single symbol token by this state +*/ +- (void)remove:(NSString *)s; +@end diff --git a/include/ParseKit/PKTerminal.h b/include/ParseKit/PKTerminal.h new file mode 100644 index 0000000..cc4a6f5 --- /dev/null +++ b/include/ParseKit/PKTerminal.h @@ -0,0 +1,49 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class PKToken; + +/*! + @class PKTerminal + @brief An Abstract Class. A PKTerminal is a parser that is not a composition of other parsers. +*/ +@interface PKTerminal : PKParser { + NSString *string; + BOOL discardFlag; +} + +/*! + @brief Designated Initializer for all concrete PKTerminal subclasses. + @details Note this is an abtract class and this method must be called on a concrete subclass. + @param s the string matched by this parser + @result an initialized PKTerminal subclass object +*/ +- (id)initWithString:(NSString *)s; + +/*! + @brief By default, terminals push themselves upon a assembly's stack, after a successful match. This method will turn off that behavior. + @details This method returns this parser as a convenience for chainging-style usage. + @result this parser, returned for chaining/convenience +*/ +- (PKTerminal *)discard; + +/*! + @property string + @brief the string matched by this parser. +*/ +@property (nonatomic, readonly, copy) NSString *string; +@end diff --git a/include/ParseKit/PKToken.h b/include/ParseKit/PKToken.h new file mode 100644 index 0000000..a7851e4 --- /dev/null +++ b/include/ParseKit/PKToken.h @@ -0,0 +1,172 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +/*! + @typedef enum PKTokenType + @brief Indicates the type of a PKToken + @var PKTokenTypeEOF A constant indicating that the endo fo the stream has been read. + @var PKTokenTypeNumber A constant indicating that a token is a number, like 3.14. + @var PKTokenTypeQuotedString A constant indicating that a token is a quoted string, like "Launch Mi". + @var PKTokenTypeSymbol A constant indicating that a token is a symbol, like "<=". + @var PKTokenTypeWord A constant indicating that a token is a word, like cat. + @var PKTokenTypeWhitespace A constant indicating that a token is whitespace, like \t. + @var PKTokenTypeComment A constant indicating that a token is a comment, like // this is a hack. + @var PKTokenTypeDelimtedString A constant indicating that a token is a delimitedString, like <#foo>. +*/ +typedef enum { + PKTokenTypeEOF, + PKTokenTypeNumber, + PKTokenTypeQuotedString, + PKTokenTypeSymbol, + PKTokenTypeWord, + PKTokenTypeWhitespace, + PKTokenTypeComment, + PKTokenTypeDelimitedString, + PKTokenTypeAny +} PKTokenType; + +/*! + @class PKToken + @brief A token represents a logical chunk of a string. + @details For example, a typical tokenizer would break the string "1.23 <= 12.3" into three tokens: the number 1.23, a less-than-or-equal symbol, and the number 12.3. A token is a receptacle, and relies on a tokenizer to decide precisely how to divide a string into tokens. +*/ +@interface PKToken : NSObject { + CGFloat floatValue; + NSString *stringValue; + PKTokenType tokenType; + + BOOL number; + BOOL quotedString; + BOOL symbol; + BOOL word; + BOOL whitespace; + BOOL comment; + BOOL delimitedString; + + id value; + NSUInteger offset; +} + +/*! + @brief Factory method for creating a singleton PKToken used to indicate that there are no more tokens. + @result A singleton used to indicate that there are no more tokens. +*/ ++ (PKToken *)EOFToken; + +/*! + @brief Factory convenience method for creating an autoreleased token. + @param t the type of this token. + @param s the string value of this token. + @param n the number falue of this token. + @result an autoreleased initialized token. +*/ ++ (id)tokenWithTokenType:(PKTokenType)t stringValue:(NSString *)s floatValue:(CGFloat)n; + +/*! + @brief Designated initializer. Constructs a token of the indicated type and associated string or numeric values. + @param t the type of this token. + @param s the string value of this token. + @param n the number falue of this token. + @result an autoreleased initialized token. +*/ +- (id)initWithTokenType:(PKTokenType)t stringValue:(NSString *)s floatValue:(CGFloat)n; + +/*! + @brief Returns true if the supplied object is an equivalent PKToken, ignoring differences in case. + @param obj the object to compare this token to. + @result true if obj is an equivalent PKToken, ignoring differences in case. +*/ +- (BOOL)isEqualIgnoringCase:(id)obj; + +/*! + @brief Returns more descriptive textual representation than -description which may be useful for debugging puposes only. + @details Usually of format similar to: <QuotedString "Launch Mi">, <Word cat>, or <Number 3.14> + @result A textual representation including more descriptive information than -description. +*/ +- (NSString *)debugDescription; + +/*! + @property number + @brief True if this token is a number. getter=isNumber +*/ +@property (nonatomic, readonly, getter=isNumber) BOOL number; + +/*! + @property quotedString + @brief True if this token is a quoted string. getter=isQuotedString +*/ +@property (nonatomic, readonly, getter=isQuotedString) BOOL quotedString; + +/*! + @property symbol + @brief True if this token is a symbol. getter=isSymbol +*/ +@property (nonatomic, readonly, getter=isSymbol) BOOL symbol; + +/*! + @property word + @brief True if this token is a word. getter=isWord +*/ +@property (nonatomic, readonly, getter=isWord) BOOL word; + +/*! + @property whitespace + @brief True if this token is whitespace. getter=isWhitespace +*/ +@property (nonatomic, readonly, getter=isWhitespace) BOOL whitespace; + +/*! + @property comment + @brief True if this token is a comment. getter=isComment +*/ +@property (nonatomic, readonly, getter=isComment) BOOL comment; + +/*! + @property delimitedString + @brief True if this token is a delimited string. getter=isDelimitedString +*/ +@property (nonatomic, readonly, getter=isDelimitedString) BOOL delimitedString; + +/*! + @property tokenType + @brief The type of this token. +*/ +@property (nonatomic, readonly) PKTokenType tokenType; + +/*! + @property floatValue + @brief The numeric value of this token. +*/ +@property (nonatomic, readonly) CGFloat floatValue; + +/*! + @property stringValue + @brief The string value of this token. +*/ +@property (nonatomic, readonly, copy) NSString *stringValue; + +/*! + @property value + @brief Returns an object that represents the value of this token. +*/ +@property (nonatomic, readonly, copy) id value; + +/*! + @property offset + @brief The character offset of this token in the original source string. +*/ +@property (nonatomic, readonly) NSUInteger offset; +@end diff --git a/include/ParseKit/PKTokenArraySource.h b/include/ParseKit/PKTokenArraySource.h new file mode 100644 index 0000000..59f4d53 --- /dev/null +++ b/include/ParseKit/PKTokenArraySource.h @@ -0,0 +1,68 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKTokenizer; +@class PKToken; + +/*! + @class PKTokenArraySource + @brief A TokenArraySource is a handy utility that enumerates over a specified reader, returning NSArrays of PKTokens delimited by a specified delimiter. + @details For example, + +@code + NSString *s = @"I came; I saw; I left in peace;"; + + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKTokenArraySource *src = [[[PKTokenArraySource alloc] initWithTokenizer:t delimiter:@";"] autorelease]; + + while ([src hasMore]) { + NSLog(@"%@", [src nextTokenArray]); + } +@endcode + + prints out: + +@code + I came + I saw + I left in peace +@endcode +*/ +@interface PKTokenArraySource : NSObject { + PKTokenizer *tokenizer; + NSString *delimiter; + PKToken *nextToken; +} + +/*! + @brief Constructs a PKTokenArraySource that will read an NSArrays of PKTokens using the specified tokenizer, delimited by the specified delimiter. + @param tokenizer a tokenizer to read tokens from + @param delimiter the character(s) that fences off where one array of tokens ends and the next begins +*/ +- (id)initWithTokenizer:(PKTokenizer *)t delimiter:(NSString *)s; + +/*! + @brief true if the source has more arrays of tokens. + @result true, if the source has more arrays of tokens that have not yet been popped with -nextTokenArray +*/ +- (BOOL)hasMore; + +/*! + @brief Returns the next array of tokens from the source. + @result the next array of tokens from the source +*/ +- (NSArray *)nextTokenArray; +@end diff --git a/include/ParseKit/PKTokenAssembly.h b/include/ParseKit/PKTokenAssembly.h new file mode 100644 index 0000000..3d18d8f --- /dev/null +++ b/include/ParseKit/PKTokenAssembly.h @@ -0,0 +1,63 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKTokenizer; + +/*! + @class PKTokenAssembly + @brief A PKTokenAssembly is a PKAssembly whose elements are PKTokens. + @details PKTokens are, roughly, the chunks of text that a PKTokenizer returns. +*/ +@interface PKTokenAssembly : PKAssembly { + PKTokenizer *tokenizer; + NSArray *tokens; + BOOL preservesWhitespaceTokens; +} + +/*! + @brief Convenience factory method for initializing an autoreleased assembly with the tokenizer t and its string + @param t tokenizer whose string will be worked on + @result an initialized autoreleased assembly +*/ ++ (id)assemblyWithTokenizer:(PKTokenizer *)t; + +/*! + @brief Convenience factory method for initializing an autoreleased assembly with the token array a and its string + @param a token array whose string will be worked on + @result an initialized autoreleased assembly +*/ ++ (id)assemblyWithTokenArray:(NSArray *)a; + +/*! + @brief Initializes an assembly with the tokenizer t and its string + @param t tokenizer whose string will be worked on + @result an initialized assembly +*/ +- (id)initWithTokenzier:(PKTokenizer *)t; + +/*! + @brief Initializes an assembly with the token array a and its string + @param a token array whose string will be worked on + @result an initialized assembly +*/ +- (id)initWithTokenArray:(NSArray *)a; + +/*! + @property preservesWhitespaceTokens + @brief If true, whitespace tokens retreived from this assembly's tokenizier will be silently placed on this assembly's stack without being reported by -next or -peek. Default is false. +*/ +@property (nonatomic) BOOL preservesWhitespaceTokens; +@end diff --git a/include/ParseKit/PKTokenizer.h b/include/ParseKit/PKTokenizer.h new file mode 100644 index 0000000..9ed2841 --- /dev/null +++ b/include/ParseKit/PKTokenizer.h @@ -0,0 +1,156 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class PKToken; +@class PKTokenizerState; +@class PKNumberState; +@class PKQuoteState; +@class PKCommentState; +@class PKSymbolState; +@class PKWhitespaceState; +@class PKWordState; +@class PKDelimitState; +@class PKReader; + +/*! + @class PKTokenizer + @brief A tokenizer divides a string into tokens. + @details

This class is highly customizable with regard to exactly how this division occurs, but it also has defaults that are suitable for many languages. This class assumes that the character values read from the string lie in the range 0-MAXINT. For example, the Unicode value of a capital A is 65, so NSLog(@"%C", (unichar)65); prints out a capital A.

+

The behavior of a tokenizer depends on its character state table. This table is an array of 256 PKTokenizerState states. The state table decides which state to enter upon reading a character from the input string.

+

For example, by default, upon reading an 'A', a tokenizer will enter a "word" state. This means the tokenizer will ask a PKWordState object to consume the 'A', along with the characters after the 'A' that form a word. The state's responsibility is to consume characters and return a complete token.

+

The default table sets a PKSymbolState for every character from 0 to 255, and then overrides this with:

+@code + From To State + 0 ' ' whitespaceState + 'a' 'z' wordState + 'A' 'Z' wordState + 160 255 wordState + '0' '9' numberState + '-' '-' numberState + '.' '.' numberState + '"' '"' quoteState + '\'' '\'' quoteState + '/' '/' commentState +@endcode +

In addition to allowing modification of the state table, this class makes each of the states above available. Some of these states are customizable. For example, wordState allows customization of what characters can be part of a word, after the first character.

+*/ +@interface PKTokenizer : NSObject { + NSString *string; + PKReader *reader; + + NSMutableArray *tokenizerStates; + + PKNumberState *numberState; + PKQuoteState *quoteState; + PKCommentState *commentState; + PKSymbolState *symbolState; + PKWhitespaceState *whitespaceState; + PKWordState *wordState; + PKDelimitState *delimitState; +} + +/*! + @brief Convenience factory method. Sets string from which to to read to nil. + @result An initialized tokenizer. +*/ ++ (id)tokenizer; + +/*! + @brief Convenience factory method. + @param s string to read from. + @result An autoreleased initialized tokenizer. +*/ ++ (id)tokenizerWithString:(NSString *)s; + +/*! + @brief Designated Initializer. Constructs a tokenizer to read from the supplied string. + @param s string to read from. + @result An initialized tokenizer. +*/ +- (id)initWithString:(NSString *)s; + +/*! + @brief Returns the next token. + @result the next token. +*/ +- (PKToken *)nextToken; + +#ifdef TARGET_OS_SNOW_LEOPARD +/*! + @brief Enumerate tokens in this tokenizer using block + @details repeatedly executes block by passing the token returned from calling -nextToken on this tokenizer + @param block the code to execute with every token returned by calling -nextToken on this tokenizer +*/ +- (void)enumerateTokensUsingBlock:(void (^)(PKToken *tok, BOOL *stop))block; +#endif + +/*! + @brief Change the state the tokenizer will enter upon reading any character between "start" and "end". + @param state the state for this character range + @param start the "start" character. e.g. 'a' or 65. + @param end the "end" character. 'z' or 90. +*/ +- (void)setTokenizerState:(PKTokenizerState *)state from:(PKUniChar)start to:(PKUniChar)end; + +/*! + @property string + @brief The string to read from. +*/ +@property (nonatomic, retain) NSString *string; + +/*! + @property numberState + @brief The state this tokenizer uses to build numbers. +*/ +@property (nonatomic, retain) PKNumberState *numberState; + +/*! + @property quoteState + @brief The state this tokenizer uses to build quoted strings. +*/ +@property (nonatomic, retain) PKQuoteState *quoteState; + +/*! + @property commentState + @brief The state this tokenizer uses to recognize (and possibly ignore) comments. +*/ +@property (nonatomic, retain) PKCommentState *commentState; + +/*! + @property symbolState + @brief The state this tokenizer uses to recognize symbols. +*/ +@property (nonatomic, retain) PKSymbolState *symbolState; + +/*! + @property whitespaceState + @brief The state this tokenizer uses to recognize (and possibly ignore) whitespace. +*/ +@property (nonatomic, retain) PKWhitespaceState *whitespaceState; + +/*! + @property wordState + @brief The state this tokenizer uses to build words. +*/ +@property (nonatomic, retain) PKWordState *wordState; + +/*! + @property delimitState + @brief The state this tokenizer uses to build delimited strings. +*/ +@property (nonatomic, retain) PKDelimitState *delimitState; +@end diff --git a/include/ParseKit/PKTokenizerState.h b/include/ParseKit/PKTokenizerState.h new file mode 100644 index 0000000..bd30ceb --- /dev/null +++ b/include/ParseKit/PKTokenizerState.h @@ -0,0 +1,56 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class PKToken; +@class PKTokenizer; +@class PKReader; + +/*! + @class PKTokenizerState + @brief A PKTokenizerState returns a token, given a reader, an initial character read from the reader, and a tokenizer that is conducting an overall tokenization of the reader. + @details The tokenizer will typically have a character state table that decides which state to use, depending on an initial character. If a single character is insufficient, a state such as PKCommentState will read a second character, and may delegate to another state, such as PKSingleLineState. This prospect of delegation is the reason that the -nextToken method has a tokenizer argument. +*/ +@interface PKTokenizerState : NSObject { + NSMutableString *stringbuf; + NSUInteger offset; + PKTokenizerState *fallbackState; + NSMutableArray *fallbackStates; +} + +/*! + @brief Return a token that represents a logical piece of a reader. + @param r the reader from which to read additional characters + @param cin the character that a tokenizer used to determine to use this state + @param t the tokenizer currently powering the tokenization + @result a token that represents a logical piece of the reader +*/ +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t; + +/*! + @brief Change the state this state will defer to upon reading any character between "start" and "end". + @param state the fallback state for this character range + @param start the "start" character. e.g. 'a' or 65. + @param end the "end" character. 'z' or 90. +*/ +- (void)setFallbackState:(PKTokenizerState *)state from:(PKUniChar)start to:(PKUniChar)end; + +/*! + @property fallbackState + @brief The state this tokenizer defers to if it starts, but ultimately aborts recognizing a token +*/ +@property (nonatomic, retain) PKTokenizerState *fallbackState; +@end diff --git a/include/ParseKit/PKTrack.h b/include/ParseKit/PKTrack.h new file mode 100644 index 0000000..087566f --- /dev/null +++ b/include/ParseKit/PKTrack.h @@ -0,0 +1,34 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKTrack + @brief A PKTrack is a sequence that throws a PKTrackException if the sequence begins but does not complete. + @details If -[PKTrack allMatchesFor:] begins but does not complete, it throws a PKTrackException. +*/ +@interface PKTrack : PKSequence { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKTrack parser. + @result an initialized autoreleased PKTrack parser. +*/ ++ (id)track; + ++ (id)trackWithSubparsers:(PKParser *)p1, ...; +@end diff --git a/include/ParseKit/PKTrackException.h b/include/ParseKit/PKTrackException.h new file mode 100644 index 0000000..65f0fc3 --- /dev/null +++ b/include/ParseKit/PKTrackException.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +extern NSString * const PKTrackExceptionName; + +/*! + @class PKTrackException + @brief Signals that a parser could not match text after a specific point. + @details The userInfo for this exception contains the following keys:
+            after (NSString *) - some indication of what text was interpretable before this exception occurred
+            expected (NSString *) - some indication of what kind of thing was expected, such as a ')' token
+            found (NSString *) - the text element the thrower actually found when it expected something else
+*/ +@interface PKTrackException : NSException { + +} + +@end diff --git a/include/ParseKit/PKTypes.h b/include/ParseKit/PKTypes.h new file mode 100644 index 0000000..02d2d6a --- /dev/null +++ b/include/ParseKit/PKTypes.h @@ -0,0 +1,18 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// a UTF-16 character. signed so that it may represent -1 as well +typedef SInt32 PKUniChar; + +#define PKEOF (PKUniChar)-1 \ No newline at end of file diff --git a/include/ParseKit/PKUppercaseWord.h b/include/ParseKit/PKUppercaseWord.h new file mode 100644 index 0000000..1bc5e64 --- /dev/null +++ b/include/ParseKit/PKUppercaseWord.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKUppercaseWord : PKWord { + +} + +@end diff --git a/include/ParseKit/PKWhitespace.h b/include/ParseKit/PKWhitespace.h new file mode 100644 index 0000000..be0ea89 --- /dev/null +++ b/include/ParseKit/PKWhitespace.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKWhitespace + @brief A PKWhitespace matches a number from a token assembly. +*/ +@interface PKWhitespace : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKWhitespace object. + @result an initialized autoreleased PKWhitespace object +*/ ++ (id)whitespace; +@end diff --git a/include/ParseKit/PKWhitespaceState.h b/include/ParseKit/PKWhitespaceState.h new file mode 100644 index 0000000..eb698e8 --- /dev/null +++ b/include/ParseKit/PKWhitespaceState.h @@ -0,0 +1,48 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKWhitespaceState + @brief A whitespace state ignores whitespace (such as blanks and tabs), and returns the tokenizer's next token. + @details By default, all characters from 0 to 32 are whitespace. +*/ +@interface PKWhitespaceState : PKTokenizerState { + NSMutableArray *whitespaceChars; + BOOL reportsWhitespaceTokens; +} + +/*! + @brief Informs whether the given character is recognized as whitespace (and therefore ignored) by this state. + @param cin the character to check + @result true if the given chracter is recognized as whitespace +*/ +- (BOOL)isWhitespaceChar:(PKUniChar)cin; + +/*! + @brief Establish the given character range as whitespace to ignore. + @param yn true if the given character range is whitespace + @param start the "start" character. e.g. 'a' or 65. + @param end the "end" character. 'z' or 90. +*/ +- (void)setWhitespaceChars:(BOOL)yn from:(PKUniChar)start to:(PKUniChar)end; + +/*! + @property reportsWhitespaceTokens + @brief determines whether a PKTokenizer associated with this state reports or silently consumes whitespace tokens. default is NO which causes silent consumption of whitespace chars +*/ +@property (nonatomic) BOOL reportsWhitespaceTokens; +@end diff --git a/include/ParseKit/PKWord.h b/include/ParseKit/PKWord.h new file mode 100644 index 0000000..90372fe --- /dev/null +++ b/include/ParseKit/PKWord.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKWord + @brief A PKWord matches a word from a token assembly. +*/ +@interface PKWord : PKTerminal { + +} + +/*! + @brief Convenience factory method for initializing an autoreleased PKWord object. + @result an initialized autoreleased PKWord object +*/ ++ (id)word; +@end diff --git a/include/ParseKit/PKWordState.h b/include/ParseKit/PKWordState.h new file mode 100644 index 0000000..030f5d7 --- /dev/null +++ b/include/ParseKit/PKWordState.h @@ -0,0 +1,49 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKWordState + @brief A word state returns a word from a reader. + @details

Like other states, a tokenizer transfers the job of reading to this state, depending on an initial character. Thus, the tokenizer decides which characters may begin a word, and this state determines which characters may appear as a second or later character in a word. These are typically different sets of characters; in particular, it is typical for digits to appear as parts of a word, but not as the initial character of a word.

+

By default, the following characters may appear in a word. The method setWordChars() allows customizing this.

+@code + From To + 'a' 'z' + 'A' 'Z' + '0' '9' +@endcode +

as well as: minus sign -, underscore _, and apostrophe '.

+*/ +@interface PKWordState : PKTokenizerState { + NSMutableArray *wordChars; +} + +/*! + @brief Establish characters in the given range as valid characters for part of a word after the first character. Note that the tokenizer must determine which characters are valid as the beginning character of a word. + @param yn true if characters in the given range are word characters + @param start the "start" character. e.g. 'a' or 65. + @param end the "end" character. 'z' or 90. +*/ +- (void)setWordChars:(BOOL)yn from:(PKUniChar)start to:(PKUniChar)end; + +/*! + @brief Informs whether the given character is recognized as a word character by this state. + @param cin the character to check + @result true if the given chracter is recognized as a word character +*/ +- (BOOL)isWordChar:(PKUniChar)c; +@end diff --git a/include/ParseKit/ParseKit.h b/include/ParseKit/ParseKit.h new file mode 100644 index 0000000..c13608d --- /dev/null +++ b/include/ParseKit/ParseKit.h @@ -0,0 +1,88 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +/*! + @mainpage ParseKit + ParseKit is a Mac OS X Framework written by Todd Ditchendorf in Objective-C 2.0 and released under the MIT Open Source License. + The framework is an Objective-C implementation of the tools described in "Building Parsers with Java" by Steven John Metsker. + ParseKit includes some significant additions beyond the designs from the book (many of them hinted at in the book itself) in order to enhance the framework's feature set, usefulness and ease-of-use. Other changes have been made to the designs in the book to match common Cocoa/Objective-C design patterns and conventions. + However, these changes are relatively superficial, and Metsker's book is the best documentation available for this framework. + + Classes in the ParseKit Framework offer 2 basic services of general use to Cocoa developers: + @li Tokenization via a tokenizer class + @li Parsing via a high-level parser-building toolkit + Learn more on the project site +*/ + +#import + +// io +#import +#import + +// parse +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +//chars +#import +#import +#import +#import +#import + +// tokens +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +// grammar +#import diff --git a/jsdemoapp/.svn/all-wcprops b/jsdemoapp/.svn/all-wcprops new file mode 100644 index 0000000..a669369 --- /dev/null +++ b/jsdemoapp/.svn/all-wcprops @@ -0,0 +1,53 @@ +K 25 +svn:wc:ra_dav:version-url +V 34 +/svn/!svn/ver/1404/trunk/jsdemoapp +END +main.m +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/583/trunk/jsdemoapp/main.m +END +ParserTest.html +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1115/trunk/jsdemoapp/ParserTest.html +END +Test.html +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1112/trunk/jsdemoapp/Test.html +END +JSDemoAppDelegate.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1115/trunk/jsdemoapp/JSDemoAppDelegate.h +END +JSDemoApp-Info.plist +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1173/trunk/jsdemoapp/JSDemoApp-Info.plist +END +JSDemoAppDelegate.m +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1404/trunk/jsdemoapp/JSDemoAppDelegate.m +END +JSDemoAppMainMenu.xib +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1176/trunk/jsdemoapp/JSDemoAppMainMenu.xib +END +DefaultValues.plist +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/584/trunk/jsdemoapp/DefaultValues.plist +END diff --git a/jsdemoapp/.svn/entries b/jsdemoapp/.svn/entries new file mode 100644 index 0000000..b20066f --- /dev/null +++ b/jsdemoapp/.svn/entries @@ -0,0 +1,300 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/jsdemoapp +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +main.m +file + + + + +2009-01-11T18:01:14.000000Z +d0119959215a3c0e063c1080b72c21ac +2009-01-11T01:15:32.782160Z +583 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +263 + +ParserTest.html +file + + + + +2009-06-30T06:11:02.000000Z +987976a960610d216d1114cc3adf1b2c +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +734 + +Test.html +file + + + + +2009-06-30T04:56:26.000000Z +6d814de5650e5d3d5d6355fb804d3e9f +2009-06-30T05:02:01.546527Z +1112 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +721 + +JSDemoAppDelegate.h +file + + + + +2009-07-03T19:42:56.000000Z +fae5b94c26b123225dc2e7c37abd375b +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +529 + +JSDemoApp-Info.plist +file + + + + +2009-07-03T20:36:46.000000Z +08cb0d5aa8a87a6178461b262cba9015 +2009-07-03T20:39:51.719779Z +1173 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +757 + +JSDemoAppDelegate.m +file + + + + +2009-11-13T07:14:30.000000Z +11da56b751f8560a53af90ce2e14e257 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3429 + +JSDemoAppMainMenu.xib +file + + + + +2009-07-03T20:47:13.000000Z +e761ba8b1d431479386bc37e71ff4d54 +2009-07-03T20:47:45.514705Z +1176 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +162358 + +DefaultValues.plist +file + + + + +2009-01-11T18:01:14.000000Z +c816c3d5b3620a32d7833be66c12212e +2009-01-11T02:09:50.994986Z +584 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +395 + diff --git a/jsdemoapp/.svn/prop-base/JSDemoAppMainMenu.xib.svn-base b/jsdemoapp/.svn/prop-base/JSDemoAppMainMenu.xib.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jsdemoapp/.svn/prop-base/JSDemoAppMainMenu.xib.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jsdemoapp/.svn/text-base/DefaultValues.plist.svn-base b/jsdemoapp/.svn/text-base/DefaultValues.plist.svn-base new file mode 100644 index 0000000..4ecd006 --- /dev/null +++ b/jsdemoapp/.svn/text-base/DefaultValues.plist.svn-base @@ -0,0 +1,15 @@ + + + + + + WebKitDeveloperExtras + + + diff --git a/jsdemoapp/.svn/text-base/JSDemoApp-Info.plist.svn-base b/jsdemoapp/.svn/text-base/JSDemoApp-Info.plist.svn-base new file mode 100644 index 0000000..ad8f8c1 --- /dev/null +++ b/jsdemoapp/.svn/text-base/JSDemoApp-Info.plist.svn-base @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + JSDemoAppMainMenu + NSPrincipalClass + NSApplication + + diff --git a/jsdemoapp/.svn/text-base/JSDemoAppDelegate.h.svn-base b/jsdemoapp/.svn/text-base/JSDemoAppDelegate.h.svn-base new file mode 100644 index 0000000..fb52575 --- /dev/null +++ b/jsdemoapp/.svn/text-base/JSDemoAppDelegate.h.svn-base @@ -0,0 +1,24 @@ +// +// JSDemoAppDelegate.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/10/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class WebView; + +@interface JSDemoAppDelegate : NSObject { + IBOutlet NSWindow *window; + IBOutlet WebView *webView; + IBOutlet NSTextField *comboBox; +} +- (IBAction)goToLocation:(id)sender; +- (IBAction)openLocation:(id)sender; +- (IBAction)collect:(id)sender; +- (IBAction)showConsole:(id)sender; + +@property (nonatomic, retain) WebView *webView; +@end diff --git a/jsdemoapp/.svn/text-base/JSDemoAppDelegate.m.svn-base b/jsdemoapp/.svn/text-base/JSDemoAppDelegate.m.svn-base new file mode 100644 index 0000000..48c03ab --- /dev/null +++ b/jsdemoapp/.svn/text-base/JSDemoAppDelegate.m.svn-base @@ -0,0 +1,135 @@ +// +// JSDemoAppDelegate.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/10/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "JSDemoAppDelegate.h" +#import +#import + +@interface NSObject (JSDemoAppExtras) +- (id)inspector; +- (void)showConsole:(id)sender; +@end + +@interface JSDemoAppDelegate () ++ (void)setUpDefaults; +@end + +@implementation JSDemoAppDelegate + ++ (void)load { + if ([JSDemoAppDelegate class] == self) { + [self setUpDefaults]; + } +} + + ++ (void)setUpDefaults { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSString *path = [[NSBundle mainBundle] pathForResource:@"DefaultValues" ofType:@"plist"]; + id defaultValues = [NSMutableDictionary dictionaryWithContentsOfFile:path]; + [[NSUserDefaultsController sharedUserDefaultsController] setInitialValues:defaultValues]; + [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues]; + [[NSUserDefaults standardUserDefaults] synchronize]; + [pool release]; +} + + +- (id)init { + if (self = [super init]) { + + } + return self; +} + + +- (void)dealloc { + self.webView = nil; + [super dealloc]; +} + + +- (void)awakeFromNib { + NSString *path = [[NSBundle mainBundle] pathForResource:@"Test" ofType:@"html"]; + [comboBox setStringValue:[[NSURL fileURLWithPath:path] absoluteString]]; + [self goToLocation:self]; +} + + +#pragma mark - +#pragma mark Actions + +- (IBAction)openLocation:(id)sender { + [window makeFirstResponder:comboBox]; +} + + +- (IBAction)goToLocation:(id)sender { + NSString *URLString = [comboBox stringValue]; + + if (![URLString length]) { + NSBeep(); + return; + } + + if (![URLString hasPrefix:@"file://"] && ![URLString hasPrefix:@"http://"] && ![URLString hasPrefix:@"https://"]) { + URLString = [NSString stringWithFormat:@"http://%@", URLString]; + [comboBox setStringValue:URLString]; + } + + [webView setMainFrameURL:URLString]; +} + + +- (IBAction)collect:(id)sender { + JSGlobalContextRef ctx = [[webView mainFrame] globalContext]; + JSGarbageCollect(ctx); +} + + +- (IBAction)showConsole:(id)sender { + [[webView inspector] showConsole:sender]; +} + + +#pragma mark - +#pragma mark WebFrameLoadDelegate + +- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame { + if (frame != [sender mainFrame]) return; + + [window setTitle:title]; +} + + +- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame { + if (frame != [sender mainFrame]) return; + + NSString *URLString = [[[[frame provisionalDataSource] request] URL] absoluteString]; + [comboBox setStringValue:URLString]; +} + + +- (void)webView:(WebView *)sender didReceiveServerRedirectForProvisionalLoadForFrame:(WebFrame *)frame { + if (frame != [sender mainFrame]) return; + + NSString *URLString = [[[[frame provisionalDataSource] request] URL] absoluteString]; + [comboBox setStringValue:URLString]; +} + + +- (void)webView:(WebView *)sender willPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame { + [comboBox setStringValue:[URL absoluteString]]; +} + + +- (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame { + PKJSParseKitSetUpContext([[sender mainFrame] globalContext]); +} + +@synthesize webView; +@end diff --git a/jsdemoapp/.svn/text-base/JSDemoAppMainMenu.xib.svn-base b/jsdemoapp/.svn/text-base/JSDemoAppMainMenu.xib.svn-base new file mode 100644 index 0000000..8ce0b7c --- /dev/null +++ b/jsdemoapp/.svn/text-base/JSDemoAppMainMenu.xib.svn-base @@ -0,0 +1,3802 @@ + + + + 1050 + 9J61 + 677 + 949.46 + 353.00 + + YES + + + + + YES + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + NSFontManager + + + AMainMenu + + YES + + + JSDemoApp + + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + JSDemoApp + + YES + + + About JSDemoApp + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Services + + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 2147483647 + + + + + + Hide JSDemoApp + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Quit JSDemoApp + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + T3BlbiBMb2NhdGlvbuKApg + l + 1048576 + 2147483647 + + + + + + Open Recent + + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 2147483647 + + + + + + Reload + r + 1048576 + 2147483647 + + + + + + Stop Loading + . + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Find + + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 2147483647 + + + + + + Check Grammar With Spelling + + 2147483647 + + + + + + + + + Substitutions + + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 2147483647 + + + + + + Stop Speaking + + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 2147483647 + + + + + + + + + Window + + 2147483647 + + + submenuAction: + + Window + + YES + + + Show Console + c + 1572864 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bring All to Front + + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + YES + + + JSDemoApp Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 15 + 2 + {{30, 591}, {359, 258}} + 1886912512 + Window + NSWindow + View + {3.40282e+38, 3.40282e+38} + {359, 258} + + + 256 + + YES + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + + {{0, 20}, {359, 172}} + + + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + + 266 + {{240, 215}, {82, 22}} + + YES + + -1804468671 + 268436480 + + + LucidaGrande + 1.300000e+01 + 1044 + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + + + + 268 + {{20, 214}, {36, 25}} + + YES + + -2080244224 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSLeftFacingTriangleTemplate + + + + 400 + 75 + + + + + 268 + {{64, 214}, {36, 25}} + + YES + + -2080244224 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSRightFacingTriangleTemplate + + + + 400 + 75 + + + + + 268 + {{108, 214}, {36, 25}} + + YES + + -2080244224 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSRefreshTemplate + + + + 400 + 75 + + + + + 268 + {{152, 214}, {36, 25}} + + YES + + -2080244224 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSStopProgressTemplate + + + + 400 + 75 + + + + + 14 + {{0, 190}, {359, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 34 + {{0, 17}, {359, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 1289 + + {{330, 218}, {16, 16}} + + 28938 + 1.600000e+01 + 1.000000e+02 + + + + 268 + {{196, 214}, {36, 25}} + + YES + + -2080244224 + 134217728 + GC + + + -2033434369 + 163 + + + 400 + 75 + + + + {359, 258} + + + {{0, 0}, {1440, 878}} + {359, 280} + {3.40282e+38, 3.40282e+38} + + + JSDemoAppDelegate + + + + + YES + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + terminate: + + + + 369 + + + + unhideAllApplications: + + + + 370 + + + + addFontTrait: + + + + 418 + + + + addFontTrait: + + + + 419 + + + + modifyFont: + + + + 420 + + + + orderFrontFontPanel: + + + + 421 + + + + modifyFont: + + + + 422 + + + + raiseBaseline: + + + + 423 + + + + lowerBaseline: + + + + 424 + + + + copyFont: + + + + 425 + + + + subscript: + + + + 426 + + + + superscript: + + + + 427 + + + + tightenKerning: + + + + 428 + + + + underline: + + + + 429 + + + + orderFrontColorPanel: + + + + 430 + + + + useAllLigatures: + + + + 431 + + + + loosenKerning: + + + + 432 + + + + pasteFont: + + + + 433 + + + + unscript: + + + + 434 + + + + useStandardKerning: + + + + 435 + + + + useStandardLigatures: + + + + 436 + + + + turnOffLigatures: + + + + 437 + + + + turnOffKerning: + + + + 438 + + + + alignLeft: + + + + 439 + + + + alignJustified: + + + + 440 + + + + copyRuler: + + + + 441 + + + + alignCenter: + + + + 442 + + + + toggleRuler: + + + + 443 + + + + alignRight: + + + + 444 + + + + pasteRuler: + + + + 445 + + + + nextKeyView + + + + 463 + + + + nextKeyView + + + + 464 + + + + nextKeyView + + + + 465 + + + + nextKeyView + + + + 466 + + + + nextKeyView + + + + 467 + + + + initialFirstResponder + + + + 471 + + + + window + + + + 473 + + + + webView + + + + 474 + + + + comboBox + + + + 475 + + + + goBack: + + + + 476 + + + + goForward: + + + + 477 + + + + reload: + + + + 478 + + + + stopLoading: + + + + 479 + + + + goToLocation: + + + + 480 + + + + openLocation: + + + + 483 + + + + reload: + + + + 486 + + + + stopLoading: + + + + 488 + + + + animate: webView.isLoading + + + + + + animate: webView.isLoading + animate + webView.isLoading + 2 + + + 489 + + + + frameLoadDelegate + + + + 490 + + + + UIDelegate + + + + 491 + + + + policyDelegate + + + + 492 + + + + collect: + + + + 495 + + + + showConsole: + + + + 498 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + + + 373 + + + YES + + + + + + 374 + + + YES + + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + 377 + + + YES + + + + + + + + + + + + + 378 + + + + + 379 + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + YES + + + + + + + + + + + + + + + + + + + + + 387 + + + + + 388 + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + YES + + + + + + 396 + + + YES + + + + + + 397 + + + YES + + + + + + 398 + + + + + 399 + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + YES + + + + + + + + + + 404 + + + + + 405 + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + YES + + + + + + + + 410 + + + + + 411 + + + + + 412 + + + + + 413 + + + YES + + + + + + + + + 414 + + + + + 415 + + + + + 416 + + + + + 417 + + + + + 446 + + + YES + + + + Window + + + 447 + + + YES + + + + + + + + + + + + + + + 448 + + + + + 449 + + + YES + + + + + + 450 + + + + + 451 + + + + + 452 + + + YES + + + + + + 453 + + + YES + + + + + + 454 + + + YES + + + + + + 455 + + + YES + + + + + + 456 + + + + + 457 + + + + + 458 + + + + + 459 + + + + + 460 + + + + + 461 + + + + + 472 + + + + + 482 + + + + + 484 + + + 1 + + + 485 + + + 7 + + + 487 + + + 1 + + + 493 + + + YES + + + + + + 494 + + + + + 496 + + + + + 497 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBEditorWindowLastContentRect + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBEditorWindowLastContentRect + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBEditorWindowLastContentRect + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBEditorWindowLastContentRect + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBEditorWindowLastContentRect + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBPluginDependency + 373.IBPluginDependency + 374.IBEditorWindowLastContentRect + 374.IBPluginDependency + 375.IBPluginDependency + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBEditorWindowLastContentRect + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 446.IBEditorWindowLastContentRect + 446.IBWindowTemplateEditedContentRect + 446.ImportedFromIB2 + 446.NSWindowTemplate.visibleAtLaunch + 446.editorWindowContentRectSynchronizationRect + 446.windowTemplate.hasMinSize + 446.windowTemplate.minSize + 447.IBPluginDependency + 447.ImportedFromIB2 + 448.IBPluginDependency + 449.IBPluginDependency + 450.IBPluginDependency + 451.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 454.IBPluginDependency + 455.IBPluginDependency + 456.IBPluginDependency + 457.IBPluginDependency + 458.IBPluginDependency + 459.IBPluginDependency + 460.IBPluginDependency + 461.IBPluginDependency + 472.IBPluginDependency + 482.IBPluginDependency + 482.ImportedFromIB2 + 484.IBPluginDependency + 484.ImportedFromIB2 + 485.IBPluginDependency + 485.ImportedFromIB2 + 487.IBPluginDependency + 487.ImportedFromIB2 + 493.IBPluginDependency + 494.IBPluginDependency + 496.IBPluginDependency + 496.ImportedFromIB2 + 497.IBPluginDependency + 497.ImportedFromIB2 + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + {{524, 524}, {189, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{817, 764}, {132, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{895, 584}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{652, 604}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{365, 632}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{895, 584}, {153, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{895, 584}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{812, -102}, {211, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{495, 1}, {449, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{11, 977}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{762, 804}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{895, 584}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{696, 804}, {86, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{782, 564}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{88, 559}, {359, 258}} + {{88, 559}, {359, 258}} + + + {{201, 387}, {507, 413}} + + {359, 258} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{507, 664}, {218, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{610, 574}, {207, 273}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{323, 672}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 498 + + + + YES + + FirstResponder + NSObject + + openLocation: + id + + + IBUserSource + + + + + JSDemoAppDelegate + NSObject + + YES + + YES + collect: + goToLocation: + openLocation: + showConsole: + + + YES + id + id + id + id + + + + YES + + YES + comboBox + webView + window + + + YES + NSTextField + WebView + NSWindow + + + + IBProjectSource + jsdemoapp/JSDemoAppDelegate.h + + + + NSObject + + IBProjectSource + test/XMLReader.h + + + + + 0 + ../ParseKit.xcodeproj + 3 + + diff --git a/jsdemoapp/.svn/text-base/ParserTest.html.svn-base b/jsdemoapp/.svn/text-base/ParserTest.html.svn-base new file mode 100644 index 0000000..c0f7785 --- /dev/null +++ b/jsdemoapp/.svn/text-base/ParserTest.html.svn-base @@ -0,0 +1,25 @@ + diff --git a/jsdemoapp/.svn/text-base/Test.html.svn-base b/jsdemoapp/.svn/text-base/Test.html.svn-base new file mode 100644 index 0000000..bdfe4eb --- /dev/null +++ b/jsdemoapp/.svn/text-base/Test.html.svn-base @@ -0,0 +1,35 @@ + diff --git a/jsdemoapp/.svn/text-base/main.m.svn-base b/jsdemoapp/.svn/text-base/main.m.svn-base new file mode 100644 index 0000000..8aa7981 --- /dev/null +++ b/jsdemoapp/.svn/text-base/main.m.svn-base @@ -0,0 +1,14 @@ +/* + * main.m + * TDParseKit + * + * Created by Todd Ditchendorf on 1/10/09. + * Copyright 2009 Todd Ditchendorf. All rights reserved. + * + */ + +#import + +int main(int argc, char *argv[]) { + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jsdemoapp/DefaultValues.plist b/jsdemoapp/DefaultValues.plist new file mode 100644 index 0000000..4ecd006 --- /dev/null +++ b/jsdemoapp/DefaultValues.plist @@ -0,0 +1,15 @@ + + + + + + WebKitDeveloperExtras + + + diff --git a/jsdemoapp/JSDemoApp-Info.plist b/jsdemoapp/JSDemoApp-Info.plist new file mode 100644 index 0000000..ad8f8c1 --- /dev/null +++ b/jsdemoapp/JSDemoApp-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSMainNibFile + JSDemoAppMainMenu + NSPrincipalClass + NSApplication + + diff --git a/jsdemoapp/JSDemoAppDelegate.h b/jsdemoapp/JSDemoAppDelegate.h new file mode 100644 index 0000000..8e19f6a --- /dev/null +++ b/jsdemoapp/JSDemoAppDelegate.h @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class WebView; + +@interface JSDemoAppDelegate : NSObject { + IBOutlet NSWindow *window; + IBOutlet WebView *webView; + IBOutlet NSTextField *comboBox; +} +- (IBAction)goToLocation:(id)sender; +- (IBAction)openLocation:(id)sender; +- (IBAction)collect:(id)sender; +- (IBAction)showConsole:(id)sender; + +@property (nonatomic, retain) WebView *webView; +@end diff --git a/jsdemoapp/JSDemoAppDelegate.m b/jsdemoapp/JSDemoAppDelegate.m new file mode 100644 index 0000000..22e2ef8 --- /dev/null +++ b/jsdemoapp/JSDemoAppDelegate.m @@ -0,0 +1,141 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "JSDemoAppDelegate.h" +#import +#import + +@interface NSObject (JSDemoAppExtras) +- (id)inspector; +- (void)showConsole:(id)sender; +@end + +@interface JSDemoAppDelegate () ++ (void)setUpDefaults; +@end + +@implementation JSDemoAppDelegate + ++ (void)load { + if ([JSDemoAppDelegate class] == self) { + [self setUpDefaults]; + } +} + + ++ (void)setUpDefaults { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + NSString *path = [[NSBundle mainBundle] pathForResource:@"DefaultValues" ofType:@"plist"]; + id defaultValues = [NSMutableDictionary dictionaryWithContentsOfFile:path]; + [[NSUserDefaultsController sharedUserDefaultsController] setInitialValues:defaultValues]; + [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues]; + [[NSUserDefaults standardUserDefaults] synchronize]; + [pool release]; +} + + +- (id)init { + if (self = [super init]) { + + } + return self; +} + + +- (void)dealloc { + self.webView = nil; + [super dealloc]; +} + + +- (void)awakeFromNib { + NSString *path = [[NSBundle mainBundle] pathForResource:@"Test" ofType:@"html"]; + [comboBox setStringValue:[[NSURL fileURLWithPath:path] absoluteString]]; + [self goToLocation:self]; +} + + +#pragma mark - +#pragma mark Actions + +- (IBAction)openLocation:(id)sender { + [window makeFirstResponder:comboBox]; +} + + +- (IBAction)goToLocation:(id)sender { + NSString *URLString = [comboBox stringValue]; + + if (![URLString length]) { + NSBeep(); + return; + } + + if (![URLString hasPrefix:@"file://"] && ![URLString hasPrefix:@"http://"] && ![URLString hasPrefix:@"https://"]) { + URLString = [NSString stringWithFormat:@"http://%@", URLString]; + [comboBox setStringValue:URLString]; + } + + [webView setMainFrameURL:URLString]; +} + + +- (IBAction)collect:(id)sender { + JSGlobalContextRef ctx = [[webView mainFrame] globalContext]; + JSGarbageCollect(ctx); +} + + +- (IBAction)showConsole:(id)sender { + [[webView inspector] showConsole:sender]; +} + + +#pragma mark - +#pragma mark WebFrameLoadDelegate + +- (void)webView:(WebView *)sender didReceiveTitle:(NSString *)title forFrame:(WebFrame *)frame { + if (frame != [sender mainFrame]) return; + + [window setTitle:title]; +} + + +- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame { + if (frame != [sender mainFrame]) return; + + NSString *URLString = [[[[frame provisionalDataSource] request] URL] absoluteString]; + [comboBox setStringValue:URLString]; +} + + +- (void)webView:(WebView *)sender didReceiveServerRedirectForProvisionalLoadForFrame:(WebFrame *)frame { + if (frame != [sender mainFrame]) return; + + NSString *URLString = [[[[frame provisionalDataSource] request] URL] absoluteString]; + [comboBox setStringValue:URLString]; +} + + +- (void)webView:(WebView *)sender willPerformClientRedirectToURL:(NSURL *)URL delay:(NSTimeInterval)seconds fireDate:(NSDate *)date forFrame:(WebFrame *)frame { + [comboBox setStringValue:[URL absoluteString]]; +} + + +- (void)webView:(WebView *)sender didClearWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame { + PKJSParseKitSetUpContext([[sender mainFrame] globalContext]); +} + +@synthesize webView; +@end diff --git a/jsdemoapp/JSDemoAppMainMenu.xib b/jsdemoapp/JSDemoAppMainMenu.xib new file mode 100644 index 0000000..8ce0b7c --- /dev/null +++ b/jsdemoapp/JSDemoAppMainMenu.xib @@ -0,0 +1,3802 @@ + + + + 1050 + 9J61 + 677 + 949.46 + 353.00 + + YES + + + + + YES + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + NSFontManager + + + AMainMenu + + YES + + + JSDemoApp + + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + JSDemoApp + + YES + + + About JSDemoApp + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + UHJlZmVyZW5jZXPigKY + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Services + + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 2147483647 + + + + + + Hide JSDemoApp + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Quit JSDemoApp + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + T3BlbuKApg + o + 1048576 + 2147483647 + + + + + + T3BlbiBMb2NhdGlvbuKApg + l + 1048576 + 2147483647 + + + + + + Open Recent + + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 2147483647 + + + + + + Reload + r + 1048576 + 2147483647 + + + + + + Stop Loading + . + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + U2F2ZSBBc+KApg + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + UHJpbnTigKY + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Delete + + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Find + + 2147483647 + + + submenuAction: + + Find + + YES + + + RmluZOKApg + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + U2hvdyBTcGVsbGluZ+KApg + : + 1048576 + 2147483647 + + + + + + Check Spelling + ; + 1048576 + 2147483647 + + + + + + Check Spelling While Typing + + 2147483647 + + + + + + Check Grammar With Spelling + + 2147483647 + + + + + + + + + Substitutions + + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + + + + Speech + + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 2147483647 + + + + + + Stop Speaking + + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Q3VzdG9taXplIFRvb2xiYXLigKY + + 2147483647 + + + + + + + + + Window + + 2147483647 + + + submenuAction: + + Window + + YES + + + Show Console + c + 1572864 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bring All to Front + + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + YES + + + JSDemoApp Help + ? + 1048576 + 2147483647 + + + + + + + + _NSMainMenu + + + 15 + 2 + {{30, 591}, {359, 258}} + 1886912512 + Window + NSWindow + View + {3.40282e+38, 3.40282e+38} + {359, 258} + + + 256 + + YES + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + + {{0, 20}, {359, 172}} + + + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + + 266 + {{240, 215}, {82, 22}} + + YES + + -1804468671 + 268436480 + + + LucidaGrande + 1.300000e+01 + 1044 + + + YES + + 6 + System + textBackgroundColor + + 3 + MQA + + + + 6 + System + textColor + + 3 + MAA + + + + + + + 268 + {{20, 214}, {36, 25}} + + YES + + -2080244224 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSLeftFacingTriangleTemplate + + + + 400 + 75 + + + + + 268 + {{64, 214}, {36, 25}} + + YES + + -2080244224 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSRightFacingTriangleTemplate + + + + 400 + 75 + + + + + 268 + {{108, 214}, {36, 25}} + + YES + + -2080244224 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSRefreshTemplate + + + + 400 + 75 + + + + + 268 + {{152, 214}, {36, 25}} + + YES + + -2080244224 + 134217728 + Round Textured + + + -2033958657 + 163 + + NSImage + NSStopProgressTemplate + + + + 400 + 75 + + + + + 14 + {{0, 190}, {359, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 34 + {{0, 17}, {359, 5}} + + {0, 0} + + 67239424 + 0 + Box + + + + 3 + MCAwLjgwMDAwMDAxAA + + + 3 + 2 + 0 + NO + + + + 1289 + + {{330, 218}, {16, 16}} + + 28938 + 1.600000e+01 + 1.000000e+02 + + + + 268 + {{196, 214}, {36, 25}} + + YES + + -2080244224 + 134217728 + GC + + + -2033434369 + 163 + + + 400 + 75 + + + + {359, 258} + + + {{0, 0}, {1440, 878}} + {359, 280} + {3.40282e+38, 3.40282e+38} + + + JSDemoAppDelegate + + + + + YES + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + showHelp: + + + + 360 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + terminate: + + + + 369 + + + + unhideAllApplications: + + + + 370 + + + + addFontTrait: + + + + 418 + + + + addFontTrait: + + + + 419 + + + + modifyFont: + + + + 420 + + + + orderFrontFontPanel: + + + + 421 + + + + modifyFont: + + + + 422 + + + + raiseBaseline: + + + + 423 + + + + lowerBaseline: + + + + 424 + + + + copyFont: + + + + 425 + + + + subscript: + + + + 426 + + + + superscript: + + + + 427 + + + + tightenKerning: + + + + 428 + + + + underline: + + + + 429 + + + + orderFrontColorPanel: + + + + 430 + + + + useAllLigatures: + + + + 431 + + + + loosenKerning: + + + + 432 + + + + pasteFont: + + + + 433 + + + + unscript: + + + + 434 + + + + useStandardKerning: + + + + 435 + + + + useStandardLigatures: + + + + 436 + + + + turnOffLigatures: + + + + 437 + + + + turnOffKerning: + + + + 438 + + + + alignLeft: + + + + 439 + + + + alignJustified: + + + + 440 + + + + copyRuler: + + + + 441 + + + + alignCenter: + + + + 442 + + + + toggleRuler: + + + + 443 + + + + alignRight: + + + + 444 + + + + pasteRuler: + + + + 445 + + + + nextKeyView + + + + 463 + + + + nextKeyView + + + + 464 + + + + nextKeyView + + + + 465 + + + + nextKeyView + + + + 466 + + + + nextKeyView + + + + 467 + + + + initialFirstResponder + + + + 471 + + + + window + + + + 473 + + + + webView + + + + 474 + + + + comboBox + + + + 475 + + + + goBack: + + + + 476 + + + + goForward: + + + + 477 + + + + reload: + + + + 478 + + + + stopLoading: + + + + 479 + + + + goToLocation: + + + + 480 + + + + openLocation: + + + + 483 + + + + reload: + + + + 486 + + + + stopLoading: + + + + 488 + + + + animate: webView.isLoading + + + + + + animate: webView.isLoading + animate + webView.isLoading + 2 + + + 489 + + + + frameLoadDelegate + + + + 490 + + + + UIDelegate + + + + 491 + + + + policyDelegate + + + + 492 + + + + collect: + + + + 495 + + + + showConsole: + + + + 498 + + + + + YES + + 0 + + YES + + + + + + -2 + + + RmlsZSdzIE93bmVyA + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + MainMenu + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 103 + + + YES + + + + 1 + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + + + + + 75 + + + 3 + + + 80 + + + 8 + + + 78 + + + 6 + + + 72 + + + + + 82 + + + 9 + + + 124 + + + YES + + + + + + 77 + + + 5 + + + 73 + + + 1 + + + 79 + + + 7 + + + 112 + + + 10 + + + 74 + + + 2 + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 106 + + + YES + + + + 2 + + + 111 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + 1111 + + + 144 + + + + + 129 + + + 121 + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + + + 373 + + + YES + + + + + + 374 + + + YES + + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + 377 + + + YES + + + + + + + + + + + + + 378 + + + + + 379 + + + + + 380 + + + + + 381 + + + + + 382 + + + + + 383 + + + + + 384 + + + + + 385 + + + + + 386 + + + YES + + + + + + + + + + + + + + + + + + + + + 387 + + + + + 388 + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + YES + + + + + + 396 + + + YES + + + + + + 397 + + + YES + + + + + + 398 + + + + + 399 + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + YES + + + + + + + + + + 404 + + + + + 405 + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + YES + + + + + + + + 410 + + + + + 411 + + + + + 412 + + + + + 413 + + + YES + + + + + + + + + 414 + + + + + 415 + + + + + 416 + + + + + 417 + + + + + 446 + + + YES + + + + Window + + + 447 + + + YES + + + + + + + + + + + + + + + 448 + + + + + 449 + + + YES + + + + + + 450 + + + + + 451 + + + + + 452 + + + YES + + + + + + 453 + + + YES + + + + + + 454 + + + YES + + + + + + 455 + + + YES + + + + + + 456 + + + + + 457 + + + + + 458 + + + + + 459 + + + + + 460 + + + + + 461 + + + + + 472 + + + + + 482 + + + + + 484 + + + 1 + + + 485 + + + 7 + + + 487 + + + 1 + + + 493 + + + YES + + + + + + 494 + + + + + 496 + + + + + 497 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 103.IBPluginDependency + 103.ImportedFromIB2 + 106.IBEditorWindowLastContentRect + 106.IBPluginDependency + 106.ImportedFromIB2 + 106.editorWindowContentRectSynchronizationRect + 111.IBPluginDependency + 111.ImportedFromIB2 + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBEditorWindowLastContentRect + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBEditorWindowLastContentRect + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBEditorWindowLastContentRect + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBEditorWindowLastContentRect + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBPluginDependency + 373.IBPluginDependency + 374.IBEditorWindowLastContentRect + 374.IBPluginDependency + 375.IBPluginDependency + 376.IBPluginDependency + 377.IBPluginDependency + 378.IBPluginDependency + 379.IBPluginDependency + 380.IBPluginDependency + 381.IBPluginDependency + 382.IBPluginDependency + 383.IBPluginDependency + 384.IBPluginDependency + 385.IBPluginDependency + 386.IBEditorWindowLastContentRect + 386.IBPluginDependency + 387.IBPluginDependency + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 446.IBEditorWindowLastContentRect + 446.IBWindowTemplateEditedContentRect + 446.ImportedFromIB2 + 446.NSWindowTemplate.visibleAtLaunch + 446.editorWindowContentRectSynchronizationRect + 446.windowTemplate.hasMinSize + 446.windowTemplate.minSize + 447.IBPluginDependency + 447.ImportedFromIB2 + 448.IBPluginDependency + 449.IBPluginDependency + 450.IBPluginDependency + 451.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 454.IBPluginDependency + 455.IBPluginDependency + 456.IBPluginDependency + 457.IBPluginDependency + 458.IBPluginDependency + 459.IBPluginDependency + 460.IBPluginDependency + 461.IBPluginDependency + 472.IBPluginDependency + 482.IBPluginDependency + 482.ImportedFromIB2 + 484.IBPluginDependency + 484.ImportedFromIB2 + 485.IBPluginDependency + 485.ImportedFromIB2 + 487.IBPluginDependency + 487.ImportedFromIB2 + 493.IBPluginDependency + 494.IBPluginDependency + 496.IBPluginDependency + 496.ImportedFromIB2 + 497.IBPluginDependency + 497.ImportedFromIB2 + 5.IBPluginDependency + 5.ImportedFromIB2 + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilderKit + com.apple.InterfaceBuilder.CocoaPlugin + + {{524, 524}, {189, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{596, 852}, {216, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{817, 764}, {132, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{895, 584}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{652, 604}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{365, 632}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{895, 584}, {153, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{895, 584}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{812, -102}, {211, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{495, 1}, {449, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{11, 977}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{762, 804}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{895, 584}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{696, 804}, {86, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{782, 564}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{88, 559}, {359, 258}} + {{88, 559}, {359, 258}} + + + {{201, 387}, {507, 413}} + + {359, 258} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{507, 664}, {218, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{610, 574}, {207, 273}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{323, 672}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + YES + + + YES + + + + + YES + + YES + + + YES + + + + 498 + + + + YES + + FirstResponder + NSObject + + openLocation: + id + + + IBUserSource + + + + + JSDemoAppDelegate + NSObject + + YES + + YES + collect: + goToLocation: + openLocation: + showConsole: + + + YES + id + id + id + id + + + + YES + + YES + comboBox + webView + window + + + YES + NSTextField + WebView + NSWindow + + + + IBProjectSource + jsdemoapp/JSDemoAppDelegate.h + + + + NSObject + + IBProjectSource + test/XMLReader.h + + + + + 0 + ../ParseKit.xcodeproj + 3 + + diff --git a/jsdemoapp/ParserTest.html b/jsdemoapp/ParserTest.html new file mode 100644 index 0000000..c0f7785 --- /dev/null +++ b/jsdemoapp/ParserTest.html @@ -0,0 +1,25 @@ + diff --git a/jsdemoapp/Test.html b/jsdemoapp/Test.html new file mode 100644 index 0000000..bdfe4eb --- /dev/null +++ b/jsdemoapp/Test.html @@ -0,0 +1,35 @@ + diff --git a/jsdemoapp/main.m b/jsdemoapp/main.m new file mode 100644 index 0000000..8aa7981 --- /dev/null +++ b/jsdemoapp/main.m @@ -0,0 +1,14 @@ +/* + * main.m + * TDParseKit + * + * Created by Todd Ditchendorf on 1/10/09. + * Copyright 2009 Todd Ditchendorf. All rights reserved. + * + */ + +#import + +int main(int argc, char *argv[]) { + return NSApplicationMain(argc, (const char **) argv); +} diff --git a/jssrc/.svn/all-wcprops b/jssrc/.svn/all-wcprops new file mode 100644 index 0000000..6abcfa5 --- /dev/null +++ b/jssrc/.svn/all-wcprops @@ -0,0 +1,455 @@ +K 25 +svn:wc:ra_dav:version-url +V 30 +/svn/!svn/ver/1404/trunk/jssrc +END +PKJSWhitespaceState.m +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1123/trunk/jssrc/PKJSWhitespaceState.m +END +PKJSCommentState.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1123/trunk/jssrc/PKJSCommentState.h +END +PKJSQuoteState.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1123/trunk/jssrc/PKJSQuoteState.m +END +PKJSCommentState.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1123/trunk/jssrc/PKJSCommentState.m +END +PKJSCollectionParser.h +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1123/trunk/jssrc/PKJSCollectionParser.h +END +PKJSTokenizer.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1123/trunk/jssrc/PKJSTokenizer.h +END +PKJSValueHolder.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1121/trunk/jssrc/PKJSValueHolder.h +END +PKJSCollectionParser.m +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1123/trunk/jssrc/PKJSCollectionParser.m +END +PKJSPattern.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1123/trunk/jssrc/PKJSPattern.h +END +PKJSTokenizer.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1123/trunk/jssrc/PKJSTokenizer.m +END +PKJSValueHolder.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1121/trunk/jssrc/PKJSValueHolder.m +END +PKJSRepetition.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1123/trunk/jssrc/PKJSRepetition.h +END +PKJSPattern.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1190/trunk/jssrc/PKJSPattern.m +END +PKJSRepetition.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1123/trunk/jssrc/PKJSRepetition.m +END +JSParseKit.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1167/trunk/jssrc/JSParseKit.h +END +PKJSNumberState.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1123/trunk/jssrc/PKJSNumberState.h +END +JSParseKit.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1123/trunk/jssrc/JSParseKit.m +END +PKJSNumberState.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1123/trunk/jssrc/PKJSNumberState.m +END +PKJSUtils.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1123/trunk/jssrc/PKJSUtils.h +END +PKJSComment.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1123/trunk/jssrc/PKJSComment.h +END +PKJSTrack.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1123/trunk/jssrc/PKJSTrack.h +END +PKJSUtils.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1126/trunk/jssrc/PKJSUtils.m +END +PKJSSymbol.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1123/trunk/jssrc/PKJSSymbol.h +END +PKJSComment.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1123/trunk/jssrc/PKJSComment.m +END +PKJSTrack.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1123/trunk/jssrc/PKJSTrack.m +END +PKJSSymbol.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1123/trunk/jssrc/PKJSSymbol.m +END +PKJSAssemblerAdapter.h +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1276/trunk/jssrc/PKJSAssemblerAdapter.h +END +PKJSAssembly.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1121/trunk/jssrc/PKJSAssembly.h +END +PKJSAssemblerAdapter.m +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1383/trunk/jssrc/PKJSAssemblerAdapter.m +END +PKJSAssembly.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1123/trunk/jssrc/PKJSAssembly.m +END +PKJSAny.h +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1123/trunk/jssrc/PKJSAny.h +END +PKJSDelimitState.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1123/trunk/jssrc/PKJSDelimitState.h +END +PKJSQuotedString.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1123/trunk/jssrc/PKJSQuotedString.h +END +PKJSCharacterAssembly.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1122/trunk/jssrc/PKJSCharacterAssembly.h +END +PKJSLiteral.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1123/trunk/jssrc/PKJSLiteral.h +END +PKJSAny.m +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1123/trunk/jssrc/PKJSAny.m +END +PKJSDelimitState.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1123/trunk/jssrc/PKJSDelimitState.m +END +PKJSQuotedString.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1123/trunk/jssrc/PKJSQuotedString.m +END +PKJSEmpty.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1123/trunk/jssrc/PKJSEmpty.h +END +PKJSCharacterAssembly.m +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1404/trunk/jssrc/PKJSCharacterAssembly.m +END +PKJSLiteral.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1123/trunk/jssrc/PKJSLiteral.m +END +PKJSEmpty.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1123/trunk/jssrc/PKJSEmpty.m +END +PKJSUtils_macros.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1126/trunk/jssrc/PKJSUtils_macros.h +END +PKJSSequence.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1123/trunk/jssrc/PKJSSequence.h +END +PKJSTerminal.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1123/trunk/jssrc/PKJSTerminal.h +END +PKJSWord.h +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1123/trunk/jssrc/PKJSWord.h +END +PKJSWordState.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1123/trunk/jssrc/PKJSWordState.h +END +PKJSSequence.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1123/trunk/jssrc/PKJSSequence.m +END +PKJSWord.m +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1123/trunk/jssrc/PKJSWord.m +END +PKJSToken.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1123/trunk/jssrc/PKJSToken.h +END +PKJSTerminal.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1123/trunk/jssrc/PKJSTerminal.m +END +PKJSAlternation.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1123/trunk/jssrc/PKJSAlternation.h +END +PKJSWordState.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1123/trunk/jssrc/PKJSWordState.m +END +PKJSUppercaseWord.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1123/trunk/jssrc/PKJSUppercaseWord.h +END +PKJSAlternation.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1123/trunk/jssrc/PKJSAlternation.m +END +PKJSToken.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1123/trunk/jssrc/PKJSToken.m +END +PKJSUppercaseWord.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1123/trunk/jssrc/PKJSUppercaseWord.m +END +PKJSParser.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1123/trunk/jssrc/PKJSParser.h +END +PKJSNum.h +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1123/trunk/jssrc/PKJSNum.h +END +PKJSParser.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1276/trunk/jssrc/PKJSParser.m +END +PKJSNum.m +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1177/trunk/jssrc/PKJSNum.m +END +PKJSSymbolState.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1123/trunk/jssrc/PKJSSymbolState.h +END +PKJSCaseInsensitiveLiteral.h +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1123/trunk/jssrc/PKJSCaseInsensitiveLiteral.h +END +PKJSSymbolState.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1123/trunk/jssrc/PKJSSymbolState.m +END +PKJSTokenizerState.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1123/trunk/jssrc/PKJSTokenizerState.h +END +PKJSCaseInsensitiveLiteral.m +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1123/trunk/jssrc/PKJSCaseInsensitiveLiteral.m +END +PKJSLowercaseWord.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1123/trunk/jssrc/PKJSLowercaseWord.h +END +PKJSTokenAssembly.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1383/trunk/jssrc/PKJSTokenAssembly.h +END +PKJSTokenizerState.m +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1123/trunk/jssrc/PKJSTokenizerState.m +END +PKJSLowercaseWord.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1123/trunk/jssrc/PKJSLowercaseWord.m +END +PKJSTokenAssembly.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1404/trunk/jssrc/PKJSTokenAssembly.m +END +PKJSDelimitedString.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1123/trunk/jssrc/PKJSDelimitedString.h +END +PKJSDelimitedString.m +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1123/trunk/jssrc/PKJSDelimitedString.m +END +PKJSWhitespaceState.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1123/trunk/jssrc/PKJSWhitespaceState.h +END +PKJSQuoteState.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1123/trunk/jssrc/PKJSQuoteState.h +END diff --git a/jssrc/.svn/entries b/jssrc/.svn/entries new file mode 100644 index 0000000..1c24420 --- /dev/null +++ b/jssrc/.svn/entries @@ -0,0 +1,2578 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/jssrc +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +PKJSWhitespaceState.m +file + + + + +2009-06-30T07:08:45.000000Z +adc56d219f02635a02d7c8dec8248ae4 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +4237 + +PKJSQuoteState.m +file + + + + +2009-06-30T07:08:45.000000Z +5b9e2e890e70292c046833580cf0a534 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2704 + +PKJSCommentState.h +file + + + + +2009-06-30T07:08:45.000000Z +073e85ebab7e87ed6ba2c264efdf29a8 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +438 + +PKJSCommentState.m +file + + + + +2009-06-30T07:08:45.000000Z +c03ab48282d5bf479bad9a0febc36f9f +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +5933 + +PKJSCollectionParser.h +file + + + + +2009-06-30T07:13:32.000000Z +d0f62099f9913227e79c8a1c9f3eeb21 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +324 + +PKJSValueHolder.h +file + + + + +2009-07-03T19:42:56.000000Z +e73b99e38d5f450df028817da89db67f +2009-06-30T06:58:43.669534Z +1121 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +471 + +PKJSTokenizer.h +file + + + + +2009-06-30T07:08:45.000000Z +43e7d6697a3a74cf9fd0b6f02634554f +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +426 + +PKJSPattern.h +file + + + + +2009-06-30T07:15:42.000000Z +d8848011010892483f8e5388c7b84ef1 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +418 + +PKJSCollectionParser.m +file + + + + +2009-06-30T07:13:32.000000Z +97113c6a18b2d8ffd561a302dd0e04da +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2017 + +PKJSValueHolder.m +file + + + + +2009-06-30T06:57:08.000000Z +11dd59ba02b5ef162338cd30194d8bba +2009-06-30T06:58:43.669534Z +1121 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +474 + +PKJSTokenizer.m +file + + + + +2009-06-30T07:08:45.000000Z +9ffc87db099cb31ba425a41586400a66 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +8639 + +PKJSPattern.m +file + + + + +2009-07-10T08:08:29.000000Z +58884de3ea9f1ab66ef04a08e3e4dd41 +2009-07-07T18:57:37.377581Z +1190 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2250 + +PKJSRepetition.h +file + + + + +2009-06-30T07:13:32.000000Z +24d6471ed6dce64d63e6056efdd53aed +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +431 + +JSParseKit.h +file + + + + +2009-07-03T19:23:18.000000Z +517a2a6d4e490d936272659d07125029 +2009-07-03T19:25:24.801046Z +1167 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +267 + +PKJSRepetition.m +file + + + + +2009-06-30T07:13:32.000000Z +48978e2c1f53486262f74ae95d0ad6e1 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1950 + +PKJSNumberState.h +file + + + + +2009-06-30T07:08:45.000000Z +52426bc24bd277801a3cbc45a8b63f66 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +434 + +JSParseKit.m +file + + + + +2009-06-30T07:09:16.000000Z +4441c898e9877ae10df239d54873bc20 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +5418 + +PKJSNumberState.m +file + + + + +2009-06-30T07:08:45.000000Z +2afae062d3ada0e74acde9fef4dd0c15 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2670 + +PKJSUtils.h +file + + + + +2009-06-30T07:17:10.000000Z +fb59dcee5ae773870ad825ef8ef67a6a +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1652 + +PKJSComment.h +file + + + + +2009-06-30T07:15:22.000000Z +c2f93ed49122daa284381da69d3f4309 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +419 + +PKJSTrack.h +file + + + + +2009-06-30T07:13:32.000000Z +64c983c98250bb63e0e5cb4e46285d64 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +411 + +PKJSUtils.m +file + + + + +2009-06-30T07:35:04.000000Z +94957eef18676ecf03d713fe1df6a2e2 +2009-06-30T07:36:06.027198Z +1126 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +8965 + +PKJSSymbol.h +file + + + + +2009-06-30T07:16:04.000000Z +0651c09a0041d95ce9c0f53715ef7cf5 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +415 + +PKJSComment.m +file + + + + +2009-06-30T07:15:26.000000Z +3a8eece7f2dc7e310c3f5c97678e3d34 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1559 + +PKJSTrack.m +file + + + + +2009-06-30T07:13:32.000000Z +ed12be85b7c1aa0d289aab064ddb85d9 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1523 + +PKJSSymbol.m +file + + + + +2009-06-30T07:16:09.000000Z +7ff5404cb2e9a10abc5ca362e31c5b9e +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1664 + +PKJSAssemblerAdapter.h +file + + + + +2009-08-06T04:02:07.000000Z +41444b77ab65e502ad261dfa5975ec62 +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +490 + +PKJSAssembly.h +file + + + + +2009-06-30T06:54:21.000000Z +7d076a8b90d542248e0438a20c488a9b +2009-06-30T06:58:43.669534Z +1121 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +291 + +PKJSAssemblerAdapter.m +file + + + + +2009-09-17T22:53:00.000000Z +0876d5e525e209c523981819686d8b38 +2009-09-17T22:53:43.141543Z +1383 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1804 + +PKJSAssembly.m +file + + + + +2009-06-30T07:17:10.000000Z +c073dd785dfdf060ceed60ebdbef66fe +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +4956 + +PKJSAny.h +file + + + + +2009-06-30T07:13:32.000000Z +0a721c037aeaae98902e5d19798af107 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +403 + +PKJSDelimitState.h +file + + + + +2009-06-30T07:08:45.000000Z +3131de90921b550ba309112f0ae949f8 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +438 + +PKJSQuotedString.h +file + + + + +2009-06-30T07:15:52.000000Z +54559ff1843288776aa7e380480b2acb +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +439 + +PKJSLiteral.h +file + + + + +2009-06-30T07:14:30.000000Z +1ae3cdb21fd794f4a5cd29596e2119f9 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +417 + +PKJSAny.m +file + + + + +2009-06-30T07:13:32.000000Z +2f3fe0ad37a33d27649ad452c797324d +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1487 + +PKJSCharacterAssembly.h +file + + + + +2009-06-30T07:01:22.000000Z +de6166fbce0277034a66abcdb0a1af0a +2009-06-30T07:02:05.278274Z +1122 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +459 + +PKJSDelimitState.m +file + + + + +2009-06-30T07:08:45.000000Z +8d166674d8bb673ea4f2ca1025367748 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3460 + +PKJSQuotedString.m +file + + + + +2009-06-30T07:15:56.000000Z +443f24e549e932b8de7af7c44d4b71e2 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1649 + +PKJSEmpty.h +file + + + + +2009-06-30T07:13:32.000000Z +d599eea24b94f1ae78ec4677e7ee6bbe +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +411 + +PKJSLiteral.m +file + + + + +2009-06-30T07:14:35.000000Z +b8c7f96c54ed5313da0c5c933faba8a7 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1686 + +PKJSCharacterAssembly.m +file + + + + +2009-11-13T07:14:30.000000Z +af6c11d42ff67a1e6911a6f2c1cb353a +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +4512 + +PKJSEmpty.m +file + + + + +2009-06-30T07:13:32.000000Z +b548e62705c202ec338bef5c7cf9459b +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1523 + +PKJSUtils_macros.h +file + + + + +2009-06-30T07:35:04.000000Z +81964ff0c06ab7be038a562ebacb208f +2009-06-30T07:36:06.027198Z +1126 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1120 + +PKJSSequence.h +file + + + + +2009-06-30T07:13:32.000000Z +ce075c5b1704d409c15f7c07ff08c84b +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +423 + +PKJSWord.h +file + + + + +2009-06-30T07:16:24.000000Z +6e435c1fae3f746b2fb17e5519a8f3f3 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +407 + +PKJSTerminal.h +file + + + + +2009-06-30T07:13:32.000000Z +e5e99870da01e7cd64a8d44c9d579570 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +292 + +PKJSWordState.h +file + + + + +2009-06-30T07:08:45.000000Z +da748defc13e08b42a187e067a279950 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +426 + +PKJSSequence.m +file + + + + +2009-06-30T07:13:32.000000Z +9e8741ce982fc7943de8ef0936b4d142 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1593 + +PKJSAlternation.h +file + + + + +2009-06-30T07:13:32.000000Z +c7441a796cabb8bffaeadd8dffa6eb39 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +435 + +PKJSTerminal.m +file + + + + +2009-06-30T07:13:32.000000Z +e972f82db848466691a0ceb1cb269ccc +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1720 + +PKJSWord.m +file + + + + +2009-06-30T07:16:28.000000Z +14881f86c81a5d586f2ba01110ecce9b +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1505 + +PKJSToken.h +file + + + + +2009-06-30T07:08:45.000000Z +79d27ac328a7daed14f7a50df419698c +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +649 + +PKJSWordState.m +file + + + + +2009-06-30T07:08:45.000000Z +03825aa5d584a6e0574fd02867163ebe +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +3241 + +PKJSUppercaseWord.h +file + + + + +2009-06-30T07:16:15.000000Z +6f8b82179d901d9ea1ae6b4a5684617f +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +443 + +PKJSAlternation.m +file + + + + +2009-06-30T07:13:32.000000Z +e3ea1ab22f12e1d9f2fdc1ff901a1ec0 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1647 + +PKJSToken.m +file + + + + +2009-06-30T07:08:45.000000Z +8363cce72bd9809467308434898c713b +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +6242 + +PKJSUppercaseWord.m +file + + + + +2009-06-30T07:16:20.000000Z +dbdd2fc3f27ddd4a026de530f0de0d11 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1796 + +PKJSParser.h +file + + + + +2009-06-30T07:13:32.000000Z +72478186f6aa5b452d5b893dcd237769 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +286 + +PKJSNum.h +file + + + + +2009-06-30T07:14:50.000000Z +c4a8707715fa8fd4d2744ca0d9edc69a +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +403 + +PKJSParser.m +file + + + + +2009-08-06T04:02:08.000000Z +562faf8085c2bedfa9d5300330f11131 +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +5401 + +PKJSNum.m +file + + + + +2009-07-03T21:56:32.000000Z +9f057b786d8add8d57b488a5bef52bb4 +2009-07-03T22:22:49.496142Z +1177 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1496 + +PKJSSymbolState.h +file + + + + +2009-06-30T07:08:45.000000Z +2ea7428cd99a7ab24a7050ecc546cc96 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +434 + +PKJSCaseInsensitiveLiteral.h +file + + + + +2009-06-30T07:15:31.000000Z +664f969300da66d28bd2e710eba46cc4 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +494 + +PKJSSymbolState.m +file + + + + +2009-06-30T07:08:45.000000Z +1abcbd7fd78d56408976f9da06ebd45d +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +3042 + +PKJSTokenizerState.h +file + + + + +2009-06-30T07:08:45.000000Z +a6c2c1a2afbc5b6e87f5a74acb49e52c +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +309 + +PKJSCaseInsensitiveLiteral.m +file + + + + +2009-06-30T07:15:36.000000Z +a5b6a57bc7a9375187a3b35a4c931ecd +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1990 + +PKJSLowercaseWord.h +file + + + + +2009-06-30T07:14:39.000000Z +a1bdd9ce5a21a2bb7f75eb16f13a144a +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +443 + +PKJSTokenAssembly.h +file + + + + +2009-09-17T22:51:52.000000Z +581ddb46340252ae15f37296cf8db65b +2009-09-17T22:53:43.141543Z +1383 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +442 + +PKJSTokenizerState.m +file + + + + +2009-06-30T07:08:45.000000Z +817e530605e37a92bef59e9a6e56b5eb +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1476 + +PKJSTokenAssembly.m +file + + + + +2009-11-13T07:14:30.000000Z +d498e42a3cb6c8eb9ed99e3206c2bcad +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +4214 + +PKJSLowercaseWord.m +file + + + + +2009-06-30T07:14:46.000000Z +4abf12aa4dc2678b60feab6417d4eaf7 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1796 + +PKJSDelimitedString.h +file + + + + +2009-06-30T07:15:08.000000Z +022b65237cb0fdcda2a12de72b57e2a5 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +450 + +PKJSDelimitedString.m +file + + + + +2009-06-30T07:15:13.000000Z +1f3318390344b46ada8f50bed9415b76 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1841 + +PKJSWhitespaceState.h +file + + + + +2009-06-30T07:08:45.000000Z +2285fa200c75530cf8143a11e20d7d73 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +450 + +PKJSQuoteState.h +file + + + + +2009-06-30T07:08:45.000000Z +45558bd431ac406af8cb67ceee47c9a9 +2009-06-30T07:21:31.602960Z +1123 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +430 + diff --git a/jssrc/.svn/prop-base/JSParseKit.h.svn-base b/jssrc/.svn/prop-base/JSParseKit.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/JSParseKit.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/JSParseKit.m.svn-base b/jssrc/.svn/prop-base/JSParseKit.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/JSParseKit.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSAssembly.h.svn-base b/jssrc/.svn/prop-base/PKJSAssembly.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSAssembly.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSAssembly.m.svn-base b/jssrc/.svn/prop-base/PKJSAssembly.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSAssembly.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSCollectionParser.h.svn-base b/jssrc/.svn/prop-base/PKJSCollectionParser.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSCollectionParser.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSCollectionParser.m.svn-base b/jssrc/.svn/prop-base/PKJSCollectionParser.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSCollectionParser.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSCommentState.h.svn-base b/jssrc/.svn/prop-base/PKJSCommentState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSCommentState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSCommentState.m.svn-base b/jssrc/.svn/prop-base/PKJSCommentState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSCommentState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSNumberState.h.svn-base b/jssrc/.svn/prop-base/PKJSNumberState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSNumberState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSNumberState.m.svn-base b/jssrc/.svn/prop-base/PKJSNumberState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSNumberState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSQuoteState.h.svn-base b/jssrc/.svn/prop-base/PKJSQuoteState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSQuoteState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSQuoteState.m.svn-base b/jssrc/.svn/prop-base/PKJSQuoteState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSQuoteState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSSymbolState.h.svn-base b/jssrc/.svn/prop-base/PKJSSymbolState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSSymbolState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSSymbolState.m.svn-base b/jssrc/.svn/prop-base/PKJSSymbolState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSSymbolState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSToken.h.svn-base b/jssrc/.svn/prop-base/PKJSToken.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSToken.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSToken.m.svn-base b/jssrc/.svn/prop-base/PKJSToken.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSToken.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSTokenAssembly.h.svn-base b/jssrc/.svn/prop-base/PKJSTokenAssembly.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSTokenAssembly.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSTokenAssembly.m.svn-base b/jssrc/.svn/prop-base/PKJSTokenAssembly.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSTokenAssembly.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSTokenizer.h.svn-base b/jssrc/.svn/prop-base/PKJSTokenizer.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSTokenizer.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSTokenizer.m.svn-base b/jssrc/.svn/prop-base/PKJSTokenizer.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSTokenizer.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSTokenizerState.h.svn-base b/jssrc/.svn/prop-base/PKJSTokenizerState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSTokenizerState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSTokenizerState.m.svn-base b/jssrc/.svn/prop-base/PKJSTokenizerState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSTokenizerState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSUtils.h.svn-base b/jssrc/.svn/prop-base/PKJSUtils.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSUtils.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSUtils.m.svn-base b/jssrc/.svn/prop-base/PKJSUtils.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSUtils.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSValueHolder.h.svn-base b/jssrc/.svn/prop-base/PKJSValueHolder.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSValueHolder.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSValueHolder.m.svn-base b/jssrc/.svn/prop-base/PKJSValueHolder.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSValueHolder.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSWhitespaceState.h.svn-base b/jssrc/.svn/prop-base/PKJSWhitespaceState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSWhitespaceState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSWhitespaceState.m.svn-base b/jssrc/.svn/prop-base/PKJSWhitespaceState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSWhitespaceState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSWordState.h.svn-base b/jssrc/.svn/prop-base/PKJSWordState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSWordState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/prop-base/PKJSWordState.m.svn-base b/jssrc/.svn/prop-base/PKJSWordState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/jssrc/.svn/prop-base/PKJSWordState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/jssrc/.svn/text-base/JSParseKit.h.svn-base b/jssrc/.svn/text-base/JSParseKit.h.svn-base new file mode 100644 index 0000000..1c5bc19 --- /dev/null +++ b/jssrc/.svn/text-base/JSParseKit.h.svn-base @@ -0,0 +1,12 @@ +// +// JSParseKit.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/10/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +void PKJSParseKitSetUpContext(JSContextRef ctx); \ No newline at end of file diff --git a/jssrc/.svn/text-base/JSParseKit.m.svn-base b/jssrc/.svn/text-base/JSParseKit.m.svn-base new file mode 100644 index 0000000..546ff89 --- /dev/null +++ b/jssrc/.svn/text-base/JSParseKit.m.svn-base @@ -0,0 +1,116 @@ +// +// PKJSParseKit.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/10/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import "PKJSUtils.h" +#import "PKJSToken.h" +#import "PKJSTokenizer.h" +#import "PKJSTokenizerState.h" +#import "PKJSAssembly.h" +#import "PKJSTokenAssembly.h" +#import "PKJSCharacterAssembly.h" +#import "PKJSWordState.h" +#import "PKJSNumberState.h" +#import "PKJSWhitespaceState.h" +#import "PKJSCommentState.h" +#import "PKJSQuoteState.h" +#import "PKJSSymbolState.h" +#import "PKJSRepetition.h" +#import "PKJSSequence.h" +#import "PKJSTrack.h" +#import "PKJSAlternation.h" +#import "PKJSEmpty.h" +#import "PKJSAny.h" +#import "PKJSWord.h" +#import "PKJSNum.h" +#import "PKJSQuotedString.h" +#import "PKJSSymbol.h" +#import "PKJSComment.h" +#import "PKJSLiteral.h" +#import "PKJSCaseInsensitiveLiteral.h" +#import "PKJSUppercaseWord.h" +#import "PKJSLowercaseWord.h" + +static void printValue(JSContextRef ctx, JSValueRef val) { + NSString *s = PKJSValueGetNSString(ctx, val, NULL); + NSLog(@"%@", s); +} + +static JSValueRef print(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + printValue(ctx, argv[0]); // TODO check args + return JSValueMakeUndefined(ctx); +} + +static JSObjectRef setUpFunction(JSContextRef ctx, char *funcName, JSObjectCallAsFunctionCallback funcCallback, JSValueRef *ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef funcNameStr = JSStringCreateWithUTF8CString(funcName); + JSObjectRef func = JSObjectMakeFunctionWithCallback(ctx, funcNameStr, funcCallback); + JSObjectSetProperty(ctx, globalObj, funcNameStr, func, kJSPropertyAttributeNone, ex); + JSStringRelease(funcNameStr); + return func; +} + +static JSObjectRef setUpConstructor(JSContextRef ctx, char *className, JSClassRef jsClass, JSObjectCallAsConstructorCallback constrCallback, JSValueRef *ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef classNameStr = JSStringCreateWithUTF8CString(className); + JSObjectRef constr = JSObjectMakeConstructor(ctx, jsClass, constrCallback); + JSObjectSetProperty(ctx, globalObj, classNameStr, constr, kJSPropertyAttributeNone, ex); + JSStringRelease(classNameStr); + return constr; +} + +static void setUpClassProperty(JSContextRef ctx, char *propName, JSValueRef prop, JSObjectRef constr, JSValueRef *ex) { + JSStringRef propNameStr = JSStringCreateWithUTF8CString(propName); + JSObjectSetProperty(ctx, constr, propNameStr, prop, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly, NULL); + JSStringRelease(propNameStr); +} + +void PKJSParseKitSetUpContext(JSContextRef ctx) { + JSValueRef ex = NULL; + + setUpFunction(ctx, "print", print, &ex); + + // Assemblies + setUpConstructor(ctx, "PKTokenAssembly", PKTokenAssembly_class(ctx), PKTokenAssembly_construct, &ex); + setUpConstructor(ctx, "PKCharacterAssembly", PKCharacterAssembly_class(ctx), PKCharacterAssembly_construct, &ex); + + // Tokenization + JSObjectRef constr = setUpConstructor(ctx, "PKToken", PKToken_class(ctx), PKToken_construct, &ex); + setUpClassProperty(ctx, "EOFToken", PKToken_getEOFToken(ctx), constr, &ex); // Class property on Token constructor + + setUpConstructor(ctx, "PKTokenizer", PKTokenizer_class(ctx), PKTokenizer_construct, &ex); + setUpConstructor(ctx, "PKWordState", PKWordState_class(ctx), PKWordState_construct, &ex); + setUpConstructor(ctx, "PKQuoteState", PKQuoteState_class(ctx), PKQuoteState_construct, &ex); + setUpConstructor(ctx, "PKNumberState", PKNumberState_class(ctx), PKNumberState_construct, &ex); + setUpConstructor(ctx, "PKSymbolState", PKSymbolState_class(ctx), PKSymbolState_construct, &ex); + setUpConstructor(ctx, "PKCommentState", PKCommentState_class(ctx), PKCommentState_construct, &ex); + setUpConstructor(ctx, "PKWhitespaceState", PKWhitespaceState_class(ctx), PKWhitespaceState_construct, &ex); + + // Parsers + setUpConstructor(ctx, "PKRepetition", PKRepetition_class(ctx), PKRepetition_construct, &ex); + + // Collection Parsers + setUpConstructor(ctx, "PKAlternation", PKAlternation_class(ctx), PKAlternation_construct, &ex); + setUpConstructor(ctx, "PKSequence", PKSequence_class(ctx), PKSequence_construct, &ex); + + // Terminal Parsers + setUpConstructor(ctx, "PKEmpty", PKEmpty_class(ctx), PKEmpty_construct, &ex); + setUpConstructor(ctx, "PKAny", PKAny_class(ctx), PKAny_construct, &ex); + + // Token Terminals + setUpConstructor(ctx, "PKWord", PKWord_class(ctx), PKWord_construct, &ex); + setUpConstructor(ctx, "PKNum", PKNum_class(ctx), PKNum_construct, &ex); + setUpConstructor(ctx, "PKQuotedString", PKQuotedString_class(ctx), PKQuotedString_construct, &ex); + setUpConstructor(ctx, "PKSymbol", PKSymbol_class(ctx), PKSymbol_construct, &ex); + setUpConstructor(ctx, "PKComment", PKComment_class(ctx), PKComment_construct, &ex); + setUpConstructor(ctx, "PKLiteral", PKLiteral_class(ctx), PKLiteral_construct, &ex); + setUpConstructor(ctx, "PKCaseInsensitiveLiteral", PKCaseInsensitiveLiteral_class(ctx), PKCaseInsensitiveLiteral_construct, &ex); + setUpConstructor(ctx, "PKUppercaseWord", PKUppercaseWord_class(ctx), PKUppercaseWord_construct, &ex); + setUpConstructor(ctx, "PKLowercaseWord", PKLowercaseWord_class(ctx), PKLowercaseWord_construct, &ex); +} diff --git a/jssrc/.svn/text-base/PKJSAlternation.h.svn-base b/jssrc/.svn/text-base/PKJSAlternation.h.svn-base new file mode 100644 index 0000000..8cbdff4 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSAlternation.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSAlternation.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKAlternation_new(JSContextRef ctx, void *data); +JSClassRef PKAlternation_class(JSContextRef ctx); +JSObjectRef PKAlternation_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSAlternation.m.svn-base b/jssrc/.svn/text-base/PKJSAlternation.m.svn-base new file mode 100644 index 0000000..4440d87 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSAlternation.m.svn-base @@ -0,0 +1,63 @@ +// +// PKJSAlternation.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSAlternation.h" +#import "PKJSUtils.h" +#import "PKJSCollectionParser.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKAlternation_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKAlternation_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKAlternation_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKAlternation_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKAlternation_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKCollectionParser_class(ctx); + def.staticFunctions = PKAlternation_staticFunctions; + def.staticValues = PKAlternation_staticValues; + def.initialize = PKAlternation_initialize; + def.finalize = PKAlternation_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKAlternation_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKAlternation_class(ctx), data); +} + +JSObjectRef PKAlternation_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKAlternation *data = [[PKAlternation alloc] init]; + return PKAlternation_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSAny.h.svn-base b/jssrc/.svn/text-base/PKJSAny.h.svn-base new file mode 100644 index 0000000..5f9f8ea --- /dev/null +++ b/jssrc/.svn/text-base/PKJSAny.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSAny.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKAny_new(JSContextRef ctx, void *data); +JSClassRef PKAny_class(JSContextRef ctx); +JSObjectRef PKAny_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSAny.m.svn-base b/jssrc/.svn/text-base/PKJSAny.m.svn-base new file mode 100644 index 0000000..2c0331c --- /dev/null +++ b/jssrc/.svn/text-base/PKJSAny.m.svn-base @@ -0,0 +1,63 @@ +// +// PKJSAny.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSAny.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKAny_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKAny_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKAny_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKAny_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKAny_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKAny_staticFunctions; + def.staticValues = PKAny_staticValues; + def.initialize = PKAny_initialize; + def.finalize = PKAny_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKAny_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKAny_class(ctx), data); +} + +JSObjectRef PKAny_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKAny *data = [[PKAny alloc] init]; + return PKAny_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSAssemblerAdapter.h.svn-base b/jssrc/.svn/text-base/PKJSAssemblerAdapter.h.svn-base new file mode 100644 index 0000000..a63dd2f --- /dev/null +++ b/jssrc/.svn/text-base/PKJSAssemblerAdapter.h.svn-base @@ -0,0 +1,22 @@ +// +// PKJSAssemblerAdapter.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/10/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class PKAssembly; + +@interface PKJSAssemblerAdapter : NSObject { + JSContextRef ctx; + JSObjectRef assemblerFunction; +} +- (void)didMatch:(PKAssembly *)a; + +- (JSObjectRef)assemblerFunction; +- (void)setAssemblerFunction:(JSObjectRef)f fromContext:(JSContextRef)c; +@end diff --git a/jssrc/.svn/text-base/PKJSAssemblerAdapter.m.svn-base b/jssrc/.svn/text-base/PKJSAssemblerAdapter.m.svn-base new file mode 100644 index 0000000..65b07df --- /dev/null +++ b/jssrc/.svn/text-base/PKJSAssemblerAdapter.m.svn-base @@ -0,0 +1,74 @@ +// +// PKJSAssemblerAdapter.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/10/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSAssemblerAdapter.h" +#import "PKJSTokenAssembly.h" +#import "PKJSCharacterAssembly.h" +#import "PKJSUtils.h" +#import +#import +#import + +@implementation PKJSAssemblerAdapter + +- (id)init { + if (self = [super init]) { + + } + return self; +} + + +- (void)dealloc { + [self setAssemblerFunction:NULL fromContext:NULL]; + [super dealloc]; +} + + +- (void)didMatch:(PKAssembly *)a { + JSValueRef arg = NULL; + if ([a isMemberOfClass:[PKTokenAssembly class]]) { + arg = (JSValueRef)PKTokenAssembly_new(ctx, a); + } else if ([a isMemberOfClass:[PKCharacterAssembly class]]) { + arg = (JSValueRef)PKCharacterAssembly_new(ctx, a); + } else { + NSAssert(0, @"Should not reach here."); + } + + JSValueRef argv[] = { arg }; + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSValueRef ex = NULL; + JSObjectCallAsFunction(ctx, assemblerFunction, globalObj, 1, argv, &ex); + if (ex) { + NSString *s = PKJSValueGetNSString(ctx, ex, NULL); + [NSException raise:@"PKJSException" format:s arguments:NULL]; + } +} + + +- (JSObjectRef)assemblerFunction { + return assemblerFunction; +} + + +- (void)setAssemblerFunction:(JSObjectRef)f fromContext:(JSContextRef)c { + if (assemblerFunction != f) { + if (ctx && assemblerFunction) { + JSValueUnprotect(ctx, assemblerFunction); + JSGarbageCollect(ctx); + } + + ctx = c; + assemblerFunction = f; + if (ctx && assemblerFunction) { + JSValueProtect(ctx, assemblerFunction); + } + } +} + +@end diff --git a/jssrc/.svn/text-base/PKJSAssembly.h.svn-base b/jssrc/.svn/text-base/PKJSAssembly.h.svn-base new file mode 100644 index 0000000..f329032 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSAssembly.h.svn-base @@ -0,0 +1,12 @@ +// +// PKJSAssembly.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/3/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKAssembly_new(JSContextRef ctx, void *data); +JSClassRef PKAssembly_class(JSContextRef ctx); diff --git a/jssrc/.svn/text-base/PKJSAssembly.m.svn-base b/jssrc/.svn/text-base/PKJSAssembly.m.svn-base new file mode 100644 index 0000000..30e0444 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSAssembly.m.svn-base @@ -0,0 +1,136 @@ +// +// PKJSAssembly.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/3/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSAssembly.h" +#import "PKJSToken.h" +#import "PKJSUtils.h" +#import +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKAssembly_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKAssembly_class, "toString"); + PKAssembly *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, [data description], ex); +} + +static JSValueRef PKAssembly_pop(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKAssembly_class, "pop"); + + PKAssembly *data = JSObjectGetPrivate(this); + PKToken *tok = [data pop]; + return PKToken_new(ctx, tok); +} + +static JSValueRef PKAssembly_push(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKAssembly_class, "push"); + PKPreconditionMethodArgc(1, "PKAssembly.push"); + + JSValueRef v = argv[0]; + + PKAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + [data push:obj]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKAssembly_objectsAbove(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKAssembly_class, "objectsAbove"); + PKPreconditionMethodArgc(1, "PKAssembly.objectsAbove"); + + JSValueRef v = argv[0]; + + PKAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + id array = [data objectsAbove:obj]; + + return PKNSArrayToJSObject(ctx, array, ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKAssembly_getDefaultDelimiter(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKAssembly *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, data.defaultDelimiter, ex); +} + +static JSValueRef PKAssembly_getStack(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKAssembly *data = JSObjectGetPrivate(this); + return PKNSArrayToJSObject(ctx, data.stack, ex); +} + +static JSValueRef PKAssembly_getTarget(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKAssembly *data = JSObjectGetPrivate(this); + return PKCFTypeToJSValue(ctx, (CFTypeRef)data.target, ex); +} + +static bool PKAssembly_setTarget(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKAssembly *data = JSObjectGetPrivate(this); + data.target = PKJSValueGetId(ctx, value, ex); + return true; +} + +static JSValueRef PKAssembly_getIsStackEmpty(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKAssembly *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isStackEmpty); +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKAssembly_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKAssembly_finalize(JSObjectRef this) { + PKAssembly *data = (PKAssembly *)JSObjectGetPrivate(this); + [data autorelease]; +} + +static JSStaticFunction PKAssembly_staticFunctions[] = { +{ "toString", PKAssembly_toString, kJSPropertyAttributeDontDelete }, +{ "pop", PKAssembly_pop, kJSPropertyAttributeDontDelete }, +{ "push", PKAssembly_push, kJSPropertyAttributeDontDelete }, +{ "objectsAbove", PKAssembly_objectsAbove, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKAssembly_staticValues[] = { +{ "defaulDelimiter", PKAssembly_getDefaultDelimiter, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // String +{ "stack", PKAssembly_getStack, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Array +{ "target", PKAssembly_getTarget, PKAssembly_setTarget, kJSPropertyAttributeDontDelete }, // Object +{ "isStackEmpty", PKAssembly_getIsStackEmpty, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark ClassMethods + +#pragma mark - +#pragma mark Public + +JSClassRef PKAssembly_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.staticFunctions = PKAssembly_staticFunctions; + def.staticValues = PKAssembly_staticValues; + def.initialize = PKAssembly_initialize; + def.finalize = PKAssembly_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKAssembly_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKAssembly_class(ctx), data); +} diff --git a/jssrc/.svn/text-base/PKJSCaseInsensitiveLiteral.h.svn-base b/jssrc/.svn/text-base/PKJSCaseInsensitiveLiteral.h.svn-base new file mode 100644 index 0000000..c6e1794 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSCaseInsensitiveLiteral.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSCaseInsensitiveCaseInsensitiveLiteral.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKCaseInsensitiveLiteral_new(JSContextRef ctx, void *data); +JSClassRef PKCaseInsensitiveLiteral_class(JSContextRef ctx); +JSObjectRef PKCaseInsensitiveLiteral_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSCaseInsensitiveLiteral.m.svn-base b/jssrc/.svn/text-base/PKJSCaseInsensitiveLiteral.m.svn-base new file mode 100644 index 0000000..bfc6f3b --- /dev/null +++ b/jssrc/.svn/text-base/PKJSCaseInsensitiveLiteral.m.svn-base @@ -0,0 +1,67 @@ +// +// PKJSCaseInsensitiveCaseInsensitiveLiteral.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSCaseInsensitiveLiteral.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKCaseInsensitiveLiteral_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKCaseInsensitiveLiteral_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKCaseInsensitiveLiteral_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKCaseInsensitiveLiteral_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKCaseInsensitiveLiteral_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKCaseInsensitiveLiteral_staticFunctions; + def.staticValues = PKCaseInsensitiveLiteral_staticValues; + def.initialize = PKCaseInsensitiveLiteral_initialize; + def.finalize = PKCaseInsensitiveLiteral_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKCaseInsensitiveLiteral_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKCaseInsensitiveLiteral_class(ctx), data); +} + +JSObjectRef PKCaseInsensitiveLiteral_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKCaseInsensitiveLiteral"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKCaseInsensitiveLiteral *data = [[PKCaseInsensitiveLiteral alloc] initWithString:s]; + return PKCaseInsensitiveLiteral_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSCharacterAssembly.h.svn-base b/jssrc/.svn/text-base/PKJSCharacterAssembly.h.svn-base new file mode 100644 index 0000000..0d8cf5a --- /dev/null +++ b/jssrc/.svn/text-base/PKJSCharacterAssembly.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSCharacterAssembly.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKCharacterAssembly_new(JSContextRef ctx, void *data); +JSClassRef PKCharacterAssembly_class(JSContextRef ctx); +JSObjectRef PKCharacterAssembly_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSCharacterAssembly.m.svn-base b/jssrc/.svn/text-base/PKJSCharacterAssembly.m.svn-base new file mode 100644 index 0000000..83a2db9 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSCharacterAssembly.m.svn-base @@ -0,0 +1,123 @@ +// +// PKJSCharacterAssembly.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSCharacterAssembly.h" +#import "PKJSUtils.h" +#import "PKJSAssembly.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKCharacterAssembly_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCharacterAssembly_class, "toString"); + PKCharacterAssembly *data = JSObjectGetPrivate(this); + JSStringRef resStr = JSStringCreateWithCFString((CFStringRef)[data description]); + JSValueRef res = JSValueMakeString(ctx, resStr); + JSStringRelease(resStr); + return res; +} + +static JSValueRef PKCharacterAssembly_pop(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCharacterAssembly_class, "pop"); + PKCharacterAssembly *data = JSObjectGetPrivate(this); + NSNumber *obj = [data pop]; + return JSValueMakeNumber(ctx, [obj doubleValue]); +} + +static JSValueRef PKCharacterAssembly_push(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCharacterAssembly_class, "push"); + PKPreconditionMethodArgc(1, "PKCharacterAssembly.push"); + + JSValueRef v = argv[0]; + + PKCharacterAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + [data push:obj]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKCharacterAssembly_objectsAbove(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCharacterAssembly_class, "objectsAbove"); + PKPreconditionMethodArgc(1, "PKCharacterAssembly.objectsAbove"); + + JSValueRef v = argv[0]; + + PKCharacterAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + id array = [data objectsAbove:obj]; + + return PKNSArrayToJSObject(ctx, array, ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKCharacterAssembly_getLength(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKCharacterAssembly *data = JSObjectGetPrivate(this); + return JSValueMakeNumber(ctx, [data length]); +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKCharacterAssembly_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKCharacterAssembly_finalize(JSObjectRef this) { + // released in PKAssembly_finalize +} + +static JSStaticFunction PKCharacterAssembly_staticFunctions[] = { +{ "toString", PKCharacterAssembly_toString, kJSPropertyAttributeDontDelete }, +{ "pop", PKCharacterAssembly_pop, kJSPropertyAttributeDontDelete }, +{ "push", PKCharacterAssembly_push, kJSPropertyAttributeDontDelete }, +{ "objectsAbove", PKCharacterAssembly_objectsAbove, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKCharacterAssembly_staticValues[] = { +{ "length", PKCharacterAssembly_getLength, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Number +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark ClassMethods + +#pragma mark - +#pragma mark Public + +JSClassRef PKCharacterAssembly_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKAssembly_class(ctx); + def.staticFunctions = PKCharacterAssembly_staticFunctions; + def.staticValues = PKCharacterAssembly_staticValues; + def.initialize = PKCharacterAssembly_initialize; + def.finalize = PKCharacterAssembly_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKCharacterAssembly_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKCharacterAssembly_class(ctx), data); +} + +JSObjectRef PKCharacterAssembly_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKCharacterAssembly"); + + JSValueRef s = argv[0]; + NSString *string = PKJSValueGetNSString(ctx, s, ex); + + PKCharacterAssembly *data = [[PKCharacterAssembly alloc] initWithString:string]; + return PKCharacterAssembly_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSCollectionParser.h.svn-base b/jssrc/.svn/text-base/PKJSCollectionParser.h.svn-base new file mode 100644 index 0000000..38fbbd0 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSCollectionParser.h.svn-base @@ -0,0 +1,12 @@ +// +// PKCollectionCollectionParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKCollectionParser_new(JSContextRef ctx, void *data); +JSClassRef PKCollectionParser_class(JSContextRef ctx); diff --git a/jssrc/.svn/text-base/PKJSCollectionParser.m.svn-base b/jssrc/.svn/text-base/PKJSCollectionParser.m.svn-base new file mode 100644 index 0000000..721d149 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSCollectionParser.m.svn-base @@ -0,0 +1,71 @@ +// +// PKCollectionCollectionParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKCollectionParser.h" +#import "PKJSUtils.h" +#import "PKJSParser.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKCollectionParser_add(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCollectionParser_class, "add"); + PKPreconditionMethodArgc(1, "add"); + + PKCollectionParser *data = JSObjectGetPrivate(this); + + JSObjectRef arg = (JSObjectRef)argv[0]; + PKParser *p = (PKParser *)JSObjectGetPrivate(arg); + [data add:p]; + return JSValueMakeUndefined(ctx); +} + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKCollectionParser_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKCollectionParser_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKCollectionParser_staticFunctions[] = { +{ "add", PKCollectionParser_add, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKCollectionParser_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKCollectionParser_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKParser_class(ctx); + def.staticFunctions = PKCollectionParser_staticFunctions; + def.staticValues = PKCollectionParser_staticValues; + def.initialize = PKCollectionParser_initialize; + def.finalize = PKCollectionParser_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKCollectionParser_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKCollectionParser_class(ctx), data); +} diff --git a/jssrc/.svn/text-base/PKJSComment.h.svn-base b/jssrc/.svn/text-base/PKJSComment.h.svn-base new file mode 100644 index 0000000..c8620b2 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSComment.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSComment.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKComment_new(JSContextRef ctx, void *data); +JSClassRef PKComment_class(JSContextRef ctx); +JSObjectRef PKComment_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSComment.m.svn-base b/jssrc/.svn/text-base/PKJSComment.m.svn-base new file mode 100644 index 0000000..0659589 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSComment.m.svn-base @@ -0,0 +1,63 @@ +// +// PKJSComment.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSComment.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKComment_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKComment_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKComment_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKComment_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKComment_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKComment_staticFunctions; + def.staticValues = PKComment_staticValues; + def.initialize = PKComment_initialize; + def.finalize = PKComment_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKComment_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKComment_class(ctx), data); +} + +JSObjectRef PKComment_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKComment *data = [[PKComment alloc] init]; + return PKComment_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSCommentState.h.svn-base b/jssrc/.svn/text-base/PKJSCommentState.h.svn-base new file mode 100644 index 0000000..64b81bd --- /dev/null +++ b/jssrc/.svn/text-base/PKJSCommentState.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSCommentState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKCommentState_new(JSContextRef ctx, void *data); +JSClassRef PKCommentState_class(JSContextRef ctx); +JSObjectRef PKCommentState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSCommentState.m.svn-base b/jssrc/.svn/text-base/PKJSCommentState.m.svn-base new file mode 100644 index 0000000..7c76e54 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSCommentState.m.svn-base @@ -0,0 +1,147 @@ +// +// PKJSCommentState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSCommentState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKCommentState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCommentState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKCommentState]", ex); +} + +static JSValueRef PKCommentState_addSingleLine(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCommentState_class, "addSingleLine"); + PKPreconditionMethodArgc(1, "PKCommentState.addSingleLine"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + + PKCommentState *data = JSObjectGetPrivate(this); + [data addSingleLineStartMarker:start]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKCommentState_removeSingleLine(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCommentState_class, "removeSingleLine"); + PKPreconditionMethodArgc(1, "PKCommentState.removeSingleLine"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + + PKCommentState *data = JSObjectGetPrivate(this); + [data removeSingleLineStartMarker:start]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKCommentState_addMultiLine(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCommentState_class, "addMultiLine"); + PKPreconditionMethodArgc(2, "PKCommentState.addMultiLine"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + NSString *end = PKJSValueGetNSString(ctx, argv[1], ex); + + PKCommentState *data = JSObjectGetPrivate(this); + [data addMultiLineStartMarker:start endMarker:end]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKCommentState_removeMultiLine(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCommentState_class, "removeSingleLine"); + PKPreconditionMethodArgc(1, "PKCommentState.removeMultiLine"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + + PKCommentState *data = JSObjectGetPrivate(this); + [data removeMultiLineStartMarker:start]; + + return JSValueMakeUndefined(ctx); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKCommentState_getReportsCommentTokens(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKCommentState *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.reportsCommentTokens); +} + +static bool PKCommentState_setReportsCommentTokens(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKCommentState *data = JSObjectGetPrivate(this); + data.reportsCommentTokens = JSValueToBoolean(ctx, value); + return true; +} + +static JSValueRef PKCommentState_getBalancesEOFTerminatedComments(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKCommentState *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.balancesEOFTerminatedComments); +} + +static bool PKCommentState_setBalancesEOFTerminatedComments(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKCommentState *data = JSObjectGetPrivate(this); + data.balancesEOFTerminatedComments = JSValueToBoolean(ctx, value); + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKCommentState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKCommentState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKCommentState_staticFunctions[] = { +{ "toString", PKCommentState_toString, kJSPropertyAttributeDontDelete }, +{ "addSingleLine", PKCommentState_addSingleLine, kJSPropertyAttributeDontDelete }, +{ "removeSingleLine", PKCommentState_removeSingleLine, kJSPropertyAttributeDontDelete }, +{ "addMultiLine", PKCommentState_addMultiLine, kJSPropertyAttributeDontDelete }, +{ "removeMultiLine", PKCommentState_removeMultiLine, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + + +static JSStaticValue PKCommentState_staticValues[] = { +{ "reportsCommentTokens", PKCommentState_getReportsCommentTokens, PKCommentState_setReportsCommentTokens, kJSPropertyAttributeDontDelete }, // Boolean +{ "balancesEOFTerminatedComments", PKCommentState_getBalancesEOFTerminatedComments, PKCommentState_setBalancesEOFTerminatedComments, kJSPropertyAttributeDontDelete }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKCommentState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKCommentState_staticFunctions; + def.staticValues = PKCommentState_staticValues; + def.initialize = PKCommentState_initialize; + def.finalize = PKCommentState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKCommentState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKCommentState_class(ctx), data); +} + +JSObjectRef PKCommentState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKCommentState *data = [[PKCommentState alloc] init]; + return PKCommentState_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSDelimitState.h.svn-base b/jssrc/.svn/text-base/PKJSDelimitState.h.svn-base new file mode 100644 index 0000000..7df505c --- /dev/null +++ b/jssrc/.svn/text-base/PKJSDelimitState.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSDelimitState.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/1/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKDelimitState_new(JSContextRef ctx, void *data); +JSClassRef PKDelimitState_class(JSContextRef ctx); +JSObjectRef PKDelimitState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSDelimitState.m.svn-base b/jssrc/.svn/text-base/PKJSDelimitState.m.svn-base new file mode 100644 index 0000000..d591bda --- /dev/null +++ b/jssrc/.svn/text-base/PKJSDelimitState.m.svn-base @@ -0,0 +1,102 @@ +// +// PKJSDelimitState.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/1/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSDelimitState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKDelimitState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKDelimitState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKDelimitState]", ex); +} + +static JSValueRef PKDelimitState_add(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKDelimitState_class, "add"); + PKPreconditionMethodArgc(4, "PKDelimitState.add"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + NSString *end = PKJSValueGetNSString(ctx, argv[1], ex); + NSString *chars = PKJSValueGetNSString(ctx, argv[2], ex); + BOOL invert = JSValueToBoolean(ctx, argv[3]); + + PKDelimitState *data = JSObjectGetPrivate(this); + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:chars]; + if (invert) { + cs = [cs invertedSet]; + } + [data addStartMarker:start endMarker:end allowedCharacterSet:cs]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKDelimitState_remove(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKDelimitState_class, "remove"); + PKPreconditionMethodArgc(1, "PKDelimitState.remove"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + + PKDelimitState *data = JSObjectGetPrivate(this); + [data removeStartMarker:start]; + + return JSValueMakeUndefined(ctx); +} + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKDelimitState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKDelimitState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKDelimitState_staticFunctions[] = { +{ "toString", PKDelimitState_toString, kJSPropertyAttributeDontDelete }, +{ "add", PKDelimitState_add, kJSPropertyAttributeDontDelete }, +{ "remove", PKDelimitState_remove, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKDelimitState_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKDelimitState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKDelimitState_staticFunctions; + def.staticValues = PKDelimitState_staticValues; + def.initialize = PKDelimitState_initialize; + def.finalize = PKDelimitState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKDelimitState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKDelimitState_class(ctx), data); +} + +JSObjectRef PKDelimitState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKDelimitState *data = [[PKDelimitState alloc] init]; + return PKDelimitState_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSDelimitedString.h.svn-base b/jssrc/.svn/text-base/PKJSDelimitedString.h.svn-base new file mode 100644 index 0000000..7a7fb3e --- /dev/null +++ b/jssrc/.svn/text-base/PKJSDelimitedString.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSDelimitedString.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/1/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKDelimitedString_new(JSContextRef ctx, void *data); +JSClassRef PKDelimitedString_class(JSContextRef ctx); +JSObjectRef PKDelimitedString_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSDelimitedString.m.svn-base b/jssrc/.svn/text-base/PKJSDelimitedString.m.svn-base new file mode 100644 index 0000000..aec66a4 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSDelimitedString.m.svn-base @@ -0,0 +1,67 @@ +// +// PKJSDelimitedString.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/1/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSDelimitedString.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKDelimitedString_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKDelimitedString_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKDelimitedString_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKDelimitedString_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKDelimitedString_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKDelimitedString_staticFunctions; + def.staticValues = PKDelimitedString_staticValues; + def.initialize = PKDelimitedString_initialize; + def.finalize = PKDelimitedString_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKDelimitedString_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKDelimitedString_class(ctx), data); +} + +JSObjectRef PKDelimitedString_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKDelimitedString"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKDelimitedString *data = [[PKDelimitedString alloc] initWithString:s]; + return PKDelimitedString_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSEmpty.h.svn-base b/jssrc/.svn/text-base/PKJSEmpty.h.svn-base new file mode 100644 index 0000000..0dd2a98 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSEmpty.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSEmpty.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKEmpty_new(JSContextRef ctx, void *data); +JSClassRef PKEmpty_class(JSContextRef ctx); +JSObjectRef PKEmpty_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSEmpty.m.svn-base b/jssrc/.svn/text-base/PKJSEmpty.m.svn-base new file mode 100644 index 0000000..b7ffdc4 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSEmpty.m.svn-base @@ -0,0 +1,63 @@ +// +// PKJSEmpty.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSEmpty.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKEmpty_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKEmpty_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKEmpty_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKEmpty_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKEmpty_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKEmpty_staticFunctions; + def.staticValues = PKEmpty_staticValues; + def.initialize = PKEmpty_initialize; + def.finalize = PKEmpty_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKEmpty_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKEmpty_class(ctx), data); +} + +JSObjectRef PKEmpty_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKEmpty *data = [[PKEmpty alloc] init]; + return PKEmpty_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSLiteral.h.svn-base b/jssrc/.svn/text-base/PKJSLiteral.h.svn-base new file mode 100644 index 0000000..bb34f68 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSLiteral.h.svn-base @@ -0,0 +1,13 @@ +// +// PKLiteral.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKLiteral_new(JSContextRef ctx, void *data); +JSClassRef PKLiteral_class(JSContextRef ctx); +JSObjectRef PKLiteral_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSLiteral.m.svn-base b/jssrc/.svn/text-base/PKJSLiteral.m.svn-base new file mode 100644 index 0000000..f3d0375 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSLiteral.m.svn-base @@ -0,0 +1,67 @@ +// +// PKLiteral.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKLiteral.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKLiteral_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKLiteral_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKLiteral_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKLiteral_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKLiteral_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKLiteral_staticFunctions; + def.staticValues = PKLiteral_staticValues; + def.initialize = PKLiteral_initialize; + def.finalize = PKLiteral_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKLiteral_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKLiteral_class(ctx), data); +} + +JSObjectRef PKLiteral_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKLiteral"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKLiteral *data = [[PKLiteral alloc] initWithString:s]; + return PKLiteral_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSLowercaseWord.h.svn-base b/jssrc/.svn/text-base/PKJSLowercaseWord.h.svn-base new file mode 100644 index 0000000..845625f --- /dev/null +++ b/jssrc/.svn/text-base/PKJSLowercaseWord.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSLowercaseWord.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/13/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKLowercaseWord_new(JSContextRef ctx, void *data); +JSClassRef PKLowercaseWord_class(JSContextRef ctx); +JSObjectRef PKLowercaseWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSLowercaseWord.m.svn-base b/jssrc/.svn/text-base/PKJSLowercaseWord.m.svn-base new file mode 100644 index 0000000..ce8e265 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSLowercaseWord.m.svn-base @@ -0,0 +1,67 @@ +// +// PKJSLowercaseWord.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/13/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSLowercaseWord.h" +#import "PKJSUtils.h" +#import "PKJSWord.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKLowercaseWord_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKLowercaseWord_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKLowercaseWord_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKLowercaseWord_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKLowercaseWord_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKWord_class(ctx); + def.staticFunctions = PKLowercaseWord_staticFunctions; + def.staticValues = PKLowercaseWord_staticValues; + def.initialize = PKLowercaseWord_initialize; + def.finalize = PKLowercaseWord_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKLowercaseWord_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKLowercaseWord_class(ctx), data); +} + +JSObjectRef PKLowercaseWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKLowercaseWord"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKLowercaseWord *data = [[PKLowercaseWord alloc] initWithString:s]; + return PKLowercaseWord_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSNum.h.svn-base b/jssrc/.svn/text-base/PKJSNum.h.svn-base new file mode 100644 index 0000000..edd4609 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSNum.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSNum.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKNum_new(JSContextRef ctx, void *data); +JSClassRef PKNum_class(JSContextRef ctx); +JSObjectRef PKNum_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSNum.m.svn-base b/jssrc/.svn/text-base/PKJSNum.m.svn-base new file mode 100644 index 0000000..023905a --- /dev/null +++ b/jssrc/.svn/text-base/PKJSNum.m.svn-base @@ -0,0 +1,63 @@ +// +// PKJSNum.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSNum.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKNum_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKNum_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKNum_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKNum_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKNum_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKNum_staticFunctions; + def.staticValues = PKNum_staticValues; + def.initialize = PKNum_initialize; + def.finalize = PKNum_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKNum_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKNum_class(ctx), data); +} + +JSObjectRef PKNum_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKNumber *data = [[PKNumber alloc] init]; + return PKNum_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSNumberState.h.svn-base b/jssrc/.svn/text-base/PKJSNumberState.h.svn-base new file mode 100644 index 0000000..de81da6 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSNumberState.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSNumberState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKNumberState_new(JSContextRef ctx, void *data); +JSClassRef PKNumberState_class(JSContextRef ctx); +JSObjectRef PKNumberState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSNumberState.m.svn-base b/jssrc/.svn/text-base/PKJSNumberState.m.svn-base new file mode 100644 index 0000000..c22c639 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSNumberState.m.svn-base @@ -0,0 +1,81 @@ +// +// PKJSNumberState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSNumberState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKNumberState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKNumberState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKNumberState]", ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKNumberState_getAllowsTrailingDot(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKNumberState *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.allowsTrailingDot); +} + +static bool PKNumberState_setAllowsTrailingDot(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKNumberState *data = JSObjectGetPrivate(this); + data.allowsTrailingDot = JSValueToBoolean(ctx, value); + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKNumberState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKNumberState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKNumberState_staticFunctions[] = { +{ "toString", PKNumberState_toString, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKNumberState_staticValues[] = { +{ "allowsTrailingDot", PKNumberState_getAllowsTrailingDot, PKNumberState_setAllowsTrailingDot, kJSPropertyAttributeDontDelete }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKNumberState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKNumberState_staticFunctions; + def.staticValues = PKNumberState_staticValues; + def.initialize = PKNumberState_initialize; + def.finalize = PKNumberState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKNumberState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKNumberState_class(ctx), data); +} + +JSObjectRef PKNumberState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKNumberState *data = [[PKNumberState alloc] init]; + return PKNumberState_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSParser.h.svn-base b/jssrc/.svn/text-base/PKJSParser.h.svn-base new file mode 100644 index 0000000..8b84eab --- /dev/null +++ b/jssrc/.svn/text-base/PKJSParser.h.svn-base @@ -0,0 +1,12 @@ +// +// PKJSParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/10/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKParser_new(JSContextRef ctx, void *data); +JSClassRef PKParser_class(JSContextRef ctx); diff --git a/jssrc/.svn/text-base/PKJSParser.m.svn-base b/jssrc/.svn/text-base/PKJSParser.m.svn-base new file mode 100644 index 0000000..e6b1c6c --- /dev/null +++ b/jssrc/.svn/text-base/PKJSParser.m.svn-base @@ -0,0 +1,154 @@ +// +// PKJSParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/10/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSParser.h" +#import "PKJSUtils.h" +#import "PKJSAssemblerAdapter.h" +#import "PKJSAssembly.h" +#import "PKJSTokenAssembly.h" +#import "PKJSCharacterAssembly.h" +#import +#import +#import +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKParser_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKParser_class, "toString"); + PKParser *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, [data description], ex); +} + +static JSValueRef PKParser_bestMatch(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKParser_class, "bestMatch"); + PKPreconditionMethodArgc(1, "bestMatch"); + + PKParser *data = JSObjectGetPrivate(this); + + JSObjectRef arg = (JSObjectRef)argv[0]; + PKAssembly *a = (PKAssembly *)JSObjectGetPrivate(arg); + a = [data bestMatchFor:a]; + + JSObjectRef result = NULL; + if ([a isMemberOfClass:[PKTokenAssembly class]]) { + result = PKTokenAssembly_new(ctx, a); + } else if ([a isMemberOfClass:[PKCharacterAssembly class]]) { + result = PKCharacterAssembly_new(ctx, a); + } + + return result; +} + +static JSValueRef PKParser_completeMatch(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKParser_class, "completeMatch"); + PKPreconditionMethodArgc(1, "completeMatch"); + + PKParser *data = JSObjectGetPrivate(this); + + JSObjectRef arg = (JSObjectRef)argv[0]; + PKAssembly *a = (PKAssembly *)JSObjectGetPrivate(arg); + a = [data completeMatchFor:a]; + + JSObjectRef result = NULL; + if ([a isMemberOfClass:[PKTokenAssembly class]]) { + result = PKTokenAssembly_new(ctx, a); + } else if ([a isMemberOfClass:[PKCharacterAssembly class]]) { + result = PKCharacterAssembly_new(ctx, a); + } + + return result; +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKParser_getAssembler(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKParser *data = JSObjectGetPrivate(this); + id assembler = data.assembler; + if ([assembler isMemberOfClass:[PKJSAssemblerAdapter class]]) { + return [assembler assemblerFunction]; + } else { + return NULL; + } +} + +static bool PKParser_setAssembler(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + if (!JSValueIsObject(ctx, value) || !JSObjectIsFunction(ctx, (JSObjectRef)value)) { + (*ex) = PKNSStringToJSValue(ctx, @"only a function object can be set as a parser's assembler property", ex); + return false; + } + + PKParser *data = JSObjectGetPrivate(this); + PKJSAssemblerAdapter *adapter = [[PKJSAssemblerAdapter alloc] init]; // retained. released in PKParser_finalize + [adapter setAssemblerFunction:(JSObjectRef)value fromContext:ctx]; + [data setAssembler:adapter selector:@selector(didMatch:)]; + return true; +} + +static JSValueRef PKParser_getName(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKParser *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, data.name, ex); +} + +static bool PKParser_setName(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKParser *data = JSObjectGetPrivate(this); + data.name = PKJSValueGetNSString(ctx, value, ex); + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKParser_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKParser_finalize(JSObjectRef this) { + PKParser *data = (PKParser *)JSObjectGetPrivate(this); + id assembler = data.assembler; + data.assembler = nil; + if ([assembler isMemberOfClass:[PKJSAssemblerAdapter class]]) { + [assembler autorelease]; + } + [data autorelease]; +} + +static JSStaticFunction PKParser_staticFunctions[] = { +{ "toString", PKParser_toString, kJSPropertyAttributeDontDelete }, +{ "bestMatch", PKParser_bestMatch, kJSPropertyAttributeDontDelete }, +{ "completeMatch", PKParser_completeMatch, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKParser_staticValues[] = { +{ "assembler", PKParser_getAssembler, PKParser_setAssembler, kJSPropertyAttributeDontDelete }, // Function +{ "name", PKParser_getName, PKParser_setName, kJSPropertyAttributeDontDelete }, // String +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKParser_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.staticFunctions = PKParser_staticFunctions; + def.staticValues = PKParser_staticValues; + def.initialize = PKParser_initialize; + def.finalize = PKParser_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKParser_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKParser_class(ctx), data); +} diff --git a/jssrc/.svn/text-base/PKJSPattern.h.svn-base b/jssrc/.svn/text-base/PKJSPattern.h.svn-base new file mode 100644 index 0000000..dac0b0d --- /dev/null +++ b/jssrc/.svn/text-base/PKJSPattern.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSPattern.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/1/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKPattern_new(JSContextRef ctx, void *data); +JSClassRef PKPattern_class(JSContextRef ctx); +JSObjectRef PKPattern_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSPattern.m.svn-base b/jssrc/.svn/text-base/PKJSPattern.m.svn-base new file mode 100644 index 0000000..ae612e7 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSPattern.m.svn-base @@ -0,0 +1,80 @@ +// +// PKJSPattern.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/1/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSPattern.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +//static JSValueRef PKPattern_invertedPattern(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { +// PKPreconditionInstaceOf(PKPattern_class, "invertedPattern"); +// +// PKPattern *data = JSObjectGetPrivate(this); +// return PKPattern_new(ctx, [data invertedPattern]); +//} +// +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKPattern_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKPattern_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKPattern_staticFunctions[] = { +//{ "invertedPattern", PKPattern_invertedPattern, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKPattern_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKPattern_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKPattern_staticFunctions; + def.staticValues = PKPattern_staticValues; + def.initialize = PKPattern_initialize; + def.finalize = PKPattern_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKPattern_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKPattern_class(ctx), data); +} + +JSObjectRef PKPattern_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKPattern"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + NSInteger opts = PKPatternOptionsNone; + + if (argc > 1) { + opts = JSValueToNumber(ctx, argv[1], ex); + } + + PKPattern *data = [[PKPattern alloc] initWithString:s options:opts]; + return PKPattern_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSQuoteState.h.svn-base b/jssrc/.svn/text-base/PKJSQuoteState.h.svn-base new file mode 100644 index 0000000..1a06d72 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSQuoteState.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSQuoteState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKQuoteState_new(JSContextRef ctx, void *data); +JSClassRef PKQuoteState_class(JSContextRef ctx); +JSObjectRef PKQuoteState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSQuoteState.m.svn-base b/jssrc/.svn/text-base/PKJSQuoteState.m.svn-base new file mode 100644 index 0000000..fa72f3d --- /dev/null +++ b/jssrc/.svn/text-base/PKJSQuoteState.m.svn-base @@ -0,0 +1,81 @@ +// +// PKJSQuoteState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSQuoteState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKQuoteState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKQuoteState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKQuoteState]", ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKQuoteState_getBalancesEOFTerminatedQuotes(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKQuoteState *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.balancesEOFTerminatedQuotes); +} + +static bool PKQuoteState_setBalancesEOFTerminatedQuotes(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKQuoteState *data = JSObjectGetPrivate(this); + data.balancesEOFTerminatedQuotes = JSValueToBoolean(ctx, value); + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKQuoteState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKQuoteState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKQuoteState_staticFunctions[] = { +{ "toString", PKQuoteState_toString, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKQuoteState_staticValues[] = { +{ "balancesEOFTerminatedQuotes", PKQuoteState_getBalancesEOFTerminatedQuotes, PKQuoteState_setBalancesEOFTerminatedQuotes, kJSPropertyAttributeDontDelete }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKQuoteState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKQuoteState_staticFunctions; + def.staticValues = PKQuoteState_staticValues; + def.initialize = PKQuoteState_initialize; + def.finalize = PKQuoteState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKQuoteState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKQuoteState_class(ctx), data); +} + +JSObjectRef PKQuoteState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKQuoteState *data = [[PKQuoteState alloc] init]; + return PKQuoteState_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSQuotedString.h.svn-base b/jssrc/.svn/text-base/PKJSQuotedString.h.svn-base new file mode 100644 index 0000000..1b37674 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSQuotedString.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSQuotedString.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKQuotedString_new(JSContextRef ctx, void *data); +JSClassRef PKQuotedString_class(JSContextRef ctx); +JSObjectRef PKQuotedString_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSQuotedString.m.svn-base b/jssrc/.svn/text-base/PKJSQuotedString.m.svn-base new file mode 100644 index 0000000..07c4f47 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSQuotedString.m.svn-base @@ -0,0 +1,63 @@ +// +// PKJSQuotedString.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSQuotedString.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKQuotedString_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKQuotedString_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKQuotedString_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKQuotedString_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKQuotedString_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKQuotedString_staticFunctions; + def.staticValues = PKQuotedString_staticValues; + def.initialize = PKQuotedString_initialize; + def.finalize = PKQuotedString_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKQuotedString_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKQuotedString_class(ctx), data); +} + +JSObjectRef PKQuotedString_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKQuotedString *data = [[PKQuotedString alloc] init]; + return PKQuotedString_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSRepetition.h.svn-base b/jssrc/.svn/text-base/PKJSRepetition.h.svn-base new file mode 100644 index 0000000..2ea1ec9 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSRepetition.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSRepetition.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKRepetition_new(JSContextRef ctx, void *data); +JSClassRef PKRepetition_class(JSContextRef ctx); +JSObjectRef PKRepetition_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSRepetition.m.svn-base b/jssrc/.svn/text-base/PKJSRepetition.m.svn-base new file mode 100644 index 0000000..72657f4 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSRepetition.m.svn-base @@ -0,0 +1,72 @@ +// +// PKJSRepetition.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSRepetition.h" +#import "PKJSUtils.h" +#import "PKJSParser.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKRepetition_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKRepetition_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKRepetition_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKRepetition_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKRepetition_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKParser_class(ctx); + def.staticFunctions = PKRepetition_staticFunctions; + def.staticValues = PKRepetition_staticValues; + def.initialize = PKRepetition_initialize; + def.finalize = PKRepetition_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKRepetition_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKRepetition_class(ctx), data); +} + +JSObjectRef PKRepetition_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKRepetition"); + + JSValueRef v = argv[0]; + if (!PKJSValueIsInstanceOfClass(ctx, v, "PKParser", ex)) { + *ex = PKNSStringToJSValue(ctx, @"argument to PKRepeition constructor must be and instance of a PKParser subclass", ex); + } + + PKParser *p = JSObjectGetPrivate((JSObjectRef)v); + + PKRepetition *data = [[PKRepetition alloc] initWithSubparser:p]; + return PKRepetition_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSSequence.h.svn-base b/jssrc/.svn/text-base/PKJSSequence.h.svn-base new file mode 100644 index 0000000..0dc69d1 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSSequence.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSSequence.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKSequence_new(JSContextRef ctx, void *data); +JSClassRef PKSequence_class(JSContextRef ctx); +JSObjectRef PKSequence_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSSequence.m.svn-base b/jssrc/.svn/text-base/PKJSSequence.m.svn-base new file mode 100644 index 0000000..820da91 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSSequence.m.svn-base @@ -0,0 +1,63 @@ +// +// PKJSSequence.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSSequence.h" +#import "PKJSUtils.h" +#import "PKJSCollectionParser.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKSequence_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKSequence_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKSequence_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKSequence_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKSequence_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKCollectionParser_class(ctx); + def.staticFunctions = PKSequence_staticFunctions; + def.staticValues = PKSequence_staticValues; + def.initialize = PKSequence_initialize; + def.finalize = PKSequence_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKSequence_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKSequence_class(ctx), data); +} + +JSObjectRef PKSequence_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKSequence *data = [[PKSequence alloc] init]; + return PKSequence_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSSymbol.h.svn-base b/jssrc/.svn/text-base/PKJSSymbol.h.svn-base new file mode 100644 index 0000000..45893eb --- /dev/null +++ b/jssrc/.svn/text-base/PKJSSymbol.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSSymbol.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKSymbol_new(JSContextRef ctx, void *data); +JSClassRef PKSymbol_class(JSContextRef ctx); +JSObjectRef PKSymbol_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSSymbol.m.svn-base b/jssrc/.svn/text-base/PKJSSymbol.m.svn-base new file mode 100644 index 0000000..a5140af --- /dev/null +++ b/jssrc/.svn/text-base/PKJSSymbol.m.svn-base @@ -0,0 +1,69 @@ +// +// PKJSSymbol.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSSymbol.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKSymbol_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKSymbol_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKSymbol_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKSymbol_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKSymbol_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKSymbol_staticFunctions; + def.staticValues = PKSymbol_staticValues; + def.initialize = PKSymbol_initialize; + def.finalize = PKSymbol_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKSymbol_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKSymbol_class(ctx), data); +} + +JSObjectRef PKSymbol_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + NSString *s = nil; + + if (argc > 0) { + s = PKJSValueGetNSString(ctx, argv[0], ex); + } + + PKSymbol *data = [[PKSymbol alloc] initWithString:s]; + return PKSymbol_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSSymbolState.h.svn-base b/jssrc/.svn/text-base/PKJSSymbolState.h.svn-base new file mode 100644 index 0000000..ae3aa9b --- /dev/null +++ b/jssrc/.svn/text-base/PKJSSymbolState.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSSymbolState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKSymbolState_new(JSContextRef ctx, void *data); +JSClassRef PKSymbolState_class(JSContextRef ctx); +JSObjectRef PKSymbolState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSSymbolState.m.svn-base b/jssrc/.svn/text-base/PKJSSymbolState.m.svn-base new file mode 100644 index 0000000..a36a68d --- /dev/null +++ b/jssrc/.svn/text-base/PKJSSymbolState.m.svn-base @@ -0,0 +1,95 @@ +// +// PKJSSymbolState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSSymbolState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKSymbolState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKSymbolState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKSymbolState]", ex); +} + +static JSValueRef PKSymbolState_add(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKSymbolState_class, "add"); + PKPreconditionMethodArgc(1, "PKSymbolState.add"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKSymbolState *data = JSObjectGetPrivate(this); + [data add:s]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKSymbolState_remove(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKSymbolState_class, "remove"); + PKPreconditionMethodArgc(1, "PKSymbolState.remove"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKSymbolState *data = JSObjectGetPrivate(this); + [data remove:s]; + + return JSValueMakeUndefined(ctx); +} + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKSymbolState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKSymbolState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKSymbolState_staticFunctions[] = { +{ "toString", PKSymbolState_toString, kJSPropertyAttributeDontDelete }, +{ "add", PKSymbolState_add, kJSPropertyAttributeDontDelete }, +{ "remove", PKSymbolState_remove, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKSymbolState_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKSymbolState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKSymbolState_staticFunctions; + def.staticValues = PKSymbolState_staticValues; + def.initialize = PKSymbolState_initialize; + def.finalize = PKSymbolState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKSymbolState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKSymbolState_class(ctx), data); +} + +JSObjectRef PKSymbolState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKSymbolState *data = [[PKSymbolState alloc] init]; + return PKSymbolState_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSTerminal.h.svn-base b/jssrc/.svn/text-base/PKJSTerminal.h.svn-base new file mode 100644 index 0000000..d4f7ddb --- /dev/null +++ b/jssrc/.svn/text-base/PKJSTerminal.h.svn-base @@ -0,0 +1,12 @@ +// +// PKJSTerminal.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKTerminal_new(JSContextRef ctx, void *data); +JSClassRef PKTerminal_class(JSContextRef ctx); diff --git a/jssrc/.svn/text-base/PKJSTerminal.m.svn-base b/jssrc/.svn/text-base/PKJSTerminal.m.svn-base new file mode 100644 index 0000000..98efca4 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSTerminal.m.svn-base @@ -0,0 +1,67 @@ +// +// PKJSTerminal.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSTerminal.h" +#import "PKJSUtils.h" +#import "PKJSParser.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKTerminal_discard(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTerminal_class, "discard"); + + PKTerminal *data = JSObjectGetPrivate(this); + [data discard]; + return this; +} + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKTerminal_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKTerminal_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKTerminal_staticFunctions[] = { +{ "discard", PKTerminal_discard, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKTerminal_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKTerminal_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKParser_class(ctx); + def.staticFunctions = PKTerminal_staticFunctions; + def.staticValues = PKTerminal_staticValues; + def.initialize = PKTerminal_initialize; + def.finalize = PKTerminal_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKTerminal_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKTerminal_class(ctx), data); +} diff --git a/jssrc/.svn/text-base/PKJSToken.h.svn-base b/jssrc/.svn/text-base/PKJSToken.h.svn-base new file mode 100644 index 0000000..b91d9b5 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSToken.h.svn-base @@ -0,0 +1,19 @@ +// +// PKJSToken.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKToken_new(JSContextRef ctx, void *data); +JSClassRef PKToken_class(JSContextRef ctx); +JSObjectRef PKToken_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); + +// a JS Class method +//JSValueRef PKToken_EOFToken(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* ex); + +// a JS Class property +JSValueRef PKToken_getEOFToken(JSContextRef ctx); diff --git a/jssrc/.svn/text-base/PKJSToken.m.svn-base b/jssrc/.svn/text-base/PKJSToken.m.svn-base new file mode 100644 index 0000000..ffd3ad3 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSToken.m.svn-base @@ -0,0 +1,159 @@ +// +// PKJSToken.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSToken.h" +#import "PKJSUtils.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKToken_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKToken_class, "toString"); + PKToken *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, [data debugDescription], ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKToken_getTokenType(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeNumber(ctx, data.tokenType); +} + +static JSValueRef PKToken_getStringValue(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, data.stringValue, ex); +} + +static JSValueRef PKToken_getFloatValue(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeNumber(ctx, data.floatValue); +} + +static JSValueRef PKToken_getIsNumber(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isNumber); +} + +static JSValueRef PKToken_getIsSymbol(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isSymbol); +} + +static JSValueRef PKToken_getIsWord(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isWord); +} + +static JSValueRef PKToken_getIsQuotedString(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isQuotedString); +} + +static JSValueRef PKToken_getIsWhitespace(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isWhitespace); +} + +static JSValueRef PKToken_getIsComment(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isComment); +} + +static JSValueRef PKToken_getIsDelimitedString(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isDelimitedString); +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKToken_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKToken_finalize(JSObjectRef this) { + PKToken *data = (PKToken *)JSObjectGetPrivate(this); + [data autorelease]; +} + +static JSStaticFunction PKToken_staticFunctions[] = { +{ "toString", PKToken_toString, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKToken_staticValues[] = { +{ "tokenType", PKToken_getTokenType, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Number +{ "stringValue", PKToken_getStringValue, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // String +{ "floatValue", PKToken_getFloatValue, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Number +{ "isNumber", PKToken_getIsNumber, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isSymbol", PKToken_getIsSymbol, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isWord", PKToken_getIsWord, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isQuotedString", PKToken_getIsQuotedString, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isWhitespace", PKToken_getIsWhitespace, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isComment", PKToken_getIsComment, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isDelimitedString", PKToken_getIsDelimitedString, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Class Methods + +// JSObjectCallAsFunctionCallback +//JSValueRef PKToken_EOFToken(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { +// static JSValueRef eof = NULL; +// if (!eof) { +// eof = PKToken_new(ctx, [PKToken EOFToken]); +// JSValueProtect(ctx, eof); // is this necessary/appropriate? +// } +// return eof; +//} + +#pragma mark - +#pragma mark Class Properties + +JSValueRef PKToken_getEOFToken(JSContextRef ctx) { + static JSObjectRef eof = NULL; + if (!eof) { + eof = PKToken_new(ctx, [PKToken EOFToken]); + } + return eof; +} + +#pragma mark - +#pragma mark Public + +JSClassRef PKToken_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.staticFunctions = PKToken_staticFunctions; + def.staticValues = PKToken_staticValues; + def.initialize = PKToken_initialize; + def.finalize = PKToken_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKToken_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKToken_class(ctx), data); +} + +JSObjectRef PKToken_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(3, "PKToken"); + + CGFloat tokenType = JSValueToNumber(ctx, argv[0], NULL); + NSString *stringValue = PKJSValueGetNSString(ctx, argv[1], ex); + CGFloat floatValue = JSValueToNumber(ctx, argv[2], NULL); + + PKToken *data = [[PKToken alloc] initWithTokenType:tokenType stringValue:stringValue floatValue:floatValue]; + return PKToken_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSTokenAssembly.h.svn-base b/jssrc/.svn/text-base/PKJSTokenAssembly.h.svn-base new file mode 100644 index 0000000..e00b979 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSTokenAssembly.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSTokenAssembly.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/3/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKTokenAssembly_new(JSContextRef ctx, void *data); +JSClassRef PKTokenAssembly_class(JSContextRef ctx); +JSObjectRef PKTokenAssembly_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSTokenAssembly.m.svn-base b/jssrc/.svn/text-base/PKJSTokenAssembly.m.svn-base new file mode 100644 index 0000000..32f9c1f --- /dev/null +++ b/jssrc/.svn/text-base/PKJSTokenAssembly.m.svn-base @@ -0,0 +1,121 @@ +// +// PKJSTokenAssembly.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/3/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSTokenAssembly.h" +#import "PKJSToken.h" +#import "PKJSUtils.h" +#import "PKJSAssembly.h" +#import +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKTokenAssembly_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenAssembly_class, "toString"); + PKTokenAssembly *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, [data description], ex); +} + +static JSValueRef PKTokenAssembly_pop(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenAssembly_class, "pop"); + PKTokenAssembly *data = JSObjectGetPrivate(this); + PKToken *tok = [data pop]; + return PKToken_new(ctx, tok); +} + +static JSValueRef PKTokenAssembly_push(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenAssembly_class, "push"); + PKPreconditionMethodArgc(1, "PKTokenAssembly.push"); + + JSValueRef v = argv[0]; + + PKTokenAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + [data push:obj]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKTokenAssembly_objectsAbove(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenAssembly_class, "objectsAbove"); + PKPreconditionMethodArgc(1, "PKTokenAssembly.objectsAbove"); + + JSValueRef v = argv[0]; + + PKTokenAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + id array = [data objectsAbove:obj]; + + return PKNSArrayToJSObject(ctx, array, ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKTokenAssembly_getLength(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenAssembly *data = JSObjectGetPrivate(this); + return JSValueMakeNumber(ctx, [data length]); +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKTokenAssembly_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKTokenAssembly_finalize(JSObjectRef this) { + // released in PKAssembly_finalize +} + +static JSStaticFunction PKTokenAssembly_staticFunctions[] = { +{ "toString", PKTokenAssembly_toString, kJSPropertyAttributeDontDelete }, +{ "pop", PKTokenAssembly_pop, kJSPropertyAttributeDontDelete }, +{ "push", PKTokenAssembly_push, kJSPropertyAttributeDontDelete }, +{ "objectsAbove", PKTokenAssembly_objectsAbove, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKTokenAssembly_staticValues[] = { +{ "length", PKTokenAssembly_getLength, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Number +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark ClassMethods + +#pragma mark - +#pragma mark Public + +JSClassRef PKTokenAssembly_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKAssembly_class(ctx); + def.staticFunctions = PKTokenAssembly_staticFunctions; + def.staticValues = PKTokenAssembly_staticValues; + def.initialize = PKTokenAssembly_initialize; + def.finalize = PKTokenAssembly_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKTokenAssembly_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKTokenAssembly_class(ctx), data); +} + +JSObjectRef PKTokenAssembly_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKTokenAssembly"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKTokenAssembly *data = [[PKTokenAssembly alloc] initWithString:s]; + return PKTokenAssembly_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSTokenizer.h.svn-base b/jssrc/.svn/text-base/PKJSTokenizer.h.svn-base new file mode 100644 index 0000000..c56fa3b --- /dev/null +++ b/jssrc/.svn/text-base/PKJSTokenizer.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSTokenizer.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/3/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKTokenizer_new(JSContextRef ctx, void *data); +JSClassRef PKTokenizer_class(JSContextRef ctx); +JSObjectRef PKTokenizer_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSTokenizer.m.svn-base b/jssrc/.svn/text-base/PKJSTokenizer.m.svn-base new file mode 100644 index 0000000..76f4e34 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSTokenizer.m.svn-base @@ -0,0 +1,215 @@ +// +// PKJSTokenizer.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/3/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSTokenizer.h" +#import "PKJSUtils.h" +#import "PKJSToken.h" +#import "PKJSWordState.h" +#import "PKJSNumberState.h" +#import "PKJSQuoteState.h" +#import "PKJSWhitespaceState.h" +#import "PKJSCommentState.h" +#import "PKJSSymbolState.h" +#import +#import +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKTokenizer_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenizer_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKTokenizer]", ex); +} + +static JSValueRef PKTokenizer_nextToken(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenizer_class, "nextToken"); + PKTokenizer *data = JSObjectGetPrivate(this); + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = [data nextToken]; + + if (eof == tok) { + return PKToken_getEOFToken(ctx); + } + + return PKToken_new(ctx, tok); +} + +static JSValueRef PKTokenizer_setTokenizerState(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenizer_class, "setTokenizerState"); + PKPreconditionMethodArgc(3, "PKTokenizer.setTokenizerState"); + + JSObjectRef stateObj = (JSObjectRef)argv[0]; + PKTokenizerState *state = JSObjectGetPrivate(stateObj); + NSString *from = PKJSValueGetNSString(ctx, argv[1], ex); + NSString *to = PKJSValueGetNSString(ctx, argv[2], ex); + + PKTokenizer *data = JSObjectGetPrivate(this); + [data setTokenizerState:state from:[from characterAtIndex:0] to:[to characterAtIndex:0]]; + + return JSValueMakeUndefined(ctx); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKTokenizer_getString(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, data.string, ex); +} + +static bool PKTokenizer_setString(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + data.string = PKJSValueGetNSString(ctx, value, ex); + return true; +} + +static JSValueRef PKTokenizer_getWordState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKWordState_new(ctx, data.wordState); + return NULL; +} + +static bool PKTokenizer_setWordState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKWordState *state = JSObjectGetPrivate(stateObj); + data.wordState = state; + return true; +} + +static JSValueRef PKTokenizer_getNumberState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKNumberState_new(ctx, data.numberState); + return NULL; +} + +static bool PKTokenizer_setNumberState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKNumberState *state = JSObjectGetPrivate(stateObj); + data.numberState = state; + return true; +} + +static JSValueRef PKTokenizer_getQuoteState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKQuoteState_new(ctx, data.quoteState); + return NULL; +} + +static bool PKTokenizer_setQuoteState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKQuoteState *state = JSObjectGetPrivate(stateObj); + data.quoteState = state; + return true; +} + +static JSValueRef PKTokenizer_getSymbolState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKSymbolState_new(ctx, data.symbolState); + return NULL; +} + +static bool PKTokenizer_setSymbolState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKSymbolState *state = JSObjectGetPrivate(stateObj); + data.symbolState = state; + return true; +} + +static JSValueRef PKTokenizer_getWhitespaceState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKWhitespaceState_new(ctx, data.whitespaceState); + return NULL; +} + +static bool PKTokenizer_setWhitespaceState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKWhitespaceState *state = JSObjectGetPrivate(stateObj); + data.whitespaceState = state; + return true; +} + +static JSValueRef PKTokenizer_getCommentState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKCommentState_new(ctx, data.commentState); + return NULL; +} + +static bool PKTokenizer_setCommentState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKCommentState *state = JSObjectGetPrivate(stateObj); + data.commentState = state; + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKTokenizer_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKTokenizer_finalize(JSObjectRef this) { + PKTokenizer *data = (PKTokenizer *)JSObjectGetPrivate(this); + [data autorelease]; +} + +static JSStaticFunction PKTokenizer_staticFunctions[] = { +{ "toString", PKTokenizer_toString, kJSPropertyAttributeDontDelete }, +{ "setTokenizerState", PKTokenizer_setTokenizerState, kJSPropertyAttributeDontDelete }, +{ "nextToken", PKTokenizer_nextToken, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKTokenizer_staticValues[] = { +{ "string", PKTokenizer_getString, PKTokenizer_setString, kJSPropertyAttributeDontDelete }, // String +{ "numberState", PKTokenizer_getNumberState, PKTokenizer_setNumberState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ "quoteState", PKTokenizer_getQuoteState, PKTokenizer_setQuoteState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ "commentState", PKTokenizer_getCommentState, PKTokenizer_setCommentState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ "symbolState", PKTokenizer_getSymbolState, PKTokenizer_setSymbolState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ "whitespaceState", PKTokenizer_getWhitespaceState, PKTokenizer_setWhitespaceState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ "wordState", PKTokenizer_getWordState, PKTokenizer_setWordState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKTokenizer_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.staticFunctions = PKTokenizer_staticFunctions; + def.staticValues = PKTokenizer_staticValues; + def.initialize = PKTokenizer_initialize; + def.finalize = PKTokenizer_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKTokenizer_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKTokenizer_class(ctx), data); +} + +JSObjectRef PKTokenizer_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKTokenizer"); + + JSValueRef s = argv[0]; + NSString *string = PKJSValueGetNSString(ctx, s, ex); + + PKTokenizer *data = [[PKTokenizer alloc] initWithString:string]; + return PKTokenizer_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSTokenizerState.h.svn-base b/jssrc/.svn/text-base/PKJSTokenizerState.h.svn-base new file mode 100644 index 0000000..ef4e19f --- /dev/null +++ b/jssrc/.svn/text-base/PKJSTokenizerState.h.svn-base @@ -0,0 +1,12 @@ +// +// PKJSTokenizerState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKTokenizerState_new(JSContextRef ctx, void *data); +JSClassRef PKTokenizerState_class(JSContextRef ctx); diff --git a/jssrc/.svn/text-base/PKJSTokenizerState.m.svn-base b/jssrc/.svn/text-base/PKJSTokenizerState.m.svn-base new file mode 100644 index 0000000..0b246c6 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSTokenizerState.m.svn-base @@ -0,0 +1,59 @@ +// +// PKJSTokenizerState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSTokenizerState.h" +#import "PKJSUtils.h" +#import "PKJSToken.h" +#import +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKTokenizerState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKTokenizerState_finalize(JSObjectRef this) { + PKTokenizerState *data = (PKTokenizerState *)JSObjectGetPrivate(this); + [data autorelease]; +} + +static JSStaticFunction PKTokenizerState_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKTokenizerState_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKTokenizerState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.staticFunctions = PKTokenizerState_staticFunctions; + def.staticValues = PKTokenizerState_staticValues; + def.initialize = PKTokenizerState_initialize; + def.finalize = PKTokenizerState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKTokenizerState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKTokenizerState_class(ctx), data); +} diff --git a/jssrc/.svn/text-base/PKJSTrack.h.svn-base b/jssrc/.svn/text-base/PKJSTrack.h.svn-base new file mode 100644 index 0000000..a4036b6 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSTrack.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSTrack.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKTrack_new(JSContextRef ctx, void *data); +JSClassRef PKTrack_class(JSContextRef ctx); +JSObjectRef PKTrack_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSTrack.m.svn-base b/jssrc/.svn/text-base/PKJSTrack.m.svn-base new file mode 100644 index 0000000..3d272fe --- /dev/null +++ b/jssrc/.svn/text-base/PKJSTrack.m.svn-base @@ -0,0 +1,63 @@ +// +// PKJSTrack.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSTrack.h" +#import "PKJSUtils.h" +#import "PKJSSequence.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKTrack_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKTrack_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKTrack_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKTrack_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKTrack_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKSequence_class(ctx); + def.staticFunctions = PKTrack_staticFunctions; + def.staticValues = PKTrack_staticValues; + def.initialize = PKTrack_initialize; + def.finalize = PKTrack_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKTrack_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKTrack_class(ctx), data); +} + +JSObjectRef PKTrack_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKTrack *data = [[PKTrack alloc] init]; + return PKTrack_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSUppercaseWord.h.svn-base b/jssrc/.svn/text-base/PKJSUppercaseWord.h.svn-base new file mode 100644 index 0000000..a43c32d --- /dev/null +++ b/jssrc/.svn/text-base/PKJSUppercaseWord.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSUppercaseWord.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/13/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKUppercaseWord_new(JSContextRef ctx, void *data); +JSClassRef PKUppercaseWord_class(JSContextRef ctx); +JSObjectRef PKUppercaseWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSUppercaseWord.m.svn-base b/jssrc/.svn/text-base/PKJSUppercaseWord.m.svn-base new file mode 100644 index 0000000..bb73a5d --- /dev/null +++ b/jssrc/.svn/text-base/PKJSUppercaseWord.m.svn-base @@ -0,0 +1,67 @@ +// +// PKJSUppercaseWord.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/13/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSUppercaseWord.h" +#import "PKJSUtils.h" +#import "PKJSWord.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKUppercaseWord_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKUppercaseWord_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKUppercaseWord_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKUppercaseWord_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKUppercaseWord_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKWord_class(ctx); + def.staticFunctions = PKUppercaseWord_staticFunctions; + def.staticValues = PKUppercaseWord_staticValues; + def.initialize = PKUppercaseWord_initialize; + def.finalize = PKUppercaseWord_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKUppercaseWord_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKUppercaseWord_class(ctx), data); +} + +JSObjectRef PKUppercaseWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKUppercaseWord"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKUppercaseWord *data = [[PKUppercaseWord alloc] initWithString:s]; + return PKUppercaseWord_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSUtils.h.svn-base b/jssrc/.svn/text-base/PKJSUtils.h.svn-base new file mode 100644 index 0000000..d4073be --- /dev/null +++ b/jssrc/.svn/text-base/PKJSUtils.h.svn-base @@ -0,0 +1,32 @@ +// +// PKJSUtils.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +#define PKPreconditionInstaceOf(cls, meth) +#define PKPreconditionMethodArgc(n, meth) +#define PKPreconditionConstructorArgc(n, meth) + +JSValueRef PKCFTypeToJSValue(JSContextRef ctx, CFTypeRef value, JSValueRef *ex); +JSValueRef PKCFStringToJSValue(JSContextRef ctx, CFStringRef cfStr, JSValueRef *ex); +JSValueRef PKNSStringToJSValue(JSContextRef ctx, NSString *nsStr, JSValueRef *ex); +JSObjectRef PKCFArrayToJSObject(JSContextRef ctx, CFArrayRef cfArray, JSValueRef *ex); +JSObjectRef PKNSArrayToJSObject(JSContextRef ctx, NSArray *nsArray, JSValueRef *ex); +JSObjectRef PKCFDictionaryToJSObject(JSContextRef ctx, CFDictionaryRef cfDict, JSValueRef *ex); +JSObjectRef PKNSDictionaryToJSObject(JSContextRef ctx, NSDictionary *nsDict, JSValueRef *ex); + +CFTypeRef PKJSValueCopyCFType(JSContextRef ctx, JSValueRef value, JSValueRef *ex); +id PKJSValueGetId(JSContextRef ctx, JSValueRef value, JSValueRef *ex); +CFStringRef PKJSValueCopyCFString(JSContextRef ctx, JSValueRef value, JSValueRef *ex); +NSString *PKJSValueGetNSString(JSContextRef ctx, JSValueRef value, JSValueRef *ex); +CFArrayRef PKJSObjectCopyCFArray(JSContextRef ctx, JSObjectRef obj, JSValueRef *ex); +CFDictionaryRef PKJSObjectCopyCFDictionary(JSContextRef ctx, JSObjectRef obj, JSValueRef *ex); + +JSObjectRef PKNSErrorToJSObject(JSContextRef ctx, NSError *nsErr, JSValueRef *ex); +bool PKJSValueIsInstanceOfClass(JSContextRef ctx, JSValueRef value, char *className, JSValueRef* ex); \ No newline at end of file diff --git a/jssrc/.svn/text-base/PKJSUtils.m.svn-base b/jssrc/.svn/text-base/PKJSUtils.m.svn-base new file mode 100644 index 0000000..bf02c8c --- /dev/null +++ b/jssrc/.svn/text-base/PKJSUtils.m.svn-base @@ -0,0 +1,236 @@ +// +// PKJSUtils.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSUtils.h" + +JSValueRef PKCFTypeToJSValue(JSContextRef ctx, CFTypeRef value, JSValueRef *ex) { + JSValueRef result = NULL; + CFTypeID typeID = CFGetTypeID(value); + + if (CFNumberGetTypeID() == typeID) { + double d; + CFNumberGetValue(value, kCFNumberDoubleType, &d); + result = JSValueMakeNumber(ctx, d); + } else if (CFBooleanGetTypeID() == typeID) { + Boolean b = CFBooleanGetValue(value); + result = JSValueMakeBoolean(ctx, b); + } else if (CFStringGetTypeID() == typeID) { + result = PKCFStringToJSValue(ctx, value, ex); + } else if (CFArrayGetTypeID() == typeID) { + result = PKCFArrayToJSObject(ctx, value, ex); + } else if (CFDictionaryGetTypeID() == typeID) { + result = PKCFDictionaryToJSObject(ctx, value, ex); + } else { + result = JSValueMakeNull(ctx); + } + + return result; +} + +JSValueRef PKCFStringToJSValue(JSContextRef ctx, CFStringRef cfStr, JSValueRef *ex) { + JSStringRef str = JSStringCreateWithCFString(cfStr); + JSValueRef result = JSValueMakeString(ctx, str); + JSStringRelease(str); + return result; +} + +JSValueRef PKNSStringToJSValue(JSContextRef ctx, NSString *nsStr, JSValueRef *ex) { + return PKCFStringToJSValue(ctx, (CFStringRef)nsStr, ex); +} + +JSObjectRef PKCFArrayToJSObject(JSContextRef ctx, CFArrayRef cfArray, JSValueRef *ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef className = JSStringCreateWithUTF8CString("Array"); + JSObjectRef arrayConstr = (JSObjectRef)JSObjectGetProperty(ctx, globalObj, className, NULL); + JSStringRelease(className); + + JSObjectRef obj = (JSObjectRef)JSObjectCallAsConstructor(ctx, arrayConstr, 0, NULL, NULL); + + CFIndex len = 0; + if (NULL != cfArray) { + len = CFArrayGetCount(cfArray); + } + + CFIndex i = 0; + for ( ; i < len; i++) { + CFTypeRef value = CFArrayGetValueAtIndex(cfArray, i); + JSValueRef propVal = PKCFTypeToJSValue(ctx, value, ex); + JSObjectSetPropertyAtIndex(ctx, obj, i, propVal, NULL); + } + + return obj; +} + +JSObjectRef PKNSArrayToJSObject(JSContextRef ctx, NSArray *nsArray, JSValueRef *ex) { + return PKCFArrayToJSObject(ctx, (CFArrayRef)nsArray, ex); +} + +JSObjectRef PKCFDictionaryToJSObject(JSContextRef ctx, CFDictionaryRef cfDict, JSValueRef *ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef className = JSStringCreateWithUTF8CString("Object"); + JSObjectRef objConstr = (JSObjectRef)JSObjectGetProperty(ctx, globalObj, className, NULL); + JSStringRelease(className); + + JSObjectRef obj = (JSObjectRef)JSObjectCallAsConstructor(ctx, objConstr, 0, NULL, NULL); + + if (NULL != cfDict) { + CFIndex len = CFDictionaryGetCount(cfDict); + CFStringRef keys[len]; + CFTypeRef values[len]; + CFDictionaryGetKeysAndValues(cfDict, (const void**)keys, (const void**)values); + + CFIndex i = 0; + for ( ; i < len; i++) { + CFStringRef key = keys[i]; + CFTypeRef value = values[i]; + + JSStringRef propName = JSStringCreateWithCFString(key); + JSValueRef propVal = PKCFTypeToJSValue(ctx, value, ex); + JSObjectSetProperty(ctx, obj, propName, propVal, kJSPropertyAttributeNone, NULL); + JSStringRelease(propName); + } + } + + return obj; +} + +JSObjectRef PKNSDictionaryToJSObject(JSContextRef ctx, NSDictionary *nsDict, JSValueRef *ex) { + return PKCFDictionaryToJSObject(ctx, (CFDictionaryRef)nsDict, ex); +} + +CFTypeRef PKJSValueCopyCFType(JSContextRef ctx, JSValueRef value, JSValueRef *ex) { + CFTypeRef result = NULL; + + if (JSValueIsBoolean(ctx, value)) { + Boolean b = JSValueToBoolean(ctx, value); + result = (b ? kCFBooleanTrue : kCFBooleanFalse); + } else if (JSValueIsNull(ctx, value)) { + result = NULL; + } else if (JSValueIsNumber(ctx, value)) { + CGFloat d = JSValueToNumber(ctx, value, NULL); + result = CFNumberCreate(NULL, kCFNumberCGFloatType, &d); + } else if (JSValueIsString(ctx, value)) { + result = PKJSValueCopyCFString(ctx, value, ex); + } else if (JSValueIsObject(ctx, value)) { + if (PKJSValueIsInstanceOfClass(ctx, value, "Array", NULL)) { + result = PKJSObjectCopyCFArray(ctx, (JSObjectRef)value, ex); + } else { + result = PKJSObjectCopyCFDictionary(ctx, (JSObjectRef)value, ex); + } + } + + return result; +} + +id PKJSValueGetId(JSContextRef ctx, JSValueRef value, JSValueRef *ex) { + return [(id)PKJSValueCopyCFType(ctx, value, ex) autorelease]; +} + +CFStringRef PKJSValueCopyCFString(JSContextRef ctx, JSValueRef value, JSValueRef *ex) { + JSStringRef str = JSValueToStringCopy(ctx, value, ex); + CFStringRef result = JSStringCopyCFString(NULL, str); + JSStringRelease(str); + return result; +} + +NSString *PKJSValueGetNSString(JSContextRef ctx, JSValueRef value, JSValueRef *ex) { + return [(id)PKJSValueCopyCFString(ctx, value, ex) autorelease]; +} + +CFArrayRef PKJSObjectCopyCFArray(JSContextRef ctx, JSObjectRef obj, JSValueRef *ex) { + JSStringRef propName = JSStringCreateWithUTF8CString("length"); + JSValueRef propVal = JSObjectGetProperty(ctx, obj, propName, NULL); + JSStringRelease(propName); + CFIndex len = (CFIndex)JSValueToNumber(ctx, propVal, NULL); + + CFMutableArrayRef cfArray = CFArrayCreateMutable(NULL, len, NULL); + + CFIndex i = 0; + for ( ; i < len; i++) { + JSValueRef val = JSObjectGetPropertyAtIndex(ctx, obj, i, NULL); + CFTypeRef cfType = PKJSValueCopyCFType(ctx, val, ex); + CFArraySetValueAtIndex(cfArray, i, cfType); + + CFRelease(cfType); + } + + CFArrayRef result = CFArrayCreateCopy(NULL, cfArray); + CFRelease(cfArray); + + return result; +} + +CFDictionaryRef PKJSObjectCopyCFDictionary(JSContextRef ctx, JSObjectRef obj, JSValueRef *ex) { + JSPropertyNameArrayRef propNames = JSObjectCopyPropertyNames(ctx, obj); + CFIndex len = JSPropertyNameArrayGetCount(propNames); + + CFMutableDictionaryRef cfDict = CFDictionaryCreateMutable(NULL, len, NULL, NULL); + + CFIndex i = 0; + for ( ; i < len; i++) { + JSStringRef propName = JSPropertyNameArrayGetNameAtIndex(propNames, i); + JSValueRef val = JSObjectGetProperty(ctx, obj, propName, NULL); + CFTypeRef cfType = PKJSValueCopyCFType(ctx, val, ex); + + CFStringRef key = JSStringCopyCFString(NULL, propName); + CFDictionarySetValue(cfDict, (const void *)key, (const void *)cfType); + + CFRelease(key); + CFRelease(cfType); + } + + JSPropertyNameArrayRelease(propNames); + CFDictionaryRef result = CFDictionaryCreateCopy(NULL, cfDict); + CFRelease(cfDict); + + return result; +} + +JSObjectRef PKNSErrorToJSObject(JSContextRef ctx, NSError *nsErr, JSValueRef *ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef className = JSStringCreateWithUTF8CString("Error"); + JSObjectRef errConstr = (JSObjectRef)JSObjectGetProperty(ctx, globalObj, className, ex); + JSStringRelease(className); + + JSObjectRef obj = (JSObjectRef)JSObjectCallAsConstructor(ctx, errConstr, 0, NULL, ex); + + if (nsErr) { + JSStringRef nameStr = JSStringCreateWithUTF8CString("ParseKitError"); + JSValueRef name = JSValueMakeString(ctx, nameStr); + JSStringRelease(nameStr); + + JSStringRef msgStr = JSStringCreateWithCFString((CFStringRef)[nsErr localizedDescription]); + JSValueRef msg = JSValueMakeString(ctx, msgStr); + JSStringRelease(msgStr); + + JSValueRef code = JSValueMakeNumber(ctx, [nsErr code]); + + JSStringRef propName = JSStringCreateWithUTF8CString("name"); + JSObjectSetProperty(ctx, obj, propName, name, kJSPropertyAttributeReadOnly|kJSPropertyAttributeDontDelete, ex); + JSStringRelease(propName); + + propName = JSStringCreateWithUTF8CString("message"); + JSObjectSetProperty(ctx, obj, propName, msg, kJSPropertyAttributeReadOnly|kJSPropertyAttributeDontDelete, ex); + JSStringRelease(propName); + + propName = JSStringCreateWithUTF8CString("code"); + JSObjectSetProperty(ctx, obj, propName, code, kJSPropertyAttributeReadOnly|kJSPropertyAttributeDontDelete, ex); + JSStringRelease(propName); + } + + return obj; +} + +bool PKJSValueIsInstanceOfClass(JSContextRef ctx, JSValueRef value, char *className, JSValueRef* ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef classNameStr = JSStringCreateWithUTF8CString(className); + JSObjectRef constr = (JSObjectRef)JSObjectGetProperty(ctx, globalObj, classNameStr, ex); + JSStringRelease(classNameStr); + + return JSValueIsInstanceOfConstructor(ctx, value, constr, NULL); +} diff --git a/jssrc/.svn/text-base/PKJSUtils_macros.h.svn-base b/jssrc/.svn/text-base/PKJSUtils_macros.h.svn-base new file mode 100644 index 0000000..0be22bd --- /dev/null +++ b/jssrc/.svn/text-base/PKJSUtils_macros.h.svn-base @@ -0,0 +1,33 @@ +/* + * PKJSUtils_macros.h + * ParseKit + * + * Created by Todd Ditchendorf on 1/11/09. + * Copyright 2009 Todd Ditchendorf. All rights reserved. + * + */ + +#undef PKPreconditionInstaceOf +#define PKPreconditionInstaceOf(cls, meth) \ + if (!JSValueIsObjectOfClass(ctx, this, (cls)(ctx))) { \ + NSString *s = [NSString stringWithFormat:@"calling method '%s' on an object that is not an instance of '%s'", (meth), #cls]; \ + (*ex) = PKNSStringToJSValue(ctx, s, ex); \ + return JSValueMakeUndefined(ctx); \ + } + +#undef PKPreconditionMethodArgc +#define PKPreconditionMethodArgc(n, meth) \ + if (argc < (n)) { \ + NSString *s = [NSString stringWithFormat:@"%s() requires %d arguments", (meth), (n)]; \ + (*ex) = PKNSStringToJSValue(ctx, s, ex); \ + return JSValueMakeUndefined(ctx); \ + } + +#undef PKPreconditionConstructorArgc +#define PKPreconditionConstructorArgc(n, meth) \ + if (argc < (n)) { \ + NSString *s = [NSString stringWithFormat:@"%s constructor requires %d arguments", (meth), (n)]; \ + (*ex) = PKNSStringToJSValue(ctx, s, ex); \ + return NULL; \ + } + diff --git a/jssrc/.svn/text-base/PKJSValueHolder.h.svn-base b/jssrc/.svn/text-base/PKJSValueHolder.h.svn-base new file mode 100644 index 0000000..0fc309c --- /dev/null +++ b/jssrc/.svn/text-base/PKJSValueHolder.h.svn-base @@ -0,0 +1,20 @@ +// +// PKJSValueHolder.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface JSValueHolder : NSObject { + JSContextRef context; + JSValueRef heldValue; +} +- (id)initWithContext:(JSContextRef)c heldValue:(JSValueRef)v; + +@property (nonatomic) JSContextRef context; +@property (nonatomic) JSValueRef heldValue; +@end \ No newline at end of file diff --git a/jssrc/.svn/text-base/PKJSValueHolder.m.svn-base b/jssrc/.svn/text-base/PKJSValueHolder.m.svn-base new file mode 100644 index 0000000..6b4eb79 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSValueHolder.m.svn-base @@ -0,0 +1,29 @@ +// +// PKJSValueHolder.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSValueHolder.h" + +@implementation JSValueHolder + +- (id)initWithContext:(JSContextRef)c heldValue:(JSValueRef)v { + if (self = [super init]) { + self.context = c; + self.heldValue = v; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +@synthesize context; +@synthesize heldValue; +@end diff --git a/jssrc/.svn/text-base/PKJSWhitespaceState.h.svn-base b/jssrc/.svn/text-base/PKJSWhitespaceState.h.svn-base new file mode 100644 index 0000000..68a04a7 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSWhitespaceState.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSWhitespaceState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKWhitespaceState_new(JSContextRef ctx, void *data); +JSClassRef PKWhitespaceState_class(JSContextRef ctx); +JSObjectRef PKWhitespaceState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSWhitespaceState.m.svn-base b/jssrc/.svn/text-base/PKJSWhitespaceState.m.svn-base new file mode 100644 index 0000000..54a4fc6 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSWhitespaceState.m.svn-base @@ -0,0 +1,109 @@ +// +// PKJSWhitespaceState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSWhitespaceState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKWhitespaceState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWhitespaceState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKWhitespaceState]", ex); +} + +static JSValueRef PKWhitespaceState_setWhitespaceChars(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWhitespaceState_class, "setWhitespaceChars"); + PKPreconditionMethodArgc(3, "PKWhitespaceState.setWhitespaceChars"); + + BOOL yn = JSValueToBoolean(ctx, argv[0]); + NSString *start = PKJSValueGetNSString(ctx, argv[1], ex); + NSString *end = PKJSValueGetNSString(ctx, argv[2], ex); + + PKWhitespaceState *data = JSObjectGetPrivate(this); + [data setWhitespaceChars:yn from:[start characterAtIndex:0] to:[end characterAtIndex:0]]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKWhitespaceState_isWhitespaceChar(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWhitespaceState_class, "isWhitespaceChar"); + PKPreconditionMethodArgc(1, "PKWhitespaceState.add"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKWhitespaceState *data = JSObjectGetPrivate(this); + BOOL yn = [data isWhitespaceChar:[s characterAtIndex:0]]; + + return JSValueMakeBoolean(ctx, yn); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKWhitespaceState_getReportsWhitespaceTokens(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKWhitespaceState *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.reportsWhitespaceTokens); +} + +static bool PKWhitespaceState_setReportsWhitespaceTokens(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKWhitespaceState *data = JSObjectGetPrivate(this); + data.reportsWhitespaceTokens = JSValueToBoolean(ctx, value); + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKWhitespaceState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKWhitespaceState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKWhitespaceState_staticFunctions[] = { +{ "toString", PKWhitespaceState_toString, kJSPropertyAttributeDontDelete }, +{ "setWhitespaceChars", PKWhitespaceState_setWhitespaceChars, kJSPropertyAttributeDontDelete }, +{ "isWhitespaceChar", PKWhitespaceState_isWhitespaceChar, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKWhitespaceState_staticValues[] = { +{ "reportsWhitespaceTokens", PKWhitespaceState_getReportsWhitespaceTokens, PKWhitespaceState_setReportsWhitespaceTokens, kJSPropertyAttributeDontDelete }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKWhitespaceState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKWhitespaceState_staticFunctions; + def.staticValues = PKWhitespaceState_staticValues; + def.initialize = PKWhitespaceState_initialize; + def.finalize = PKWhitespaceState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKWhitespaceState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKWhitespaceState_class(ctx), data); +} + +JSObjectRef PKWhitespaceState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKWhitespaceState *data = [[PKWhitespaceState alloc] init]; + return PKWhitespaceState_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSWord.h.svn-base b/jssrc/.svn/text-base/PKJSWord.h.svn-base new file mode 100644 index 0000000..bc3880c --- /dev/null +++ b/jssrc/.svn/text-base/PKJSWord.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSWord.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKWord_new(JSContextRef ctx, void *data); +JSClassRef PKWord_class(JSContextRef ctx); +JSObjectRef PKWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSWord.m.svn-base b/jssrc/.svn/text-base/PKJSWord.m.svn-base new file mode 100644 index 0000000..63d4156 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSWord.m.svn-base @@ -0,0 +1,63 @@ +// +// PKJSWord.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSWord.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKWord_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKWord_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKWord_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKWord_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKWord_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKWord_staticFunctions; + def.staticValues = PKWord_staticValues; + def.initialize = PKWord_initialize; + def.finalize = PKWord_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKWord_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKWord_class(ctx), data); +} + +JSObjectRef PKWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKWord *data = [[PKWord alloc] init]; + return PKWord_new(ctx, data); +} diff --git a/jssrc/.svn/text-base/PKJSWordState.h.svn-base b/jssrc/.svn/text-base/PKJSWordState.h.svn-base new file mode 100644 index 0000000..34e2562 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSWordState.h.svn-base @@ -0,0 +1,13 @@ +// +// PKJSWordState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +JSObjectRef PKWordState_new(JSContextRef ctx, void *data); +JSClassRef PKWordState_class(JSContextRef ctx); +JSObjectRef PKWordState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/.svn/text-base/PKJSWordState.m.svn-base b/jssrc/.svn/text-base/PKJSWordState.m.svn-base new file mode 100644 index 0000000..1082294 --- /dev/null +++ b/jssrc/.svn/text-base/PKJSWordState.m.svn-base @@ -0,0 +1,97 @@ +// +// PKJSWordState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/9/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKJSWordState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKWordState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWordState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKWordState]", ex); +} + +static JSValueRef PKWordState_setWordChars(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWordState_class, "setWordChars"); + PKPreconditionMethodArgc(3, "PKWordState.setWordChars"); + + BOOL yn = JSValueToBoolean(ctx, argv[0]); + NSString *start = PKJSValueGetNSString(ctx, argv[1], ex); + NSString *end = PKJSValueGetNSString(ctx, argv[2], ex); + + PKWordState *data = JSObjectGetPrivate(this); + [data setWordChars:yn from:[start characterAtIndex:0] to:[end characterAtIndex:0]]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKWordState_isWordChar(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWordState_class, "isWordChar"); + PKPreconditionMethodArgc(1, "PKWordState.isWordChar"); + + NSInteger c = (NSInteger)JSValueToNumber(ctx, argv[0], ex); + + PKWordState *data = JSObjectGetPrivate(this); + BOOL yn = [data isWordChar:c]; + + return JSValueMakeBoolean(ctx, yn); +} + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKWordState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKWordState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKWordState_staticFunctions[] = { +{ "toString", PKWordState_toString, kJSPropertyAttributeDontDelete }, +{ "setWordChars", PKWordState_setWordChars, kJSPropertyAttributeDontDelete }, +{ "isWordChar", PKWordState_isWordChar, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKWordState_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKWordState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKWordState_staticFunctions; + def.staticValues = PKWordState_staticValues; + def.initialize = PKWordState_initialize; + def.finalize = PKWordState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKWordState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKWordState_class(ctx), data); +} + +JSObjectRef PKWordState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKWordState *data = [[PKWordState alloc] init]; + return PKWordState_new(ctx, data); +} diff --git a/jssrc/JSParseKit.h b/jssrc/JSParseKit.h new file mode 100644 index 0000000..9550956 --- /dev/null +++ b/jssrc/JSParseKit.h @@ -0,0 +1,18 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +void PKJSParseKitSetUpContext(JSContextRef ctx); \ No newline at end of file diff --git a/jssrc/JSParseKit.m b/jssrc/JSParseKit.m new file mode 100644 index 0000000..dbc999f --- /dev/null +++ b/jssrc/JSParseKit.m @@ -0,0 +1,122 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import "PKJSUtils.h" +#import "PKJSToken.h" +#import "PKJSTokenizer.h" +#import "PKJSTokenizerState.h" +#import "PKJSAssembly.h" +#import "PKJSTokenAssembly.h" +#import "PKJSCharacterAssembly.h" +#import "PKJSWordState.h" +#import "PKJSNumberState.h" +#import "PKJSWhitespaceState.h" +#import "PKJSCommentState.h" +#import "PKJSQuoteState.h" +#import "PKJSSymbolState.h" +#import "PKJSRepetition.h" +#import "PKJSSequence.h" +#import "PKJSTrack.h" +#import "PKJSAlternation.h" +#import "PKJSEmpty.h" +#import "PKJSAny.h" +#import "PKJSWord.h" +#import "PKJSNum.h" +#import "PKJSQuotedString.h" +#import "PKJSSymbol.h" +#import "PKJSComment.h" +#import "PKJSLiteral.h" +#import "PKJSCaseInsensitiveLiteral.h" +#import "PKJSUppercaseWord.h" +#import "PKJSLowercaseWord.h" + +static void printValue(JSContextRef ctx, JSValueRef val) { + NSString *s = PKJSValueGetNSString(ctx, val, NULL); + NSLog(@"%@", s); +} + +static JSValueRef print(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + printValue(ctx, argv[0]); // TODO check args + return JSValueMakeUndefined(ctx); +} + +static JSObjectRef setUpFunction(JSContextRef ctx, char *funcName, JSObjectCallAsFunctionCallback funcCallback, JSValueRef *ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef funcNameStr = JSStringCreateWithUTF8CString(funcName); + JSObjectRef func = JSObjectMakeFunctionWithCallback(ctx, funcNameStr, funcCallback); + JSObjectSetProperty(ctx, globalObj, funcNameStr, func, kJSPropertyAttributeNone, ex); + JSStringRelease(funcNameStr); + return func; +} + +static JSObjectRef setUpConstructor(JSContextRef ctx, char *className, JSClassRef jsClass, JSObjectCallAsConstructorCallback constrCallback, JSValueRef *ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef classNameStr = JSStringCreateWithUTF8CString(className); + JSObjectRef constr = JSObjectMakeConstructor(ctx, jsClass, constrCallback); + JSObjectSetProperty(ctx, globalObj, classNameStr, constr, kJSPropertyAttributeNone, ex); + JSStringRelease(classNameStr); + return constr; +} + +static void setUpClassProperty(JSContextRef ctx, char *propName, JSValueRef prop, JSObjectRef constr, JSValueRef *ex) { + JSStringRef propNameStr = JSStringCreateWithUTF8CString(propName); + JSObjectSetProperty(ctx, constr, propNameStr, prop, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly, NULL); + JSStringRelease(propNameStr); +} + +void PKJSParseKitSetUpContext(JSContextRef ctx) { + JSValueRef ex = NULL; + + setUpFunction(ctx, "print", print, &ex); + + // Assemblies + setUpConstructor(ctx, "PKTokenAssembly", PKTokenAssembly_class(ctx), PKTokenAssembly_construct, &ex); + setUpConstructor(ctx, "PKCharacterAssembly", PKCharacterAssembly_class(ctx), PKCharacterAssembly_construct, &ex); + + // Tokenization + JSObjectRef constr = setUpConstructor(ctx, "PKToken", PKToken_class(ctx), PKToken_construct, &ex); + setUpClassProperty(ctx, "EOFToken", PKToken_getEOFToken(ctx), constr, &ex); // Class property on Token constructor + + setUpConstructor(ctx, "PKTokenizer", PKTokenizer_class(ctx), PKTokenizer_construct, &ex); + setUpConstructor(ctx, "PKWordState", PKWordState_class(ctx), PKWordState_construct, &ex); + setUpConstructor(ctx, "PKQuoteState", PKQuoteState_class(ctx), PKQuoteState_construct, &ex); + setUpConstructor(ctx, "PKNumberState", PKNumberState_class(ctx), PKNumberState_construct, &ex); + setUpConstructor(ctx, "PKSymbolState", PKSymbolState_class(ctx), PKSymbolState_construct, &ex); + setUpConstructor(ctx, "PKCommentState", PKCommentState_class(ctx), PKCommentState_construct, &ex); + setUpConstructor(ctx, "PKWhitespaceState", PKWhitespaceState_class(ctx), PKWhitespaceState_construct, &ex); + + // Parsers + setUpConstructor(ctx, "PKRepetition", PKRepetition_class(ctx), PKRepetition_construct, &ex); + + // Collection Parsers + setUpConstructor(ctx, "PKAlternation", PKAlternation_class(ctx), PKAlternation_construct, &ex); + setUpConstructor(ctx, "PKSequence", PKSequence_class(ctx), PKSequence_construct, &ex); + + // Terminal Parsers + setUpConstructor(ctx, "PKEmpty", PKEmpty_class(ctx), PKEmpty_construct, &ex); + setUpConstructor(ctx, "PKAny", PKAny_class(ctx), PKAny_construct, &ex); + + // Token Terminals + setUpConstructor(ctx, "PKWord", PKWord_class(ctx), PKWord_construct, &ex); + setUpConstructor(ctx, "PKNum", PKNum_class(ctx), PKNum_construct, &ex); + setUpConstructor(ctx, "PKQuotedString", PKQuotedString_class(ctx), PKQuotedString_construct, &ex); + setUpConstructor(ctx, "PKSymbol", PKSymbol_class(ctx), PKSymbol_construct, &ex); + setUpConstructor(ctx, "PKComment", PKComment_class(ctx), PKComment_construct, &ex); + setUpConstructor(ctx, "PKLiteral", PKLiteral_class(ctx), PKLiteral_construct, &ex); + setUpConstructor(ctx, "PKCaseInsensitiveLiteral", PKCaseInsensitiveLiteral_class(ctx), PKCaseInsensitiveLiteral_construct, &ex); + setUpConstructor(ctx, "PKUppercaseWord", PKUppercaseWord_class(ctx), PKUppercaseWord_construct, &ex); + setUpConstructor(ctx, "PKLowercaseWord", PKLowercaseWord_class(ctx), PKLowercaseWord_construct, &ex); +} diff --git a/jssrc/PKJSAlternation.h b/jssrc/PKJSAlternation.h new file mode 100644 index 0000000..6f1fdf5 --- /dev/null +++ b/jssrc/PKJSAlternation.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKAlternation_new(JSContextRef ctx, void *data); +JSClassRef PKAlternation_class(JSContextRef ctx); +JSObjectRef PKAlternation_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSAlternation.m b/jssrc/PKJSAlternation.m new file mode 100644 index 0000000..437e75a --- /dev/null +++ b/jssrc/PKJSAlternation.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSAlternation.h" +#import "PKJSUtils.h" +#import "PKJSCollectionParser.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKAlternation_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKAlternation_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKAlternation_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKAlternation_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKAlternation_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKCollectionParser_class(ctx); + def.staticFunctions = PKAlternation_staticFunctions; + def.staticValues = PKAlternation_staticValues; + def.initialize = PKAlternation_initialize; + def.finalize = PKAlternation_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKAlternation_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKAlternation_class(ctx), data); +} + +JSObjectRef PKAlternation_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKAlternation *data = [[PKAlternation alloc] init]; + return PKAlternation_new(ctx, data); +} diff --git a/jssrc/PKJSAny.h b/jssrc/PKJSAny.h new file mode 100644 index 0000000..a54887a --- /dev/null +++ b/jssrc/PKJSAny.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKAny_new(JSContextRef ctx, void *data); +JSClassRef PKAny_class(JSContextRef ctx); +JSObjectRef PKAny_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSAny.m b/jssrc/PKJSAny.m new file mode 100644 index 0000000..2f672de --- /dev/null +++ b/jssrc/PKJSAny.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSAny.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKAny_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKAny_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKAny_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKAny_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKAny_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKAny_staticFunctions; + def.staticValues = PKAny_staticValues; + def.initialize = PKAny_initialize; + def.finalize = PKAny_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKAny_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKAny_class(ctx), data); +} + +JSObjectRef PKAny_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKAny *data = [[PKAny alloc] init]; + return PKAny_new(ctx, data); +} diff --git a/jssrc/PKJSAssemblerAdapter.h b/jssrc/PKJSAssemblerAdapter.h new file mode 100644 index 0000000..417783c --- /dev/null +++ b/jssrc/PKJSAssemblerAdapter.h @@ -0,0 +1,28 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class PKAssembly; + +@interface PKJSAssemblerAdapter : NSObject { + JSContextRef ctx; + JSObjectRef assemblerFunction; +} +- (void)didMatch:(PKAssembly *)a; + +- (JSObjectRef)assemblerFunction; +- (void)setAssemblerFunction:(JSObjectRef)f fromContext:(JSContextRef)c; +@end diff --git a/jssrc/PKJSAssemblerAdapter.m b/jssrc/PKJSAssemblerAdapter.m new file mode 100644 index 0000000..c39ee42 --- /dev/null +++ b/jssrc/PKJSAssemblerAdapter.m @@ -0,0 +1,80 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSAssemblerAdapter.h" +#import "PKJSTokenAssembly.h" +#import "PKJSCharacterAssembly.h" +#import "PKJSUtils.h" +#import +#import +#import + +@implementation PKJSAssemblerAdapter + +- (id)init { + if (self = [super init]) { + + } + return self; +} + + +- (void)dealloc { + [self setAssemblerFunction:NULL fromContext:NULL]; + [super dealloc]; +} + + +- (void)didMatch:(PKAssembly *)a { + JSValueRef arg = NULL; + if ([a isMemberOfClass:[PKTokenAssembly class]]) { + arg = (JSValueRef)PKTokenAssembly_new(ctx, a); + } else if ([a isMemberOfClass:[PKCharacterAssembly class]]) { + arg = (JSValueRef)PKCharacterAssembly_new(ctx, a); + } else { + NSAssert(0, @"Should not reach here."); + } + + JSValueRef argv[] = { arg }; + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSValueRef ex = NULL; + JSObjectCallAsFunction(ctx, assemblerFunction, globalObj, 1, argv, &ex); + if (ex) { + NSString *s = PKJSValueGetNSString(ctx, ex, NULL); + [NSException raise:@"PKJSException" format:s arguments:NULL]; + } +} + + +- (JSObjectRef)assemblerFunction { + return assemblerFunction; +} + + +- (void)setAssemblerFunction:(JSObjectRef)f fromContext:(JSContextRef)c { + if (assemblerFunction != f) { + if (ctx && assemblerFunction) { + JSValueUnprotect(ctx, assemblerFunction); + JSGarbageCollect(ctx); + } + + ctx = c; + assemblerFunction = f; + if (ctx && assemblerFunction) { + JSValueProtect(ctx, assemblerFunction); + } + } +} + +@end diff --git a/jssrc/PKJSAssembly.h b/jssrc/PKJSAssembly.h new file mode 100644 index 0000000..efddd30 --- /dev/null +++ b/jssrc/PKJSAssembly.h @@ -0,0 +1,18 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKAssembly_new(JSContextRef ctx, void *data); +JSClassRef PKAssembly_class(JSContextRef ctx); diff --git a/jssrc/PKJSAssembly.m b/jssrc/PKJSAssembly.m new file mode 100644 index 0000000..1282f66 --- /dev/null +++ b/jssrc/PKJSAssembly.m @@ -0,0 +1,142 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSAssembly.h" +#import "PKJSToken.h" +#import "PKJSUtils.h" +#import +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKAssembly_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKAssembly_class, "toString"); + PKAssembly *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, [data description], ex); +} + +static JSValueRef PKAssembly_pop(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKAssembly_class, "pop"); + + PKAssembly *data = JSObjectGetPrivate(this); + PKToken *tok = [data pop]; + return PKToken_new(ctx, tok); +} + +static JSValueRef PKAssembly_push(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKAssembly_class, "push"); + PKPreconditionMethodArgc(1, "PKAssembly.push"); + + JSValueRef v = argv[0]; + + PKAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + [data push:obj]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKAssembly_objectsAbove(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKAssembly_class, "objectsAbove"); + PKPreconditionMethodArgc(1, "PKAssembly.objectsAbove"); + + JSValueRef v = argv[0]; + + PKAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + id array = [data objectsAbove:obj]; + + return PKNSArrayToJSObject(ctx, array, ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKAssembly_getDefaultDelimiter(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKAssembly *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, data.defaultDelimiter, ex); +} + +static JSValueRef PKAssembly_getStack(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKAssembly *data = JSObjectGetPrivate(this); + return PKNSArrayToJSObject(ctx, data.stack, ex); +} + +static JSValueRef PKAssembly_getTarget(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKAssembly *data = JSObjectGetPrivate(this); + return PKCFTypeToJSValue(ctx, (CFTypeRef)data.target, ex); +} + +static bool PKAssembly_setTarget(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKAssembly *data = JSObjectGetPrivate(this); + data.target = PKJSValueGetId(ctx, value, ex); + return true; +} + +static JSValueRef PKAssembly_getIsStackEmpty(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKAssembly *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isStackEmpty); +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKAssembly_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKAssembly_finalize(JSObjectRef this) { + PKAssembly *data = (PKAssembly *)JSObjectGetPrivate(this); + [data autorelease]; +} + +static JSStaticFunction PKAssembly_staticFunctions[] = { +{ "toString", PKAssembly_toString, kJSPropertyAttributeDontDelete }, +{ "pop", PKAssembly_pop, kJSPropertyAttributeDontDelete }, +{ "push", PKAssembly_push, kJSPropertyAttributeDontDelete }, +{ "objectsAbove", PKAssembly_objectsAbove, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKAssembly_staticValues[] = { +{ "defaulDelimiter", PKAssembly_getDefaultDelimiter, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // String +{ "stack", PKAssembly_getStack, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Array +{ "target", PKAssembly_getTarget, PKAssembly_setTarget, kJSPropertyAttributeDontDelete }, // Object +{ "isStackEmpty", PKAssembly_getIsStackEmpty, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark ClassMethods + +#pragma mark - +#pragma mark Public + +JSClassRef PKAssembly_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.staticFunctions = PKAssembly_staticFunctions; + def.staticValues = PKAssembly_staticValues; + def.initialize = PKAssembly_initialize; + def.finalize = PKAssembly_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKAssembly_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKAssembly_class(ctx), data); +} diff --git a/jssrc/PKJSCaseInsensitiveLiteral.h b/jssrc/PKJSCaseInsensitiveLiteral.h new file mode 100644 index 0000000..c719403 --- /dev/null +++ b/jssrc/PKJSCaseInsensitiveLiteral.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKCaseInsensitiveLiteral_new(JSContextRef ctx, void *data); +JSClassRef PKCaseInsensitiveLiteral_class(JSContextRef ctx); +JSObjectRef PKCaseInsensitiveLiteral_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSCaseInsensitiveLiteral.m b/jssrc/PKJSCaseInsensitiveLiteral.m new file mode 100644 index 0000000..1414623 --- /dev/null +++ b/jssrc/PKJSCaseInsensitiveLiteral.m @@ -0,0 +1,73 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSCaseInsensitiveLiteral.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKCaseInsensitiveLiteral_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKCaseInsensitiveLiteral_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKCaseInsensitiveLiteral_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKCaseInsensitiveLiteral_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKCaseInsensitiveLiteral_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKCaseInsensitiveLiteral_staticFunctions; + def.staticValues = PKCaseInsensitiveLiteral_staticValues; + def.initialize = PKCaseInsensitiveLiteral_initialize; + def.finalize = PKCaseInsensitiveLiteral_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKCaseInsensitiveLiteral_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKCaseInsensitiveLiteral_class(ctx), data); +} + +JSObjectRef PKCaseInsensitiveLiteral_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKCaseInsensitiveLiteral"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKCaseInsensitiveLiteral *data = [[PKCaseInsensitiveLiteral alloc] initWithString:s]; + return PKCaseInsensitiveLiteral_new(ctx, data); +} diff --git a/jssrc/PKJSCharacterAssembly.h b/jssrc/PKJSCharacterAssembly.h new file mode 100644 index 0000000..8da40a5 --- /dev/null +++ b/jssrc/PKJSCharacterAssembly.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKCharacterAssembly_new(JSContextRef ctx, void *data); +JSClassRef PKCharacterAssembly_class(JSContextRef ctx); +JSObjectRef PKCharacterAssembly_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSCharacterAssembly.m b/jssrc/PKJSCharacterAssembly.m new file mode 100644 index 0000000..81dd943 --- /dev/null +++ b/jssrc/PKJSCharacterAssembly.m @@ -0,0 +1,129 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSCharacterAssembly.h" +#import "PKJSUtils.h" +#import "PKJSAssembly.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKCharacterAssembly_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCharacterAssembly_class, "toString"); + PKCharacterAssembly *data = JSObjectGetPrivate(this); + JSStringRef resStr = JSStringCreateWithCFString((CFStringRef)[data description]); + JSValueRef res = JSValueMakeString(ctx, resStr); + JSStringRelease(resStr); + return res; +} + +static JSValueRef PKCharacterAssembly_pop(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCharacterAssembly_class, "pop"); + PKCharacterAssembly *data = JSObjectGetPrivate(this); + NSNumber *obj = [data pop]; + return JSValueMakeNumber(ctx, [obj doubleValue]); +} + +static JSValueRef PKCharacterAssembly_push(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCharacterAssembly_class, "push"); + PKPreconditionMethodArgc(1, "PKCharacterAssembly.push"); + + JSValueRef v = argv[0]; + + PKCharacterAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + [data push:obj]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKCharacterAssembly_objectsAbove(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCharacterAssembly_class, "objectsAbove"); + PKPreconditionMethodArgc(1, "PKCharacterAssembly.objectsAbove"); + + JSValueRef v = argv[0]; + + PKCharacterAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + id array = [data objectsAbove:obj]; + + return PKNSArrayToJSObject(ctx, array, ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKCharacterAssembly_getLength(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKCharacterAssembly *data = JSObjectGetPrivate(this); + return JSValueMakeNumber(ctx, [data length]); +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKCharacterAssembly_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKCharacterAssembly_finalize(JSObjectRef this) { + // released in PKAssembly_finalize +} + +static JSStaticFunction PKCharacterAssembly_staticFunctions[] = { +{ "toString", PKCharacterAssembly_toString, kJSPropertyAttributeDontDelete }, +{ "pop", PKCharacterAssembly_pop, kJSPropertyAttributeDontDelete }, +{ "push", PKCharacterAssembly_push, kJSPropertyAttributeDontDelete }, +{ "objectsAbove", PKCharacterAssembly_objectsAbove, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKCharacterAssembly_staticValues[] = { +{ "length", PKCharacterAssembly_getLength, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Number +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark ClassMethods + +#pragma mark - +#pragma mark Public + +JSClassRef PKCharacterAssembly_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKAssembly_class(ctx); + def.staticFunctions = PKCharacterAssembly_staticFunctions; + def.staticValues = PKCharacterAssembly_staticValues; + def.initialize = PKCharacterAssembly_initialize; + def.finalize = PKCharacterAssembly_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKCharacterAssembly_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKCharacterAssembly_class(ctx), data); +} + +JSObjectRef PKCharacterAssembly_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKCharacterAssembly"); + + JSValueRef s = argv[0]; + NSString *string = PKJSValueGetNSString(ctx, s, ex); + + PKCharacterAssembly *data = [[PKCharacterAssembly alloc] initWithString:string]; + return PKCharacterAssembly_new(ctx, data); +} diff --git a/jssrc/PKJSCollectionParser.h b/jssrc/PKJSCollectionParser.h new file mode 100644 index 0000000..697880b --- /dev/null +++ b/jssrc/PKJSCollectionParser.h @@ -0,0 +1,18 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKCollectionParser_new(JSContextRef ctx, void *data); +JSClassRef PKCollectionParser_class(JSContextRef ctx); diff --git a/jssrc/PKJSCollectionParser.m b/jssrc/PKJSCollectionParser.m new file mode 100644 index 0000000..4bc2513 --- /dev/null +++ b/jssrc/PKJSCollectionParser.m @@ -0,0 +1,77 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKCollectionParser.h" +#import "PKJSUtils.h" +#import "PKJSParser.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKCollectionParser_add(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCollectionParser_class, "add"); + PKPreconditionMethodArgc(1, "add"); + + PKCollectionParser *data = JSObjectGetPrivate(this); + + JSObjectRef arg = (JSObjectRef)argv[0]; + PKParser *p = (PKParser *)JSObjectGetPrivate(arg); + [data add:p]; + return JSValueMakeUndefined(ctx); +} + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKCollectionParser_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKCollectionParser_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKCollectionParser_staticFunctions[] = { +{ "add", PKCollectionParser_add, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKCollectionParser_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKCollectionParser_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKParser_class(ctx); + def.staticFunctions = PKCollectionParser_staticFunctions; + def.staticValues = PKCollectionParser_staticValues; + def.initialize = PKCollectionParser_initialize; + def.finalize = PKCollectionParser_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKCollectionParser_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKCollectionParser_class(ctx), data); +} diff --git a/jssrc/PKJSComment.h b/jssrc/PKJSComment.h new file mode 100644 index 0000000..972e35a --- /dev/null +++ b/jssrc/PKJSComment.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKComment_new(JSContextRef ctx, void *data); +JSClassRef PKComment_class(JSContextRef ctx); +JSObjectRef PKComment_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSComment.m b/jssrc/PKJSComment.m new file mode 100644 index 0000000..6435e4b --- /dev/null +++ b/jssrc/PKJSComment.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSComment.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKComment_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKComment_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKComment_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKComment_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKComment_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKComment_staticFunctions; + def.staticValues = PKComment_staticValues; + def.initialize = PKComment_initialize; + def.finalize = PKComment_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKComment_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKComment_class(ctx), data); +} + +JSObjectRef PKComment_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKComment *data = [[PKComment alloc] init]; + return PKComment_new(ctx, data); +} diff --git a/jssrc/PKJSCommentState.h b/jssrc/PKJSCommentState.h new file mode 100644 index 0000000..ac50ae6 --- /dev/null +++ b/jssrc/PKJSCommentState.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKCommentState_new(JSContextRef ctx, void *data); +JSClassRef PKCommentState_class(JSContextRef ctx); +JSObjectRef PKCommentState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSCommentState.m b/jssrc/PKJSCommentState.m new file mode 100644 index 0000000..abb8744 --- /dev/null +++ b/jssrc/PKJSCommentState.m @@ -0,0 +1,153 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSCommentState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKCommentState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCommentState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKCommentState]", ex); +} + +static JSValueRef PKCommentState_addSingleLine(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCommentState_class, "addSingleLine"); + PKPreconditionMethodArgc(1, "PKCommentState.addSingleLine"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + + PKCommentState *data = JSObjectGetPrivate(this); + [data addSingleLineStartMarker:start]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKCommentState_removeSingleLine(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCommentState_class, "removeSingleLine"); + PKPreconditionMethodArgc(1, "PKCommentState.removeSingleLine"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + + PKCommentState *data = JSObjectGetPrivate(this); + [data removeSingleLineStartMarker:start]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKCommentState_addMultiLine(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCommentState_class, "addMultiLine"); + PKPreconditionMethodArgc(2, "PKCommentState.addMultiLine"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + NSString *end = PKJSValueGetNSString(ctx, argv[1], ex); + + PKCommentState *data = JSObjectGetPrivate(this); + [data addMultiLineStartMarker:start endMarker:end]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKCommentState_removeMultiLine(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKCommentState_class, "removeSingleLine"); + PKPreconditionMethodArgc(1, "PKCommentState.removeMultiLine"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + + PKCommentState *data = JSObjectGetPrivate(this); + [data removeMultiLineStartMarker:start]; + + return JSValueMakeUndefined(ctx); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKCommentState_getReportsCommentTokens(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKCommentState *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.reportsCommentTokens); +} + +static bool PKCommentState_setReportsCommentTokens(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKCommentState *data = JSObjectGetPrivate(this); + data.reportsCommentTokens = JSValueToBoolean(ctx, value); + return true; +} + +static JSValueRef PKCommentState_getBalancesEOFTerminatedComments(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKCommentState *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.balancesEOFTerminatedComments); +} + +static bool PKCommentState_setBalancesEOFTerminatedComments(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKCommentState *data = JSObjectGetPrivate(this); + data.balancesEOFTerminatedComments = JSValueToBoolean(ctx, value); + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKCommentState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKCommentState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKCommentState_staticFunctions[] = { +{ "toString", PKCommentState_toString, kJSPropertyAttributeDontDelete }, +{ "addSingleLine", PKCommentState_addSingleLine, kJSPropertyAttributeDontDelete }, +{ "removeSingleLine", PKCommentState_removeSingleLine, kJSPropertyAttributeDontDelete }, +{ "addMultiLine", PKCommentState_addMultiLine, kJSPropertyAttributeDontDelete }, +{ "removeMultiLine", PKCommentState_removeMultiLine, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + + +static JSStaticValue PKCommentState_staticValues[] = { +{ "reportsCommentTokens", PKCommentState_getReportsCommentTokens, PKCommentState_setReportsCommentTokens, kJSPropertyAttributeDontDelete }, // Boolean +{ "balancesEOFTerminatedComments", PKCommentState_getBalancesEOFTerminatedComments, PKCommentState_setBalancesEOFTerminatedComments, kJSPropertyAttributeDontDelete }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKCommentState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKCommentState_staticFunctions; + def.staticValues = PKCommentState_staticValues; + def.initialize = PKCommentState_initialize; + def.finalize = PKCommentState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKCommentState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKCommentState_class(ctx), data); +} + +JSObjectRef PKCommentState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKCommentState *data = [[PKCommentState alloc] init]; + return PKCommentState_new(ctx, data); +} diff --git a/jssrc/PKJSDelimitState.h b/jssrc/PKJSDelimitState.h new file mode 100644 index 0000000..6b462e6 --- /dev/null +++ b/jssrc/PKJSDelimitState.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKDelimitState_new(JSContextRef ctx, void *data); +JSClassRef PKDelimitState_class(JSContextRef ctx); +JSObjectRef PKDelimitState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSDelimitState.m b/jssrc/PKJSDelimitState.m new file mode 100644 index 0000000..f06425f --- /dev/null +++ b/jssrc/PKJSDelimitState.m @@ -0,0 +1,108 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSDelimitState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKDelimitState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKDelimitState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKDelimitState]", ex); +} + +static JSValueRef PKDelimitState_add(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKDelimitState_class, "add"); + PKPreconditionMethodArgc(4, "PKDelimitState.add"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + NSString *end = PKJSValueGetNSString(ctx, argv[1], ex); + NSString *chars = PKJSValueGetNSString(ctx, argv[2], ex); + BOOL invert = JSValueToBoolean(ctx, argv[3]); + + PKDelimitState *data = JSObjectGetPrivate(this); + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:chars]; + if (invert) { + cs = [cs invertedSet]; + } + [data addStartMarker:start endMarker:end allowedCharacterSet:cs]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKDelimitState_remove(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKDelimitState_class, "remove"); + PKPreconditionMethodArgc(1, "PKDelimitState.remove"); + + NSString *start = PKJSValueGetNSString(ctx, argv[0], ex); + + PKDelimitState *data = JSObjectGetPrivate(this); + [data removeStartMarker:start]; + + return JSValueMakeUndefined(ctx); +} + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKDelimitState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKDelimitState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKDelimitState_staticFunctions[] = { +{ "toString", PKDelimitState_toString, kJSPropertyAttributeDontDelete }, +{ "add", PKDelimitState_add, kJSPropertyAttributeDontDelete }, +{ "remove", PKDelimitState_remove, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKDelimitState_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKDelimitState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKDelimitState_staticFunctions; + def.staticValues = PKDelimitState_staticValues; + def.initialize = PKDelimitState_initialize; + def.finalize = PKDelimitState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKDelimitState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKDelimitState_class(ctx), data); +} + +JSObjectRef PKDelimitState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKDelimitState *data = [[PKDelimitState alloc] init]; + return PKDelimitState_new(ctx, data); +} diff --git a/jssrc/PKJSDelimitedString.h b/jssrc/PKJSDelimitedString.h new file mode 100644 index 0000000..2ffc1de --- /dev/null +++ b/jssrc/PKJSDelimitedString.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKDelimitedString_new(JSContextRef ctx, void *data); +JSClassRef PKDelimitedString_class(JSContextRef ctx); +JSObjectRef PKDelimitedString_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSDelimitedString.m b/jssrc/PKJSDelimitedString.m new file mode 100644 index 0000000..1763308 --- /dev/null +++ b/jssrc/PKJSDelimitedString.m @@ -0,0 +1,73 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSDelimitedString.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKDelimitedString_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKDelimitedString_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKDelimitedString_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKDelimitedString_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKDelimitedString_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKDelimitedString_staticFunctions; + def.staticValues = PKDelimitedString_staticValues; + def.initialize = PKDelimitedString_initialize; + def.finalize = PKDelimitedString_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKDelimitedString_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKDelimitedString_class(ctx), data); +} + +JSObjectRef PKDelimitedString_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKDelimitedString"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKDelimitedString *data = [[PKDelimitedString alloc] initWithString:s]; + return PKDelimitedString_new(ctx, data); +} diff --git a/jssrc/PKJSEmpty.h b/jssrc/PKJSEmpty.h new file mode 100644 index 0000000..068ebe1 --- /dev/null +++ b/jssrc/PKJSEmpty.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKEmpty_new(JSContextRef ctx, void *data); +JSClassRef PKEmpty_class(JSContextRef ctx); +JSObjectRef PKEmpty_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSEmpty.m b/jssrc/PKJSEmpty.m new file mode 100644 index 0000000..20c1cbd --- /dev/null +++ b/jssrc/PKJSEmpty.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSEmpty.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKEmpty_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKEmpty_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKEmpty_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKEmpty_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKEmpty_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKEmpty_staticFunctions; + def.staticValues = PKEmpty_staticValues; + def.initialize = PKEmpty_initialize; + def.finalize = PKEmpty_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKEmpty_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKEmpty_class(ctx), data); +} + +JSObjectRef PKEmpty_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKEmpty *data = [[PKEmpty alloc] init]; + return PKEmpty_new(ctx, data); +} diff --git a/jssrc/PKJSLiteral.h b/jssrc/PKJSLiteral.h new file mode 100644 index 0000000..4358010 --- /dev/null +++ b/jssrc/PKJSLiteral.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKLiteral_new(JSContextRef ctx, void *data); +JSClassRef PKLiteral_class(JSContextRef ctx); +JSObjectRef PKLiteral_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSLiteral.m b/jssrc/PKJSLiteral.m new file mode 100644 index 0000000..65540c6 --- /dev/null +++ b/jssrc/PKJSLiteral.m @@ -0,0 +1,73 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKLiteral.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKLiteral_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKLiteral_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKLiteral_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKLiteral_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKLiteral_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKLiteral_staticFunctions; + def.staticValues = PKLiteral_staticValues; + def.initialize = PKLiteral_initialize; + def.finalize = PKLiteral_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKLiteral_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKLiteral_class(ctx), data); +} + +JSObjectRef PKLiteral_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKLiteral"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKLiteral *data = [[PKLiteral alloc] initWithString:s]; + return PKLiteral_new(ctx, data); +} diff --git a/jssrc/PKJSLowercaseWord.h b/jssrc/PKJSLowercaseWord.h new file mode 100644 index 0000000..3177bd5 --- /dev/null +++ b/jssrc/PKJSLowercaseWord.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKLowercaseWord_new(JSContextRef ctx, void *data); +JSClassRef PKLowercaseWord_class(JSContextRef ctx); +JSObjectRef PKLowercaseWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSLowercaseWord.m b/jssrc/PKJSLowercaseWord.m new file mode 100644 index 0000000..e4c8942 --- /dev/null +++ b/jssrc/PKJSLowercaseWord.m @@ -0,0 +1,73 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSLowercaseWord.h" +#import "PKJSUtils.h" +#import "PKJSWord.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKLowercaseWord_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKLowercaseWord_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKLowercaseWord_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKLowercaseWord_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKLowercaseWord_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKWord_class(ctx); + def.staticFunctions = PKLowercaseWord_staticFunctions; + def.staticValues = PKLowercaseWord_staticValues; + def.initialize = PKLowercaseWord_initialize; + def.finalize = PKLowercaseWord_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKLowercaseWord_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKLowercaseWord_class(ctx), data); +} + +JSObjectRef PKLowercaseWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKLowercaseWord"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKLowercaseWord *data = [[PKLowercaseWord alloc] initWithString:s]; + return PKLowercaseWord_new(ctx, data); +} diff --git a/jssrc/PKJSNum.h b/jssrc/PKJSNum.h new file mode 100644 index 0000000..9304a10 --- /dev/null +++ b/jssrc/PKJSNum.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKNum_new(JSContextRef ctx, void *data); +JSClassRef PKNum_class(JSContextRef ctx); +JSObjectRef PKNum_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSNum.m b/jssrc/PKJSNum.m new file mode 100644 index 0000000..4cc1182 --- /dev/null +++ b/jssrc/PKJSNum.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSNum.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKNum_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKNum_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKNum_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKNum_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKNum_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKNum_staticFunctions; + def.staticValues = PKNum_staticValues; + def.initialize = PKNum_initialize; + def.finalize = PKNum_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKNum_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKNum_class(ctx), data); +} + +JSObjectRef PKNum_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKNumber *data = [[PKNumber alloc] init]; + return PKNum_new(ctx, data); +} diff --git a/jssrc/PKJSNumberState.h b/jssrc/PKJSNumberState.h new file mode 100644 index 0000000..cc0e483 --- /dev/null +++ b/jssrc/PKJSNumberState.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKNumberState_new(JSContextRef ctx, void *data); +JSClassRef PKNumberState_class(JSContextRef ctx); +JSObjectRef PKNumberState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSNumberState.m b/jssrc/PKJSNumberState.m new file mode 100644 index 0000000..60345d9 --- /dev/null +++ b/jssrc/PKJSNumberState.m @@ -0,0 +1,87 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSNumberState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKNumberState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKNumberState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKNumberState]", ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKNumberState_getAllowsTrailingDot(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKNumberState *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.allowsTrailingDot); +} + +static bool PKNumberState_setAllowsTrailingDot(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKNumberState *data = JSObjectGetPrivate(this); + data.allowsTrailingDot = JSValueToBoolean(ctx, value); + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKNumberState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKNumberState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKNumberState_staticFunctions[] = { +{ "toString", PKNumberState_toString, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKNumberState_staticValues[] = { +{ "allowsTrailingDot", PKNumberState_getAllowsTrailingDot, PKNumberState_setAllowsTrailingDot, kJSPropertyAttributeDontDelete }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKNumberState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKNumberState_staticFunctions; + def.staticValues = PKNumberState_staticValues; + def.initialize = PKNumberState_initialize; + def.finalize = PKNumberState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKNumberState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKNumberState_class(ctx), data); +} + +JSObjectRef PKNumberState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKNumberState *data = [[PKNumberState alloc] init]; + return PKNumberState_new(ctx, data); +} diff --git a/jssrc/PKJSParser.h b/jssrc/PKJSParser.h new file mode 100644 index 0000000..7f62cb4 --- /dev/null +++ b/jssrc/PKJSParser.h @@ -0,0 +1,18 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKParser_new(JSContextRef ctx, void *data); +JSClassRef PKParser_class(JSContextRef ctx); diff --git a/jssrc/PKJSParser.m b/jssrc/PKJSParser.m new file mode 100644 index 0000000..106e879 --- /dev/null +++ b/jssrc/PKJSParser.m @@ -0,0 +1,160 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSParser.h" +#import "PKJSUtils.h" +#import "PKJSAssemblerAdapter.h" +#import "PKJSAssembly.h" +#import "PKJSTokenAssembly.h" +#import "PKJSCharacterAssembly.h" +#import +#import +#import +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKParser_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKParser_class, "toString"); + PKParser *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, [data description], ex); +} + +static JSValueRef PKParser_bestMatch(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKParser_class, "bestMatch"); + PKPreconditionMethodArgc(1, "bestMatch"); + + PKParser *data = JSObjectGetPrivate(this); + + JSObjectRef arg = (JSObjectRef)argv[0]; + PKAssembly *a = (PKAssembly *)JSObjectGetPrivate(arg); + a = [data bestMatchFor:a]; + + JSObjectRef result = NULL; + if ([a isMemberOfClass:[PKTokenAssembly class]]) { + result = PKTokenAssembly_new(ctx, a); + } else if ([a isMemberOfClass:[PKCharacterAssembly class]]) { + result = PKCharacterAssembly_new(ctx, a); + } + + return result; +} + +static JSValueRef PKParser_completeMatch(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKParser_class, "completeMatch"); + PKPreconditionMethodArgc(1, "completeMatch"); + + PKParser *data = JSObjectGetPrivate(this); + + JSObjectRef arg = (JSObjectRef)argv[0]; + PKAssembly *a = (PKAssembly *)JSObjectGetPrivate(arg); + a = [data completeMatchFor:a]; + + JSObjectRef result = NULL; + if ([a isMemberOfClass:[PKTokenAssembly class]]) { + result = PKTokenAssembly_new(ctx, a); + } else if ([a isMemberOfClass:[PKCharacterAssembly class]]) { + result = PKCharacterAssembly_new(ctx, a); + } + + return result; +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKParser_getAssembler(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKParser *data = JSObjectGetPrivate(this); + id assembler = data.assembler; + if ([assembler isMemberOfClass:[PKJSAssemblerAdapter class]]) { + return [assembler assemblerFunction]; + } else { + return NULL; + } +} + +static bool PKParser_setAssembler(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + if (!JSValueIsObject(ctx, value) || !JSObjectIsFunction(ctx, (JSObjectRef)value)) { + (*ex) = PKNSStringToJSValue(ctx, @"only a function object can be set as a parser's assembler property", ex); + return false; + } + + PKParser *data = JSObjectGetPrivate(this); + PKJSAssemblerAdapter *adapter = [[PKJSAssemblerAdapter alloc] init]; // retained. released in PKParser_finalize + [adapter setAssemblerFunction:(JSObjectRef)value fromContext:ctx]; + [data setAssembler:adapter selector:@selector(didMatch:)]; + return true; +} + +static JSValueRef PKParser_getName(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKParser *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, data.name, ex); +} + +static bool PKParser_setName(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKParser *data = JSObjectGetPrivate(this); + data.name = PKJSValueGetNSString(ctx, value, ex); + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKParser_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKParser_finalize(JSObjectRef this) { + PKParser *data = (PKParser *)JSObjectGetPrivate(this); + id assembler = data.assembler; + data.assembler = nil; + if ([assembler isMemberOfClass:[PKJSAssemblerAdapter class]]) { + [assembler autorelease]; + } + [data autorelease]; +} + +static JSStaticFunction PKParser_staticFunctions[] = { +{ "toString", PKParser_toString, kJSPropertyAttributeDontDelete }, +{ "bestMatch", PKParser_bestMatch, kJSPropertyAttributeDontDelete }, +{ "completeMatch", PKParser_completeMatch, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKParser_staticValues[] = { +{ "assembler", PKParser_getAssembler, PKParser_setAssembler, kJSPropertyAttributeDontDelete }, // Function +{ "name", PKParser_getName, PKParser_setName, kJSPropertyAttributeDontDelete }, // String +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKParser_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.staticFunctions = PKParser_staticFunctions; + def.staticValues = PKParser_staticValues; + def.initialize = PKParser_initialize; + def.finalize = PKParser_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKParser_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKParser_class(ctx), data); +} diff --git a/jssrc/PKJSPattern.h b/jssrc/PKJSPattern.h new file mode 100644 index 0000000..d0b678a --- /dev/null +++ b/jssrc/PKJSPattern.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKPattern_new(JSContextRef ctx, void *data); +JSClassRef PKPattern_class(JSContextRef ctx); +JSObjectRef PKPattern_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSPattern.m b/jssrc/PKJSPattern.m new file mode 100644 index 0000000..d5938ea --- /dev/null +++ b/jssrc/PKJSPattern.m @@ -0,0 +1,86 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSPattern.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +//static JSValueRef PKPattern_invertedPattern(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { +// PKPreconditionInstaceOf(PKPattern_class, "invertedPattern"); +// +// PKPattern *data = JSObjectGetPrivate(this); +// return PKPattern_new(ctx, [data invertedPattern]); +//} +// +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKPattern_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKPattern_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKPattern_staticFunctions[] = { +//{ "invertedPattern", PKPattern_invertedPattern, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKPattern_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKPattern_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKPattern_staticFunctions; + def.staticValues = PKPattern_staticValues; + def.initialize = PKPattern_initialize; + def.finalize = PKPattern_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKPattern_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKPattern_class(ctx), data); +} + +JSObjectRef PKPattern_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKPattern"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + NSInteger opts = PKPatternOptionsNone; + + if (argc > 1) { + opts = JSValueToNumber(ctx, argv[1], ex); + } + + PKPattern *data = [[PKPattern alloc] initWithString:s options:opts]; + return PKPattern_new(ctx, data); +} diff --git a/jssrc/PKJSQuoteState.h b/jssrc/PKJSQuoteState.h new file mode 100644 index 0000000..4f9ffd4 --- /dev/null +++ b/jssrc/PKJSQuoteState.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKQuoteState_new(JSContextRef ctx, void *data); +JSClassRef PKQuoteState_class(JSContextRef ctx); +JSObjectRef PKQuoteState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSQuoteState.m b/jssrc/PKJSQuoteState.m new file mode 100644 index 0000000..87a7d8b --- /dev/null +++ b/jssrc/PKJSQuoteState.m @@ -0,0 +1,87 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSQuoteState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKQuoteState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKQuoteState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKQuoteState]", ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKQuoteState_getBalancesEOFTerminatedQuotes(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKQuoteState *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.balancesEOFTerminatedQuotes); +} + +static bool PKQuoteState_setBalancesEOFTerminatedQuotes(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKQuoteState *data = JSObjectGetPrivate(this); + data.balancesEOFTerminatedQuotes = JSValueToBoolean(ctx, value); + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKQuoteState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKQuoteState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKQuoteState_staticFunctions[] = { +{ "toString", PKQuoteState_toString, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKQuoteState_staticValues[] = { +{ "balancesEOFTerminatedQuotes", PKQuoteState_getBalancesEOFTerminatedQuotes, PKQuoteState_setBalancesEOFTerminatedQuotes, kJSPropertyAttributeDontDelete }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKQuoteState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKQuoteState_staticFunctions; + def.staticValues = PKQuoteState_staticValues; + def.initialize = PKQuoteState_initialize; + def.finalize = PKQuoteState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKQuoteState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKQuoteState_class(ctx), data); +} + +JSObjectRef PKQuoteState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKQuoteState *data = [[PKQuoteState alloc] init]; + return PKQuoteState_new(ctx, data); +} diff --git a/jssrc/PKJSQuotedString.h b/jssrc/PKJSQuotedString.h new file mode 100644 index 0000000..e328a14 --- /dev/null +++ b/jssrc/PKJSQuotedString.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKQuotedString_new(JSContextRef ctx, void *data); +JSClassRef PKQuotedString_class(JSContextRef ctx); +JSObjectRef PKQuotedString_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSQuotedString.m b/jssrc/PKJSQuotedString.m new file mode 100644 index 0000000..649b7fc --- /dev/null +++ b/jssrc/PKJSQuotedString.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSQuotedString.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKQuotedString_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKQuotedString_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKQuotedString_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKQuotedString_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKQuotedString_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKQuotedString_staticFunctions; + def.staticValues = PKQuotedString_staticValues; + def.initialize = PKQuotedString_initialize; + def.finalize = PKQuotedString_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKQuotedString_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKQuotedString_class(ctx), data); +} + +JSObjectRef PKQuotedString_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKQuotedString *data = [[PKQuotedString alloc] init]; + return PKQuotedString_new(ctx, data); +} diff --git a/jssrc/PKJSRepetition.h b/jssrc/PKJSRepetition.h new file mode 100644 index 0000000..1e61cef --- /dev/null +++ b/jssrc/PKJSRepetition.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKRepetition_new(JSContextRef ctx, void *data); +JSClassRef PKRepetition_class(JSContextRef ctx); +JSObjectRef PKRepetition_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSRepetition.m b/jssrc/PKJSRepetition.m new file mode 100644 index 0000000..68cdb23 --- /dev/null +++ b/jssrc/PKJSRepetition.m @@ -0,0 +1,78 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSRepetition.h" +#import "PKJSUtils.h" +#import "PKJSParser.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKRepetition_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKRepetition_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKRepetition_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKRepetition_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKRepetition_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKParser_class(ctx); + def.staticFunctions = PKRepetition_staticFunctions; + def.staticValues = PKRepetition_staticValues; + def.initialize = PKRepetition_initialize; + def.finalize = PKRepetition_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKRepetition_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKRepetition_class(ctx), data); +} + +JSObjectRef PKRepetition_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKRepetition"); + + JSValueRef v = argv[0]; + if (!PKJSValueIsInstanceOfClass(ctx, v, "PKParser", ex)) { + *ex = PKNSStringToJSValue(ctx, @"argument to PKRepeition constructor must be and instance of a PKParser subclass", ex); + } + + PKParser *p = JSObjectGetPrivate((JSObjectRef)v); + + PKRepetition *data = [[PKRepetition alloc] initWithSubparser:p]; + return PKRepetition_new(ctx, data); +} diff --git a/jssrc/PKJSSequence.h b/jssrc/PKJSSequence.h new file mode 100644 index 0000000..e0f633a --- /dev/null +++ b/jssrc/PKJSSequence.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKSequence_new(JSContextRef ctx, void *data); +JSClassRef PKSequence_class(JSContextRef ctx); +JSObjectRef PKSequence_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSSequence.m b/jssrc/PKJSSequence.m new file mode 100644 index 0000000..6868060 --- /dev/null +++ b/jssrc/PKJSSequence.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSSequence.h" +#import "PKJSUtils.h" +#import "PKJSCollectionParser.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKSequence_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKSequence_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKSequence_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKSequence_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKSequence_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKCollectionParser_class(ctx); + def.staticFunctions = PKSequence_staticFunctions; + def.staticValues = PKSequence_staticValues; + def.initialize = PKSequence_initialize; + def.finalize = PKSequence_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKSequence_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKSequence_class(ctx), data); +} + +JSObjectRef PKSequence_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKSequence *data = [[PKSequence alloc] init]; + return PKSequence_new(ctx, data); +} diff --git a/jssrc/PKJSSymbol.h b/jssrc/PKJSSymbol.h new file mode 100644 index 0000000..3441639 --- /dev/null +++ b/jssrc/PKJSSymbol.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKSymbol_new(JSContextRef ctx, void *data); +JSClassRef PKSymbol_class(JSContextRef ctx); +JSObjectRef PKSymbol_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSSymbol.m b/jssrc/PKJSSymbol.m new file mode 100644 index 0000000..582bd18 --- /dev/null +++ b/jssrc/PKJSSymbol.m @@ -0,0 +1,75 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSSymbol.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKSymbol_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKSymbol_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKSymbol_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKSymbol_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKSymbol_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKSymbol_staticFunctions; + def.staticValues = PKSymbol_staticValues; + def.initialize = PKSymbol_initialize; + def.finalize = PKSymbol_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKSymbol_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKSymbol_class(ctx), data); +} + +JSObjectRef PKSymbol_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + NSString *s = nil; + + if (argc > 0) { + s = PKJSValueGetNSString(ctx, argv[0], ex); + } + + PKSymbol *data = [[PKSymbol alloc] initWithString:s]; + return PKSymbol_new(ctx, data); +} diff --git a/jssrc/PKJSSymbolState.h b/jssrc/PKJSSymbolState.h new file mode 100644 index 0000000..230b7da --- /dev/null +++ b/jssrc/PKJSSymbolState.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKSymbolState_new(JSContextRef ctx, void *data); +JSClassRef PKSymbolState_class(JSContextRef ctx); +JSObjectRef PKSymbolState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSSymbolState.m b/jssrc/PKJSSymbolState.m new file mode 100644 index 0000000..60f83e8 --- /dev/null +++ b/jssrc/PKJSSymbolState.m @@ -0,0 +1,101 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSSymbolState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKSymbolState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKSymbolState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKSymbolState]", ex); +} + +static JSValueRef PKSymbolState_add(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKSymbolState_class, "add"); + PKPreconditionMethodArgc(1, "PKSymbolState.add"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKSymbolState *data = JSObjectGetPrivate(this); + [data add:s]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKSymbolState_remove(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKSymbolState_class, "remove"); + PKPreconditionMethodArgc(1, "PKSymbolState.remove"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKSymbolState *data = JSObjectGetPrivate(this); + [data remove:s]; + + return JSValueMakeUndefined(ctx); +} + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKSymbolState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKSymbolState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKSymbolState_staticFunctions[] = { +{ "toString", PKSymbolState_toString, kJSPropertyAttributeDontDelete }, +{ "add", PKSymbolState_add, kJSPropertyAttributeDontDelete }, +{ "remove", PKSymbolState_remove, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKSymbolState_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKSymbolState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKSymbolState_staticFunctions; + def.staticValues = PKSymbolState_staticValues; + def.initialize = PKSymbolState_initialize; + def.finalize = PKSymbolState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKSymbolState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKSymbolState_class(ctx), data); +} + +JSObjectRef PKSymbolState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKSymbolState *data = [[PKSymbolState alloc] init]; + return PKSymbolState_new(ctx, data); +} diff --git a/jssrc/PKJSTerminal.h b/jssrc/PKJSTerminal.h new file mode 100644 index 0000000..4ed426b --- /dev/null +++ b/jssrc/PKJSTerminal.h @@ -0,0 +1,18 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKTerminal_new(JSContextRef ctx, void *data); +JSClassRef PKTerminal_class(JSContextRef ctx); diff --git a/jssrc/PKJSTerminal.m b/jssrc/PKJSTerminal.m new file mode 100644 index 0000000..d982fb0 --- /dev/null +++ b/jssrc/PKJSTerminal.m @@ -0,0 +1,73 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSTerminal.h" +#import "PKJSUtils.h" +#import "PKJSParser.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKTerminal_discard(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTerminal_class, "discard"); + + PKTerminal *data = JSObjectGetPrivate(this); + [data discard]; + return this; +} + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKTerminal_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKTerminal_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKTerminal_staticFunctions[] = { +{ "discard", PKTerminal_discard, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKTerminal_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKTerminal_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKParser_class(ctx); + def.staticFunctions = PKTerminal_staticFunctions; + def.staticValues = PKTerminal_staticValues; + def.initialize = PKTerminal_initialize; + def.finalize = PKTerminal_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKTerminal_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKTerminal_class(ctx), data); +} diff --git a/jssrc/PKJSToken.h b/jssrc/PKJSToken.h new file mode 100644 index 0000000..7154e48 --- /dev/null +++ b/jssrc/PKJSToken.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKToken_new(JSContextRef ctx, void *data); +JSClassRef PKToken_class(JSContextRef ctx); +JSObjectRef PKToken_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); + +// a JS Class method +//JSValueRef PKToken_EOFToken(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef* ex); + +// a JS Class property +JSValueRef PKToken_getEOFToken(JSContextRef ctx); diff --git a/jssrc/PKJSToken.m b/jssrc/PKJSToken.m new file mode 100644 index 0000000..37935b1 --- /dev/null +++ b/jssrc/PKJSToken.m @@ -0,0 +1,165 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSToken.h" +#import "PKJSUtils.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKToken_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKToken_class, "toString"); + PKToken *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, [data debugDescription], ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKToken_getTokenType(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeNumber(ctx, data.tokenType); +} + +static JSValueRef PKToken_getStringValue(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, data.stringValue, ex); +} + +static JSValueRef PKToken_getFloatValue(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeNumber(ctx, data.floatValue); +} + +static JSValueRef PKToken_getIsNumber(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isNumber); +} + +static JSValueRef PKToken_getIsSymbol(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isSymbol); +} + +static JSValueRef PKToken_getIsWord(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isWord); +} + +static JSValueRef PKToken_getIsQuotedString(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isQuotedString); +} + +static JSValueRef PKToken_getIsWhitespace(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isWhitespace); +} + +static JSValueRef PKToken_getIsComment(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isComment); +} + +static JSValueRef PKToken_getIsDelimitedString(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKToken *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.isDelimitedString); +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKToken_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKToken_finalize(JSObjectRef this) { + PKToken *data = (PKToken *)JSObjectGetPrivate(this); + [data autorelease]; +} + +static JSStaticFunction PKToken_staticFunctions[] = { +{ "toString", PKToken_toString, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKToken_staticValues[] = { +{ "tokenType", PKToken_getTokenType, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Number +{ "stringValue", PKToken_getStringValue, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // String +{ "floatValue", PKToken_getFloatValue, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Number +{ "isNumber", PKToken_getIsNumber, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isSymbol", PKToken_getIsSymbol, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isWord", PKToken_getIsWord, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isQuotedString", PKToken_getIsQuotedString, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isWhitespace", PKToken_getIsWhitespace, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isComment", PKToken_getIsComment, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ "isDelimitedString", PKToken_getIsDelimitedString, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Class Methods + +// JSObjectCallAsFunctionCallback +//JSValueRef PKToken_EOFToken(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { +// static JSValueRef eof = NULL; +// if (!eof) { +// eof = PKToken_new(ctx, [PKToken EOFToken]); +// JSValueProtect(ctx, eof); // is this necessary/appropriate? +// } +// return eof; +//} + +#pragma mark - +#pragma mark Class Properties + +JSValueRef PKToken_getEOFToken(JSContextRef ctx) { + static JSObjectRef eof = NULL; + if (!eof) { + eof = PKToken_new(ctx, [PKToken EOFToken]); + } + return eof; +} + +#pragma mark - +#pragma mark Public + +JSClassRef PKToken_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.staticFunctions = PKToken_staticFunctions; + def.staticValues = PKToken_staticValues; + def.initialize = PKToken_initialize; + def.finalize = PKToken_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKToken_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKToken_class(ctx), data); +} + +JSObjectRef PKToken_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(3, "PKToken"); + + CGFloat tokenType = JSValueToNumber(ctx, argv[0], NULL); + NSString *stringValue = PKJSValueGetNSString(ctx, argv[1], ex); + CGFloat floatValue = JSValueToNumber(ctx, argv[2], NULL); + + PKToken *data = [[PKToken alloc] initWithTokenType:tokenType stringValue:stringValue floatValue:floatValue]; + return PKToken_new(ctx, data); +} diff --git a/jssrc/PKJSTokenAssembly.h b/jssrc/PKJSTokenAssembly.h new file mode 100644 index 0000000..fb9c9e3 --- /dev/null +++ b/jssrc/PKJSTokenAssembly.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKTokenAssembly_new(JSContextRef ctx, void *data); +JSClassRef PKTokenAssembly_class(JSContextRef ctx); +JSObjectRef PKTokenAssembly_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSTokenAssembly.m b/jssrc/PKJSTokenAssembly.m new file mode 100644 index 0000000..c8b40d7 --- /dev/null +++ b/jssrc/PKJSTokenAssembly.m @@ -0,0 +1,127 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSTokenAssembly.h" +#import "PKJSToken.h" +#import "PKJSUtils.h" +#import "PKJSAssembly.h" +#import +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKTokenAssembly_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenAssembly_class, "toString"); + PKTokenAssembly *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, [data description], ex); +} + +static JSValueRef PKTokenAssembly_pop(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenAssembly_class, "pop"); + PKTokenAssembly *data = JSObjectGetPrivate(this); + PKToken *tok = [data pop]; + return PKToken_new(ctx, tok); +} + +static JSValueRef PKTokenAssembly_push(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenAssembly_class, "push"); + PKPreconditionMethodArgc(1, "PKTokenAssembly.push"); + + JSValueRef v = argv[0]; + + PKTokenAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + [data push:obj]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKTokenAssembly_objectsAbove(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenAssembly_class, "objectsAbove"); + PKPreconditionMethodArgc(1, "PKTokenAssembly.objectsAbove"); + + JSValueRef v = argv[0]; + + PKTokenAssembly *data = JSObjectGetPrivate(this); + id obj = PKJSValueGetId(ctx, v, ex); + id array = [data objectsAbove:obj]; + + return PKNSArrayToJSObject(ctx, array, ex); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKTokenAssembly_getLength(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenAssembly *data = JSObjectGetPrivate(this); + return JSValueMakeNumber(ctx, [data length]); +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKTokenAssembly_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKTokenAssembly_finalize(JSObjectRef this) { + // released in PKAssembly_finalize +} + +static JSStaticFunction PKTokenAssembly_staticFunctions[] = { +{ "toString", PKTokenAssembly_toString, kJSPropertyAttributeDontDelete }, +{ "pop", PKTokenAssembly_pop, kJSPropertyAttributeDontDelete }, +{ "push", PKTokenAssembly_push, kJSPropertyAttributeDontDelete }, +{ "objectsAbove", PKTokenAssembly_objectsAbove, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKTokenAssembly_staticValues[] = { +{ "length", PKTokenAssembly_getLength, NULL, kJSPropertyAttributeDontDelete|kJSPropertyAttributeReadOnly }, // Number +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark ClassMethods + +#pragma mark - +#pragma mark Public + +JSClassRef PKTokenAssembly_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKAssembly_class(ctx); + def.staticFunctions = PKTokenAssembly_staticFunctions; + def.staticValues = PKTokenAssembly_staticValues; + def.initialize = PKTokenAssembly_initialize; + def.finalize = PKTokenAssembly_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKTokenAssembly_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKTokenAssembly_class(ctx), data); +} + +JSObjectRef PKTokenAssembly_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKTokenAssembly"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKTokenAssembly *data = [[PKTokenAssembly alloc] initWithString:s]; + return PKTokenAssembly_new(ctx, data); +} diff --git a/jssrc/PKJSTokenizer.h b/jssrc/PKJSTokenizer.h new file mode 100644 index 0000000..1aa5084 --- /dev/null +++ b/jssrc/PKJSTokenizer.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKTokenizer_new(JSContextRef ctx, void *data); +JSClassRef PKTokenizer_class(JSContextRef ctx); +JSObjectRef PKTokenizer_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSTokenizer.m b/jssrc/PKJSTokenizer.m new file mode 100644 index 0000000..2a93eea --- /dev/null +++ b/jssrc/PKJSTokenizer.m @@ -0,0 +1,221 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSTokenizer.h" +#import "PKJSUtils.h" +#import "PKJSToken.h" +#import "PKJSWordState.h" +#import "PKJSNumberState.h" +#import "PKJSQuoteState.h" +#import "PKJSWhitespaceState.h" +#import "PKJSCommentState.h" +#import "PKJSSymbolState.h" +#import +#import +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKTokenizer_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenizer_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKTokenizer]", ex); +} + +static JSValueRef PKTokenizer_nextToken(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenizer_class, "nextToken"); + PKTokenizer *data = JSObjectGetPrivate(this); + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = [data nextToken]; + + if (eof == tok) { + return PKToken_getEOFToken(ctx); + } + + return PKToken_new(ctx, tok); +} + +static JSValueRef PKTokenizer_setTokenizerState(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKTokenizer_class, "setTokenizerState"); + PKPreconditionMethodArgc(3, "PKTokenizer.setTokenizerState"); + + JSObjectRef stateObj = (JSObjectRef)argv[0]; + PKTokenizerState *state = JSObjectGetPrivate(stateObj); + NSString *from = PKJSValueGetNSString(ctx, argv[1], ex); + NSString *to = PKJSValueGetNSString(ctx, argv[2], ex); + + PKTokenizer *data = JSObjectGetPrivate(this); + [data setTokenizerState:state from:[from characterAtIndex:0] to:[to characterAtIndex:0]]; + + return JSValueMakeUndefined(ctx); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKTokenizer_getString(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKNSStringToJSValue(ctx, data.string, ex); +} + +static bool PKTokenizer_setString(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + data.string = PKJSValueGetNSString(ctx, value, ex); + return true; +} + +static JSValueRef PKTokenizer_getWordState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKWordState_new(ctx, data.wordState); + return NULL; +} + +static bool PKTokenizer_setWordState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKWordState *state = JSObjectGetPrivate(stateObj); + data.wordState = state; + return true; +} + +static JSValueRef PKTokenizer_getNumberState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKNumberState_new(ctx, data.numberState); + return NULL; +} + +static bool PKTokenizer_setNumberState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKNumberState *state = JSObjectGetPrivate(stateObj); + data.numberState = state; + return true; +} + +static JSValueRef PKTokenizer_getQuoteState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKQuoteState_new(ctx, data.quoteState); + return NULL; +} + +static bool PKTokenizer_setQuoteState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKQuoteState *state = JSObjectGetPrivate(stateObj); + data.quoteState = state; + return true; +} + +static JSValueRef PKTokenizer_getSymbolState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKSymbolState_new(ctx, data.symbolState); + return NULL; +} + +static bool PKTokenizer_setSymbolState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKSymbolState *state = JSObjectGetPrivate(stateObj); + data.symbolState = state; + return true; +} + +static JSValueRef PKTokenizer_getWhitespaceState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKWhitespaceState_new(ctx, data.whitespaceState); + return NULL; +} + +static bool PKTokenizer_setWhitespaceState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKWhitespaceState *state = JSObjectGetPrivate(stateObj); + data.whitespaceState = state; + return true; +} + +static JSValueRef PKTokenizer_getCommentState(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + return PKCommentState_new(ctx, data.commentState); + return NULL; +} + +static bool PKTokenizer_setCommentState(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKTokenizer *data = JSObjectGetPrivate(this); + JSObjectRef stateObj = JSValueToObject(ctx, value, ex); + PKCommentState *state = JSObjectGetPrivate(stateObj); + data.commentState = state; + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKTokenizer_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKTokenizer_finalize(JSObjectRef this) { + PKTokenizer *data = (PKTokenizer *)JSObjectGetPrivate(this); + [data autorelease]; +} + +static JSStaticFunction PKTokenizer_staticFunctions[] = { +{ "toString", PKTokenizer_toString, kJSPropertyAttributeDontDelete }, +{ "setTokenizerState", PKTokenizer_setTokenizerState, kJSPropertyAttributeDontDelete }, +{ "nextToken", PKTokenizer_nextToken, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKTokenizer_staticValues[] = { +{ "string", PKTokenizer_getString, PKTokenizer_setString, kJSPropertyAttributeDontDelete }, // String +{ "numberState", PKTokenizer_getNumberState, PKTokenizer_setNumberState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ "quoteState", PKTokenizer_getQuoteState, PKTokenizer_setQuoteState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ "commentState", PKTokenizer_getCommentState, PKTokenizer_setCommentState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ "symbolState", PKTokenizer_getSymbolState, PKTokenizer_setSymbolState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ "whitespaceState", PKTokenizer_getWhitespaceState, PKTokenizer_setWhitespaceState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ "wordState", PKTokenizer_getWordState, PKTokenizer_setWordState, kJSPropertyAttributeDontDelete }, // PKTokenizerState +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKTokenizer_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.staticFunctions = PKTokenizer_staticFunctions; + def.staticValues = PKTokenizer_staticValues; + def.initialize = PKTokenizer_initialize; + def.finalize = PKTokenizer_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKTokenizer_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKTokenizer_class(ctx), data); +} + +JSObjectRef PKTokenizer_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKTokenizer"); + + JSValueRef s = argv[0]; + NSString *string = PKJSValueGetNSString(ctx, s, ex); + + PKTokenizer *data = [[PKTokenizer alloc] initWithString:string]; + return PKTokenizer_new(ctx, data); +} diff --git a/jssrc/PKJSTokenizerState.h b/jssrc/PKJSTokenizerState.h new file mode 100644 index 0000000..48ab5ca --- /dev/null +++ b/jssrc/PKJSTokenizerState.h @@ -0,0 +1,18 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKTokenizerState_new(JSContextRef ctx, void *data); +JSClassRef PKTokenizerState_class(JSContextRef ctx); diff --git a/jssrc/PKJSTokenizerState.m b/jssrc/PKJSTokenizerState.m new file mode 100644 index 0000000..3083808 --- /dev/null +++ b/jssrc/PKJSTokenizerState.m @@ -0,0 +1,65 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSTokenizerState.h" +#import "PKJSUtils.h" +#import "PKJSToken.h" +#import +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKTokenizerState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKTokenizerState_finalize(JSObjectRef this) { + PKTokenizerState *data = (PKTokenizerState *)JSObjectGetPrivate(this); + [data autorelease]; +} + +static JSStaticFunction PKTokenizerState_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKTokenizerState_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKTokenizerState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.staticFunctions = PKTokenizerState_staticFunctions; + def.staticValues = PKTokenizerState_staticValues; + def.initialize = PKTokenizerState_initialize; + def.finalize = PKTokenizerState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKTokenizerState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKTokenizerState_class(ctx), data); +} diff --git a/jssrc/PKJSTrack.h b/jssrc/PKJSTrack.h new file mode 100644 index 0000000..ac92390 --- /dev/null +++ b/jssrc/PKJSTrack.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKTrack_new(JSContextRef ctx, void *data); +JSClassRef PKTrack_class(JSContextRef ctx); +JSObjectRef PKTrack_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSTrack.m b/jssrc/PKJSTrack.m new file mode 100644 index 0000000..6a4e70d --- /dev/null +++ b/jssrc/PKJSTrack.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSTrack.h" +#import "PKJSUtils.h" +#import "PKJSSequence.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKTrack_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKTrack_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKTrack_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKTrack_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKTrack_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKSequence_class(ctx); + def.staticFunctions = PKTrack_staticFunctions; + def.staticValues = PKTrack_staticValues; + def.initialize = PKTrack_initialize; + def.finalize = PKTrack_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKTrack_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKTrack_class(ctx), data); +} + +JSObjectRef PKTrack_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKTrack *data = [[PKTrack alloc] init]; + return PKTrack_new(ctx, data); +} diff --git a/jssrc/PKJSUppercaseWord.h b/jssrc/PKJSUppercaseWord.h new file mode 100644 index 0000000..5763965 --- /dev/null +++ b/jssrc/PKJSUppercaseWord.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKUppercaseWord_new(JSContextRef ctx, void *data); +JSClassRef PKUppercaseWord_class(JSContextRef ctx); +JSObjectRef PKUppercaseWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSUppercaseWord.m b/jssrc/PKJSUppercaseWord.m new file mode 100644 index 0000000..5e2f6f2 --- /dev/null +++ b/jssrc/PKJSUppercaseWord.m @@ -0,0 +1,73 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSUppercaseWord.h" +#import "PKJSUtils.h" +#import "PKJSWord.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKUppercaseWord_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKUppercaseWord_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKUppercaseWord_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKUppercaseWord_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKUppercaseWord_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKWord_class(ctx); + def.staticFunctions = PKUppercaseWord_staticFunctions; + def.staticValues = PKUppercaseWord_staticValues; + def.initialize = PKUppercaseWord_initialize; + def.finalize = PKUppercaseWord_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKUppercaseWord_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKUppercaseWord_class(ctx), data); +} + +JSObjectRef PKUppercaseWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionConstructorArgc(1, "PKUppercaseWord"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKUppercaseWord *data = [[PKUppercaseWord alloc] initWithString:s]; + return PKUppercaseWord_new(ctx, data); +} diff --git a/jssrc/PKJSUtils.h b/jssrc/PKJSUtils.h new file mode 100644 index 0000000..f119d47 --- /dev/null +++ b/jssrc/PKJSUtils.h @@ -0,0 +1,38 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +#define PKPreconditionInstaceOf(cls, meth) +#define PKPreconditionMethodArgc(n, meth) +#define PKPreconditionConstructorArgc(n, meth) + +JSValueRef PKCFTypeToJSValue(JSContextRef ctx, CFTypeRef value, JSValueRef *ex); +JSValueRef PKCFStringToJSValue(JSContextRef ctx, CFStringRef cfStr, JSValueRef *ex); +JSValueRef PKNSStringToJSValue(JSContextRef ctx, NSString *nsStr, JSValueRef *ex); +JSObjectRef PKCFArrayToJSObject(JSContextRef ctx, CFArrayRef cfArray, JSValueRef *ex); +JSObjectRef PKNSArrayToJSObject(JSContextRef ctx, NSArray *nsArray, JSValueRef *ex); +JSObjectRef PKCFDictionaryToJSObject(JSContextRef ctx, CFDictionaryRef cfDict, JSValueRef *ex); +JSObjectRef PKNSDictionaryToJSObject(JSContextRef ctx, NSDictionary *nsDict, JSValueRef *ex); + +CFTypeRef PKJSValueCopyCFType(JSContextRef ctx, JSValueRef value, JSValueRef *ex); +id PKJSValueGetId(JSContextRef ctx, JSValueRef value, JSValueRef *ex); +CFStringRef PKJSValueCopyCFString(JSContextRef ctx, JSValueRef value, JSValueRef *ex); +NSString *PKJSValueGetNSString(JSContextRef ctx, JSValueRef value, JSValueRef *ex); +CFArrayRef PKJSObjectCopyCFArray(JSContextRef ctx, JSObjectRef obj, JSValueRef *ex); +CFDictionaryRef PKJSObjectCopyCFDictionary(JSContextRef ctx, JSObjectRef obj, JSValueRef *ex); + +JSObjectRef PKNSErrorToJSObject(JSContextRef ctx, NSError *nsErr, JSValueRef *ex); +bool PKJSValueIsInstanceOfClass(JSContextRef ctx, JSValueRef value, char *className, JSValueRef* ex); \ No newline at end of file diff --git a/jssrc/PKJSUtils.m b/jssrc/PKJSUtils.m new file mode 100644 index 0000000..c9be532 --- /dev/null +++ b/jssrc/PKJSUtils.m @@ -0,0 +1,242 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSUtils.h" + +JSValueRef PKCFTypeToJSValue(JSContextRef ctx, CFTypeRef value, JSValueRef *ex) { + JSValueRef result = NULL; + CFTypeID typeID = CFGetTypeID(value); + + if (CFNumberGetTypeID() == typeID) { + double d; + CFNumberGetValue(value, kCFNumberDoubleType, &d); + result = JSValueMakeNumber(ctx, d); + } else if (CFBooleanGetTypeID() == typeID) { + Boolean b = CFBooleanGetValue(value); + result = JSValueMakeBoolean(ctx, b); + } else if (CFStringGetTypeID() == typeID) { + result = PKCFStringToJSValue(ctx, value, ex); + } else if (CFArrayGetTypeID() == typeID) { + result = PKCFArrayToJSObject(ctx, value, ex); + } else if (CFDictionaryGetTypeID() == typeID) { + result = PKCFDictionaryToJSObject(ctx, value, ex); + } else { + result = JSValueMakeNull(ctx); + } + + return result; +} + +JSValueRef PKCFStringToJSValue(JSContextRef ctx, CFStringRef cfStr, JSValueRef *ex) { + JSStringRef str = JSStringCreateWithCFString(cfStr); + JSValueRef result = JSValueMakeString(ctx, str); + JSStringRelease(str); + return result; +} + +JSValueRef PKNSStringToJSValue(JSContextRef ctx, NSString *nsStr, JSValueRef *ex) { + return PKCFStringToJSValue(ctx, (CFStringRef)nsStr, ex); +} + +JSObjectRef PKCFArrayToJSObject(JSContextRef ctx, CFArrayRef cfArray, JSValueRef *ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef className = JSStringCreateWithUTF8CString("Array"); + JSObjectRef arrayConstr = (JSObjectRef)JSObjectGetProperty(ctx, globalObj, className, NULL); + JSStringRelease(className); + + JSObjectRef obj = (JSObjectRef)JSObjectCallAsConstructor(ctx, arrayConstr, 0, NULL, NULL); + + CFIndex len = 0; + if (NULL != cfArray) { + len = CFArrayGetCount(cfArray); + } + + CFIndex i = 0; + for ( ; i < len; i++) { + CFTypeRef value = CFArrayGetValueAtIndex(cfArray, i); + JSValueRef propVal = PKCFTypeToJSValue(ctx, value, ex); + JSObjectSetPropertyAtIndex(ctx, obj, i, propVal, NULL); + } + + return obj; +} + +JSObjectRef PKNSArrayToJSObject(JSContextRef ctx, NSArray *nsArray, JSValueRef *ex) { + return PKCFArrayToJSObject(ctx, (CFArrayRef)nsArray, ex); +} + +JSObjectRef PKCFDictionaryToJSObject(JSContextRef ctx, CFDictionaryRef cfDict, JSValueRef *ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef className = JSStringCreateWithUTF8CString("Object"); + JSObjectRef objConstr = (JSObjectRef)JSObjectGetProperty(ctx, globalObj, className, NULL); + JSStringRelease(className); + + JSObjectRef obj = (JSObjectRef)JSObjectCallAsConstructor(ctx, objConstr, 0, NULL, NULL); + + if (NULL != cfDict) { + CFIndex len = CFDictionaryGetCount(cfDict); + CFStringRef keys[len]; + CFTypeRef values[len]; + CFDictionaryGetKeysAndValues(cfDict, (const void**)keys, (const void**)values); + + CFIndex i = 0; + for ( ; i < len; i++) { + CFStringRef key = keys[i]; + CFTypeRef value = values[i]; + + JSStringRef propName = JSStringCreateWithCFString(key); + JSValueRef propVal = PKCFTypeToJSValue(ctx, value, ex); + JSObjectSetProperty(ctx, obj, propName, propVal, kJSPropertyAttributeNone, NULL); + JSStringRelease(propName); + } + } + + return obj; +} + +JSObjectRef PKNSDictionaryToJSObject(JSContextRef ctx, NSDictionary *nsDict, JSValueRef *ex) { + return PKCFDictionaryToJSObject(ctx, (CFDictionaryRef)nsDict, ex); +} + +CFTypeRef PKJSValueCopyCFType(JSContextRef ctx, JSValueRef value, JSValueRef *ex) { + CFTypeRef result = NULL; + + if (JSValueIsBoolean(ctx, value)) { + Boolean b = JSValueToBoolean(ctx, value); + result = (b ? kCFBooleanTrue : kCFBooleanFalse); + } else if (JSValueIsNull(ctx, value)) { + result = NULL; + } else if (JSValueIsNumber(ctx, value)) { + CGFloat d = JSValueToNumber(ctx, value, NULL); + result = CFNumberCreate(NULL, kCFNumberCGFloatType, &d); + } else if (JSValueIsString(ctx, value)) { + result = PKJSValueCopyCFString(ctx, value, ex); + } else if (JSValueIsObject(ctx, value)) { + if (PKJSValueIsInstanceOfClass(ctx, value, "Array", NULL)) { + result = PKJSObjectCopyCFArray(ctx, (JSObjectRef)value, ex); + } else { + result = PKJSObjectCopyCFDictionary(ctx, (JSObjectRef)value, ex); + } + } + + return result; +} + +id PKJSValueGetId(JSContextRef ctx, JSValueRef value, JSValueRef *ex) { + return [(id)PKJSValueCopyCFType(ctx, value, ex) autorelease]; +} + +CFStringRef PKJSValueCopyCFString(JSContextRef ctx, JSValueRef value, JSValueRef *ex) { + JSStringRef str = JSValueToStringCopy(ctx, value, ex); + CFStringRef result = JSStringCopyCFString(NULL, str); + JSStringRelease(str); + return result; +} + +NSString *PKJSValueGetNSString(JSContextRef ctx, JSValueRef value, JSValueRef *ex) { + return [(id)PKJSValueCopyCFString(ctx, value, ex) autorelease]; +} + +CFArrayRef PKJSObjectCopyCFArray(JSContextRef ctx, JSObjectRef obj, JSValueRef *ex) { + JSStringRef propName = JSStringCreateWithUTF8CString("length"); + JSValueRef propVal = JSObjectGetProperty(ctx, obj, propName, NULL); + JSStringRelease(propName); + CFIndex len = (CFIndex)JSValueToNumber(ctx, propVal, NULL); + + CFMutableArrayRef cfArray = CFArrayCreateMutable(NULL, len, NULL); + + CFIndex i = 0; + for ( ; i < len; i++) { + JSValueRef val = JSObjectGetPropertyAtIndex(ctx, obj, i, NULL); + CFTypeRef cfType = PKJSValueCopyCFType(ctx, val, ex); + CFArraySetValueAtIndex(cfArray, i, cfType); + + CFRelease(cfType); + } + + CFArrayRef result = CFArrayCreateCopy(NULL, cfArray); + CFRelease(cfArray); + + return result; +} + +CFDictionaryRef PKJSObjectCopyCFDictionary(JSContextRef ctx, JSObjectRef obj, JSValueRef *ex) { + JSPropertyNameArrayRef propNames = JSObjectCopyPropertyNames(ctx, obj); + CFIndex len = JSPropertyNameArrayGetCount(propNames); + + CFMutableDictionaryRef cfDict = CFDictionaryCreateMutable(NULL, len, NULL, NULL); + + CFIndex i = 0; + for ( ; i < len; i++) { + JSStringRef propName = JSPropertyNameArrayGetNameAtIndex(propNames, i); + JSValueRef val = JSObjectGetProperty(ctx, obj, propName, NULL); + CFTypeRef cfType = PKJSValueCopyCFType(ctx, val, ex); + + CFStringRef key = JSStringCopyCFString(NULL, propName); + CFDictionarySetValue(cfDict, (const void *)key, (const void *)cfType); + + CFRelease(key); + CFRelease(cfType); + } + + JSPropertyNameArrayRelease(propNames); + CFDictionaryRef result = CFDictionaryCreateCopy(NULL, cfDict); + CFRelease(cfDict); + + return result; +} + +JSObjectRef PKNSErrorToJSObject(JSContextRef ctx, NSError *nsErr, JSValueRef *ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef className = JSStringCreateWithUTF8CString("Error"); + JSObjectRef errConstr = (JSObjectRef)JSObjectGetProperty(ctx, globalObj, className, ex); + JSStringRelease(className); + + JSObjectRef obj = (JSObjectRef)JSObjectCallAsConstructor(ctx, errConstr, 0, NULL, ex); + + if (nsErr) { + JSStringRef nameStr = JSStringCreateWithUTF8CString("ParseKitError"); + JSValueRef name = JSValueMakeString(ctx, nameStr); + JSStringRelease(nameStr); + + JSStringRef msgStr = JSStringCreateWithCFString((CFStringRef)[nsErr localizedDescription]); + JSValueRef msg = JSValueMakeString(ctx, msgStr); + JSStringRelease(msgStr); + + JSValueRef code = JSValueMakeNumber(ctx, [nsErr code]); + + JSStringRef propName = JSStringCreateWithUTF8CString("name"); + JSObjectSetProperty(ctx, obj, propName, name, kJSPropertyAttributeReadOnly|kJSPropertyAttributeDontDelete, ex); + JSStringRelease(propName); + + propName = JSStringCreateWithUTF8CString("message"); + JSObjectSetProperty(ctx, obj, propName, msg, kJSPropertyAttributeReadOnly|kJSPropertyAttributeDontDelete, ex); + JSStringRelease(propName); + + propName = JSStringCreateWithUTF8CString("code"); + JSObjectSetProperty(ctx, obj, propName, code, kJSPropertyAttributeReadOnly|kJSPropertyAttributeDontDelete, ex); + JSStringRelease(propName); + } + + return obj; +} + +bool PKJSValueIsInstanceOfClass(JSContextRef ctx, JSValueRef value, char *className, JSValueRef* ex) { + JSObjectRef globalObj = JSContextGetGlobalObject(ctx); + JSStringRef classNameStr = JSStringCreateWithUTF8CString(className); + JSObjectRef constr = (JSObjectRef)JSObjectGetProperty(ctx, globalObj, classNameStr, ex); + JSStringRelease(classNameStr); + + return JSValueIsInstanceOfConstructor(ctx, value, constr, NULL); +} diff --git a/jssrc/PKJSUtils_macros.h b/jssrc/PKJSUtils_macros.h new file mode 100644 index 0000000..0be22bd --- /dev/null +++ b/jssrc/PKJSUtils_macros.h @@ -0,0 +1,33 @@ +/* + * PKJSUtils_macros.h + * ParseKit + * + * Created by Todd Ditchendorf on 1/11/09. + * Copyright 2009 Todd Ditchendorf. All rights reserved. + * + */ + +#undef PKPreconditionInstaceOf +#define PKPreconditionInstaceOf(cls, meth) \ + if (!JSValueIsObjectOfClass(ctx, this, (cls)(ctx))) { \ + NSString *s = [NSString stringWithFormat:@"calling method '%s' on an object that is not an instance of '%s'", (meth), #cls]; \ + (*ex) = PKNSStringToJSValue(ctx, s, ex); \ + return JSValueMakeUndefined(ctx); \ + } + +#undef PKPreconditionMethodArgc +#define PKPreconditionMethodArgc(n, meth) \ + if (argc < (n)) { \ + NSString *s = [NSString stringWithFormat:@"%s() requires %d arguments", (meth), (n)]; \ + (*ex) = PKNSStringToJSValue(ctx, s, ex); \ + return JSValueMakeUndefined(ctx); \ + } + +#undef PKPreconditionConstructorArgc +#define PKPreconditionConstructorArgc(n, meth) \ + if (argc < (n)) { \ + NSString *s = [NSString stringWithFormat:@"%s constructor requires %d arguments", (meth), (n)]; \ + (*ex) = PKNSStringToJSValue(ctx, s, ex); \ + return NULL; \ + } + diff --git a/jssrc/PKJSValueHolder.h b/jssrc/PKJSValueHolder.h new file mode 100644 index 0000000..5fe242f --- /dev/null +++ b/jssrc/PKJSValueHolder.h @@ -0,0 +1,26 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface JSValueHolder : NSObject { + JSContextRef context; + JSValueRef heldValue; +} +- (id)initWithContext:(JSContextRef)c heldValue:(JSValueRef)v; + +@property (nonatomic) JSContextRef context; +@property (nonatomic) JSValueRef heldValue; +@end \ No newline at end of file diff --git a/jssrc/PKJSValueHolder.m b/jssrc/PKJSValueHolder.m new file mode 100644 index 0000000..dbad598 --- /dev/null +++ b/jssrc/PKJSValueHolder.m @@ -0,0 +1,35 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSValueHolder.h" + +@implementation JSValueHolder + +- (id)initWithContext:(JSContextRef)c heldValue:(JSValueRef)v { + if (self = [super init]) { + self.context = c; + self.heldValue = v; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +@synthesize context; +@synthesize heldValue; +@end diff --git a/jssrc/PKJSWhitespaceState.h b/jssrc/PKJSWhitespaceState.h new file mode 100644 index 0000000..7c9f0bd --- /dev/null +++ b/jssrc/PKJSWhitespaceState.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKWhitespaceState_new(JSContextRef ctx, void *data); +JSClassRef PKWhitespaceState_class(JSContextRef ctx); +JSObjectRef PKWhitespaceState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSWhitespaceState.m b/jssrc/PKJSWhitespaceState.m new file mode 100644 index 0000000..39702be --- /dev/null +++ b/jssrc/PKJSWhitespaceState.m @@ -0,0 +1,115 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSWhitespaceState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKWhitespaceState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWhitespaceState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKWhitespaceState]", ex); +} + +static JSValueRef PKWhitespaceState_setWhitespaceChars(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWhitespaceState_class, "setWhitespaceChars"); + PKPreconditionMethodArgc(3, "PKWhitespaceState.setWhitespaceChars"); + + BOOL yn = JSValueToBoolean(ctx, argv[0]); + NSString *start = PKJSValueGetNSString(ctx, argv[1], ex); + NSString *end = PKJSValueGetNSString(ctx, argv[2], ex); + + PKWhitespaceState *data = JSObjectGetPrivate(this); + [data setWhitespaceChars:yn from:[start characterAtIndex:0] to:[end characterAtIndex:0]]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKWhitespaceState_isWhitespaceChar(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWhitespaceState_class, "isWhitespaceChar"); + PKPreconditionMethodArgc(1, "PKWhitespaceState.add"); + + NSString *s = PKJSValueGetNSString(ctx, argv[0], ex); + + PKWhitespaceState *data = JSObjectGetPrivate(this); + BOOL yn = [data isWhitespaceChar:[s characterAtIndex:0]]; + + return JSValueMakeBoolean(ctx, yn); +} + +#pragma mark - +#pragma mark Properties + +static JSValueRef PKWhitespaceState_getReportsWhitespaceTokens(JSContextRef ctx, JSObjectRef this, JSStringRef propName, JSValueRef *ex) { + PKWhitespaceState *data = JSObjectGetPrivate(this); + return JSValueMakeBoolean(ctx, data.reportsWhitespaceTokens); +} + +static bool PKWhitespaceState_setReportsWhitespaceTokens(JSContextRef ctx, JSObjectRef this, JSStringRef propertyName, JSValueRef value, JSValueRef *ex) { + PKWhitespaceState *data = JSObjectGetPrivate(this); + data.reportsWhitespaceTokens = JSValueToBoolean(ctx, value); + return true; +} + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKWhitespaceState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKWhitespaceState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKWhitespaceState_staticFunctions[] = { +{ "toString", PKWhitespaceState_toString, kJSPropertyAttributeDontDelete }, +{ "setWhitespaceChars", PKWhitespaceState_setWhitespaceChars, kJSPropertyAttributeDontDelete }, +{ "isWhitespaceChar", PKWhitespaceState_isWhitespaceChar, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKWhitespaceState_staticValues[] = { +{ "reportsWhitespaceTokens", PKWhitespaceState_getReportsWhitespaceTokens, PKWhitespaceState_setReportsWhitespaceTokens, kJSPropertyAttributeDontDelete }, // Boolean +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKWhitespaceState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKWhitespaceState_staticFunctions; + def.staticValues = PKWhitespaceState_staticValues; + def.initialize = PKWhitespaceState_initialize; + def.finalize = PKWhitespaceState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKWhitespaceState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKWhitespaceState_class(ctx), data); +} + +JSObjectRef PKWhitespaceState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKWhitespaceState *data = [[PKWhitespaceState alloc] init]; + return PKWhitespaceState_new(ctx, data); +} diff --git a/jssrc/PKJSWord.h b/jssrc/PKJSWord.h new file mode 100644 index 0000000..bdd5a9c --- /dev/null +++ b/jssrc/PKJSWord.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKWord_new(JSContextRef ctx, void *data); +JSClassRef PKWord_class(JSContextRef ctx); +JSObjectRef PKWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSWord.m b/jssrc/PKJSWord.m new file mode 100644 index 0000000..4e8bc09 --- /dev/null +++ b/jssrc/PKJSWord.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSWord.h" +#import "PKJSUtils.h" +#import "PKJSTerminal.h" +#import + +#pragma mark - +#pragma mark Methods + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKWord_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKWord_finalize(JSObjectRef this) { + // released in PKParser_finalize +} + +static JSStaticFunction PKWord_staticFunctions[] = { +{ 0, 0, 0 } +}; + +static JSStaticValue PKWord_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKWord_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTerminal_class(ctx); + def.staticFunctions = PKWord_staticFunctions; + def.staticValues = PKWord_staticValues; + def.initialize = PKWord_initialize; + def.finalize = PKWord_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKWord_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKWord_class(ctx), data); +} + +JSObjectRef PKWord_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKWord *data = [[PKWord alloc] init]; + return PKWord_new(ctx, data); +} diff --git a/jssrc/PKJSWordState.h b/jssrc/PKJSWordState.h new file mode 100644 index 0000000..aaa91a4 --- /dev/null +++ b/jssrc/PKJSWordState.h @@ -0,0 +1,19 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +JSObjectRef PKWordState_new(JSContextRef ctx, void *data); +JSClassRef PKWordState_class(JSContextRef ctx); +JSObjectRef PKWordState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef* ex); diff --git a/jssrc/PKJSWordState.m b/jssrc/PKJSWordState.m new file mode 100644 index 0000000..851ec6d --- /dev/null +++ b/jssrc/PKJSWordState.m @@ -0,0 +1,103 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKJSWordState.h" +#import "PKJSUtils.h" +#import "PKJSTokenizerState.h" +#import + +#pragma mark - +#pragma mark Methods + +static JSValueRef PKWordState_toString(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWordState_class, "toString"); + return PKNSStringToJSValue(ctx, @"[object PKWordState]", ex); +} + +static JSValueRef PKWordState_setWordChars(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWordState_class, "setWordChars"); + PKPreconditionMethodArgc(3, "PKWordState.setWordChars"); + + BOOL yn = JSValueToBoolean(ctx, argv[0]); + NSString *start = PKJSValueGetNSString(ctx, argv[1], ex); + NSString *end = PKJSValueGetNSString(ctx, argv[2], ex); + + PKWordState *data = JSObjectGetPrivate(this); + [data setWordChars:yn from:[start characterAtIndex:0] to:[end characterAtIndex:0]]; + + return JSValueMakeUndefined(ctx); +} + +static JSValueRef PKWordState_isWordChar(JSContextRef ctx, JSObjectRef function, JSObjectRef this, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKPreconditionInstaceOf(PKWordState_class, "isWordChar"); + PKPreconditionMethodArgc(1, "PKWordState.isWordChar"); + + NSInteger c = (NSInteger)JSValueToNumber(ctx, argv[0], ex); + + PKWordState *data = JSObjectGetPrivate(this); + BOOL yn = [data isWordChar:c]; + + return JSValueMakeBoolean(ctx, yn); +} + +#pragma mark - +#pragma mark Properties + +#pragma mark - +#pragma mark Initializer/Finalizer + +static void PKWordState_initialize(JSContextRef ctx, JSObjectRef this) { + +} + +static void PKWordState_finalize(JSObjectRef this) { + // released in PKTokenizerState_finalize +} + +static JSStaticFunction PKWordState_staticFunctions[] = { +{ "toString", PKWordState_toString, kJSPropertyAttributeDontDelete }, +{ "setWordChars", PKWordState_setWordChars, kJSPropertyAttributeDontDelete }, +{ "isWordChar", PKWordState_isWordChar, kJSPropertyAttributeDontDelete }, +{ 0, 0, 0 } +}; + +static JSStaticValue PKWordState_staticValues[] = { +{ 0, 0, 0, 0 } +}; + +#pragma mark - +#pragma mark Public + +JSClassRef PKWordState_class(JSContextRef ctx) { + static JSClassRef jsClass = NULL; + if (!jsClass) { + JSClassDefinition def = kJSClassDefinitionEmpty; + def.parentClass = PKTokenizerState_class(ctx); + def.staticFunctions = PKWordState_staticFunctions; + def.staticValues = PKWordState_staticValues; + def.initialize = PKWordState_initialize; + def.finalize = PKWordState_finalize; + jsClass = JSClassCreate(&def); + } + return jsClass; +} + +JSObjectRef PKWordState_new(JSContextRef ctx, void *data) { + return JSObjectMake(ctx, PKWordState_class(ctx), data); +} + +JSObjectRef PKWordState_construct(JSContextRef ctx, JSObjectRef constructor, size_t argc, const JSValueRef argv[], JSValueRef *ex) { + PKWordState *data = [[PKWordState alloc] init]; + return PKWordState_new(ctx, data); +} diff --git a/res/.svn/all-wcprops b/res/.svn/all-wcprops new file mode 100644 index 0000000..5056f2d --- /dev/null +++ b/res/.svn/all-wcprops @@ -0,0 +1,251 @@ +K 25 +svn:wc:ra_dav:version-url +V 28 +/svn/!svn/ver/1399/trunk/res +END +css2_1.grammar +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1177/trunk/res/css2_1.grammar +END +css.css +K 25 +svn:wc:ra_dav:version-url +V 35 +/svn/!svn/ver/552/trunk/res/css.css +END +small-xml-file.xml +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/99/trunk/res/small-xml-file.xml +END +xml.grammar +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1276/trunk/res/xml.grammar +END +proto.grammar +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1177/trunk/res/proto.grammar +END +example1.srgs +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/524/trunk/res/example1.srgs +END +mini_css.grammar +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1275/trunk/res/mini_css.grammar +END +erb.grammar +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1274/trunk/res/erb.grammar +END +example.html +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1263/trunk/res/example.html +END +objc.grammar +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1145/trunk/res/objc.grammar +END +nonascii.html +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/119/trunk/res/nonascii.html +END +xpath_grammar.txt +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/2/trunk/res/xpath_grammar.txt +END +rubyhash.grammar +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1177/trunk/res/rubyhash.grammar +END +apple-boss.json +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/527/trunk/res/apple-boss.json +END +nyt.html +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/!svn/ver/1171/trunk/res/nyt.html +END +example.css +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1264/trunk/res/example.css +END +svn-commands.txt +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1392/trunk/res/svn-commands.txt +END +xml_grammar.txt +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/68/trunk/res/xml_grammar.txt +END +nspredicate.grammar +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1275/trunk/res/nspredicate.grammar +END +yahoo.json +K 25 +svn:wc:ra_dav:version-url +V 38 +/svn/!svn/ver/527/trunk/res/yahoo.json +END +yahoo_with_comments.json +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/543/trunk/res/yahoo_with_comments.json +END +html.grammar +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1264/trunk/res/html.grammar +END +html.css +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/!svn/ver/1263/trunk/res/html.css +END +javascript.grammar +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1177/trunk/res/javascript.grammar +END +yahoo-small.json +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/2/trunk/res/yahoo-small.json +END +json.grammar +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1316/trunk/res/json.grammar +END +json_with_comments.grammar +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1276/trunk/res/json_with_comments.grammar +END +json_with_comments.css +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/543/trunk/res/json_with_comments.css +END +json.css +K 25 +svn:wc:ra_dav:version-url +V 36 +/svn/!svn/ver/473/trunk/res/json.css +END +nasty.html +K 25 +svn:wc:ra_dav:version-url +V 38 +/svn/!svn/ver/198/trunk/res/nasty.html +END +date.grammar +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1107/trunk/res/date.grammar +END +SRGSGrammar.txt +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/24/trunk/res/SRGSGrammar.txt +END +apple-boss.xml +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/527/trunk/res/apple-boss.xml +END +json_with_discards.grammar +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1276/trunk/res/json_with_discards.grammar +END +stuff.txt +K 25 +svn:wc:ra_dav:version-url +V 36 +/svn/!svn/ver/38/trunk/res/stuff.txt +END +c.grammar +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/!svn/ver/986/trunk/res/c.grammar +END +xpath1_0.grammar +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1224/trunk/res/xpath1_0.grammar +END +json-old.grammar +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/363/trunk/res/json-old.grammar +END +javascript_ll.txt +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/893/trunk/res/javascript_ll.txt +END +css.grammar +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1177/trunk/res/css.grammar +END +arithmetic.grammar +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1399/trunk/res/arithmetic.grammar +END diff --git a/res/.svn/entries b/res/.svn/entries new file mode 100644 index 0000000..8e056e5 --- /dev/null +++ b/res/.svn/entries @@ -0,0 +1,1429 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/res +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-09-25T23:53:58.853281Z +1399 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + + + + + + +0 + +css.css +file + + + + +2009-01-04T21:18:31.000000Z +78c18946f6ffaeeadfd3225a10c13aa9 +2009-01-02T21:43:54.047733Z +552 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1214 + +css2_1.grammar +file + + + + +2009-07-03T22:20:03.000000Z +7f4b8609cb7a9e7de4784d2027854e0e +2009-07-03T22:22:49.496142Z +1177 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +4703 + +small-xml-file.xml +file + + + + +2008-09-09T00:54:01.000000Z +635b643c51c10c25d74855a7dcd65ad7 +2008-09-08T23:19:29.702882Z +99 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +166 + +xml.grammar +file + + + + +2009-08-06T04:02:07.000000Z +94d761cc17bb711ba4009cbdc0455cb4 +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +11924 + +proto.grammar +file + + + + +2009-07-03T22:20:03.000000Z +71ffa9a03c1e9ff3f87e462e3e6f167a +2009-07-03T22:22:49.496142Z +1177 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3405 + +example1.srgs +file + + + + +2008-12-29T06:08:01.000000Z +ac4d9edd3f3a8d0885cd1574fbfee228 +2008-12-29T03:54:03.697310Z +524 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +711 + +mini_css.grammar +file + + + + +2009-08-06T04:02:07.000000Z +68d7c36dd4772abaf6e52f5e4b9ab7d0 +2009-08-02T22:59:20.682429Z +1275 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +813 + +erb.grammar +file + + + + +2009-08-06T04:02:07.000000Z +025b7af4a42f649ca18f18967d98d7a5 +2009-08-02T22:44:31.009697Z +1274 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +325 + +example.html +file + + + + +2009-07-27T05:59:17.000000Z +8acc3431d1ef730e3a44e514510f9574 +2009-07-27T06:00:08.623243Z +1263 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +783 + +objc.grammar +file + + + + +2009-07-02T08:13:09.000000Z +1ef69df65f7382e86f87d489a71ba253 +2009-07-02T08:13:30.903884Z +1145 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +4399 + +nonascii.html +file + + + + +2008-09-18T01:15:25.000000Z +0918e25c989141d4da9df817d8f673cb +2008-09-16T19:18:13.595792Z +119 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +6 + +xpath_grammar.txt +file + + + + +2008-08-16T23:18:00.000000Z +32115e5c48f844d6bd2e83af42fe8446 +2008-08-18T01:13:08.367577Z +2 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3950 + +rubyhash.grammar +file + + + + +2009-07-03T22:20:03.000000Z +61fb027ff53c0b8e5df4ca5887596acf +2009-07-03T22:22:49.496142Z +1177 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1038 + +nyt.html +file + + + + +2009-07-03T19:31:31.000000Z +5abad5697c979748ef9bda66990736df +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +113050 + +apple-boss.json +file + + + + +2008-12-29T06:08:02.000000Z +7e719d89f39e583f06642d862ed813ef +2008-12-29T04:00:43.071407Z +527 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +8216 + +example.css +file + + + + +2009-07-28T03:33:06.000000Z +875b6fe0d66f849e7419cb66227cdd84 +2009-07-28T06:26:12.609772Z +1264 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +840 + +svn-commands.txt +file + + + + +2009-09-18T00:49:42.000000Z +d5e47b33bce5963b78b2bc22de7669c6 +2009-09-18T00:49:49.588045Z +1392 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +854 + +xml_grammar.txt +file + + + + +2008-08-26T03:36:19.000000Z +31ab6ac70b8792fbcb63cd2e36f7dd74 +2008-08-26T05:15:19.863356Z +68 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +5496 + +nspredicate.grammar +file + + + + +2009-08-06T04:02:07.000000Z +d4cf34d579213216979219c558582098 +2009-08-02T22:59:20.682429Z +1275 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3462 + +yahoo.json +file + + + + +2008-12-29T06:08:01.000000Z +10f19042248cc1480cceafe7175eb45c +2008-12-29T04:00:43.071407Z +527 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +11443 + +yahoo_with_comments.json +file + + + + +2008-12-31T23:28:36.000000Z +2617530644acc7917735d879d502b1d6 +2008-12-31T21:33:31.036262Z +543 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +11458 + +html.grammar +file + + + + +2009-07-27T06:05:06.000000Z +42ff37705f7dc757bbb05eed90db135c +2009-07-28T06:26:12.609772Z +1264 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1095 + +javascript.grammar +file + + + + +2009-07-03T22:20:03.000000Z +429f32f5c4ec3a566d867094eee35365 +2009-07-03T22:22:49.496142Z +1177 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +11065 + +html.css +file + + + + +2009-07-27T05:59:49.000000Z +1857dbf2d1fe28ae47ca777a1316e622 +2009-07-27T06:00:08.623243Z +1263 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1243 + +yahoo-small.json +file + + + + +2008-08-08T08:34:59.000000Z +23e4438ccaa83a0346f3ab81436a61a2 +2008-08-18T01:13:08.367577Z +2 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +504 + +json.grammar +file + + + + +2009-08-06T04:02:07.000000Z +52a4cde3481a720099df8bed8918b91f +2009-08-09T07:55:34.749013Z +1316 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2046 + +json_with_comments.grammar +file + + + + +2009-08-06T04:02:07.000000Z +2df8fb3e2f25a33674065bd6ea33ef73 +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2322 + +json_with_comments.css +file + + + + +2008-12-31T23:28:36.000000Z +0574c6077487daae145207849c703125 +2008-12-31T21:33:31.036262Z +543 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1099 + +json.css +file + + + + +2008-12-29T06:08:01.000000Z +b2276bc75b093411857889aeeb276c39 +2008-12-26T09:14:14.897421Z +473 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +969 + +nasty.html +file + + + + +2008-11-27T01:12:57.000000Z +4cd07edd01f6efb55ad479b50f096e32 +2008-11-22T03:34:58.359586Z +198 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +735 + +date.grammar +file + + + + +2009-06-30T04:19:25.000000Z +f9244b34537528d24141a96a3f72bc9d +2009-06-30T04:22:36.109998Z +1107 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1310 + +SRGSGrammar.txt +file + + + + +2008-08-20T02:41:16.000000Z +bfbf550b59adb8b21f035e76baec3708 +2008-08-20T06:37:48.564650Z +24 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +5060 + +apple-boss.xml +file + + + + +2008-12-29T06:08:02.000000Z +db9d148b40fa176c258a35a0c988e880 +2008-12-29T04:00:43.071407Z +527 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +9613 + +json_with_discards.grammar +file + + + + +2009-08-06T04:02:07.000000Z +18a78c158a62ccb02ee08df390048281 +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1463 + +stuff.txt +file + + + + +2008-08-24T02:17:00.000000Z +481f79553a2649211a1c487bd57ac5dc +2008-08-24T02:19:05.295252Z +38 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +174 + +c.grammar +file + + + + +2009-06-19T01:49:29.000000Z +1ea0553001b76ace1feb861a7621228b +2009-06-18T19:17:13.046641Z +986 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +7964 + +xpath1_0.grammar +file + + + + +2009-07-13T06:15:35.000000Z +b7e468adee1046af806193595765d28a +2009-07-13T06:15:46.893213Z +1224 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3566 + +json-old.grammar +file + + + + +2008-12-15T21:27:05.000000Z +ad5d870f4668e457c6d2daf5d08060a0 +2008-12-15T09:09:56.347605Z +363 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +958 + +javascript_ll.txt +file + + + + +2009-06-04T04:25:06.000000Z +f683396eb9bb1c5937e80196d162f141 +2009-06-04T04:57:04.693087Z +893 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3930 + +css.grammar +file + + + + +2009-07-03T22:20:03.000000Z +164208ebbcbf2b14b4476ff61d4ab437 +2009-07-03T22:22:49.496142Z +1177 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1342 + +arithmetic.grammar +file + + + + +2009-09-26T03:08:41.000000Z +64cceacdfc3c183d3908227b31550ba8 +2009-09-25T23:53:58.853281Z +1399 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +352 + diff --git a/res/.svn/prop-base/example1.srgs.svn-base b/res/.svn/prop-base/example1.srgs.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/res/.svn/prop-base/example1.srgs.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/res/.svn/prop-base/mini_css.grammar.svn-base b/res/.svn/prop-base/mini_css.grammar.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/res/.svn/prop-base/mini_css.grammar.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/res/.svn/prop-base/nyt.html.svn-base b/res/.svn/prop-base/nyt.html.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/res/.svn/prop-base/nyt.html.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/res/.svn/prop-base/yahoo-small.json.svn-base b/res/.svn/prop-base/yahoo-small.json.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/res/.svn/prop-base/yahoo-small.json.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/res/.svn/text-base/SRGSGrammar.txt.svn-base b/res/.svn/text-base/SRGSGrammar.txt.svn-base new file mode 100644 index 0000000..d894c82 --- /dev/null +++ b/res/.svn/text-base/SRGSGrammar.txt.svn-base @@ -0,0 +1,218 @@ +selfIdentHeader ::= + '#ABNF' #x20 VersionNumber (#x20 CharEncoding)? ';' + [Additional constraints: + - The semicolon (';') must immediately be followed + by an end-of-line. + ] + +VersionNumber ::= + '1.0' + +CharEncoding ::= + Nmtoken + +BaseURI ::= + ABNF_URI + +LanguageCode ::= + Nmtoken + [Additional constraints: + - The language code must be a valid language identifier. + ] + +RuleName ::= + '$' ConstrainedName + +ConstrainedName ::= + Name - (Char* ('.' | ':' | '-') Char*) + +TagFormat ::= + ABNF_URI + +LexiconURI ::= + ABNF_URI | ABNF_URI_with_Media_Type + +SingleQuotedCharacters ::= + ''' [^']* ''' + +DoubleQuotedCharacters ::= + '"' [^"]* '"' + +QuotedCharacters ::= + SingleQuotedCharacters | DoubleQuotedCharacters + +Weight ::= + '/' Number '/' + + +Repeat ::= + [0-9]+ ('-' [0-9]*)? + [Additional constraints: + - A number to the right of the hyphen must not be + greater than the number to the left of the hyphen. + ] + + +Probability ::= + '/' Number '/' + [Additional constraints: + - The float value must be in the range of "0.0" + to "1.0" (inclusive). + ] + +Number ::= + [0-9]+ | [0-9]+ '.' [0-9]* | [0-9]* '.' [0-9]+ + +ExternalRuleRef ::= + '$' ABNF_URI | '$' ABNF_URI_with_Media_Type + [Additional constraints: + - The referenced grammar must have the same mode + ("voice" or "dtmf") as the referencing grammar. + - If the URI reference contains a fragment + identifier, the referenced rule must be a + public rule of another grammar. + - If the URI reference does not contain a fragment + identifier, i.e. if it is an implicit root rule reference, + then the referenced grammar must declare a root + rule. + ] + +Token ::= + Nmtoken | DoubleQuotedCharacters + +LanguageAttachment ::= + '!' LanguageCode + +Tag ::= + '{' [^}]* '}' + | '{!{' (Char* - (Char* '}!}' Char*)) '}!}' + +------------------------------------------------------------ + +ABNF_URI + and ABNF_URI_with_Media_Type + are defined +in Section 1.6 Terminology. + +Name is defined by the XML Name production [XML §2.3]. + +Nmtoken is defined by the XML Nmtoken production [XML §2.3]. + +NameChar is defined by the XML NameChar production [XML §2.3]. + +Char is defined by the XML Char production [XML §2.2]. + + + + + + + + + + + + + +grammar ::= + selfIdentHeader declaration* ruleDefinition* + +declaration ::= + baseDecl | languageDecl | modeDecl | rootRuleDecl + | tagFormatDecl | lexiconDecl | metaDecl | tagDecl + +baseDecl ::= + 'base' BaseURI ';' + [Additional constraints: + - A base declaration must not appear more than + once in grammar. + ] + +languageDecl ::= + 'language' LanguageCode ';' + [Additional constraints: + - A language declaration must not appear more than + once in grammar. + - A language declaration is required if the + grammar mode is "voice". + ] + +modeDecl ::= + 'mode' 'voice' ';' | 'mode' 'dtmf' ';' + [Additional constraints: + - A mode declaration must not appear more than + once in grammar. + ] + +rootRuleDecl ::= + 'root' RuleName ';' + [Additional constraints: + - A root rule declaration must not appear more + than once in grammar. + - The root rule must be a rule that is defined + within the grammar. + ] + +tagFormatDecl ::= + 'tag-format' TagFormat ';' + [Additional constraints: + - A tag-format declaration must not appear more + than once in grammar. + ] + +lexiconDecl ::= + 'lexicon' LexiconURI ';' + +metaDecl ::= + 'http-equiv' QuotedCharacters 'is' QuotedCharacters ';' + | 'meta' QuotedCharacters 'is' QuotedCharacters ';' + + +tagDecl ::= + Tag ';' + + +ruleDefinition ::= + scope? RuleName '=' ruleExpansion ';' + [Additional constraints: + - The rule name must be unique within a grammar, + i.e. no rule must be defined more than once + within a grammar. + ] + +scope ::= + 'private' | 'public' + +ruleExpansion ::= + ruleAlternative ( '|' ruleAlternative )* + +ruleAlternative ::= + Weight? sequenceElement+ + +sequenceElement ::= + subexpansion | subexpansion repeatOperator + +subexpansion ::= + Token LanguageAttachment? + | ruleRef + | Tag + | '(' ')' + | '(' ruleExpansion ')' LanguageAttachment? + | '[' ruleExpansion ']' LanguageAttachment? + +ruleRef ::= + localRuleRef | ExternalRuleRef | specialRuleRef + +localRuleRef ::= + RuleName + [Additional constraints: + - The referenced rule must be defined within the + same grammar. + ] + +specialRuleRef ::= + '$NULL' | '$VOID' | '$GARBAGE' + + +repeatOperator ::= + '<' Repeat Probability? '>' \ No newline at end of file diff --git a/res/.svn/text-base/apple-boss.json.svn-base b/res/.svn/text-base/apple-boss.json.svn-base new file mode 100644 index 0000000..a082201 --- /dev/null +++ b/res/.svn/text-base/apple-boss.json.svn-base @@ -0,0 +1,80 @@ +{"ysearchresponse": + {"responsecode":"200", + "nextpage":"\/ysearch\/web\/v1\/apple?appid=LcU4qWbV34HAOHTXXZbYfB1_AgYH5_AhlzYZ6Qvm4hdEDw6B1MicVEIYPtQLOTnb&format=json&start=10", + "totalhits":"50793319", + "deephits":"1510000000", + "count":"10", + "start":"0", + "resultset_web": + [{"abstract":"Macintosh hardware, software, and Internet tools. Offering Quicktime info, developer resources, and other items related to Apple<\/b> computers.", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnNTdsamw3BGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzAEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=10qut2vvd\/**http%3A\/\/www.apple.com\/","date":"2008\/08\/12", + "dispurl":"www.apple.com<\/b>", + "size":"10765", + "title":"Apple<\/b>, Inc.", + "url":"http:\/\/www.apple.com\/"}, + {"abstract":"The official online store for iPods, Mac laptops and Macintosh computers, with free shipping over $50. Also featuring software such as Final Cut and Office 2008 for Mac.", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnaTZsYjRpBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzEEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=1fufchaio\/**http%3A\/\/rdrw1.yahoo.com\/click%3Fu=http%3A\/\/feedpoint.net\/r\/redir.jsp%253Fengine%253DINK%2526pcid%253D597997%2526fid%253D-2%2526url%253Dhttp%3A\/\/store.apple.com\/1-800-MY-APPLE\/WebObjects\/AppleStore%253Faosid%253Dp210%2526cid%253DOAS-US-YPI%2526src%253Dyssp%26y=04C664CB0EAC6A0CE6%26i=1473%26c=59131%26q=02%255ESSHPM%255BL7~oosz6%26e=utf-8%26r=1%26d=wow~LcU4qWbV34HAOHTXXZbYfB1_AgYH5_AhlzYZ6Qvm4hdEDw6B1MicVEIYPtQLOTnb-en-us%26n=LN94K1HIB6HKGRUL%26s=1%26t=%26m=48A3A234%26x=051726E3806650ACD5A44E8C8BD13ADACC", + "date":"2008\/08\/13", + "dispurl":"store.apple.com<\/b>", + "size":"49418", + "title":"Mac Laptops, iPods and Macintosh Computers | Apple<\/b> Online Store", + "url":"http:\/\/store.apple.com\/"}, + {"abstract":"Encyclopedia article about the computer company, including history, product lines, and corporate affairs. ...<\/b> Apple's<\/b> software products include the Mac OS X ...<\/b>", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnNHB0OGduBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzIEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=11c328ll9\/**http%3A\/\/en.wikipedia.org\/wiki\/Apple_Inc.", + "date":"2008\/08\/10", + "dispurl":"en.wikipedia.org<\/b>\/wiki\/Apple<\/b>_Inc.", + "size":"285957", + "title":"Apple<\/b> Inc. - Wikipedia, the free encyclopedia", + "url":"http:\/\/en.wikipedia.org\/wiki\/Apple_Inc."}, + {"abstract":"Detailed overview of the apple's<\/b> origins, flavors, and health benefits.", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnMmh1a3BkBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzMEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=117d3a7f6\/**http%3A\/\/en.wikipedia.org\/wiki\/Apple", + "date":"2008\/08\/11", + "dispurl":"en.wikipedia.org<\/b>\/wiki\/Apple<\/b>", + "size":"128319", + "title":"Apple<\/b> - Wikipedia", + "url":"http:\/\/en.wikipedia.org\/wiki\/Apple"}, + {"abstract":"Your complete guide to all things Macintosh. Get the latest reviews, news, videos, downloads, tips, and more for Mac laptops, desktops, and OS X 10.5 (Leopard)", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnNWR1czdzBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzQEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=117n1p7jv\/**http%3A\/\/www.cnet.com\/apple-mac.html", + "date":"2008\/08\/09", + "dispurl":"www.cnet.com<\/b>\/apple<\/b>-mac.html", + "size":"102719", + "title":"Apple<\/b> Mac: Mac OS, Mac laptop, Mac desktop - CNET.com", + "url":"http:\/\/www.cnet.com\/apple-mac.html"}, + {"abstract":"Watch Apple<\/b> CEO Steve Jobs unveil iPhone 3G, the App Store, MobileMe, and more ...<\/b> Copyright \u00a9 2008 Apple<\/b> Inc. All rights reserved. Terms of Use | Privacy Policy ...<\/b>", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnbjkwdjF0BGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzUEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=1272or2mo\/**http%3A\/\/events.apple.com.edgesuite.net\/0806wdt546x\/event\/index.html", + "date":"2008\/07\/16", + "dispurl":"events.apple.com.edgesuite.net<\/b>\/0806wdt546x\/event\/index.html", + "size":"17259", + "title":"Apple<\/b> - QuickTime - WWDC 2008 Keynote", + "url":"http:\/\/events.apple.com.edgesuite.net\/0806wdt546x\/event\/index.html"}, + {"abstract":"Apple's<\/b> GrayShare technology gives you the ability to print over 130 shades of ...<\/b> are part of the CSW 4000 Series Update 1.0 posted on Apple<\/b> Software Updates. ...<\/b>", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRndXBuYjJ1BGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzYEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=11r2bnul4\/**http%3A\/\/docs.info.apple.com\/article.html%3Fartnum=30153", + "date":"2004\/09\/20", + "dispurl":"docs.info.apple.com<\/b>\/article.html?artnum=30153", + "size":"37078", + "title":"StyleWriter Printers: Print Drivers and Cable Matrix", + "url":"http:\/\/docs.info.apple.com\/article.html?artnum=30153"}, + {"abstract":"8 Jumps Apple<\/b> releases firmware 2.0 for iPhone, iPod Touch ...<\/b> Apple<\/b> underestimated the load on their servers, which left many users stuck on ...<\/b>", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnY3I0MWFoBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzcEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=10pb88a2t\/**http%3A\/\/apple.qj.net\/", + "date":"2008\/07\/14", + "dispurl":"apple.qj.net<\/b>", + "size":"82416", + "title":"QJ.NET - QuickJump Home - Apple<\/b> News - QJ.NET", + "url":"http:\/\/apple.qj.net\/"}, + {"abstract":"Daily Apple<\/b> news updates, forums, reviews, and features.", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnN2tqM2ZpBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzgEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=111js1asj\/**http%3A\/\/www.appleinsider.com\/", + "date":"2008\/08\/12", + "dispurl":"www.appleinsider.com<\/b>", + "size":"82410", + "title":"AppleInsider", + "url":"http:\/\/www.appleinsider.com\/"}, + {"abstract":"Offers threaded discussions related to news for Apple<\/b> users.", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnaTlmZm5iBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzkEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=10vvqn6ao\/**http%3A\/\/apple.slashdot.org\/", + "date":"2008\/08\/13", + "dispurl":"apple.slashdot.org<\/b>", + "size":"43683", + "title":"apple<\/b>.slashdot.org", + "url":"http:\/\/apple.slashdot.org\/"} + ] + } +} \ No newline at end of file diff --git a/res/.svn/text-base/apple-boss.xml.svn-base b/res/.svn/text-base/apple-boss.xml.svn-base new file mode 100644 index 0000000..14a3187 --- /dev/null +++ b/res/.svn/text-base/apple-boss.xml.svn-base @@ -0,0 +1,96 @@ + + + + + + Apple computers.]]> + + 2008/08/17 + apple.com]]> + 10765 + <![CDATA[<b>Apple</b>, Inc.]]> + http://www.apple.com/ + + + The official online store for iPods, Mac laptops and Macintosh computers, with free shipping over $50. Also featuring software such as Final Cut and Office 2008 for Mac. + + 2008/08/18 + store.apple.com]]> + 101744 + <![CDATA[Mac Laptops, iPods and Macintosh Computers | <b>Apple</b> Online Store]]> + http://store.apple.com/ + + + ... Apple's software products include the Mac OS X ...]]> + + 2008/08/10 + en.wikipedia.org/wiki/Apple_Inc.]]> + 285957 + <![CDATA[<b>Apple</b> Inc. - Wikipedia, the free encyclopedia]]> + http://en.wikipedia.org/wiki/Apple_Inc. + + + Apple's software products include the Mac OS X operating system, iTunes media ... Apple was established on April 1, 1976 by Steve Jobs, Steve Wozniak, and Ronald ...]]> + + 2008/08/18 + en.wikipedia.org/wiki/Apple_Computer]]> + 249715 + <![CDATA[<b>Apple</b> Inc. - Wikipedia, the free encyclopedia]]> + http://en.wikipedia.org/wiki/Apple_Computer + + + Your complete guide to all things Macintosh. Get the latest reviews, news, videos, downloads, tips, and more for Mac laptops, desktops, and OS X 10.5 (Leopard) + + 2008/08/18 + cnet.com/apple-mac.html]]> + 100558 + <![CDATA[<b>Apple</b> Mac: Mac OS, Mac laptop, Mac desktop - CNET.com]]> + http://www.cnet.com/apple-mac.html + + + Apple CEO Steve Jobs unveil iPhone 3G, the App Store, MobileMe, and more ... Copyright © 2008 Apple Inc. All rights reserved. Terms of Use | Privacy Policy ...]]> + + 2008/07/16 + events.apple.com.edgesuite.net/0806wdt546x/event/index.html]]> + 17259 + <![CDATA[<b>Apple</b> - QuickTime - WWDC 2008 Keynote]]> + http://events.apple.com.edgesuite.net/0806wdt546x/event/index.html + + + Apple's GrayShare technology gives you the ability to print over 130 shades of ... are part of the CSW 4000 Series Update 1.0 posted on Apple Software Updates. ...]]> + + 2004/09/20 + docs.info.apple.com/article.html?artnum=30153]]> + 37078 + StyleWriter Printers: Print Drivers and Cable Matrix + http://docs.info.apple.com/article.html?artnum=30153 + + + Apple releases firmware 2.0 for iPhone, iPod Touch ... Apple underestimated the load on their servers, which left many users stuck on ...]]> + + 2008/07/14 + apple.qj.net]]> + 82416 + <![CDATA[QJ.NET - QuickJump Home - <b>Apple</b> News - QJ.NET]]> + http://apple.qj.net/ + + + Apple users.]]> + + 2008/08/18 + apple.slashdot.org]]> + 44408 + <![CDATA[<b>apple</b>.slashdot.org]]> + http://apple.slashdot.org/ + + + Apple Authorized Training Centers offer Mac OS X and Pro Apps exams ... Publicize your certifications on Apple's website, and connect with clients and employers ...]]> + + 2008/07/25 + prometric.com/apple/default.htm]]> + 13318 + <![CDATA[Prometric: <b>Apple</b> Certification]]> + http://www.prometric.com/apple/default.htm + + + diff --git a/res/.svn/text-base/arithmetic.grammar.svn-base b/res/.svn/text-base/arithmetic.grammar.svn-base new file mode 100644 index 0000000..9b2e038 --- /dev/null +++ b/res/.svn/text-base/arithmetic.grammar.svn-base @@ -0,0 +1,10 @@ +@start = expr; +expr = term (plusTerm | minusTerm)*; +term = factor (timesFactor | divFactor)*; +plusTerm = '+' term; +minusTerm = '-' term; +factor = phrase exponentFactor | phrase; +timesFactor = '*' factor; +divFactor = '/' factor; +exponentFactor = '^' factor; +phrase = '(' expr ')' | Number; diff --git a/res/.svn/text-base/c.grammar.svn-base b/res/.svn/text-base/c.grammar.svn-base new file mode 100644 index 0000000..03fa75f --- /dev/null +++ b/res/.svn/text-base/c.grammar.svn-base @@ -0,0 +1,314 @@ + translation-unit: + external-declaration + translation-unit external-declaration + + external-declaration: + function-definition + declaration + + function-definition: + declaration-specifiersopt declarator declaration-listopt compound-statement + + declaration: + declaration-specifiers init-declarator-listopt; + + declaration-list: + declaration + declaration-list declaration + + declaration-specifiers: + storage-class-specifier declaration-specifiersopt + type-specifier declaration-specifiersopt + type-qualifier declaration-specifiersopt + + storage-class specifier: one of + auto register static extern typedef + + type specifier: one of + void char short int long float double signed + unsigned struct-or-union-specifier enum-specifier typedef-name + + type-qualifier: one of + const volatile + + struct-or-union-specifier: + struct-or-union identifieropt { struct-declaration-list } + struct-or-union identifier + + struct-or-union: one of + struct union + + struct-declaration-list: + struct declaration + struct-declaration-list struct declaration + + init-declarator-list: + init-declarator + init-declarator-list, init-declarator + + init-declarator: + declarator + declarator = initializer + + struct-declaration: + specifier-qualifier-list struct-declarator-list; + + specifier-qualifier-list: + type-specifier specifier-qualifier-listopt + type-qualifier specifier-qualifier-listopt + + struct-declarator-list: + struct-declarator + struct-declarator-list , struct-declarator + + struct-declarator: + declarator + declaratoropt : constant-expression + + enum-specifier: + enum identifieropt { enumerator-list } + enum identifier + + enumerator-list: + enumerator + enumerator-list , enumerator + + enumerator: + identifier + identifier = constant-expression + + declarator: + pointeropt direct-declarator + + direct-declarator: + identifier + (declarator) + direct-declarator [ constant-expressionopt ] + direct-declarator ( parameter-type-list ) + direct-declarator ( identifier-listopt ) + + pointer: + * type-qualifier-listopt + * type-qualifier-listopt pointer + + type-qualifier-list: + type-qualifier + type-qualifier-list type-qualifier + + parameter-type-list: + parameter-list + parameter-list , ... + + parameter-list: + parameter-declaration + parameter-list , parameter-declaration + + parameter-declaration: + declaration-specifiers declarator + declaration-specifiers abstract-declaratoropt + + identifier-list: + identifier + identifier-list , identifier + + initializer: + assignment-expression + { initializer-list } + { initializer-list , } + + initializer-list: + initializer + initializer-list , initializer + + type-name: + specifier-qualifier-list abstract-declaratoropt + + abstract-declarator: + pointer + pointeropt direct-abstract-declarator + + direct-abstract-declarator: + ( abstract-declarator ) + direct-abstract-declaratoropt [constant-expressionopt] + direct-abstract-declaratoropt (parameter-type-listopt) + + typedef-name: + identifier + + statement: + labeled-statement + expression-statement + compound-statement + selection-statement + iteration-statement + jump-statement + + labeled-statement: + identifier : statement + case constant-expression : statement + default : statement + + expression-statement: + expressionopt; + + compound-statement: + { declaration-listopt statement-listopt } + + statement-list: + statement + statement-list statement + + selection-statement: + if (expression) statement + if (expression) statement else statement + switch (expression) statement + + iteration-statement: + while (expression) statement + do statement while (expression); + for (expressionopt; expressionopt; expressionopt) statement + + jump-statement: + goto identifier; + continue; + break; + return expressionopt; + + expression: + assignment-expression + expression , assignment-expression + + assignment-expression: + conditional-expression + unary-expression assignment-operator assignment-expression + + assignment-operator: one of + = *= /= %= += -= <<= >>= &= ^= |= + + conditional-expression: + logical-OR-expression + logical-OR-expression ? expression : conditional-expression + + constant-expression: + conditional-expression + + logical-OR-expression: + logical-AND-expression + logical-OR-expression || logical-AND-expression + + logical-AND-expression: + inclusive-OR-expression + logical-AND-expression && inclusive-OR-expression + + inclusive-OR-expression: + exclusive-OR-expression + inclusive-OR-expression | exclusive-OR-expression + + exclusive-OR-expression: + AND-expression + exclusive-OR-expression ^ AND-expression + + AND-expression: + equality-expression + AND-expression & equality-expression + + equality-expression: + relational-expression + equality-expression == relational-expression + equality-expression != relational-expression + + relational-expression: + shift-expression + relational-expression < shift-expression + relational-expression > shift-expression + relational-expression <= shift-expression + relational-expression >= shift-expression + + shift-expression: + additive-expression + shift-expression << additive-expression + shift-expression >> additive-expression + + additive-expression: + multiplicative-expression + additive-expression + multiplicative-expression + additive-expression - multiplicative-expression + + multiplicative-expression: + multiplicative-expression * cast-expression + multiplicative-expression / cast-expression + multiplicative-expression % cast-expression + + cast-expression: + unary expression + (type-name) cast-expression + + unary-expression: + postfix expression + ++unary expression + --unary expression + unary-operator cast-expression + sizeof unary-expression + sizeof (type-name) + + unary operator: one of + & * + - ~ ! + + postfix-expression: + primary-expression + postfix-expression[expression] + postfix-expression(argument-expression-listopt) + postfix-expression.identifier + postfix-expression->+identifier + postfix-expression++ + postfix-expression-- + primary-expression: + identifier + constant + string + (expression) + + argument-expression-list: + assignment-expression + assignment-expression-list , assignment-expression + + constant: + integer-constant + character-constant + floating-constant + enumeration-constant + +# The following grammar for the preprocessor summarizes the structure of control lines, but is not suitable for mechanized parsing. It includes the symbol text, which means ordinary program text, non-conditional preprocessor control lines, or complete preprocessor conditional instructions. + + control-line: + # define identifier token-sequence + # define identifier(identifier, ... , identifier) token-sequence + # undef identifier + # include + # include "filename" + # line constant "filename" + # line constant + # error token-sequenceopt + # pragma token-sequenceopt + # + preprocessor-conditional + + preprocessor-conditional: + if-line text elif-parts else-partopt #endif + + if-line: + # if constant-expression + # ifdef identifier + # ifndef identifier + + elif-parts: + elif-line text + elif-partsopt + + elif-line: + # elif constant-expression + + else-part: + else-line text + else-line: + #else \ No newline at end of file diff --git a/res/.svn/text-base/css.css.svn-base b/res/.svn/text-base/css.css.svn-base new file mode 100644 index 0000000..0c139b9 --- /dev/null +++ b/res/.svn/text-base/css.css.svn-base @@ -0,0 +1,71 @@ +openCurly, +closeCurly, +openBracket, +closeBracket, +eq, +comma, +colon, +semi, +openParen, +closeParen, +gt, +tilde, +pipe, +fwdSlash, +hash, +dot { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +selectorWord { + color:rgb(255, 255, 255); + background-color:rgb(20, 20, 26); + font-family:'Georgia'; + font-size:15px; +} + +selectorQuotedString { + color:rgb(196.35, 45.9, 51.0); + background-color:rgb(20, 20, 26); + font-family:'Georgia'; + font-size:15px; +} + +constant, string, semi { + color:rgb(196.35, 45.9, 51.0); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +property { + color:rgb(84.15, 114.75, 122.4); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +num { + color:rgb(22.95, 158.1, 188.7); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +//text { +// color:rgb(61.2, 178.5, 68.85); +// background-color:rgb(30, 30, 36); +// font-family:'Monaco'; +// font-size:11px; +//} + +word { + color:rgb(255, 255, 255); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + diff --git a/res/.svn/text-base/css.grammar.svn-base b/res/.svn/text-base/css.grammar.svn-base new file mode 100644 index 0000000..e414a53 --- /dev/null +++ b/res/.svn/text-base/css.grammar.svn-base @@ -0,0 +1,44 @@ +/** + A Grammar for CSS + + This grammar is intentionally lenient/forgiving. + The purpose is to highlight, not validate (possibly invalid) CSS. + +*/ + +@multiLineComments = '/*' '*/'; +@wordState = '-'; + +@start = ruleset*; +ruleset = selectors openCurly decls closeCurly; +selectors = selector commaSelector*; +selector = (selectorWord | hash | dot |colon | gt | openBracket | closeBracket | eq | selectorQuotedString | tilde | pipe)+; +selectorWord = Word; +selectorQuotedString = QuotedString; +commaSelector = comma selector; +decls = Empty | actualDecls; +actualDecls = decl decl*; +decl = property colon expr semi; +property = Word; +expr = (string | constant | num | openParen | closeParen | comma | fwdSlash)+; +string = QuotedString; +constant = Word; + +openCurly = '{'; +closeCurly = '}'; +openBracket = '['; +closeBracket = ']'; +eq = '='; +comma = ','; +colon = ':'; +semi = ';'; +openParen = '('; +closeParen = ')'; +gt = '>'; +tilde = '~'; +pipe = '|'; +fwdSlash = '/'; +hash = '#'; +dot = '.'; + +num = Number; \ No newline at end of file diff --git a/res/.svn/text-base/css2_1.grammar.svn-base b/res/.svn/text-base/css2_1.grammar.svn-base new file mode 100644 index 0000000..7e412ca --- /dev/null +++ b/res/.svn/text-base/css2_1.grammar.svn-base @@ -0,0 +1,203 @@ +/* + This is an attempt to convert the official CSS 2.1 grammar to TDParseKit +*/ + + +@start = stylesheet; + +// stylesheet +// : [ CHARSET_SYM S* STRING S* ';' ]? +// [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* +// [ [ ruleset | media | page | font_face ] [S|CDO|CDC]* ]* +// ; +charsetSymbol = '@' 'charset'; +charset = (charsetSymbol Word ';'); +stylesheet = charset? import* contents; +contents = (ruleset | media | page | fontFace)*; +stuff = (cdo|cdc)*; + + +// import +// : IMPORT_SYM S* +// [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S* +// ; +mediaList = medium commaMedium*; +commaMedium = ',' medium; +importSymbol = '@' 'import'; +import = importSymbol (Word | uri) mediaList? ';'; + + +// media +// : MEDIA_SYM S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S* +// ; + +mediaSymbol = '@' 'media'; +media = mediaSymbol mediaList '{' ruleset* '}'; + + + +// medium +// : IDENT S* +// ; +medium = identifier; + + + +// page +// : PAGE_SYM S* IDENT? pseudo_page? S* +// '{' S* declaration [ ';' S* declaration ]* '}' S* +// ; +pageSymbol = '@' 'page'; +page = pagePrefix pageBody; +pagePrefix = pageSymbol identifier? pseudoPage?; +pageBody = '{' decl decl* '}'; + + +// pseudo_page +// : ':' IDENT +// ; +pseudoPage = ':' identifier; + + +// font_face +// : FONT_FACE_SYM S* +// '{' S* declaration [ ';' S* declaration ]* '}' S* +// ; +fontFaceSymbol = '@' fontFace; +fontFace = fontFaceSymbol '{' decl decl* '}'; + + +// operator +// : '/' S* | ',' S* | /* empty * / +// ; +operator = '/' | ',' | Empty; + + + +// combinator +// : '+' S* | '>' S* | /* empty * / +// ; +combinator = '+' | '>' | Empty; + + + +// unary_operator +// : '-' | '+' +// ; +unaryOperator = '-' | '+'; + + +// property +// : IDENT S* +// ; +property = identifier; + + +// ruleset +// : selector [ ',' S* selector ]* +// '{' S* declaration [ ';' S* declaration ]* '}' S* +// ; +ruleset = selector commaSelector* '{' decl decl* '}'; +commaSelector = ',' selector; + + +// selector +// : simple_selector [ combinator simple_selector ]* +// ; +selector = simpleSelector (combinator simpleSelector)*; + + +// simple_selector +// : element_name? [ HASH | class | attrib | pseudo ]* S* +// ; +simpleSelector = elementName? (hash | class | attrib | pseudo)*; + + +// class +// : '.' IDENT +// ; +class = '.' identifier; + + +// element_name +// : IDENT | '*' +// ; +elementName = identifier | '*'; + + +// attrib +// : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S* +// [ IDENT | STRING ] S* ]? ']' +// ; +attrib = '[' identifier (('=' | includes | dashmatch) (identifier | Word))? ']'; + + +// pseudo +// : ':' [ IDENT | FUNCTION S* IDENT S* ')' ] +// ; +pseudo = ':' identifier | function identifier ')'; + + +// declaration +// : property ':' S* expr prio? +// | /* empty * / +// ; +decl = (property ':' expr prio?) | Empty; + + +// prio +// : IMPORTANT_SYM S* +// ; +prio = '!' 'important'; + + +// expr +// : term [ operator term ]* +// ; +expr = term (operator term)*; + + +// term +// : unary_operator? +// [ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* | +// TIME S* | FREQ S* | function ] +// | STRING S* | IDENT S* | URI S* | RGB S* | UNICODERANGE S* | hexcolor +// ; +term = unaryOperator? (Number | percentage | length | ems | exs | angle | time | freq | function) + | Word | identifier | uri | hexcolor; + + +// function +// : FUNCTION S* expr ')' S* +// ; +function = XXX expr ')'; + + +// * +// * There is a constraint on the color that it must +// * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) +// * after the "#"; e.g., "#000" is OK, but "#abcd" is not. +// * +// hexcolor +// : HASH S* +// ; +hexcolor = hash; + +cdo = ''; +includes = '~='; +dashmatch = '|='; + +identifier = Word; + +hash = '#' (Word|Number); +ems = Number 'em'; +exs = Number 'ex'; +length = Number ('px'|'cm'|'mm'|'in'|'pt'|'pc'); +angle = Number ('deg'|'rad'|'grad'); +time = Number ('s'|'ms'); +freq = Number ('hz'|'khz'); +dimension = Number identifier; +percentage = Number '%'; +uri = 'url' '(' (Word|Symbol|Number)+ ')'; +function = identifier '('; diff --git a/res/.svn/text-base/date.grammar.svn-base b/res/.svn/text-base/date.grammar.svn-base new file mode 100644 index 0000000..b1084a9 --- /dev/null +++ b/res/.svn/text-base/date.grammar.svn-base @@ -0,0 +1,40 @@ +/* + + TDParseKit Grammar Syntax now supports regular expressions (powered by RegExKit Lite) + + So, as a trivial (and useless) example, the following TDPK grammar + specifies a tiny language which allows dates in the format of: + + 2009-06-21 + +*/ + +@start = date; // the 'date' production is the outermost production in this grammar + +date = /\d{4}/ '-' /\d{2}/ '-' /\d{2}/; // will match any sequence of tokens whose `stringValue` property matches these regexes + // separated by two '-' chars + + + + + + + + +/* +NOTE: +An equivalent grammar could be expressed in many ways. Here's an equivalent grammar with explicit ObjC assembler callbacks added: + + +@start = year dash month dash day; + +dash = '-'; + +year (matchedYear:) = /\d{4}/; // when matched, your specified `assembler` object (think delegate) will receive a + // callback to it's `-matchedYear:` method with a `PKAssembly` argument. + // the token matched by the regex will on the top of the assebly's stack ready for you + +month (matchedMonth:) = /\d{2}/; +day (matchedDay:) = /\d{2}/; + +*/ \ No newline at end of file diff --git a/res/.svn/text-base/erb.grammar.svn-base b/res/.svn/text-base/erb.grammar.svn-base new file mode 100644 index 0000000..a8ff87a --- /dev/null +++ b/res/.svn/text-base/erb.grammar.svn-base @@ -0,0 +1,15 @@ +@symbols = '<@' '<@=' '@>'; + +@start = (ignored | importantStuff)*; +ignored = ~startMarker; + +importantStuff = print | eval; +print = printStartMarker keyPath endMarker; +eval = evalStartMarker keyPath endMarker; + +keyPath = Word dotWord*; +dotWord = ('.' Word); + +printStartMarker = '<@='; +evalStartMarker = '<@'; +endMarker = '@>'; \ No newline at end of file diff --git a/res/.svn/text-base/example.css.svn-base b/res/.svn/text-base/example.css.svn-base new file mode 100644 index 0000000..790775a --- /dev/null +++ b/res/.svn/text-base/example.css.svn-base @@ -0,0 +1,54 @@ +.openCurly > closeCurly, +#comma[foo], +colon[foo=bar] bat, +openParen[foo="bar"], +closeParen, +name:psuedo-name, +foo[bar|=baz] +px, +px, +rgb { + -webkit-border-radius:12px; + color: rgb(178.5, 35.7, 135.15); + background-color: rgb(30, 30, 36); + font-family: 'Monaco'; + font-size: 11 em; + font-weight: bold; +} + +body { + font:14px/1.4 "Lucida Grande", LucidaGrande, Verdana, Helvetica, Arial; +} + +#content { + position:relative; + width:650px; + margin:20px auto; +} + +#icon { + float:left; + margin-right:15px; +} + +h1 { + padding-top:15px; + font-size:48px; +} + +#desc { + position:absolute; + left:170px; top:75px; +} + +#screenshot { + display:block; + width:500px; + margin:80px auto 35px; + border:1px solid silver; +} + +#copyright, #credits, #hostedby { + font-size:small; + text-align:center; +} diff --git a/res/.svn/text-base/example.html.svn-base b/res/.svn/text-base/example.html.svn-base new file mode 100644 index 0000000..beb23a0 --- /dev/null +++ b/res/.svn/text-base/example.html.svn-base @@ -0,0 +1,28 @@ + + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + + CFBundleName + ${PRODUCT_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.parsekit.ParseKit + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.4 + NSPrincipalClass + + + \ No newline at end of file diff --git a/res/.svn/text-base/example1.srgs.svn-base b/res/.svn/text-base/example1.srgs.svn-base new file mode 100644 index 0000000..2549db4 --- /dev/null +++ b/res/.svn/text-base/example1.srgs.svn-base @@ -0,0 +1,24 @@ +#ABNF 1.0 ISO-8859-1; + +// Default grammar language is US English +language en-US; + +// Single language attachment to tokens +// Note that "fr-CA" (Canadian French) is applied to only +// the word "oui" because of precedence rules +$yes = yes | oui!fr-CA; + +// Single language attachment to an expansion +$people1 = (Michel Tremblay | André Roy)!fr-CA; + +// Handling language-specific pronunciations of the same word +// A capable speech recognizer will listen for Mexican Spanish and +// US English pronunciations. +$people2 = Jose!en-US | Jose!es-MX; + +/** + * Multi-lingual input possible + * @example may I speak to André Roy + * @example may I speak to Jose + */ +public $request = may I speak to ($people1 | $people2); \ No newline at end of file diff --git a/res/.svn/text-base/html.css.svn-base b/res/.svn/text-base/html.css.svn-base new file mode 100644 index 0000000..43d3ba0 --- /dev/null +++ b/res/.svn/text-base/html.css.svn-base @@ -0,0 +1,63 @@ +lt, gt, fwdSlash, endTagStart, eq { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +eq { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +tagName { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +attrValue { + color:rgb(84.15, 114.75, 122.4); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +attrName { + color:rgb(84.15, 114.75, 122.4); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +text { +// color:rgb(61.2, 178.5, 68.85); + color:rgb(255, 255, 255); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +comment { + color:rgb(61.2, 178.5, 68.85); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +pi { + color:rgb(22.95, 158.1, 188.7); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +doctype { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} \ No newline at end of file diff --git a/res/.svn/text-base/html.grammar.svn-base b/res/.svn/text-base/html.grammar.svn-base new file mode 100644 index 0000000..4754f8d --- /dev/null +++ b/res/.svn/text-base/html.grammar.svn-base @@ -0,0 +1,41 @@ +/* + An HTML grammar for use with TDParseKit + + this grammar is intentionally very forgiving (non-strict) + the point here is to highlight, not validate, HTML. +*/ + +@multiLineComments = ''; +@commentState = '<'; +@commentState.fallbackState = delimitState; + +@delimitedString = '' nil; +@delimitedString = '' nil; +@delimitState.fallbackState = symbolState; + +@start = any*; +any = element | text | doctype | pi | comment; + +pi = DelimitedString(''); + +doctype = DelimitedString(''); +element = emptyTag | startTag elementContent* endTag; +elementContent = element | text | comment | pi; +text = /[^<]+/; + +emptyTag = lt tagName attr* fwdSlash gt; +startTag = lt junk? tagName attr* gt; +endTag = lt fwdSlash tagName gt; + +tagName = Word; + +attr = attrName (eq attrValue)?; +attrName = Word; +attrValue = QuotedString; + +eq = '='; +lt = '<'; +gt = '>'; +fwdSlash = '/'; + +comment = Comment; diff --git a/res/.svn/text-base/javascript.grammar.svn-base b/res/.svn/text-base/javascript.grammar.svn-base new file mode 100644 index 0000000..af9032f --- /dev/null +++ b/res/.svn/text-base/javascript.grammar.svn-base @@ -0,0 +1,430 @@ +@symbols = '||' '&&' '!=' '!==' '==' '===' '<=' '>=' '++' '--' '+=' '-=' '*=' '/=' '%=' '<<' '>>' '>>>' '<<=' '>>=' '>>>=' '&=' '^=' '|='; + +@reportsCommentTokens = YES; +@commentState = '/'; +@singleLineComments = '//'; +@multiLineComments = '/*' '*/'; + +@start = program; + +if = 'if'; +else = 'else'; +while = 'while'; +for = 'for'; +in = 'in'; +break = 'break'; +continue = 'continue'; +with = 'with'; +return = 'return'; +var = 'var'; +delete = 'delete'; +new = 'new'; +this = 'this'; +false = 'false'; +true = 'true'; +null = 'null'; +undefined = 'undefined'; +void = 'void'; +typeof = 'typeof'; +instanceof = 'instanceof'; +function = 'function'; + +openCurly = '{'; +closeCurly = '}'; +openParen = '('; +closeParen = ')'; +openBracket = '['; +closeBracket = ']'; +comma = ','; +dot = '.'; +semi = ';'; +colon = ':'; +equals = '='; +not = '!'; +lt = '<'; +gt = '>'; +amp = '&'; +pipe = '|'; +caret = '^'; +tilde = '~'; +question = '?'; +plus = '+'; +minus = '-'; +times = '*'; +div = '/'; +mod = '%'; + +or = '||'; +and = '&&'; +ne = '!='; +isnot = '!=='; +eq = '=='; +is = '==='; +le = '<='; +ge = '>='; +plusPlus = '++'; +minusMinus = '--'; +plusEq = '+='; +minusEq = '-='; +timesEq = '*='; +divEq = '/='; +modEq = '%='; +shiftLeft = '<<'; +shiftRight = '>>'; +shiftRightExt = '>>>'; +shiftLeftEq = '<<='; +shiftRightEq = '>>='; +shiftRightExtEq = '>>>='; +andEq = '&='; +xorEq = '^='; +orEq = '|='; + +assignmentOperator = equals | plusEq | minusEq | timesEq | divEq | modEq | shiftLeftEq | shiftRightEq | shiftRightExtEq | andEq | xorEq | orEq; + +relationalOperator = lt | gt | ge | le | instanceof; +equalityOperator = eq | ne | is | isnot; + +shiftOperator = shiftLeft | shiftRight | shiftRightExt; +incrementOperator = plusPlus | minusMinus; +unaryOperator = tilde | delete | typeof | void; + +multiplicativeOperator = times | div | mod; + + + +// Program: +// empty +// Element Program + +program = element+; + + + +// Element: +// function Identifier ( ParameterListOpt ) CompoundStatement +// Statement + +element = func | stmt; +func = function identifier openParen paramListOpt closeParen compoundStmt; + + + +// ParameterListOpt: +// empty +// ParameterList + +paramListOpt = Empty | paramList; + + + +// ParameterList: +// Identifier +// Identifier , ParameterList + +paramList = identifier commaIdentifier*; +commaIdentifier = comma identifier; + + + +// CompoundStatement: +// { Statements } + +compoundStmt = openCurly stmts closeCurly; + + + +// Statements: +// empty +// Statement Statements + +stmts = stmt*; + + + +// Statement: +// ; +// if Condition Statement +// if Condition Statement else Statement +// while Condition Statement +// ForParen ; ExpressionOpt ; ExpressionOpt ) Statement +// ForBegin ; ExpressionOpt ; ExpressionOpt ) Statement +// ForBegin in Expression ) Statement +// break ; +// continue ; +// with ( Expression ) Statement +// return ExpressionOpt ; +// CompoundStatement +// VariablesOrExpression ; + +stmt = semi | ifStmt | ifElseStmt | whileStmt | forParenStmt | forBeginStmt | forInStmt | breakStmt | continueStmt | withStmt | returnStmt | compoundStmt | variablesOrExprStmt; +ifStmt = if condition stmt; +ifElseStmt = if condition stmt else stmt; +whileStmt = while condition stmt; +forParenStmt = forParen semi exprOpt semi exprOpt closeParen stmt; +forBeginStmt = forBegin semi exprOpt semi exprOpt closeParen stmt; +forInStmt = forBegin in expr closeParen stmt; +breakStmt = break semi; +continueStmt = continue semi; +withStmt = with openParen expr closeParen stmt; +returnStmt = return exprOpt semi; +variablesOrExprStmt = variablesOrExpr semi; + + + +// Condition: +// ( Expression ) + +condition = openParen expr closeParen; + + + +// ForParen: +// for ( + +forParen = for openParen; + + + +// ForBegin: +// ForParen VariablesOrExpression + +forBegin = forParen variablesOrExpr; + + + +// VariablesOrExpression: +// var Variables +// Expression + +variablesOrExpr = varVariables | expr; +varVariables = var variables; + + + +// Variables: +// Variable +// Variable , Variables + +variables = variable commaVariable*; +commaVariable = comma variable; + + + +// Variable: +// Identifier +// Identifier = AssignmentExpression + +variable = identifier assignment?; +assignment = equals assignmentExpr; + + + +// ExpressionOpt: +// empty +// Expression + +exprOpt = Empty | expr; // TODO -- Empty | expr; + + + +// Expression: +// AssignmentExpression +// AssignmentExpression , Expression + +expr = assignmentExpr commaExpr?; +commaExpr = comma expr; + + + +// AssignmentExpression: +// ConditionalExpression +// ConditionalExpression AssignmentOperator AssignmentExpression + +assignmentExpr = conditionalExpr extraAssignment?; +extraAssignment = assignmentOperator assignmentExpr; + + + +// ConditionalExpression: +// OrExpression +// OrExpression ? AssignmentExpression : AssignmentExpression + +conditionalExpr = orExpr ternaryExpr?; +ternaryExpr = question assignmentExpr colon assignmentExpr; + + + +// OrExpression: +// AndExpression +// AndExpression || OrExpression + +orExpr = andExpr orAndExpr*; +orAndExpr = or andExpr; + + + +// AndExpression: +// BitwiseOrExpression +// BitwiseOrExpression && AndExpression + +andExpr = bitwiseOrExpr andAndExpr?; +andAndExpr = and andExpr; + + + +// BitwiseOrExpression: +// BitwiseXorExpression +// BitwiseXorExpression | BitwiseOrExpression + +bitwiseOrExpr = bitwiseXorExpr pipeBitwiseOrExpr?; +pipeBitwiseOrExpr = pipe bitwiseOrExpr; + + + +// BitwiseXorExpression: +// BitwiseAndExpression +// BitwiseAndExpression ^ BitwiseXorExpression + +bitwiseXorExpr = bitwiseAndExpr caretBitwiseXorExpr?; +caretBitwiseXorExpr = caret bitwiseXorExpr; + + + +// BitwiseAndExpression: +// EqualityExpression +// EqualityExpression & BitwiseAndExpression + +bitwiseAndExpr = equalityExpr ampBitwiseAndExpression?; +ampBitwiseAndExpression = amp bitwiseAndExpr; + + + +// EqualityExpression: +// RelationalExpression +// RelationalExpression EqualityualityOperator EqualityExpression + +equalityExpr = relationalExpr equalityOpEqualityExpr?; +equalityOpEqualityExpr = equalityOperator equalityExpr; + + + +// RelationalExpression: +// ShiftExpression +// RelationalExpression RelationalationalOperator ShiftExpression + +relationalExpr = shiftExpr | relationalExprRHS; +relationalExprRHS = relationalExpr relationalOperator shiftExpr; + + + +// ShiftExpression: +// AdditiveExpression +// AdditiveExpression ShiftOperator ShiftExpression + +shiftExpr = additiveExpr shiftOpShiftExpr?; +shiftOpShiftExpr = shiftOperator shiftExpr; + + + +// AdditiveExpression: +// MultiplicativeExpression +// MultiplicativeExpression + AdditiveExpression +// MultiplicativeExpression - AdditiveExpression + +additiveExpr = multiplicativeExpr plusOrMinusExpr?; +plusOrMinusExpr = plusExpr | minusExpr; +plusExpr = plus additiveExpr; +minusExpr = minus additiveExpr; + + + +// MultiplicativeExpression: +// UnaryExpression +// UnaryExpression MultiplicativeOperator MultiplicativeExpression + +multiplicativeExpr = unaryExpr (multiplicativeOperator multiplicativeExpr)?; + + + +// UnaryExpression: +// MemberExpression +// UnaryOperator UnaryExpression +// - UnaryExpression +// IncrementOperator MemberExpression +// MemberExpression IncrementOperator +// new Constructor +// delete MemberExpression + +unaryExpr = memberExpr | unaryExpr1 | unaryExpr2 | unaryExpr3 | unaryExpr4 | unaryExpr5 | unaryExpr6; +unaryExpr1 = unaryOperator unaryExpr; +unaryExpr2 = minus unaryExpr; +unaryExpr3 = incrementOperator memberExpr; +unaryExpr4 = memberExpr incrementOperator; +unaryExpr5 = new constructor; +unaryExpr6 = delete memberExpr; + + + +// Constructor: +// this . ConstructorCall +// ConstructorCall + +constructor = constructorCall; // TODO ??? + + + +// ConstructorCall: +// Identifier +// Identifier ( ArgumentListOpt ) +// Identifier . ConstructorCall + +constructorCall = identifier parenArgListParen?; // TODO +parenArgListParen = openParen argListOpt closeParen; + + + +// MemberExpression: +// PrimaryExpression +// PrimaryExpression . MemberExpression +// PrimaryExpression [ Expression ] +// PrimaryExpression ( ArgumentListOpt ) + +memberExpr = primaryExpr dotBracketOrParenExpr?; +dotBracketOrParenExpr = dotMemberExpr | bracketMemberExpr | parenMemberExpr; +dotMemberExpr = dot memberExpr; +bracketMemberExpr = openBracket expr closeBracket; +parenMemberExpr = openParen argListOpt closeParen; + + + +// ArgumentListOpt: +// empty +// ArgumentList + +argListOpt = argList?; + + + +// ArgumentList: +// AssignmentExpression +// AssignmentExpression , ArgumentList + +argList = assignmentExpr commaAssignmentExpr*; +commaAssignmentExpr = comma assignmentExpr; + + + +// PrimaryExpression: +// ( Expression ) +// Identifier +// IntegerLiteral +// FloatingPointLiteral +// StringLiteral +// false +// true +// null +// this + +primaryExpr = parenExprParen | identifier | Number | QuotedString | false | true | null | undefined | this; +parenExprParen = openParen expr closeParen; +identifier = Word; diff --git a/res/.svn/text-base/javascript_ll.txt.svn-base b/res/.svn/text-base/javascript_ll.txt.svn-base new file mode 100644 index 0000000..9ddb815 --- /dev/null +++ b/res/.svn/text-base/javascript_ll.txt.svn-base @@ -0,0 +1,133 @@ + +JavaScript LL(1) Grammar + +This appendix contains the NQLL(1) grammar (Not Quite LL(1)) for JavaScript. +NOTE: This appendix is missing the algorithm for recovering from missing semicolon errors. + + +Program: + empty + Element Program + Element: + function Identifier ( ParameterListOpt ) CompoundStatement + Statement + ParameterListOpt: + empty + ParameterList + ParameterList: + Identifier + Identifier , ParameterList + CompoundStatement: + { Statements } + Statements: + empty + Statement Statements + Statement: + ; + if Condition Statement + if Condition Statement else Statement + while Condition Statement + ForParen ; ExpressionOpt ; ExpressionOpt ) Statement + ForBegin ; ExpressionOpt ; ExpressionOpt ) Statement + ForBegin in Expression ) Statement + break ; + continue ; + with ( Expression ) Statement + return ExpressionOpt ; + CompoundStatement + VariablesOrExpression ; + Condition: + ( Expression ) + ForParen: + for ( + ForBegin: + ForParen VariablesOrExpression + VariablesOrExpression: + var Variables + Expression + Variables: + Variable + Variable , Variables + Variable: + Identifier + Identifier = AssignmentExpression + ExpressionOpt: + empty + Expression + Expression: + AssignmentExpression + AssignmentExpression , Expression + AssignmentExpression: + ConditionalExpression + ConditionalExpression AssignmentOperator AssignmentExpression + ConditionalExpression: + OrExpression + OrExpression ? AssignmentExpression : AssignmentExpression + OrExpression: + AndExpression + AndExpression || OrExpression + AndExpression: + BitwiseOrExpression + BitwiseOrExpression && AndExpression + BitwiseOrExpression: + BitwiseXorExpression + BitwiseXorExpression | BitwiseOrExpression + BitwiseXorExpression: + BitwiseAndExpression + BitwiseAndExpression ^ BitwiseXorExpression + BitwiseAndExpression: + EqualityExpression + EqualityExpression & BitwiseAndExpression + EqualityExpression: + RelationalExpression + RelationalExpression EqualityualityOperator EqualityExpression + RelationalExpression: + ShiftExpression + RelationalExpression RelationalationalOperator ShiftExpression + ShiftExpression: + AdditiveExpression + AdditiveExpression ShiftOperator ShiftExpression + AdditiveExpression: + MultiplicativeExpression + MultiplicativeExpression + AdditiveExpression + MultiplicativeExpression - AdditiveExpression + MultiplicativeExpression: + UnaryExpression + UnaryExpression MultiplicativeOperator MultiplicativeExpression + UnaryExpression: + MemberExpression + UnaryOperator UnaryExpression + - UnaryExpression + IncrementOperator MemberExpression + MemberExpression IncrementOperator + new Constructor + delete MemberExpression + Constructor: + this . ConstructorCall + ConstructorCall + ConstructorCall: + Identifier + Identifier ( ArgumentListOpt ) + Identifier . ConstructorCall + MemberExpression: + PrimaryExpression + PrimaryExpression . MemberExpression + PrimaryExpression [ Expression ] + PrimaryExpression ( ArgumentListOpt ) + ArgumentListOpt: + empty + ArgumentList + ArgumentList: + AssignmentExpression + AssignmentExpression , ArgumentList + PrimaryExpression: + ( Expression ) + Identifier + IntegerLiteral + FloatingPointLiteral + StringLiteral + false + true + null + this +[Previous] [First] \ No newline at end of file diff --git a/res/.svn/text-base/json-old.grammar.svn-base b/res/.svn/text-base/json-old.grammar.svn-base new file mode 100644 index 0000000..782543c --- /dev/null +++ b/res/.svn/text-base/json-old.grammar.svn-base @@ -0,0 +1,26 @@ +/** + A Grammar for JSON + + NOTE: This grammar has a fatal flaw. it does not allow for the heirarchical nature of + JSON. Objects and arrays may only be one level deep according to this grammar. + This is a limitation of my grammar parser: it does not allow circular references. + That wll be fixed soon + + */ +null = 'null'; +true = 'true'; +false = 'false'; +value = null | true | false | Num | QuotedString; // here's the flaw. should include: "array | object" + +commaValue = ',' value; +actualArray = value commaValue*; +arrayContent = Empty | actualArray; +array = '[' arrayContent ']'; + +property = QuotedString ':' value; // NOTE: property names are quoted in JSON +commaProperty = ',' property; +actualObject = property commaProperty*; +objectContent = Empty | actualObject; +object = '{' objectContent '}'; + +start = (array | object); \ No newline at end of file diff --git a/res/.svn/text-base/json.css.svn-base b/res/.svn/text-base/json.css.svn-base new file mode 100644 index 0000000..b5083e7 --- /dev/null +++ b/res/.svn/text-base/json.css.svn-base @@ -0,0 +1,43 @@ +/** + +A CSS Stylesheet that matches the JSON grammar + +note that each terminal production from json.grammar is listed in a CSS selector below. +text that matches any of these productions will display with the css properties listed here + +*/ + +openCurly, closeCurly, openBracket, closeBracket, comma, colon { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +null, true, false { + color:rgb(196.35, 45.9, 51.0); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +propertyName { + color:rgb(84.15, 114.75, 122.4); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +string { + color:rgb(61.2, 178.5, 68.85); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +number { + color:rgb(22.95, 158.1, 188.7); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} diff --git a/res/.svn/text-base/json.grammar.svn-base b/res/.svn/text-base/json.grammar.svn-base new file mode 100644 index 0000000..decd888 --- /dev/null +++ b/res/.svn/text-base/json.grammar.svn-base @@ -0,0 +1,60 @@ +/* + A Grammar for JSON. + +*/ + +@start = Empty | array | object; + +object = openCurly (Empty | objectContent) closeCurly; +objectContent = property commaProperty*; +property = propertyName colon value; +commaProperty = comma property; +propertyName = QuotedString; // NOTE: property names are quoted in JSON + +array = openBracket (Empty | arrayContent) closeBracket; +arrayContent = value commaValue*; +commaValue = comma value; + +value = null | boolean | array | object | number | string; + +string = QuotedString; +number = Number; +null = 'null'; +boolean = 'true' | 'false'; + +openCurly = '{'; +closeCurly = '}'; +openBracket = '['; +closeBracket = ']'; +comma = ','; +colon = ':'; + + +/* + + The built-in terminal production types are (note titlecase) : Empty, Number, QuotedString, Word, UppercaseWord, LowercaseWord + You define collections (alternations, repetitions or sequences) and literal terminals (in quotes). These should be lowercase. + The special '@start' production is the outermost production. + + you can discard tokens by following them with a bang ('!') like: + + closeCurly = '}'!; + + Feed this grammar to -[PKParserFactory parserFromGrammar:assembler:] along with a reference + to an assembler (a call back delegate), and it will return a PKParser object which can + parse strings conforming to this language/grammar. + + The when the returned parser is used, the provided assembler will receive method callbacks for each production matched, like: + + -didMatchObjectAssembly: + -didMatchObjectContentAssembly: + -didMatchPropertyAssembly: + -didMatchArrayAssembly: + -didMatchOpenCurlyAssembly: + etc. + + Each callback method must accept a single PKAssembly argument. This assembly argument + will contain information about the progress made on the the string currently being parsed. + Also the assembly's stack will contain the tokens parsed so far in the current statement. + +*/ \ No newline at end of file diff --git a/res/.svn/text-base/json_with_comments.css.svn-base b/res/.svn/text-base/json_with_comments.css.svn-base new file mode 100644 index 0000000..b0c9d02 --- /dev/null +++ b/res/.svn/text-base/json_with_comments.css.svn-base @@ -0,0 +1,50 @@ +/** + +A CSS Stylesheet that matches the JSON grammar + +note that each terminal production from json.grammar is listed in a CSS selector below. +text that matches any of these productions will display with the css properties listed here + +*/ + +openCurly, closeCurly, openBracket, closeBracket, comma, colon { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +null, true, false { + color:rgb(196.35, 45.9, 51.0); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +propertyName { + color:rgb(84.15, 114.75, 122.4); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +string { + color:rgb(61.2, 178.5, 68.85); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +number { + color:rgb(22.95, 158.1, 188.7); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +comment { + color:rgb(72.95, 208.1, 238.7); + background-color:rgb(0, 0, 0); + font-family:'Monaco'; + font-size:11px; +} diff --git a/res/.svn/text-base/json_with_comments.grammar.svn-base b/res/.svn/text-base/json_with_comments.grammar.svn-base new file mode 100644 index 0000000..a397488 --- /dev/null +++ b/res/.svn/text-base/json_with_comments.grammar.svn-base @@ -0,0 +1,67 @@ +/* + A Fake Grammar for JSON with comments (JSON does not have comments). + +*/ + +@singleLineComments = '#'; +@multiLineComments = '/*' '*/'; + +@start = (Empty | array | object) comment?; + +object = openCurly comment? objectContent closeCurly; +objectContent = Empty | actualObject; +actualObject = property commaProperty*; +property = propertyName colon comment? value; +commaProperty = comma comment? property; +propertyName = QuotedString; // NOTE: property names are quoted in JSON + +array = openBracket comment? arrayContent closeBracket; +arrayContent = Empty | actualArray; +actualArray = value commaValue*; +commaValue = comma comment? value; + +value = (null | true | false | number | string | array | object) comment?; + +comment = Comment; +string = QuotedString; +number = Number; +null = 'null'; +true = 'true'; +false = 'false'; + +openCurly = '{'; +closeCurly = '}'; +openBracket = '['; +closeBracket = ']'; +comma = ','; +colon = ':'; + + +/* + + The built-in terminal production types are (note titlecase) : Empty, Number, QuotedString, Word, UppercaseWord, LowercaseWord + You define collections (alternations, repetitions or sequences) and literal terminals (in quotes). These should be lowercase. + The special '@start' production is the outermost production. + + you can discard tokens by following them with a bang ('!') like: + + closeCurly = '}'!; + + Feed this grammar to -[PKParserFactory parserFromGrammar:assembler:] along with a reference + to an assembler (a call back delegate), and it will return a PKParser object which can + parse strings conforming to this language/grammar. + + The when the returned parser is used, the provided assembler will receive method callbacks for each production matched, like: + + -didMatchObjectAssembly: + -didMatchObjectContentAssembly: + -didMatchPropertyAssembly: + -didMatchArrayAssembly: + -didMatchOpenCurlyAssembly: + etc. + + Each callback method must accept a single PKAssembly argument. This assembly argument + will contain information about the progress made on the the string currently being parsed. + Also the assembly's stack will contain the tokens parsed so far in the current statement. + +*/ \ No newline at end of file diff --git a/res/.svn/text-base/json_with_discards.grammar.svn-base b/res/.svn/text-base/json_with_discards.grammar.svn-base new file mode 100644 index 0000000..f2afb83 --- /dev/null +++ b/res/.svn/text-base/json_with_discards.grammar.svn-base @@ -0,0 +1,39 @@ +/* + A Grammar for JSON which specifies which tokens should be discarded + + Feed this to -[PKParserFactory parserFromGrammar:assembler:] along with a reference + to an assembler (a call back delegate), and it will return a PKParser object which can + parse strings conforming to this language/grammar. + + The when the returned parser is used, the provided assembler will receive method callbacks like: + + -didMatchStart: + -didMatchObject: + -didMatchProperty: + -didMatchArray: + etc. + + whenever a grammar production of the corresponding name has been matched. + + Each callback method must accept a single PKAssembly argument. The provided assembly + will contain information about the progress made on the the string currently being parsed. + Also the assembly's stack will contain the tokens parsed so far in the current statement. +*/ + +@start = Empty | array | object; + +object = '{' objectContent '}'!; +objectContent = Empty | actualObject; +actualObject = property commaProperty*; +commaProperty = ','! property; +property = QuotedString ':'! value; // NOTE: property names are quoted in JSON + +array = '[' arrayContent ']'!; +arrayContent = Empty | actualArray; +actualArray = value commaValue*; +commaValue = ','! value; + +value = null | true | false | array | object | Number | QuotedString; +null = 'null'!; +true = 'true'!; +false = 'false'!; diff --git a/res/.svn/text-base/mini_css.grammar.svn-base b/res/.svn/text-base/mini_css.grammar.svn-base new file mode 100644 index 0000000..12f6ecf --- /dev/null +++ b/res/.svn/text-base/mini_css.grammar.svn-base @@ -0,0 +1,18 @@ +/* + A Grammar for a small subset of CSS useful for syntax highlighting in an NSTextView + NSAttributedString +*/ + +@start = ruleset*; +ruleset = selectors '{' decls '}'!; +selectors = selector commaSelector*; +selector = LowercaseWord; // forcing selectors to be lowercase words for use in a future syntax-highlight framework where i want that +commaSelector = ','! selector; +decls = Empty | actualDecls; +actualDecls = decl decl*; +decl = property ':'! expr ';'!?; +property = 'color' | 'background-color' | 'font-family' | 'font-size'; +expr = pixelValue | rgb | string | constants; +pixelValue = Number 'px'!; +rgb = 'rgb'! '(' Number ','! Number ','! Number ')'!; +string = QuotedString; +constants = 'bold' | 'normal' | 'italic'; \ No newline at end of file diff --git a/res/.svn/text-base/nasty.html.svn-base b/res/.svn/text-base/nasty.html.svn-base new file mode 100644 index 0000000..fa9aceb --- /dev/null +++ b/res/.svn/text-base/nasty.html.svn-base @@ -0,0 +1,68 @@ + + + +http://www.apple.com/ + + + +< + + url + xmls:foo="bar" baz + + = + + "foobar">yes maam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/.svn/text-base/nonascii.html.svn-base b/res/.svn/text-base/nonascii.html.svn-base new file mode 100644 index 0000000..f39658d --- /dev/null +++ b/res/.svn/text-base/nonascii.html.svn-base @@ -0,0 +1 @@ +ア \ No newline at end of file diff --git a/res/.svn/text-base/nspredicate.grammar.svn-base b/res/.svn/text-base/nspredicate.grammar.svn-base new file mode 100644 index 0000000..8022439 --- /dev/null +++ b/res/.svn/text-base/nspredicate.grammar.svn-base @@ -0,0 +1,121 @@ +/* +A Grammar for Apple's NSPredicate String Format Syntax + +See: http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html + +*/ + +@wordState = '#'; +@wordChars = '.' '[' ']'; + +@symbols = '==' '>=' '=>' '<=' '=<' '!=' '<>' '&&' '||'; + +@start = expr; + +// Expressions + expr = orTerm orOrTerm*; + orOrTerm = or orTerm; + orTerm = andTerm andAndTerm*; + andAndTerm = and andTerm; + andTerm = primaryExpr | compoundExpr; + compoundExpr = '('! expr ')'!; + primaryExpr = predicate | negatedPredicate; + negatedPredicate = not predicate; + + predicate = boolPredicate | comparisonPredicate | stringTestPredicate | collectionTestPredicate; + + +// values + value = keyPath | string | num | bool | array; + + string = QuotedString; + num = Number; + bool = true | false; + true = 'true'!; + false = 'false'!; + +// arrays + array = '{' arrayContentsOpt '}'!; + arrayContentsOpt = Empty | arrayContents; + arrayContents = value commaValue*; + commaValue = ','! value; + + +// keyPaths + keyPath = Word; + +// keyPath = key dotKey*; +// key = name memberAccess?; +// name = Word; +// dotKey = '.' key; +// memberAccess = '[' (num | 'FIRST' | 'LAST' | 'SIZE') ']'; + + +// Comparison Tests + comparisonPredicate = numComparisonPredicate | collectionComparisonPredicate; + + numComparisonPredicate = numComparisonValue comparisonOp numComparisonValue; + numComparisonValue = keyPath | num; + + comparisonOp = eq | gt | lt | gtEq | ltEq | notEq | between; + + eq = '=' | '=='; + gt = '>'; + lt = '<'; + gtEq = '>=' | '=>'; + ltEq = '<=' | '=<'; + notEq = '!=' | '<>'; + between = 'BETWEEN'; + +// breaking these out to make the assembler callbacks simpler + collectionComparisonPredicate = collectionLtPredicate | collectionGtPredicate | collectionLtEqPredicate | collectionGtEqPredicate | collectionEqPredicate | collectionNotEqPredicate; + + collectionLtPredicate = aggregateOp collection lt value; + collectionGtPredicate = aggregateOp collection gt value; + collectionLtEqPredicate = aggregateOp collection ltEq value; + collectionGtEqPredicate = aggregateOp collection gtEq value; + collectionEqPredicate = aggregateOp collection eq value; + collectionNotEqPredicate = aggregateOp collection notEq value; + + + +// Boolean Value Predicates + boolPredicate = truePredicate | falsePredicate; + + truePredicate = 'TRUEPREDICATE'!; + falsePredicate = 'FALSEPREDICATE'!; + + + +// Compound Expressions + and = 'AND'! | '&&'!; + or = 'OR'! | '||'!; + not = 'NOT'! | '!'!; + + + +// String Tests + stringTestPredicate = string stringTestOp value; + + stringTestOp = beginswith | contains | endswith | like | matches; + + beginswith = 'BEGINSWITH'; + contains = 'CONTAINS'; + endswith = 'ENDSWITH'; + like = 'LIKE'; + matches = 'MATCHES'; + + +// Collection Tests + collectionTestPredicate = value in collection; + collection = keyPath | array; + in = 'IN'!; + + +// Aggregate Operators + aggregateOp = any | some | all | none; + any = 'ANY'; + some = 'SOME'; + all = 'ALL'; + none = 'NONE'; + diff --git a/res/.svn/text-base/nyt.html.svn-base b/res/.svn/text-base/nyt.html.svn-base new file mode 100644 index 0000000..3cd9c5d --- /dev/null +++ b/res/.svn/text-base/nyt.html.svn-base @@ -0,0 +1,1843 @@ + + + + + + + + + + + + + + + + +The New York Times - Breaking News, World News & Multimedia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ +
+
+ + +
+
+ + +
+ +
Wednesday, September 17, 2008 Last Update: 2:12 PM ET
+
+ +
+ +
+ +
+
+
+ + + +
+
+ +
+ + + + + + + + + + + + + + + + +
+ + + + + + +
+ +
+ + + + + +
+
+
+ + + + + +

+Stocks Drop Sharply Despite Bailout of Big Insurer +

+
+ +

+The Fed’s rescue of A.I.G. failed to placate investors, and a report showing a further decline in housing starts added to the gloom. +

+ + + + +
+ + + + +
+
Q & A
+
The A.I.G. Rescue
+

+David Leonhardt answers questions about the implications of the A.I.G. bailout and the economy. +

+ +
+ +
+
+ + +
+
+
+ + +
+
+ +
+ + + +
+ +
Yuriko Nakao/Reuters
+
+ +
+

A board in Tokyo displayed rising stock prices. Stock markets rallied across much of Asia in early trading in response to the rescue of A.I.G.

+ + +
+ + +
+
+ +
+ +
+ + + +
+
+In Asia, the Bloom Is Off the A.I.G. Rose +
+ +

If A.I.G.’s reputation suffers heavily, the company will face an uphill battle in Asia and its other global markets.

+ + + +
+ +
+ + + + + + + + + + +
+
+
+
+
+
+ +
+ + + +
+
American Exception
+
+Supreme Court’s Global Influence Is Waning +
+ +

A diminishing number of foreign courts seem to pay attention to the writings of American justices.

+ + + + +
+ + + + +
+
+16 Are Killed in Attack on U.S. Embassy in Yemen +
+ +

Militants opened fire on the embassy in Sana and detonated a car bomb at its gates, but no Americans were killed or injured, a Yemeni official said.

+ + + + +
+ +
+ +
+
+ + +

2008 Campaign

+ + +
+ + + +
+
+Abortion Issue Again Dividing Catholic Votes +
+ +

A struggle on how Catholics should apply their beliefs in politics is reaching swing cities like Scranton, Pa.

+ + + + +
+ + + + +
+
+New York Settles Lawsuit Over Homeless Families +
+ +

The costly litigation, over homeless families’ access to shelter in New York City, has dragged on since 1983.

+ + + +
+ +
+ + +
+
+
MORE NEWS
+ +
+
+ + + + + + +
+
+
+ +
 
+
+
+
+ +
+ + + + +
+ + +
+
+
+
+ +
+
GUEST Q & A
+
Wheels: Questions for Motocross Champion
+

James Stewart, winner of both the World Supercross and AMA Supercross championships, is taking questions from readers.

+ +
+
+ +
National Correspondent
+

+Amy Harmon, who covers the impact of science and technology on American life, is answering questions. +

+
+ +
+ +
+
+
+ + +
+ + + +
+
+
+ + +

Travel »

+
A Cultural Cornerstone

A Cultural CornerstoneCasco Viejo seems poised to become a hotbed of nightclubs, cafes, and hotels.

+ +
+
36 Hours in San Francisco

36 Hours in San Francisco Prosperity hasn’t sapped the Mission District of its eclecticism.

+
+
+ + +
+
+
+ + +
+ + + + + +
+
+ +
+ +

My Portfolios »

+ + + +
+ +
+ + +
+ +
+
+ + + + + +
+ + +
+ + +
+ + +
+
+ +
+ +
+
+ +
A Scottish House, Traditional Yet Modern
+

BerlinThe “Upside-Down House”, designed in 1959 by James Morris and Robert Steedman, holds a prominent place in Edinburgh’s recent architectural history.

+ +
+
+
+
+Find Properties +
+
+ + +Advanced Search » +
+ + +
+ + + + +
+ + +
+
+
+
General Motors at 100
+

Chevrolet VoltThe Chevrolet Volt, which G.M. unveiled on Tuesday, is intended to provide a jump-start for General Motors’ second century.

+ +
+
+ +

+Submit photos and view and comment on other readers’ cars. Also, view and submit events to the +Automotive Events Calendar. +

+ +
+
+ +
+ + +
+
+Search for new cars +
+
+ + + +
+
+
+
+Search for used cars +
+
+ + + + +
+
+
+More in Automobiles +
+ +
+ +
+
+ + +
+ + +
+

+NYtimes.com / Monster +

+
+
+
Fresh Starts
+
Navigators for the College Bound
+

Navigators for the College BoundPrivate educational consultants take up where overburdened high school guidance counselors leave off.

+
+
ADVERTISEMENT
+
+
+
+

+Find the best job in the +New York metro area +and beyond. +

+
+ + + + Advanced Search » +
+
+Tools +
+ +
+Employers +
+ +
+
+ +
+ + + + + +
+ +
+ + + + + + + + +
+ +
+ + +
+
+  +
+

Inside NYTimes.com

+
+ + + + + + + + + + + + + + + + + + + + + +

Media & Advertising »

World »

Opinion »

Music »

Opinion »

Dining & Wine »

+
+
+ +Chrysler Is Loyal to Its Pickup in a Cold Market + +
+
Chrysler Is Loyal to Its Pickup in a Cold Market
+
+
+
+
+ +Friction as India Converts Farmland Into Factories + +
+
Friction as India Converts Farmland Into Factories
+
+
+
+
+ + + +
+
+
+
+
+
+ +When Julian Schnabel Met Plácido Domingo + +
+
When Julian Schnabel Met Plácido Domingo
+
+
+
+
+ +Op-Ed: Another Country + +
+
Op-Ed: Another Country
+
+
+
+
+ +Instead of Eating to Diet, They’re Eating to Enjoy + +
+
Instead of Eating to Diet, They’re Eating to Enjoy
+
+
+ +
+ +
+ + + + + + + + + +
+ + + + + + + + + +
+ +
+ + + + + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ + + + + + +
+
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/.svn/text-base/objc.grammar.svn-base b/res/.svn/text-base/objc.grammar.svn-base new file mode 100644 index 0000000..5dec845 --- /dev/null +++ b/res/.svn/text-base/objc.grammar.svn-base @@ -0,0 +1,236 @@ + +@symbol = '@interface'; +@symbol = '@implementation'; +@symbol = '@end'; +@symbol = '@class'; +@symbol = '@protocol'; + +// external-declaration: +// function-definition +// declaration +// class-interface +// class-implementation +// category-interface +// category-implementation +// protocol-declaration +// class-declaration-list + +externalDecl = functionDef | decl | classInterface | classImpl | categoryInterface | categoryImpl | protocolDecl | classDeclList; + +// class-interface: +// @interface class-name [ : superclass-name ] +// [ protocol-reference-list ] +// [ instance-variables ] +// [ interface-declaration-list ] +// @end + +classInterface = '@interface' className (':' superclassName)? protocolRefList? ivars? interfaceDeclList? '@end'; + +// class-implementation: +// @implementation class-name [ : superclass-name ] +// [ instance-variables ] +// [ implementation-definition-list ] +// @end + +classImpl = '@implementation' className (':' superclassName)? ivars? implementationDefList? '@end'; + +// category-interface: +// @interface class-name ( category-name ) +// [ protocol-reference-list ] +// [ interface-declaration-list ] +// @end + +categoryInterface = '@interface' className '(' categoryName ')' protocolRefList? interfaceDeclList? '@end'; + +category-implementation: +@implementation class-name ( category-name ) +[ implementation-definition-list ] +@end + +protocol-declaration: +@protocol protocol-name +[ protocol-reference-list ] +[ interface-declaration-list ] +@end + +class-declaration-list: +@class class-list ; + +class-list: +class-name +class-list , class-name + +protocol-reference-list: +< protocol-list > + +protocol-list: +protocol-name +protocol-list , protocol-name + +class-name: +identifier + +superclass-name: +identifier + +category-name: +identifier + +protocol-name: +identifier + +instance-variables: +{ [ visibility-specification ] struct-declaration-list [ instance-variables ] } + +visibility-specification: +@private +@protected +@public + +interface-declaration-list: +declaration +method-declaration +interface-declaration-list declaration +interface-declaration-list method-declaration + +method-declaration: +class-method-declaration +instance-method-declaration + +class-method-declaration: ++ [ method-type ] method-selector ; + +instance-method-declaration: +- [ method-type ] method-selector ; + +implementation-definition-list: +function-definition +declaration +method-definition +implementation-definition-list function-definition +implementation-definition-list declaration +implementation-definition-list method-definition + +method-definition: +class-method-definition +instance-method-definition + +class-method-definition: ++ [ method-type ] method-selector [ declaration-list ] compound-statement + +instance-method-definition: +- [ method-type ] method-selector [ declaration-list ] compound-statement + +method-selector: +unary-selector +keyword-selector [ , ... ] +keyword-selector [ , parameter-type-list ] + +unary-selector: +selector + +keyword-selector: +keyword-declarator +keyword-selector keyword-declarator + +keyword-declarator: +: [ method-type ] identifier +selector : [ method-type ] identifier + +selector: +identifier + +method-type: +( type-name ) + + +Type Specifiers +type-specifier: +void +char +short +int +long +float +double +signed +unsigned +id [ protocol-reference-list ] +class-name [ protocol-reference-list ] +struct-or-union-specifier +enum-specifier +typedef-name + +struct-or-union-specifier: +struct-or-union [ identifier ] { struct-declaration-list } +struct-or-union [ identifier ] { @defs ( class-name ) } +struct-or-union identifier + + +Type Qualifiers +type-qualifier: +const +volatile +protocol-qualifier + +protocol-qualifier: +in +out +inout +bycopy +byref +oneway + + +Primary Expressions +primary-expression: +identifier +constant +string +( expression ) +self +message-expression +selector-expression +protocol-expression +encode-expression + +message-expression: +[ receiver message-selector ] + +receiver: +expression +class-name +super + +message-selector: +selector +keyword-argument-list + +keyword-argument-list: +keyword-argument +keyword-argument-list keyword-argument + +keyword-argument: +selector : expression +: expression + +selector-expression: +@selector ( selector-name ) + +selector-name: +selector +keyword-name-list + +keyword-name-list: +keyword-name +keyword-name-list keyword-name + +keyword-name: +selector : +: + +protocol-expression: +@protocol ( protocol-name ) + +encode-expression: +@encode ( type-name ) \ No newline at end of file diff --git a/res/.svn/text-base/proto.grammar.svn-base b/res/.svn/text-base/proto.grammar.svn-base new file mode 100644 index 0000000..e9adbb7 --- /dev/null +++ b/res/.svn/text-base/proto.grammar.svn-base @@ -0,0 +1,93 @@ +// proto ::= ( message | extend | enum | import | package | option | ";" )* +proto = ( message | extend | enum | import | package | option | ";" )*; + +// import ::= "import" strLit ";" +import = "import" strLit ";"; + +// package ::= "package" ident ";" +package = "package" ident ";"; + +// option ::= "option" optionBody ";" +option = "option" optionBody ";"; + +// optionBody ::= ident ( "." ident )* "=" constant +optionBody = ident ( "." ident )* "=" constant; + +// message ::= "message" ident messageBody +message = "message" ident messageBody; + +// extend ::= "extend" userType messageBody +extend = "extend" userType messageBody; + +// enum ::= "enum" ident "{" ( option | enumField | ";" )* "}" +enum = "enum" ident "{" ( option | enumField | ";" )* "}"; + +// enumField ::= ident "=" intLit ";" +enumField = ident "=" intLit ";"; + +// service ::= "service" ident "{" ( option | rpc | ";" )* "}" +service = "service" ident "{" ( option | rpc | ";" )* "}"; + +// rpc ::= "rpc" ident "(" userType ")" "returns" "(" userType ")" ";" +rpc = "rpc" ident "(" userType ")" "returns" "(" userType ")" ";"; + +// messageBody ::= "{" ( field | enum | message | extend | extensions | group | option | ":" )* "}" +messageBody = "{" ( field | enum | message | extend | extensions | group | option | ":" )* "}"; + +// group ::= modifier "group" camelIdent "=" intLit messageBody +group = modifier "group" camelIdent "=" intLit messageBody; + +// // tag number must be 2^28-1 or lower + +// field ::= modifier type ident "=" intLit ( "[" fieldOption ( "," fieldOption )* "]" )? ";" +field = modifier type ident "=" intLit ( "[" fieldOption ( "," fieldOption )* "]" )? ";"; + +// fieldOption ::= optionBody | "default" "=" constant +fieldOption = optionBody | "default" "=" constant; + +// extensions ::= "extensions" intLit "to" ( intLit | "max" ) ";" +extensions = "extensions" intLit "to" ( intLit | "max" ) ";"; + +// modifier ::= "required" | "optional" | "repeated" +modifier ::= "required" | "optional" | "repeated"; + +// type ::= "double" | "float" | "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64" | "fixed32" | "fixed64" | "sfixed32" | "sfixed64" | "bool" | "string" | "bytes" | userType +type = "double" | "float" | "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64" | "fixed32" | "fixed64" | "sfixed32" | "sfixed64" | "bool" | "string" | "bytes" | userType; + +// // leading dot for identifiers means they're fully qualified + +// userType ::= ( "."? ident )+ +userType = ( "."? ident )+; + +// constant ::= ident | intLit | floatLit | strLit | boolLit +constant = ident | numLit | strLit | boolLit; + +// ident ::= /[A-Za-z_][\w_]*/ +ident = /[A-Za-z_][\w_]*/; + +// // according to parser.cc, group names must start with a capital letter as a +// // hack for backwards-compatibility + +// camelIdent ::= /[A-Z][\w_]*/ +camelIdent = /[A-Z][\w_]*/; + +// intLit ::= decInt | hexInt | octInt +// decInt ::= /\d+/ +// hexInt ::= /0[xX]([A-Fa-f0-9])+/ +// octInt ::= /0[0-7]+/ +// floatLit ::= /\d+(\.\d+)?([Ee][\+-]?\d+)?/ // allow_f_after_float_ is +numLit = Number; + +// disabled by default in tokenizer.cc + +// boolLit ::= "true" | "false" +boolLit = "true" | "false"; + +// strLit ::= quote ( hexEscape | octEscape | charEscape | /[^\0\n]/ )* +strLit = QuotedString; + +// quote +// quote ::= /["']/ +// hexEscape ::= /\\[Xx][A-Fa-f0-9]{1,2}/ +// octEscape ::= /\\0?[0-7]{1,3}/ +// charEscape ::= /\\[abfnrtv\\\?'"]/ diff --git a/res/.svn/text-base/rubyhash.grammar.svn-base b/res/.svn/text-base/rubyhash.grammar.svn-base new file mode 100644 index 0000000..e66161c --- /dev/null +++ b/res/.svn/text-base/rubyhash.grammar.svn-base @@ -0,0 +1,35 @@ +/* + {"brand"=>{"name"=>"something", + "logo"=>#, + "summary"=>"wee", "content"=>"woopy doo"}, "commit"=>"Save", + "authenticity_token"=>"43a94d60304a7fb13a4ff61a5960461ce714e92b", + "action"=>"create", "controller"=>"admin/brands"} +*/ + +@reportsCommentTokens = YES; +@commentState = '#'; +@multiLineComments = '#<' '>'; +@symbols = '=>'; + +@start = Empty | object; + +object = openCurly objectContent closeCurly; +objectContent = Empty | actualObject; +actualObject = property commaProperty*; +property = propertyName arrow value; +commaProperty = comma property; +propertyName = QuotedString; // NOTE: property names are quoted + +value = null | true | false | object | number | string | fileRef; + +string = QuotedString; +number = Number; +fileRef = Comment; +null = 'null'; +true = 'true'; +false = 'false'; + +openCurly = '{'; +closeCurly = '}'; +comma = ','; +arrow = '=>'; diff --git a/res/.svn/text-base/small-xml-file.xml.svn-base b/res/.svn/text-base/small-xml-file.xml.svn-base new file mode 100644 index 0000000..da49760 --- /dev/null +++ b/res/.svn/text-base/small-xml-file.xml.svn-base @@ -0,0 +1,6 @@ + +http://www.apple.com/ +yes maam + + + \ No newline at end of file diff --git a/res/.svn/text-base/stuff.txt.svn-base b/res/.svn/text-base/stuff.txt.svn-base new file mode 100644 index 0000000..17690e4 --- /dev/null +++ b/res/.svn/text-base/stuff.txt.svn-base @@ -0,0 +1,8 @@ + + + +sudo /Users/itod/Downloads/checker-60/scan-build -o Desktop xcodebuild \ No newline at end of file diff --git a/res/.svn/text-base/svn-commands.txt.svn-base b/res/.svn/text-base/svn-commands.txt.svn-base new file mode 100644 index 0000000..9abc1e8 --- /dev/null +++ b/res/.svn/text-base/svn-commands.txt.svn-base @@ -0,0 +1,23 @@ +svn copy -r1392 https://todparsekit.googlecode.com/svn/trunk/ \ + https://todparsekit.googlecode.com/svn/tags/release-1.5-tag \ + -m "Creating 1.5 release tag from -r1392" + +svn copy -r1392 https://todparsekit.googlecode.com/svn/tags/release-1.5-tag \ + https://todparsekit.googlecode.com/svn/branches/release-1.5-branch \ + -m "Creating 1.5 release branch from -r1392" + + + + +svn delete https://todparsekit.googlecode.com/svn/tags/release-1.4.2-tag \ + -m "deleting first 1.4.2 release tag" + +svn delete https://todparsekit.googlecode.com/svn/branches/release-1.4.2-branch \ + -m "deleting first 1.4.2 release branch" + + + +svn copy -r1361 https://todparsekit.googlecode.com/svn/trunk/ \ + https://todparsekit.googlecode.com/svn/branches/dev-gcd-branch \ + -m "Creating a dev branch for testing GCD stuff. from -r1361" + \ No newline at end of file diff --git a/res/.svn/text-base/xml.grammar.svn-base b/res/.svn/text-base/xml.grammar.svn-base new file mode 100644 index 0000000..15979d6 --- /dev/null +++ b/res/.svn/text-base/xml.grammar.svn-base @@ -0,0 +1,388 @@ +/** + This is a relatively complete TDParseKit grammar for XML 1.0 derived from the XML specification: + + http://www.w3.org/TR/REC-xml/ + + You can create the parser in ObjC like: + + NSString *g = .. // fetch this grammar from disk or wherever + PKParser *p = [[PKParserFactory factory] parserFromGrammar:g assembler:self]; + + NSString *XMLString = .. // fetch some XML + [p parse:XMLString]; + + If implemented, your assembler object will receive callbacks for each production in this grammar, like: + + - (void)didMatchElement:(PKAssembly *)a; + - (void)didMatchAttribute:(PKAssembly *)a; + + + This parser is running successfully on some non-trivial real-world XML documents, + but i'm sure there are bugs (espcially in the DTD stuff). + + It's also a little too lenient about a few quoted string values in the spec, and doesnt yet forbid some chars it should. + + I have some tests, But will need many more if this is to be a serious parser: + + http://code.google.com/p/todparsekit/source/browse/trunk/test/TDXMLParserTest.m + + + (I'd like to write an ObjC SAX interface to this parser) + + (Is this the first XML parser implemented directly in Objective-C?) +*/ + +@start = document; + +@reportsWhitespaceTokens = YES; + +@symbols = '&#' '&#x' '' '' '' nil; +@delimitedString = '' nil; + + +// [1] document ::= prolog element Misc* + + document = prolog element misc*; + + +// [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ +// [3] S ::= (#x20 | #x9 | #xD | #xA)+ +// [4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] +// [4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] +// [5] Name ::= NameStartChar (NameChar)* +// [6] Names ::= Name (#x20 Name)* +// [7] Nmtoken ::= (NameChar)+ +// [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* + + @wordState = ':' '.' '-' '_'; + @wordChars = ':' '.' '-' '_'; + + nmtoken = Word; + + name = Word & /[^-:\.].*/; + + // names = name (S name)*; + // nmtokens = nmtoken (S nmtoken)*; + + + +// [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'" +// [10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" +// [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") + + entityValue = QuotedString; // TODO + attValue = QuotedString; // TODO + systemLiteral = QuotedString; + + +// [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" +// [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] + + pubidLiteral = QuotedString; // TODO + + +// [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) + + charData = /[^<\&]+/; + + +// [15] Comment ::= '' + + comment = DelimitedString(''); + + +// [16] PI ::= '' Char*)))? '?>' +// [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) + + pi = '/* '?>'; + piTarget = name - /xml/i; + + +// [18] CDSect ::= CDStart CData CDEnd +// [19] CDStart ::= '' Char*)) +// [21] CDEnd ::= ']]>' + + cdSect = DelimitedString(''); + + +// [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? + + prolog = xmlDecl? misc* (doctypedecl misc*)?; + + +// [23] XMLDecl ::= '' + + xmlDecl = ''; + + +// [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"') +// [26] VersionNum ::= '1.' [0-9]+ + + versionNum = /(['"])1\.[0-9]\1/; + versionInfo = S 'version' eq versionNum; + + +// [25] Eq ::= S? '=' S? + + eq = S? '=' S?; + + +// [27] Misc ::= Comment | PI | S + + misc = comment | pi | S; + + +// [28] doctypedecl ::= '' + + doctypedecl = ''; + + +// [28a] DeclSep ::= PEReference | S + + declSep = peReference | S; + + +// [28b] intSubset ::= (markupdecl | DeclSep)* + + intSubset = (markupdecl | declSep)*; + + +// [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment + + markupdecl = elementdecl | attlistDecl | entityDecl | notationDecl | pi | comment; + + +// [30] extSubset ::= TextDecl? extSubsetDecl + + extSubset = textDecl? extSubsetDecl; + +// [31] extSubsetDecl ::= ( markupdecl | conditionalSect | DeclSep)* + + extSubsetDecl = (markupdecl | conditionalSect | declSep)*; + + +// [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"')) + + sdDecl = S 'standalone' eq /(["'])(yes|no)\1/; + +// [39] element ::= EmptyElemTag | STag content ETag + + element = emptyElemTag | sTag content eTag; + + +// [40] STag ::= '<' Name (S Attribute)* S? '>' + + sTag = '<' name (S attribute)* S? '>'; + + +// [41] Attribute ::= Name Eq AttValue + + attribute = name eq attValue; + + +// [42] ETag ::= '' + + eTag = ''; + + +// [43] content ::= CharData? ((element | Reference | CDSect | PI | Comment) CharData?)* + + content = Empty | (element | reference | cdSect | pi | comment | charData)+; + + +// [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' + + emptyElemTag = '<' name (S attribute)* S? '/>'; + + +// [45] elementdecl ::= '' + + elementdecl = ''; + + +// [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children + + contentspec = 'EMPTY' | 'ANY' | mixed | children; + + +// [47] children ::= (choice | seq) ('?' | '*' | '+')? + + children = (choice | seq) ('?' | '*' | '+')?; + + +// [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? + + cp = (name) ('?' | '*' | '+')?; // TODO !!!!!!!!!!!!!! + + +// [49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')' + + choice = '(' S? cp ( S? '|' S? cp )+ S? ')'; + + +// [50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')' + + seq = '(' S? cp ( S? ',' S? cp )* S? ')'; + + +// [51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')' + + mixed = '(' S? '#PCDATA' (S? '|' S? name)* S? ')*' | '(' S? '#PCDATA' S? ')'; + + +// [52] AttlistDecl ::= '' + + attlistDecl = ''; + + +// AttDef ::= S Name S AttType S DefaultDecl + + attDef = S name S attType S defaultDecl; + + +// [54] AttType ::= StringType | TokenizedType | EnumeratedType + + attType = stringType | tokenizedType | enumeratedType; + + +// [55] StringType ::= 'CDATA' + + stringType = 'CDATA'; + + +// [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' + + tokenizedType = 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS'; + + +// [57] EnumeratedType ::= NotationType | Enumeration + + enumeratedType = notationType | enumeration; + + +// [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' + + notationType = 'NOTATION' S '(' S? name (S? '|' S? name)* S? ')'; + + +// [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' + + enumeration = '(' S? nmtoken (S? '|' S? nmtoken)* S? ')'; + + +// [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) + + defaultDecl = '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? attValue); + + +// [61] conditionalSect ::= includeSect | ignoreSect + + conditionalSect = includeSect | ignoreSect; + + +// [62] includeSect ::= '' + + includeSect = ''; + + +// [63] ignoreSect ::= '' + + ignoreSect = ''; + + +// [64] ignoreSectContents ::= Ignore ('' Ignore)* + + ignoreSectContents = ignore ('' ignore)*; + + +// [65] Ignore ::= Char* - (Char* ('') Char*) + + ignore = Word - /[^<]*().*/; + + +// [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';' + + charRef = '&#' /[0-9]+/ ';' | '&#x' /[0-9a-fA-F]+/ ';'; + + +// [67] Reference ::= EntityRef | CharRef + + reference = entityRef | charRef; + + +// [68] EntityRef ::= '&' Name ';' + + entityRef = '&' name ';'; + + +// [69] PEReference ::= '%' Name ';' + + peReference = '%' name ';'; + + +// [70] EntityDecl ::= GEDecl | PEDecl + + entityDecl = geDecl | peDecl; + + +// [71] GEDecl ::= '' + + geDecl = ''; + + +// [72] PEDecl ::= '' + + peDecl = ''; + + +// [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) + + entityDef = entityValue | (externalID nDataDecl?); + + +// [74] PEDef ::= EntityValue | ExternalID + + peDef = entityValue | externalID; + + +// [75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral + + externalID = 'SYSTEM' S systemLiteral | 'PUBLIC' S pubidLiteral S systemLiteral; + + +// [76] NDataDecl ::= S 'NDATA' S Name + + nDataDecl = S 'NDATA' S name; + + +// [77] TextDecl ::= '' + + textDecl = ''; + + +// [78] extParsedEnt ::= TextDecl? content + + extParsedEnt = textDecl? content; + + +// [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" ) +// [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* + + encName = /[A-Za-z][-A-Za-z0-9._]*/+; + encodingDecl = S 'encoding' eq QuotedString; + + +// [82] NotationDecl ::= '' + + notationDecl = ''; + + +// [83] PublicID ::= 'PUBLIC' S PubidLiteral + + publicID = 'PUBLIC' S pubidLiteral; diff --git a/res/.svn/text-base/xml_grammar.txt.svn-base b/res/.svn/text-base/xml_grammar.txt.svn-base new file mode 100644 index 0000000..bd01b6b --- /dev/null +++ b/res/.svn/text-base/xml_grammar.txt.svn-base @@ -0,0 +1,78 @@ +[1] document ::= prolog element Misc* +[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ +[3] S ::= (#x20 | #x9 | #xD | #xA)+ +[4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender +[5] Name ::= (Letter | '_' | ':') (NameChar)* +[6] Names ::= Name (#x20 Name)* +[7] Nmtoken ::= (NameChar)+ +[8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* +[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'" +[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" +[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") +[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" +[13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] +[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) +[15] Comment ::= '' +[16] PI ::= '' Char*)))? '?>' +[17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) +[18] CDSect ::= CDStart CData CDEnd +[19] CDStart ::= '' Char*)) +[21] CDEnd ::= ']]>' +[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? +[23] XMLDecl ::= '' +[24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"') +[25] Eq ::= S? '=' S? +[26] VersionNum ::= '1.0' +[27] Misc ::= Comment | PI | S +[28] doctypedecl ::= ''[VC: Root Element Type] +[28a] DeclSep ::= PEReference | S[WFC: PE Between Declarations] +[28b] intSubset ::= (markupdecl | DeclSep)* +[29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment[VC: Proper Declaration/PE Nesting] +[30] extSubset ::= TextDecl? extSubsetDecl +[31] extSubsetDecl ::= ( markupdecl | conditionalSect | DeclSep)* +[32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))[VC: Standalone Document Declaration] +[39] element ::= EmptyElemTag | STag content ETag[WFC: Element Type Match] +[40] STag ::= '<' Name (S Attribute)* S? '>'[WFC: Unique Att Spec] +[41] Attribute ::= Name Eq AttValue[VC: Attribute Value Type] +[42] ETag ::= '' +[43] content ::= CharData? ((element | Reference | CDSect | PI | Comment) CharData?)* +[44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'[WFC: Unique Att Spec] +[45] elementdecl ::= ''[VC: Unique Element Type Declaration] +[46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children +[47] children ::= (choice | seq) ('?' | '*' | '+')? +[48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? +[49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'[VC: Proper Group/PE Nesting] +[50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'[VC: Proper Group/PE Nesting] +[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'[VC: Proper Group/PE Nesting] +[52] AttlistDecl ::= '' +[53] AttDef ::= S Name S AttType S DefaultDecl +[54] AttType ::= StringType | TokenizedType | EnumeratedType +[55] StringType ::= 'CDATA' +[56] TokenizedType ::= 'ID'[VC: ID] +[57] EnumeratedType ::= NotationType | Enumeration +[58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'[VC: Notation Attributes] +[59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'[VC: Enumeration] +[60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)[VC: Required Attribute] +[61] conditionalSect ::= includeSect | ignoreSect +[62] includeSect ::= ''[VC: Proper Conditional Section/PE Nesting] +[63] ignoreSect ::= ''[VC: Proper Conditional Section/PE Nesting] +[64] ignoreSectContents ::= Ignore ('' Ignore)* +[65] Ignore ::= Char* - (Char* ('') Char*) +[66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'[WFC: Legal Character] +[67] Reference ::= EntityRef | CharRef +[68] EntityRef ::= '&' Name ';'[WFC: Entity Declared] +[69] PEReference ::= '%' Name ';'[VC: Entity Declared] +[70] EntityDecl ::= GEDecl | PEDecl +[71] GEDecl ::= '' +[72] PEDecl ::= '' +[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) +[74] PEDef ::= EntityValue | ExternalID +[75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral +[76] NDataDecl ::= S 'NDATA' S Name[VC: Notation Declared] +[77] TextDecl ::= '' +[78] extParsedEnt ::= TextDecl? content +[80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" ) +[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*/* Encoding name contains only Latin characters */ +[82] NotationDecl ::= ''[VC: Unique Notation Name] +[83] PublicID ::= 'PUBLIC' S PubidLiteral \ No newline at end of file diff --git a/res/.svn/text-base/xpath1_0.grammar.svn-base b/res/.svn/text-base/xpath1_0.grammar.svn-base new file mode 100644 index 0000000..12e37f8 --- /dev/null +++ b/res/.svn/text-base/xpath1_0.grammar.svn-base @@ -0,0 +1,80 @@ +/* + An XPath 1.0 grammar derived from the XPath 1.0 Specification: + + http://www.w3.org/TR/xpath + + + + NOTE-TO-SELF: to avoid infinite recursion, I had to eliminate this production: + + abbreviatedRelativeLocationPath = relativeLocationPath '//' step; + + and therefore remove `abbreviatedRelativeLocationPath` from `relativeLocationPath` which changed from + + relativeLocationPath = step ('/' step)* | abbreviatedRelativeLocationPath; + + to: + + relativeLocationPath = '//'? step ('/' step)*; + + +*/ + +@start = expr; + +@symbols = '//' '..' '!=' '::' '<=' '>='; + +@wordState = '_'; +@wordChars = '_' '.' '-'; + +@numberState = '.'; // numbers may start with dot +@allowsTrailingDot = YES; // numbers may end with dot +@symbolState = '+' '-'; // numbers may not start with a plus or minus sign. they're actually unary operators +@allowsScientificNotation = NO; // exponents not allowed +@allowsOctalNotation = NO; // octal not allowed +@allowsHexidecimalNotation = NO; // hex not allowed + + +expr = orExpr; + orExpr = andExpr ('or' andExpr)*; + andExpr = equalityExpr ('and' equalityExpr)*; + equalityExpr = relationalExpr (('=' | '!=') relationalExpr)*; + relationalExpr = additiveExpr (('<' | '>' | '<=' | '>=') additiveExpr)*; + additiveExpr = multiplicativeExpr (('+' | '-') multiplicativeExpr)*; + multiplicativeExpr = unaryExpr ((multiplyOperator | 'div' | 'mod') unaryExpr)*; + multiplyOperator = '*'; + unaryExpr = '-'* unionExpr; + unionExpr = pathExpr ('|' pathExpr)*; + + +pathExpr = locationPath | filterExpr (('/'| '//') relativeLocationPath)?; + locationPath = relativeLocationPath | absoluteLocationPath; + relativeLocationPath = '//'? step ('/' step)*; + absoluteLocationPath = '/' relativeLocationPath? | abbreviatedAbsoluteLocationPath; + abbreviatedAbsoluteLocationPath = '//' relativeLocationPath; + + filterExpr = primaryExpr predicate*; + primaryExpr = variableReference | literal | number | functionCall | '(' expr ')'; + variableReference = '$' qName; // note whitespace is not allowed here. also qName is optional + literal = QuotedString; + number = Number; + functionCall = functionName '(' (argument (',' argument)* )? ')'; + functionName = qName - nodeType; + qName = (prefix ':')? localPart; + prefix = ncName; + localPart = ncName; + ncName = Word; + argument = expr; + predicate = '[' predicateExpr ']'; + predicateExpr = expr; + + + step = axisSpecifier nodeTest predicate* | abbreviatedStep; + axisSpecifier = axisName '::' | abbreviatedAxisSpecifier; + axisName = 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' | 'descendant' | 'descendant-or-self' | 'following' | 'following-sibling' | 'namespace' | 'parent' | 'preceding' | 'preceding-sibling' | 'self'; + abbreviatedAxisSpecifier = '@'?; + nodeTest = nameTest | nodeType '(' ')' | 'processing-instruction' '(' literal ')'; + nameTest = '*' | ncName ':' '*' | qName; // note whitespace should not be allowed in second alt here + nodeType = 'comment' | 'text' | 'processing-instruction' | 'node'; + abbreviatedStep = '.' | '..'; + diff --git a/res/.svn/text-base/xpath_grammar.txt.svn-base b/res/.svn/text-base/xpath_grammar.txt.svn-base new file mode 100644 index 0000000..5aacfcf --- /dev/null +++ b/res/.svn/text-base/xpath_grammar.txt.svn-base @@ -0,0 +1,88 @@ +[1] LocationPath ::= RelativeLocationPath | AbsoluteLocationPath +[2] AbsoluteLocationPath ::= '/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath +[3] RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath +[4] Step ::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep +[5] AxisSpecifier ::= AxisName '::' | AbbreviatedAxisSpecifier +[6] AxisName ::= 'ancestor' + | 'ancestor-or-self' + | 'attribute' + | 'child' + | 'descendant' + | 'descendant-or-self' + | 'following' + | 'following-sibling' + | 'namespace' + | 'parent' + | 'preceding' + | 'preceding-sibling' + | 'self' +[7] NodeTest ::= NameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' +[8] Predicate ::= '[' PredicateExpr ']' +[9] PredicateExpr ::= Expr +[10] AbbreviatedAbsoluteLocationPath ::= '//' RelativeLocationPath +[11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step +[12] AbbreviatedStep ::= '.' | '..' +[13] AbbreviatedAxisSpecifier ::= '@'? +[14] Expr ::= OrExpr +[15] PrimaryExpr ::= VariableReference + | '(' Expr ')' + | Literal + | Number + | FunctionCall +[16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument )* )? ')' +[17] Argument ::= Expr +[18] UnionExpr ::= PathExpr | UnionExpr '|' PathExpr +[19] PathExpr ::= LocationPath + | FilterExpr + | FilterExpr '/' RelativeLocationPath + | FilterExpr '//' RelativeLocationPath +[20] FilterExpr ::= PrimaryExpr | FilterExpr Predicate +[21] OrExpr ::= AndExpr | OrExpr 'or' AndExpr +[22] AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr +[23] EqualityExpr ::= RelationalExpr + | EqualityExpr '=' RelationalExpr + | EqualityExpr '!=' RelationalExpr +[24] RelationalExpr ::= AdditiveExpr + | RelationalExpr '<' AdditiveExpr + | RelationalExpr '>' AdditiveExpr + | RelationalExpr '<=' AdditiveExpr + | RelationalExpr '>=' AdditiveExpr +[25] AdditiveExpr ::= MultiplicativeExpr + | AdditiveExpr '+' MultiplicativeExpr + | AdditiveExpr '-' MultiplicativeExpr +[26] MultiplicativeExpr ::= UnaryExpr + | MultiplicativeExpr MultiplyOperator UnaryExpr + | MultiplicativeExpr 'div' UnaryExpr + | MultiplicativeExpr 'mod' UnaryExpr +[27] UnaryExpr ::= UnionExpr + | '-' UnaryExpr + +[28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' + | NameTest + | NodeType + | Operator + | FunctionName + | AxisName + | Literal + | Number + | VariableReference +[29] Literal ::= '"' [^"]* '"' + | "'" [^']* "'" +[30] Number ::= Digits ('.' Digits?)? + | '.' Digits +[31] Digits ::= [0-9]+ +[32] Operator ::= OperatorName + | MultiplyOperator + | '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>=' +[33] OperatorName ::= 'and' | 'or' | 'mod' | 'div' +[34] MultiplyOperator ::= '*' +[35] FunctionName ::= QName - NodeType +[36] VariableReference ::= '$' QName +[37] NameTest ::= '*' + | NCName ':' '*' + | QName +[38] NodeType ::= 'comment' + | 'text' + | 'processing-instruction' + | 'node' +[39] ExprWhitespace ::= S \ No newline at end of file diff --git a/res/.svn/text-base/yahoo-small.json.svn-base b/res/.svn/text-base/yahoo-small.json.svn-base new file mode 100644 index 0000000..210bf96 --- /dev/null +++ b/res/.svn/text-base/yahoo-small.json.svn-base @@ -0,0 +1,18 @@ +{"name": "Yahoo!", + "permalink": "yahoo", + "homepage_url": "http://www.yahoo.com", + "blog_url": "http://yodel.yahoo.com/", + "blog_feed_url": "http://ycorpblog.com/feed/", + "category_code": "web", + "number_of_employees": 13600, + "founded_year": 1994, + "founded_month": null, + "founded_day": null, + "deadpooled_year": null, + "deadpooled_month": null, + "deadpooled_day": null, + "deadpooled_url": null, + "tag_list": "search, portal, webmail, photos", + "email_address": "", + "phone_number": "(408) 349-3300" +} \ No newline at end of file diff --git a/res/.svn/text-base/yahoo.json.svn-base b/res/.svn/text-base/yahoo.json.svn-base new file mode 100644 index 0000000..aab012a --- /dev/null +++ b/res/.svn/text-base/yahoo.json.svn-base @@ -0,0 +1,370 @@ +{"name": "Yahoo!", + "permalink": "yahoo", + "homepage_url": "http://www.yahoo.com", + "blog_url": "http://yodel.yahoo.com/", + "blog_feed_url": "http://ycorpblog.com/feed/", + "category_code": "web", + "number_of_employees": 13600, + "founded_year": 1994, + "founded_month": null, + "founded_day": null, + "deadpooled_year": null, + "deadpooled_month": null, + "deadpooled_day": null, + "deadpooled_url": null, + "tag_list": "search, portal, webmail, photos", + "email_address": "", + "phone_number": "(408) 349-3300", + "overview": "Yahoo was founded in 1994 by Stanford Ph.D. students David Filo and Jerry Yang. It has since evolved into a major internet brand with search, content verticals, and other web services.", + "image": + {"available_sizes": + [[[150, + 37], + "assets/images/resized/0001/0836/10836v1-max-250x150.png"], + [[200, + 50], + "assets/images/resized/0001/0836/10836v1-max-250x250.png"], + [[200, + 50], + "assets/images/resized/0001/0836/10836v1-max-450x450.png"]], + "attribution": null}, + "products": + [{"name": "Yahoo.com", + "permalink": "yahoo-com"}, + {"name": "Yahoo! Mail", + "permalink": "yahoo-mail"}, + {"name": "Yahoo! Search", + "permalink": "yahoo-search"}, + {"name": "Yahoo! Directory", + "permalink": "yahoo-directory"}, + {"name": "Yahoo! Finance", + "permalink": "yahoo-finance"}, + {"name": "My Yahoo", + "permalink": "my-yahoo"}, + {"name": "Yahoo! News", + "permalink": "yahoo-news"}, + {"name": "Yahoo! Groups", + "permalink": "yahoo-groups"}, + {"name": "Yahoo! Messenger", + "permalink": "yahoo-messenger"}, + {"name": "Yahoo! Games", + "permalink": "yahoo-games"}, + {"name": "Yahoo! People Search", + "permalink": "yahoo-people-search"}, + {"name": "Yahoo! Movies", + "permalink": "yahoo-movies"}, + {"name": "Yahoo! Weather", + "permalink": "yahoo-weather"}, + {"name": "Yahoo! Video", + "permalink": "yahoo-video"}, + {"name": "Yahoo! Music", + "permalink": "yahoo-music"}, + {"name": "Yahoo! Sports", + "permalink": "yahoo-sports"}, + {"name": "Yahoo! Maps", + "permalink": "yahoo-maps"}, + {"name": "Yahoo! Auctions", + "permalink": "yahoo-auctions"}, + {"name": "Yahoo! Widgets", + "permalink": "yahoo-widgets"}, + {"name": "Yahoo! Shopping", + "permalink": "yahoo-shopping"}, + {"name": "Yahoo! Real Estate", + "permalink": "yahoo-real-estate"}, + {"name": "Yahoo! Travel", + "permalink": "yahoo-travel"}, + {"name": "Yahoo! Classifieds", + "permalink": "yahoo-classifieds"}, + {"name": "Yahoo! Answers", + "permalink": "yahoo-answers"}, + {"name": "Yahoo! Mobile", + "permalink": "yahoo-mobile"}, + {"name": "Yahoo! Buzz", + "permalink": "yahoo-buzz"}, + {"name": "Yahoo! Open Search Platform", + "permalink": "yahoo-open-search-platform"}, + {"name": "Fire Eagle", + "permalink": "fireeagle"}, + {"name": "Shine", + "permalink": "shine"}, + {"name": "Yahoo! Shortcuts", + "permalink": "yahoo-shortcuts"}], + "competitions": + [{"competitor": + {"name": "Google", + "permalink": "google"}}, + {"competitor": + {"name": "seesmic", + "permalink": "seesmic"}}, + {"competitor": + {"name": "BricaBox", + "permalink": "bricabox"}}, + {"competitor": + {"name": "Clickpass", + "permalink": "clickpass"}}, + {"competitor": + {"name": "Tencent", + "permalink": "tencent"}}, + {"competitor": + {"name": "Hurdan", + "permalink": "better-searcher"}}, + {"competitor": + {"name": "Powerset", + "permalink": "powerset"}}, + {"competitor": + {"name": "Baidu", + "permalink": "baidu"}}, + {"competitor": + {"name": "Zenbe", + "permalink": "zenbe"}}, + {"competitor": + {"name": "Yandex", + "permalink": "yandex"}}, + {"competitor": + {"name": "Placebase", + "permalink": "placebase"}}, + {"competitor": + {"name": "AOL", + "permalink": "aol"}}], + "providerships": + [{"title": "", + "is_past": false, + "provider": + {"name": "OutCast Communications", + "permalink": "outcast-communications"}}, + {"title": "Investment Banking", + "is_past": null, + "provider": + {"name": "Moelis \u0026 Company", + "permalink": "moelis-company"}}, + {"title": "Public Relations", + "is_past": false, + "provider": + {"name": "Powerscourt", + "permalink": "powerscourt"}}], + "funding_rounds": + [], + "investments": + [{"funding_round": + {"round_code": "c", + "source_url": "http://sanjose.bizjournals.com/sanjose/stories/2004/05/24/daily3.html", + "source_description": "Plaxo connects to more funding", + "raised_amount": 7000000.0, + "raised_currency_code": "USD", + "funded_year": 2004, + "funded_month": 4, + "funded_day": 1, + "company": + {"name": "Plaxo", + "permalink": "plaxo"}}}, + {"funding_round": + {"round_code": "b", + "source_url": "http://www.techcrunch.com/2007/08/21/vlingo-voice-enable-any-mobile-application/", + "source_description": "", + "raised_amount": 20000000.0, + "raised_currency_code": "USD", + "funded_year": 2008, + "funded_month": 4, + "funded_day": 2, + "company": + {"name": "Vlingo", + "permalink": "vlingo"}}}, + {"funding_round": + {"round_code": "b", + "source_url": "http://www.paidcontent.org/entry/419-india-deals-ebay-sells-stake-in-indian-ops-bharatmatrimony-gets-2175-mi/", + "source_description": "India Deals: eBay Sells Stake In Indian Ops; Bharatmatrimony Gets $11.75 Million From Yahoo \u0026 Others", + "raised_amount": 11750000.0, + "raised_currency_code": "USD", + "funded_year": 2008, + "funded_month": 2, + "funded_day": 5, + "company": + {"name": "Bharat Matrimony", + "permalink": "bharat-matrimony"}}}], + "acquisition": null, + "acquisitions": + [{"price_amount": null, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 12, + "acquired_day": 1, + "company": + {"name": "delicious", + "permalink": "delicious"}}, + {"price_amount": 1000000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 8, + "acquired_day": 1, + "company": + {"name": "Alibaba", + "permalink": "alibaba"}}, + {"price_amount": 160000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2004, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "Musicmatch", + "permalink": "musicmatch"}}, + {"price_amount": 350000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2007, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "Zimbra", + "permalink": "zimbra"}}, + {"price_amount": 670000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2004, + "acquired_month": 4, + "acquired_day": 1, + "company": + {"name": "Kelkoo", + "permalink": "kelkoo"}}, + {"price_amount": 35000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://arstechnica.com/news.ars/post/20050324-4732.html", + "source_description": "", + "acquired_year": 2005, + "acquired_month": 3, + "acquired_day": 1, + "company": + {"name": "Flickr", + "permalink": "flickr"}}, + {"price_amount": 1000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 10, + "acquired_day": 1, + "company": + {"name": "Upcoming", + "permalink": "upcoming"}}, + {"price_amount": 300000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2007, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "BlueLithium", + "permalink": "bluelithium"}}, + {"price_amount": 160000000.0, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2008/02/12/yahoo-confirms-maven-networks-acquisition/", + "source_description": "Yahoo Confirms Maven Networks Acquisition", + "acquired_year": 2008, + "acquired_month": 1, + "acquired_day": 31, + "company": + {"name": "Maven Networks", + "permalink": "maven-networks"}}, + {"price_amount": 800000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.techcrunch.com/2007/04/29/panama-not-enough-to-battle-google-yahoo-acquires-rightmedia/", + "source_description": "Panama Not Enough To Battle Google: Yahoo Acquires RightMedia", + "acquired_year": 2007, + "acquired_month": 4, + "acquired_day": null, + "company": + {"name": "Right Media", + "permalink": "right-media"}}, + {"price_amount": 10000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.techcrunch.com/2007/01/08/yahoo-buys-mybloglog-no-they-didnt-wait-yes/", + "source_description": "", + "acquired_year": 2007, + "acquired_month": 1, + "acquired_day": null, + "company": + {"name": "MyBlogLog", + "permalink": "mybloglog"}}, + {"price_amount": 40000000.0, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2008/02/04/yahoo-acquires-israeli-foxytunes/", + "source_description": "TechCrunch", + "acquired_year": 2008, + "acquired_month": 2, + "acquired_day": 4, + "company": + {"name": "FoxyTunes", + "permalink": "foxytunes"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2006/09/27/yahoo-has-acquired-jumpcut/", + "source_description": "Yahoo! has acquired Jumpcut", + "acquired_year": 2006, + "acquired_month": 10, + "acquired_day": 2, + "company": + {"name": "Jumpcut", + "permalink": "jumpcut"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.ysearchblog.com/archives/000581.html", + "source_description": "Inquisitor Joins the Yahoo! Search Team", + "acquired_year": 2008, + "acquired_month": 5, + "acquired_day": 9, + "company": + {"name": "Inquisitor", + "permalink": "inquisitor"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.thealarmclock.com/mt/archives/2008/04/yahoo_buys_ad_a.html", + "source_description": "Yahoo! Buys Ad Analytics Firm Indextools", + "acquired_year": 2008, + "acquired_month": 4, + "acquired_day": 10, + "company": + {"name": "Indextools", + "permalink": "indextools"}}], + "offices": + [{"description": null, + "address1": "701 First Avenue", + "address2": "", + "zip_code": "94089", + "city": "Sunnyvale", + "state_code": "CA", + "country_code": "USA", + "latitude": 37.418531, + "longitude": -122.025485}], + "milestones": + [], + "ipo": + {"valuation_amount": null, + "valuation_currency_code": "USD", + "pub_year": 1996, + "pub_month": 4, + "pub_day": 12, + "stock_symbol": "YHOO"} +} \ No newline at end of file diff --git a/res/.svn/text-base/yahoo_with_comments.json.svn-base b/res/.svn/text-base/yahoo_with_comments.json.svn-base new file mode 100644 index 0000000..9d11005 --- /dev/null +++ b/res/.svn/text-base/yahoo_with_comments.json.svn-base @@ -0,0 +1,370 @@ +{"name": "Yahoo!" /* foo bar */ , + "permalink": "yahoo", + "homepage_url": "http://www.yahoo.com", + "blog_url": "http://yodel.yahoo.com/", + "blog_feed_url": "http://ycorpblog.com/feed/", + "category_code": "web", + "number_of_employees": 13600, + "founded_year": 1994, + "founded_month": null, + "founded_day": null, + "deadpooled_year": null, + "deadpooled_month": null, + "deadpooled_day": null, + "deadpooled_url": null, + "tag_list": "search, portal, webmail, photos", + "email_address": "", + "phone_number": "(408) 349-3300", + "overview": "Yahoo was founded in 1994 by Stanford Ph.D. students David Filo and Jerry Yang. It has since evolved into a major internet brand with search, content verticals, and other web services.", + "image": + {"available_sizes": + [[[150, + 37], + "assets/images/resized/0001/0836/10836v1-max-250x150.png"], + [[200, + 50], + "assets/images/resized/0001/0836/10836v1-max-250x250.png"], + [[200, + 50], + "assets/images/resized/0001/0836/10836v1-max-450x450.png"]], + "attribution": null}, + "products": + [{"name": "Yahoo.com", + "permalink": "yahoo-com"}, + {"name": "Yahoo! Mail", + "permalink": "yahoo-mail"}, + {"name": "Yahoo! Search", + "permalink": "yahoo-search"}, + {"name": "Yahoo! Directory", + "permalink": "yahoo-directory"}, + {"name": "Yahoo! Finance", + "permalink": "yahoo-finance"}, + {"name": "My Yahoo", + "permalink": "my-yahoo"}, + {"name": "Yahoo! News", + "permalink": "yahoo-news"}, + {"name": "Yahoo! Groups", + "permalink": "yahoo-groups"}, + {"name": "Yahoo! Messenger", + "permalink": "yahoo-messenger"}, + {"name": "Yahoo! Games", + "permalink": "yahoo-games"}, + {"name": "Yahoo! People Search", + "permalink": "yahoo-people-search"}, + {"name": "Yahoo! Movies", + "permalink": "yahoo-movies"}, + {"name": "Yahoo! Weather", + "permalink": "yahoo-weather"}, + {"name": "Yahoo! Video", + "permalink": "yahoo-video"}, + {"name": "Yahoo! Music", + "permalink": "yahoo-music"}, + {"name": "Yahoo! Sports", + "permalink": "yahoo-sports"}, + {"name": "Yahoo! Maps", + "permalink": "yahoo-maps"}, + {"name": "Yahoo! Auctions", + "permalink": "yahoo-auctions"}, + {"name": "Yahoo! Widgets", + "permalink": "yahoo-widgets"}, + {"name": "Yahoo! Shopping", + "permalink": "yahoo-shopping"}, + {"name": "Yahoo! Real Estate", + "permalink": "yahoo-real-estate"}, + {"name": "Yahoo! Travel", + "permalink": "yahoo-travel"}, + {"name": "Yahoo! Classifieds", + "permalink": "yahoo-classifieds"}, + {"name": "Yahoo! Answers", + "permalink": "yahoo-answers"}, + {"name": "Yahoo! Mobile", + "permalink": "yahoo-mobile"}, + {"name": "Yahoo! Buzz", + "permalink": "yahoo-buzz"}, + {"name": "Yahoo! Open Search Platform", + "permalink": "yahoo-open-search-platform"}, + {"name": "Fire Eagle", + "permalink": "fireeagle"}, + {"name": "Shine", + "permalink": "shine"}, + {"name": "Yahoo! Shortcuts", + "permalink": "yahoo-shortcuts"}], + "competitions": + [{"competitor": + {"name": "Google", + "permalink": "google"}}, + {"competitor": + {"name": "seesmic", + "permalink": "seesmic"}}, + {"competitor": + {"name": "BricaBox", + "permalink": "bricabox"}}, + {"competitor": + {"name": "Clickpass", + "permalink": "clickpass"}}, + {"competitor": + {"name": "Tencent", + "permalink": "tencent"}}, + {"competitor": + {"name": "Hurdan", + "permalink": "better-searcher"}}, + {"competitor": + {"name": "Powerset", + "permalink": "powerset"}}, + {"competitor": + {"name": "Baidu", + "permalink": "baidu"}}, + {"competitor": + {"name": "Zenbe", + "permalink": "zenbe"}}, + {"competitor": + {"name": "Yandex", + "permalink": "yandex"}}, + {"competitor": + {"name": "Placebase", + "permalink": "placebase"}}, + {"competitor": + {"name": "AOL", + "permalink": "aol"}}], + "providerships": + [{"title": "", + "is_past": false, + "provider": + {"name": "OutCast Communications", + "permalink": "outcast-communications"}}, + {"title": "Investment Banking", + "is_past": null, + "provider": + {"name": "Moelis \u0026 Company", + "permalink": "moelis-company"}}, + {"title": "Public Relations", + "is_past": false, + "provider": + {"name": "Powerscourt", + "permalink": "powerscourt"}}], + "funding_rounds": + [], + "investments": + [{"funding_round": + {"round_code": "c", + "source_url": "http://sanjose.bizjournals.com/sanjose/stories/2004/05/24/daily3.html", + "source_description": "Plaxo connects to more funding", + "raised_amount": 7000000.0, + "raised_currency_code": "USD", + "funded_year": 2004, + "funded_month": 4, + "funded_day": 1, + "company": + {"name": "Plaxo", + "permalink": "plaxo"}}}, + {"funding_round": + {"round_code": "b", + "source_url": "http://www.techcrunch.com/2007/08/21/vlingo-voice-enable-any-mobile-application/", + "source_description": "", + "raised_amount": 20000000.0, + "raised_currency_code": "USD", + "funded_year": 2008, + "funded_month": 4, + "funded_day": 2, + "company": + {"name": "Vlingo", + "permalink": "vlingo"}}}, + {"funding_round": + {"round_code": "b", + "source_url": "http://www.paidcontent.org/entry/419-india-deals-ebay-sells-stake-in-indian-ops-bharatmatrimony-gets-2175-mi/", + "source_description": "India Deals: eBay Sells Stake In Indian Ops; Bharatmatrimony Gets $11.75 Million From Yahoo \u0026 Others", + "raised_amount": 11750000.0, + "raised_currency_code": "USD", + "funded_year": 2008, + "funded_month": 2, + "funded_day": 5, + "company": + {"name": "Bharat Matrimony", + "permalink": "bharat-matrimony"}}}], + "acquisition": null, + "acquisitions": + [{"price_amount": null, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 12, + "acquired_day": 1, + "company": + {"name": "delicious", + "permalink": "delicious"}}, + {"price_amount": 1000000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 8, + "acquired_day": 1, + "company": + {"name": "Alibaba", + "permalink": "alibaba"}}, + {"price_amount": 160000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2004, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "Musicmatch", + "permalink": "musicmatch"}}, + {"price_amount": 350000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2007, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "Zimbra", + "permalink": "zimbra"}}, + {"price_amount": 670000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2004, + "acquired_month": 4, + "acquired_day": 1, + "company": + {"name": "Kelkoo", + "permalink": "kelkoo"}}, + {"price_amount": 35000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://arstechnica.com/news.ars/post/20050324-4732.html", + "source_description": "", + "acquired_year": 2005, + "acquired_month": 3, + "acquired_day": 1, + "company": + {"name": "Flickr", + "permalink": "flickr"}}, + {"price_amount": 1000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 10, + "acquired_day": 1, + "company": + {"name": "Upcoming", + "permalink": "upcoming"}}, + {"price_amount": 300000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2007, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "BlueLithium", + "permalink": "bluelithium"}}, + {"price_amount": 160000000.0, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2008/02/12/yahoo-confirms-maven-networks-acquisition/", + "source_description": "Yahoo Confirms Maven Networks Acquisition", + "acquired_year": 2008, + "acquired_month": 1, + "acquired_day": 31, + "company": + {"name": "Maven Networks", + "permalink": "maven-networks"}}, + {"price_amount": 800000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.techcrunch.com/2007/04/29/panama-not-enough-to-battle-google-yahoo-acquires-rightmedia/", + "source_description": "Panama Not Enough To Battle Google: Yahoo Acquires RightMedia", + "acquired_year": 2007, + "acquired_month": 4, + "acquired_day": null, + "company": + {"name": "Right Media", + "permalink": "right-media"}}, + {"price_amount": 10000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.techcrunch.com/2007/01/08/yahoo-buys-mybloglog-no-they-didnt-wait-yes/", + "source_description": "", + "acquired_year": 2007, + "acquired_month": 1, + "acquired_day": null, + "company": + {"name": "MyBlogLog", + "permalink": "mybloglog"}}, + {"price_amount": 40000000.0, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2008/02/04/yahoo-acquires-israeli-foxytunes/", + "source_description": "TechCrunch", + "acquired_year": 2008, + "acquired_month": 2, + "acquired_day": 4, + "company": + {"name": "FoxyTunes", + "permalink": "foxytunes"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2006/09/27/yahoo-has-acquired-jumpcut/", + "source_description": "Yahoo! has acquired Jumpcut", + "acquired_year": 2006, + "acquired_month": 10, + "acquired_day": 2, + "company": + {"name": "Jumpcut", + "permalink": "jumpcut"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.ysearchblog.com/archives/000581.html", + "source_description": "Inquisitor Joins the Yahoo! Search Team", + "acquired_year": 2008, + "acquired_month": 5, + "acquired_day": 9, + "company": + {"name": "Inquisitor", + "permalink": "inquisitor"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.thealarmclock.com/mt/archives/2008/04/yahoo_buys_ad_a.html", + "source_description": "Yahoo! Buys Ad Analytics Firm Indextools", + "acquired_year": 2008, + "acquired_month": 4, + "acquired_day": 10, + "company": + {"name": "Indextools", + "permalink": "indextools"}}], + "offices": + [{"description": null, + "address1": "701 First Avenue", + "address2": "", + "zip_code": "94089", + "city": "Sunnyvale", + "state_code": "CA", + "country_code": "USA", + "latitude": 37.418531, + "longitude": -122.025485}], + "milestones": + [], + "ipo": + {"valuation_amount": null, + "valuation_currency_code": "USD", + "pub_year": 1996, + "pub_month": 4, + "pub_day": 12, + "stock_symbol": "YHOO"} +} \ No newline at end of file diff --git a/res/.svn/tmp/tempfile.2.tmp b/res/.svn/tmp/tempfile.2.tmp new file mode 100644 index 0000000..6d8645d --- /dev/null +++ b/res/.svn/tmp/tempfile.2.tmp @@ -0,0 +1,240 @@ +/* + An XPath 1.0 grammar derived from the XPath 1.0 Specification: + + http://www.w3.org/TR/xpath + +*/ + +@start = locationPath; + +@symbols = '//' + '..' + '!=' + '::' + '<=' + '>='; + + +// [1] LocationPath ::= RelativeLocationPath | AbsoluteLocationPath + + locationPath = relativeLocationPath | absoluteLocationPath; + + + +// [2] AbsoluteLocationPath ::= '/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath + + absoluteLocationPath = '/' relativeLocationPath? | abbreviatedAbsoluteLocationPath; + + +// [3] RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath +// avoiding left recursion + + relativeLocationPath = step slashStep* | abbreviatedRelativeLocationPath; + + +// [4] Step ::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep + + step = axisSpecifier nodeTest predicate* | abbreviatedStep; + + +// [5] AxisSpecifier ::= AxisName '::' | AbbreviatedAxisSpecifier + + axisSpecifier = axisName '::' | abbreviatedAxisSpecifier; + + +// [6] AxisName ::= 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' | 'descendant' | 'descendant-or-self' +// | 'following' | 'following-sibling' | 'namespace' | 'parent' | 'preceding' | 'preceding-sibling' | 'self' + + axisName = 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' | 'descendant' | 'descendant-or-self' + | 'following' | 'following-sibling' | 'namespace' | 'parent' | 'preceding' | 'preceding-sibling' | 'self'; + + +// [7] NodeTest ::= NameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' + + nodeTest = nameTest | nodeType '(' ')' | 'processing-instruction' '(' literal ')'; + + +// [8] Predicate ::= '[' PredicateExpr ']' + + predicate = '[' predicateExpr ']'; + + +// [9] PredicateExpr ::= Expr + + predicateExpr = expr; + + +// [10] AbbreviatedAbsoluteLocationPath ::= '//' RelativeLocationPath + + abbreviatedAbsoluteLocationPath = '//' relativeLocationPath; + + +// [11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step + + abbreviatedRelativeLocationPath = relativeLocationPath '//' step; + + +// [12] AbbreviatedStep ::= '.' | '..' + + abbreviatedStep = '.' | '..'; + + +// [13] AbbreviatedAxisSpecifier ::= '@'? + + abbreviatedAxisSpecifier = '@'?; + + +// [14] Expr ::= OrExpr + + expr = orExpr; + + +// [15] PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall + + primaryExpr = variableReference | '(' expr ')' | literal | Num | functionCall; + + + +// [16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument )* )? ')' + + functionCall ::= functionName '(' (argument (',' argument)* )? ')'; + + +// [17] Argument ::= Expr + + argument = expr; + + +// [18] UnionExpr ::= PathExpr | UnionExpr '|' PathExpr +// avoiding Left recursion + + unionExpr = pathExpr ('|' pathExpr)*; + + +// [19] PathExpr ::= LocationPath +// | FilterExpr +// | FilterExpr '/' RelativeLocationPath +// | FilterExpr '//' RelativeLocationPath + + pathExpr = locationPath | filterExpr (('/'| '//') relativeLocationPath)?; + + +// [20] FilterExpr ::= PrimaryExpr | FilterExpr Predicate +// avoiding Left recursion ?? + + filterExpr = primaryExpr predicate? + + +// [21] OrExpr ::= AndExpr | OrExpr 'or' AndExpr +// avoiding Left recursion + + orExpr = andExpr ('or' andExpr)*; + + +// [22] AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr +// avoiding Left recursion + + andExpr = equalityExpr ('and' equalityExpr)*; + + +// [23] EqualityExpr ::= RelationalExpr | EqualityExpr '=' RelationalExpr | EqualityExpr '!=' RelationalExpr +// avoiding Left recursion + + equalityExpr = relationalExpr (('='|'!=') relationalExpr)?; + // TODO repetition or alternation? + + +// [24] RelationalExpr ::= AdditiveExpr +// | RelationalExpr '<' AdditiveExpr +// | RelationalExpr '>' AdditiveExpr +// | RelationalExpr '<=' AdditiveExpr +// | RelationalExpr '>=' AdditiveExpr +// avoiding Left recursion + + relationalExpr = additiveExpr ('<' additiveExpr | '>' additiveExpr | '<=' additiveExpr | '>=' additiveExpr)?; + + +// [25] AdditiveExpr ::= MultiplicativeExpr +// | AdditiveExpr '+' MultiplicativeExpr +// | AdditiveExpr '-' MultiplicativeExpr +// avoiding Left recursion + + additiveExpr = multiplicativeExpr ('+' multiplicativeExpr | '-' multiplicativeExpr)?; + + +// [26] MultiplicativeExpr ::= UnaryExpr +// | MultiplicativeExpr MultiplyOperator UnaryExpr +// | MultiplicativeExpr 'div' UnaryExpr +// | MultiplicativeExpr 'mod' UnaryExpr +// avoiding Left recursion + + multiplicativeExpr = unaryExpr (multiplyOperator unaryExpr | 'div' unaryExpr | 'mod' unaryExpr)?; + + +// [27] UnaryExpr ::= UnionExpr | '-' UnaryExpr +// avoiding Left recursion + + unaryExpr = '-'? unionExpr; + + +// [28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' +// | NameTest +// | NodeType +// | Operator +// | FunctionName +// | AxisName +// | Literal +// | Number +// | VariableReference + + exprToken = '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' + | nameTest + | nodeType + | operator + | functionName + | axisName + | literal + | number + | variableReference; + + +// [32] Operator ::= OperatorName | MultiplyOperator | '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>=' + + operator = operatorName | multiplyOperator | '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>='; + + +// [33] OperatorName ::= 'and' | 'or' | 'mod' | 'div' + + operatorName = 'and' | 'or' | 'mod' | 'div'; + + +// [34] MultiplyOperator ::= '*' + + multiplyOperator = '*'; + + +// [7] QName ::= PrefixedName| UnprefixedName +// [8] PrefixedName ::= Prefix ':' LocalPart +// [9] UnprefixedName ::= LocalPart +// [10] Prefix ::= NCName + + prefix = /[^:]+/; + + +// [11] LocalPart ::= NCName + + localPart = /[^:]+/; + + +// [35] FunctionName ::= QName - NodeType + +// [36] VariableReference ::= '$' QName + + +// [37] NameTest ::= '*' | NCName ':' '*' | QName + + +// [38] NodeType ::= 'comment' +// | 'text' +// | 'processing-instruction' +// | 'node' diff --git a/res/.svn/tmp/tempfile.3.tmp b/res/.svn/tmp/tempfile.3.tmp new file mode 100644 index 0000000..28a825e --- /dev/null +++ b/res/.svn/tmp/tempfile.3.tmp @@ -0,0 +1,266 @@ +/* + An XPath 1.0 grammar derived from the XPath 1.0 Specification: + + http://www.w3.org/TR/xpath + +*/ + +@start = expr; + +@symbols = '//' '..' '!=' '::' '<=' '>='; + +@wordState = '_'; +@wordChars = '_' '.' ':' '-'; + +name = Word; + +ncName = name & /[^:]+/; + + + +// [1] LocationPath ::= RelativeLocationPath | AbsoluteLocationPath + + locationPath = relativeLocationPath | absoluteLocationPath; + + + +// [2] AbsoluteLocationPath ::= '/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath + + absoluteLocationPath = '/' relativeLocationPath? | abbreviatedAbsoluteLocationPath; + + +// [3] RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath +// avoiding left recursion + + // avoiding infinite loop + relativeLocationPath = step slashStep*; // | abbreviatedRelativeLocationPath; + + +// [4] Step ::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep + + step = axisSpecifier nodeTest predicate* | abbreviatedStep; + + +// [5] AxisSpecifier ::= AxisName '::' | AbbreviatedAxisSpecifier + + axisSpecifier = axisName '::' | abbreviatedAxisSpecifier; + + +// [6] AxisName ::= 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' | 'descendant' | 'descendant-or-self' +// | 'following' | 'following-sibling' | 'namespace' | 'parent' | 'preceding' | 'preceding-sibling' | 'self' + + axisName = 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' | 'descendant' | 'descendant-or-self' + | 'following' | 'following-sibling' | 'namespace' | 'parent' | 'preceding' | 'preceding-sibling' | 'self'; + + +// [7] NodeTest ::= NameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' + + nodeTest = nameTest | nodeType '(' ')' | 'processing-instruction' '(' literal ')'; + + +// [8] Predicate ::= '[' PredicateExpr ']' + + predicate = '[' predicateExpr ']'; + + +// [9] PredicateExpr ::= Expr + + predicateExpr = expr; + + +// [10] AbbreviatedAbsoluteLocationPath ::= '//' RelativeLocationPath + + abbreviatedAbsoluteLocationPath = '//' relativeLocationPath; + + +// [11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step + + abbreviatedRelativeLocationPath = relativeLocationPath '//' step; + + +// [12] AbbreviatedStep ::= '.' | '..' + + abbreviatedStep = '.' | '..'; + + +// [13] AbbreviatedAxisSpecifier ::= '@'? + + abbreviatedAxisSpecifier = '@'?; + + +// [14] Expr ::= OrExpr + + expr = orExpr; + + +// [15] PrimaryExpr ::= VariableReference | '(' Expr ')' | Literal | Number | FunctionCall + + primaryExpr = variableReference | '(' expr ')' | literal | Num | functionCall; + literal = QuotedString; + variableReference = '$' Word; + +// [16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument )* )? ')' + + functionCall = functionName '(' (argument (',' argument)* )? ')'; + + +// [17] Argument ::= Expr + + argument = expr; + + +// [18] UnionExpr ::= PathExpr | UnionExpr '|' PathExpr +// avoiding Left recursion + + unionExpr = pathExpr ('|' pathExpr)*; + + +// [19] PathExpr ::= LocationPath +// | FilterExpr +// | FilterExpr '/' RelativeLocationPath +// | FilterExpr '//' RelativeLocationPath + + pathExpr = locationPath | filterExpr (('/'| '//') relativeLocationPath)?; + + +// [20] FilterExpr ::= PrimaryExpr | FilterExpr Predicate +// avoiding Left recursion ?? + + filterExpr = primaryExpr predicate?; + + +// [21] OrExpr ::= AndExpr | OrExpr 'or' AndExpr +// avoiding Left recursion + + orExpr = andExpr ('or' andExpr)*; + + +// [22] AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr +// avoiding Left recursion + + andExpr = equalityExpr ('and' equalityExpr)*; + + +// [23] EqualityExpr ::= RelationalExpr | EqualityExpr '=' RelationalExpr | EqualityExpr '!=' RelationalExpr +// avoiding Left recursion + + equalityExpr = relationalExpr (('=' | '!=') relationalExpr)*; + + +// [24] RelationalExpr ::= AdditiveExpr +// | RelationalExpr '<' AdditiveExpr +// | RelationalExpr '>' AdditiveExpr +// | RelationalExpr '<=' AdditiveExpr +// | RelationalExpr '>=' AdditiveExpr +// avoiding Left recursion + + relationalExpr = additiveExpr (('<' | '>' | '<=' | '>=') additiveExpr)*; + + +// [25] AdditiveExpr ::= MultiplicativeExpr +// | AdditiveExpr '+' MultiplicativeExpr +// | AdditiveExpr '-' MultiplicativeExpr +// avoiding Left recursion + + additiveExpr = multiplicativeExpr (('+' | '-') multiplicativeExpr)*; + + +// [26] MultiplicativeExpr ::= UnaryExpr +// | MultiplicativeExpr MultiplyOperator UnaryExpr +// | MultiplicativeExpr 'div' UnaryExpr +// | MultiplicativeExpr 'mod' UnaryExpr +// avoiding Left recursion + + multiplicativeExpr = unaryExpr ((multiplyOperator | 'div' | 'mod') unaryExpr)*; + + +// [27] UnaryExpr ::= UnionExpr | '-' UnaryExpr +// avoiding Left recursion + + unaryExpr = '-'? unionExpr; + + +// [28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' +// | NameTest +// | NodeType +// | Operator +// | FunctionName +// | AxisName +// | Literal +// | Number +// | VariableReference + +// exprToken = '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' +// | nameTest +// | nodeType +// | operator +// | functionName +// | axisName +// | literal +// | number +// | variableReference; + + +// [32] Operator ::= OperatorName | MultiplyOperator | '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>=' + +// operator = operatorName | multiplyOperator | '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>='; + + +// [33] OperatorName ::= 'and' | 'or' | 'mod' | 'div' + +// operatorName = 'and' | 'or' | 'mod' | 'div'; + + +// [34] MultiplyOperator ::= '*' + + multiplyOperator = '*'; + + +// [7] QName ::= PrefixedName | UnprefixedName + + qName = prefixedName | unprefixedName; + + +// [8] PrefixedName ::= Prefix ':' LocalPart + + prefixedName = prefix ':' locaPart; + + +// [9] UnprefixedName ::= LocalPart + + unprefixedName = localPart; + + +// [10] Prefix ::= NCName + + prefix = ncName; + + +// [11] LocalPart ::= NCName + + localPart = ncName; + + +// [35] FunctionName ::= QName - NodeType + + functionName = qName - nodeType; + + +// [36] VariableReference ::= '$' QName + + variableReferece = '$' qName; + + +// [37] NameTest ::= '*' | NCName ':' '*' | QName + + nameTest = '*' | ncName ':' '*' | qName; + + +// [38] NodeType ::= 'comment' +// | 'text' +// | 'processing-instruction' +// | 'node' + + nodeType = 'comment' | 'text' | 'processing-instruction' | 'node'; + + \ No newline at end of file diff --git a/res/.svn/tmp/tempfile.tmp b/res/.svn/tmp/tempfile.tmp new file mode 100644 index 0000000..f90921a --- /dev/null +++ b/res/.svn/tmp/tempfile.tmp @@ -0,0 +1,108 @@ +""" +A Grammar for Apple's NSPredicate String Format Syntax + +See: http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html + +""" + +@wordState = '#'; +@wordChars = '.' '[' ']'; + +@symbols = '==' '>=' '=>' '<=' '=<' '!=' '<>' '&&' '||'; + +@start = expr; + +# Expressions + expr = orTerm orOrTerm*; + orOrTerm = or orTerm; + orTerm = andTerm andAndTerm*; + andAndTerm = and andTerm; + andTerm = primaryExpr | compoundExpr; + compoundExpr = '('.discard expr ')'.discard; + primaryExpr = predicate | negatedPredicate; + negatedPredicate = not predicate; + + predicate = aggregateOp? actualPredicate; + actualPredicate = boolPredicate | comparisonPredicate | stringTestPredicate | collectionTestPredicate; + + +# values + value = keyPath | string | num | bool | array; + + string = QuotedString; + num = Num; + bool = true | false; + true = 'true'.discard; + false = 'false'.discard; + +# arrays + array = '{' arrayContentsOpt '}'.discard; + arrayContentsOpt = Empty | arrayContents; + arrayContents = value commaValue*; + commaValue = ','.discard value; + + +# keyPaths + keyPath = Word; + +# keyPath = key dotKey*; +# key = name memberAccess?; +# name = Word; +# dotKey = '.' key; +# memberAccess = '[' (num | 'FIRST' | 'LAST' | 'SIZE') ']'; + + +# Comparison Tests + comparisonPredicate = comparisonValue comparisonOp comparisonValue; + comparisonValue = keyPath | num; + + comparisonOp = eq | gt | lt | gtEq | ltEq | notEq | between; + + eq = '=' | '=='; + gt = '>'; + lt = '<'; + gtEq = '>=' | '=>'; + ltEq = '<=' | '=<'; + notEq = '!=' | '<>'; + between = 'BETWEEN'; + +# Boolean Value Predicates + boolPredicate = truePredicate | falsePredicate; + + truePredicate = 'TRUEPREDICATE'.discard; + falsePredicate = 'FALSEPREDICATE'.discard; + + + +# Compound Expressions + and = 'AND'.discard | '&&'.discard; + or = 'OR'.discard | '||'.discard; + not = 'NOT'.discard | '!'.discard; + + + +# String Tests + stringTestPredicate = string stringTestOp value; + + stringTestOp = beginswith | contains | endswith | like | matches; + + beginswith = 'BEGINSWITH'; + contains = 'CONTAINS'; + endswith = 'ENDSWITH'; + like = 'LIKE'; + matches = 'MATCHES'; + + +# Collection Tests + collectionTestPredicate = value in collection; + collection = keyPath | array; + in = 'IN'.discard; + + +# Aggregate Operators + aggregateOp = any | some | all | none; + any = 'ANY'; + some = 'SOME'; + all = 'ALL'; + none = 'NONE'; + diff --git a/res/SRGSGrammar.txt b/res/SRGSGrammar.txt new file mode 100644 index 0000000..d894c82 --- /dev/null +++ b/res/SRGSGrammar.txt @@ -0,0 +1,218 @@ +selfIdentHeader ::= + '#ABNF' #x20 VersionNumber (#x20 CharEncoding)? ';' + [Additional constraints: + - The semicolon (';') must immediately be followed + by an end-of-line. + ] + +VersionNumber ::= + '1.0' + +CharEncoding ::= + Nmtoken + +BaseURI ::= + ABNF_URI + +LanguageCode ::= + Nmtoken + [Additional constraints: + - The language code must be a valid language identifier. + ] + +RuleName ::= + '$' ConstrainedName + +ConstrainedName ::= + Name - (Char* ('.' | ':' | '-') Char*) + +TagFormat ::= + ABNF_URI + +LexiconURI ::= + ABNF_URI | ABNF_URI_with_Media_Type + +SingleQuotedCharacters ::= + ''' [^']* ''' + +DoubleQuotedCharacters ::= + '"' [^"]* '"' + +QuotedCharacters ::= + SingleQuotedCharacters | DoubleQuotedCharacters + +Weight ::= + '/' Number '/' + + +Repeat ::= + [0-9]+ ('-' [0-9]*)? + [Additional constraints: + - A number to the right of the hyphen must not be + greater than the number to the left of the hyphen. + ] + + +Probability ::= + '/' Number '/' + [Additional constraints: + - The float value must be in the range of "0.0" + to "1.0" (inclusive). + ] + +Number ::= + [0-9]+ | [0-9]+ '.' [0-9]* | [0-9]* '.' [0-9]+ + +ExternalRuleRef ::= + '$' ABNF_URI | '$' ABNF_URI_with_Media_Type + [Additional constraints: + - The referenced grammar must have the same mode + ("voice" or "dtmf") as the referencing grammar. + - If the URI reference contains a fragment + identifier, the referenced rule must be a + public rule of another grammar. + - If the URI reference does not contain a fragment + identifier, i.e. if it is an implicit root rule reference, + then the referenced grammar must declare a root + rule. + ] + +Token ::= + Nmtoken | DoubleQuotedCharacters + +LanguageAttachment ::= + '!' LanguageCode + +Tag ::= + '{' [^}]* '}' + | '{!{' (Char* - (Char* '}!}' Char*)) '}!}' + +------------------------------------------------------------ + +ABNF_URI + and ABNF_URI_with_Media_Type + are defined +in Section 1.6 Terminology. + +Name is defined by the XML Name production [XML §2.3]. + +Nmtoken is defined by the XML Nmtoken production [XML §2.3]. + +NameChar is defined by the XML NameChar production [XML §2.3]. + +Char is defined by the XML Char production [XML §2.2]. + + + + + + + + + + + + + +grammar ::= + selfIdentHeader declaration* ruleDefinition* + +declaration ::= + baseDecl | languageDecl | modeDecl | rootRuleDecl + | tagFormatDecl | lexiconDecl | metaDecl | tagDecl + +baseDecl ::= + 'base' BaseURI ';' + [Additional constraints: + - A base declaration must not appear more than + once in grammar. + ] + +languageDecl ::= + 'language' LanguageCode ';' + [Additional constraints: + - A language declaration must not appear more than + once in grammar. + - A language declaration is required if the + grammar mode is "voice". + ] + +modeDecl ::= + 'mode' 'voice' ';' | 'mode' 'dtmf' ';' + [Additional constraints: + - A mode declaration must not appear more than + once in grammar. + ] + +rootRuleDecl ::= + 'root' RuleName ';' + [Additional constraints: + - A root rule declaration must not appear more + than once in grammar. + - The root rule must be a rule that is defined + within the grammar. + ] + +tagFormatDecl ::= + 'tag-format' TagFormat ';' + [Additional constraints: + - A tag-format declaration must not appear more + than once in grammar. + ] + +lexiconDecl ::= + 'lexicon' LexiconURI ';' + +metaDecl ::= + 'http-equiv' QuotedCharacters 'is' QuotedCharacters ';' + | 'meta' QuotedCharacters 'is' QuotedCharacters ';' + + +tagDecl ::= + Tag ';' + + +ruleDefinition ::= + scope? RuleName '=' ruleExpansion ';' + [Additional constraints: + - The rule name must be unique within a grammar, + i.e. no rule must be defined more than once + within a grammar. + ] + +scope ::= + 'private' | 'public' + +ruleExpansion ::= + ruleAlternative ( '|' ruleAlternative )* + +ruleAlternative ::= + Weight? sequenceElement+ + +sequenceElement ::= + subexpansion | subexpansion repeatOperator + +subexpansion ::= + Token LanguageAttachment? + | ruleRef + | Tag + | '(' ')' + | '(' ruleExpansion ')' LanguageAttachment? + | '[' ruleExpansion ']' LanguageAttachment? + +ruleRef ::= + localRuleRef | ExternalRuleRef | specialRuleRef + +localRuleRef ::= + RuleName + [Additional constraints: + - The referenced rule must be defined within the + same grammar. + ] + +specialRuleRef ::= + '$NULL' | '$VOID' | '$GARBAGE' + + +repeatOperator ::= + '<' Repeat Probability? '>' \ No newline at end of file diff --git a/res/apple-boss.json b/res/apple-boss.json new file mode 100644 index 0000000..a082201 --- /dev/null +++ b/res/apple-boss.json @@ -0,0 +1,80 @@ +{"ysearchresponse": + {"responsecode":"200", + "nextpage":"\/ysearch\/web\/v1\/apple?appid=LcU4qWbV34HAOHTXXZbYfB1_AgYH5_AhlzYZ6Qvm4hdEDw6B1MicVEIYPtQLOTnb&format=json&start=10", + "totalhits":"50793319", + "deephits":"1510000000", + "count":"10", + "start":"0", + "resultset_web": + [{"abstract":"Macintosh hardware, software, and Internet tools. Offering Quicktime info, developer resources, and other items related to Apple<\/b> computers.", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnNTdsamw3BGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzAEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=10qut2vvd\/**http%3A\/\/www.apple.com\/","date":"2008\/08\/12", + "dispurl":"www.apple.com<\/b>", + "size":"10765", + "title":"Apple<\/b>, Inc.", + "url":"http:\/\/www.apple.com\/"}, + {"abstract":"The official online store for iPods, Mac laptops and Macintosh computers, with free shipping over $50. Also featuring software such as Final Cut and Office 2008 for Mac.", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnaTZsYjRpBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzEEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=1fufchaio\/**http%3A\/\/rdrw1.yahoo.com\/click%3Fu=http%3A\/\/feedpoint.net\/r\/redir.jsp%253Fengine%253DINK%2526pcid%253D597997%2526fid%253D-2%2526url%253Dhttp%3A\/\/store.apple.com\/1-800-MY-APPLE\/WebObjects\/AppleStore%253Faosid%253Dp210%2526cid%253DOAS-US-YPI%2526src%253Dyssp%26y=04C664CB0EAC6A0CE6%26i=1473%26c=59131%26q=02%255ESSHPM%255BL7~oosz6%26e=utf-8%26r=1%26d=wow~LcU4qWbV34HAOHTXXZbYfB1_AgYH5_AhlzYZ6Qvm4hdEDw6B1MicVEIYPtQLOTnb-en-us%26n=LN94K1HIB6HKGRUL%26s=1%26t=%26m=48A3A234%26x=051726E3806650ACD5A44E8C8BD13ADACC", + "date":"2008\/08\/13", + "dispurl":"store.apple.com<\/b>", + "size":"49418", + "title":"Mac Laptops, iPods and Macintosh Computers | Apple<\/b> Online Store", + "url":"http:\/\/store.apple.com\/"}, + {"abstract":"Encyclopedia article about the computer company, including history, product lines, and corporate affairs. ...<\/b> Apple's<\/b> software products include the Mac OS X ...<\/b>", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnNHB0OGduBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzIEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=11c328ll9\/**http%3A\/\/en.wikipedia.org\/wiki\/Apple_Inc.", + "date":"2008\/08\/10", + "dispurl":"en.wikipedia.org<\/b>\/wiki\/Apple<\/b>_Inc.", + "size":"285957", + "title":"Apple<\/b> Inc. - Wikipedia, the free encyclopedia", + "url":"http:\/\/en.wikipedia.org\/wiki\/Apple_Inc."}, + {"abstract":"Detailed overview of the apple's<\/b> origins, flavors, and health benefits.", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnMmh1a3BkBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzMEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=117d3a7f6\/**http%3A\/\/en.wikipedia.org\/wiki\/Apple", + "date":"2008\/08\/11", + "dispurl":"en.wikipedia.org<\/b>\/wiki\/Apple<\/b>", + "size":"128319", + "title":"Apple<\/b> - Wikipedia", + "url":"http:\/\/en.wikipedia.org\/wiki\/Apple"}, + {"abstract":"Your complete guide to all things Macintosh. Get the latest reviews, news, videos, downloads, tips, and more for Mac laptops, desktops, and OS X 10.5 (Leopard)", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnNWR1czdzBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzQEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=117n1p7jv\/**http%3A\/\/www.cnet.com\/apple-mac.html", + "date":"2008\/08\/09", + "dispurl":"www.cnet.com<\/b>\/apple<\/b>-mac.html", + "size":"102719", + "title":"Apple<\/b> Mac: Mac OS, Mac laptop, Mac desktop - CNET.com", + "url":"http:\/\/www.cnet.com\/apple-mac.html"}, + {"abstract":"Watch Apple<\/b> CEO Steve Jobs unveil iPhone 3G, the App Store, MobileMe, and more ...<\/b> Copyright \u00a9 2008 Apple<\/b> Inc. All rights reserved. Terms of Use | Privacy Policy ...<\/b>", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnbjkwdjF0BGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzUEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=1272or2mo\/**http%3A\/\/events.apple.com.edgesuite.net\/0806wdt546x\/event\/index.html", + "date":"2008\/07\/16", + "dispurl":"events.apple.com.edgesuite.net<\/b>\/0806wdt546x\/event\/index.html", + "size":"17259", + "title":"Apple<\/b> - QuickTime - WWDC 2008 Keynote", + "url":"http:\/\/events.apple.com.edgesuite.net\/0806wdt546x\/event\/index.html"}, + {"abstract":"Apple's<\/b> GrayShare technology gives you the ability to print over 130 shades of ...<\/b> are part of the CSW 4000 Series Update 1.0 posted on Apple<\/b> Software Updates. ...<\/b>", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRndXBuYjJ1BGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzYEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=11r2bnul4\/**http%3A\/\/docs.info.apple.com\/article.html%3Fartnum=30153", + "date":"2004\/09\/20", + "dispurl":"docs.info.apple.com<\/b>\/article.html?artnum=30153", + "size":"37078", + "title":"StyleWriter Printers: Print Drivers and Cable Matrix", + "url":"http:\/\/docs.info.apple.com\/article.html?artnum=30153"}, + {"abstract":"8 Jumps Apple<\/b> releases firmware 2.0 for iPhone, iPod Touch ...<\/b> Apple<\/b> underestimated the load on their servers, which left many users stuck on ...<\/b>", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnY3I0MWFoBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzcEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=10pb88a2t\/**http%3A\/\/apple.qj.net\/", + "date":"2008\/07\/14", + "dispurl":"apple.qj.net<\/b>", + "size":"82416", + "title":"QJ.NET - QuickJump Home - Apple<\/b> News - QJ.NET", + "url":"http:\/\/apple.qj.net\/"}, + {"abstract":"Daily Apple<\/b> news updates, forums, reviews, and features.", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnN2tqM2ZpBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzgEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=111js1asj\/**http%3A\/\/www.appleinsider.com\/", + "date":"2008\/08\/12", + "dispurl":"www.appleinsider.com<\/b>", + "size":"82410", + "title":"AppleInsider", + "url":"http:\/\/www.appleinsider.com\/"}, + {"abstract":"Offers threaded discussions related to news for Apple<\/b> users.", + "clickurl":"http:\/\/us.lrd.yahoo.com\/_ylc=X3oDMTRnaTlmZm5iBGFwcGlkA0xjVTRxV2JWMzRIQU9IVFhYWmJZZkIxX0FnWUg1X0FobHpZWjZRdm00aGRFRHc2QjFNaWNWRUlZUHRRTE9UbmIEcG9zAzkEc2VydmljZQNZU2VhcmNoV2ViBHNyY3B2aWQDa0Z2c25VTGFSV3o2WVEyZnBObGVyUURwWXMucUJVaWpvalFBQlJuZw--\/SIG=10vvqn6ao\/**http%3A\/\/apple.slashdot.org\/", + "date":"2008\/08\/13", + "dispurl":"apple.slashdot.org<\/b>", + "size":"43683", + "title":"apple<\/b>.slashdot.org", + "url":"http:\/\/apple.slashdot.org\/"} + ] + } +} \ No newline at end of file diff --git a/res/apple-boss.xml b/res/apple-boss.xml new file mode 100644 index 0000000..14a3187 --- /dev/null +++ b/res/apple-boss.xml @@ -0,0 +1,96 @@ + + + + + + Apple computers.]]> + + 2008/08/17 + apple.com]]> + 10765 + <![CDATA[<b>Apple</b>, Inc.]]> + http://www.apple.com/ + + + The official online store for iPods, Mac laptops and Macintosh computers, with free shipping over $50. Also featuring software such as Final Cut and Office 2008 for Mac. + + 2008/08/18 + store.apple.com]]> + 101744 + <![CDATA[Mac Laptops, iPods and Macintosh Computers | <b>Apple</b> Online Store]]> + http://store.apple.com/ + + + ... Apple's software products include the Mac OS X ...]]> + + 2008/08/10 + en.wikipedia.org/wiki/Apple_Inc.]]> + 285957 + <![CDATA[<b>Apple</b> Inc. - Wikipedia, the free encyclopedia]]> + http://en.wikipedia.org/wiki/Apple_Inc. + + + Apple's software products include the Mac OS X operating system, iTunes media ... Apple was established on April 1, 1976 by Steve Jobs, Steve Wozniak, and Ronald ...]]> + + 2008/08/18 + en.wikipedia.org/wiki/Apple_Computer]]> + 249715 + <![CDATA[<b>Apple</b> Inc. - Wikipedia, the free encyclopedia]]> + http://en.wikipedia.org/wiki/Apple_Computer + + + Your complete guide to all things Macintosh. Get the latest reviews, news, videos, downloads, tips, and more for Mac laptops, desktops, and OS X 10.5 (Leopard) + + 2008/08/18 + cnet.com/apple-mac.html]]> + 100558 + <![CDATA[<b>Apple</b> Mac: Mac OS, Mac laptop, Mac desktop - CNET.com]]> + http://www.cnet.com/apple-mac.html + + + Apple CEO Steve Jobs unveil iPhone 3G, the App Store, MobileMe, and more ... Copyright © 2008 Apple Inc. All rights reserved. Terms of Use | Privacy Policy ...]]> + + 2008/07/16 + events.apple.com.edgesuite.net/0806wdt546x/event/index.html]]> + 17259 + <![CDATA[<b>Apple</b> - QuickTime - WWDC 2008 Keynote]]> + http://events.apple.com.edgesuite.net/0806wdt546x/event/index.html + + + Apple's GrayShare technology gives you the ability to print over 130 shades of ... are part of the CSW 4000 Series Update 1.0 posted on Apple Software Updates. ...]]> + + 2004/09/20 + docs.info.apple.com/article.html?artnum=30153]]> + 37078 + StyleWriter Printers: Print Drivers and Cable Matrix + http://docs.info.apple.com/article.html?artnum=30153 + + + Apple releases firmware 2.0 for iPhone, iPod Touch ... Apple underestimated the load on their servers, which left many users stuck on ...]]> + + 2008/07/14 + apple.qj.net]]> + 82416 + <![CDATA[QJ.NET - QuickJump Home - <b>Apple</b> News - QJ.NET]]> + http://apple.qj.net/ + + + Apple users.]]> + + 2008/08/18 + apple.slashdot.org]]> + 44408 + <![CDATA[<b>apple</b>.slashdot.org]]> + http://apple.slashdot.org/ + + + Apple Authorized Training Centers offer Mac OS X and Pro Apps exams ... Publicize your certifications on Apple's website, and connect with clients and employers ...]]> + + 2008/07/25 + prometric.com/apple/default.htm]]> + 13318 + <![CDATA[Prometric: <b>Apple</b> Certification]]> + http://www.prometric.com/apple/default.htm + + + diff --git a/res/arithmetic.grammar b/res/arithmetic.grammar new file mode 100644 index 0000000..9b2e038 --- /dev/null +++ b/res/arithmetic.grammar @@ -0,0 +1,10 @@ +@start = expr; +expr = term (plusTerm | minusTerm)*; +term = factor (timesFactor | divFactor)*; +plusTerm = '+' term; +minusTerm = '-' term; +factor = phrase exponentFactor | phrase; +timesFactor = '*' factor; +divFactor = '/' factor; +exponentFactor = '^' factor; +phrase = '(' expr ')' | Number; diff --git a/res/c.grammar b/res/c.grammar new file mode 100644 index 0000000..03fa75f --- /dev/null +++ b/res/c.grammar @@ -0,0 +1,314 @@ + translation-unit: + external-declaration + translation-unit external-declaration + + external-declaration: + function-definition + declaration + + function-definition: + declaration-specifiersopt declarator declaration-listopt compound-statement + + declaration: + declaration-specifiers init-declarator-listopt; + + declaration-list: + declaration + declaration-list declaration + + declaration-specifiers: + storage-class-specifier declaration-specifiersopt + type-specifier declaration-specifiersopt + type-qualifier declaration-specifiersopt + + storage-class specifier: one of + auto register static extern typedef + + type specifier: one of + void char short int long float double signed + unsigned struct-or-union-specifier enum-specifier typedef-name + + type-qualifier: one of + const volatile + + struct-or-union-specifier: + struct-or-union identifieropt { struct-declaration-list } + struct-or-union identifier + + struct-or-union: one of + struct union + + struct-declaration-list: + struct declaration + struct-declaration-list struct declaration + + init-declarator-list: + init-declarator + init-declarator-list, init-declarator + + init-declarator: + declarator + declarator = initializer + + struct-declaration: + specifier-qualifier-list struct-declarator-list; + + specifier-qualifier-list: + type-specifier specifier-qualifier-listopt + type-qualifier specifier-qualifier-listopt + + struct-declarator-list: + struct-declarator + struct-declarator-list , struct-declarator + + struct-declarator: + declarator + declaratoropt : constant-expression + + enum-specifier: + enum identifieropt { enumerator-list } + enum identifier + + enumerator-list: + enumerator + enumerator-list , enumerator + + enumerator: + identifier + identifier = constant-expression + + declarator: + pointeropt direct-declarator + + direct-declarator: + identifier + (declarator) + direct-declarator [ constant-expressionopt ] + direct-declarator ( parameter-type-list ) + direct-declarator ( identifier-listopt ) + + pointer: + * type-qualifier-listopt + * type-qualifier-listopt pointer + + type-qualifier-list: + type-qualifier + type-qualifier-list type-qualifier + + parameter-type-list: + parameter-list + parameter-list , ... + + parameter-list: + parameter-declaration + parameter-list , parameter-declaration + + parameter-declaration: + declaration-specifiers declarator + declaration-specifiers abstract-declaratoropt + + identifier-list: + identifier + identifier-list , identifier + + initializer: + assignment-expression + { initializer-list } + { initializer-list , } + + initializer-list: + initializer + initializer-list , initializer + + type-name: + specifier-qualifier-list abstract-declaratoropt + + abstract-declarator: + pointer + pointeropt direct-abstract-declarator + + direct-abstract-declarator: + ( abstract-declarator ) + direct-abstract-declaratoropt [constant-expressionopt] + direct-abstract-declaratoropt (parameter-type-listopt) + + typedef-name: + identifier + + statement: + labeled-statement + expression-statement + compound-statement + selection-statement + iteration-statement + jump-statement + + labeled-statement: + identifier : statement + case constant-expression : statement + default : statement + + expression-statement: + expressionopt; + + compound-statement: + { declaration-listopt statement-listopt } + + statement-list: + statement + statement-list statement + + selection-statement: + if (expression) statement + if (expression) statement else statement + switch (expression) statement + + iteration-statement: + while (expression) statement + do statement while (expression); + for (expressionopt; expressionopt; expressionopt) statement + + jump-statement: + goto identifier; + continue; + break; + return expressionopt; + + expression: + assignment-expression + expression , assignment-expression + + assignment-expression: + conditional-expression + unary-expression assignment-operator assignment-expression + + assignment-operator: one of + = *= /= %= += -= <<= >>= &= ^= |= + + conditional-expression: + logical-OR-expression + logical-OR-expression ? expression : conditional-expression + + constant-expression: + conditional-expression + + logical-OR-expression: + logical-AND-expression + logical-OR-expression || logical-AND-expression + + logical-AND-expression: + inclusive-OR-expression + logical-AND-expression && inclusive-OR-expression + + inclusive-OR-expression: + exclusive-OR-expression + inclusive-OR-expression | exclusive-OR-expression + + exclusive-OR-expression: + AND-expression + exclusive-OR-expression ^ AND-expression + + AND-expression: + equality-expression + AND-expression & equality-expression + + equality-expression: + relational-expression + equality-expression == relational-expression + equality-expression != relational-expression + + relational-expression: + shift-expression + relational-expression < shift-expression + relational-expression > shift-expression + relational-expression <= shift-expression + relational-expression >= shift-expression + + shift-expression: + additive-expression + shift-expression << additive-expression + shift-expression >> additive-expression + + additive-expression: + multiplicative-expression + additive-expression + multiplicative-expression + additive-expression - multiplicative-expression + + multiplicative-expression: + multiplicative-expression * cast-expression + multiplicative-expression / cast-expression + multiplicative-expression % cast-expression + + cast-expression: + unary expression + (type-name) cast-expression + + unary-expression: + postfix expression + ++unary expression + --unary expression + unary-operator cast-expression + sizeof unary-expression + sizeof (type-name) + + unary operator: one of + & * + - ~ ! + + postfix-expression: + primary-expression + postfix-expression[expression] + postfix-expression(argument-expression-listopt) + postfix-expression.identifier + postfix-expression->+identifier + postfix-expression++ + postfix-expression-- + primary-expression: + identifier + constant + string + (expression) + + argument-expression-list: + assignment-expression + assignment-expression-list , assignment-expression + + constant: + integer-constant + character-constant + floating-constant + enumeration-constant + +# The following grammar for the preprocessor summarizes the structure of control lines, but is not suitable for mechanized parsing. It includes the symbol text, which means ordinary program text, non-conditional preprocessor control lines, or complete preprocessor conditional instructions. + + control-line: + # define identifier token-sequence + # define identifier(identifier, ... , identifier) token-sequence + # undef identifier + # include + # include "filename" + # line constant "filename" + # line constant + # error token-sequenceopt + # pragma token-sequenceopt + # + preprocessor-conditional + + preprocessor-conditional: + if-line text elif-parts else-partopt #endif + + if-line: + # if constant-expression + # ifdef identifier + # ifndef identifier + + elif-parts: + elif-line text + elif-partsopt + + elif-line: + # elif constant-expression + + else-part: + else-line text + else-line: + #else \ No newline at end of file diff --git a/res/css.css b/res/css.css new file mode 100644 index 0000000..0c139b9 --- /dev/null +++ b/res/css.css @@ -0,0 +1,71 @@ +openCurly, +closeCurly, +openBracket, +closeBracket, +eq, +comma, +colon, +semi, +openParen, +closeParen, +gt, +tilde, +pipe, +fwdSlash, +hash, +dot { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +selectorWord { + color:rgb(255, 255, 255); + background-color:rgb(20, 20, 26); + font-family:'Georgia'; + font-size:15px; +} + +selectorQuotedString { + color:rgb(196.35, 45.9, 51.0); + background-color:rgb(20, 20, 26); + font-family:'Georgia'; + font-size:15px; +} + +constant, string, semi { + color:rgb(196.35, 45.9, 51.0); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +property { + color:rgb(84.15, 114.75, 122.4); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +num { + color:rgb(22.95, 158.1, 188.7); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +//text { +// color:rgb(61.2, 178.5, 68.85); +// background-color:rgb(30, 30, 36); +// font-family:'Monaco'; +// font-size:11px; +//} + +word { + color:rgb(255, 255, 255); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + diff --git a/res/css.grammar b/res/css.grammar new file mode 100644 index 0000000..e414a53 --- /dev/null +++ b/res/css.grammar @@ -0,0 +1,44 @@ +/** + A Grammar for CSS + + This grammar is intentionally lenient/forgiving. + The purpose is to highlight, not validate (possibly invalid) CSS. + +*/ + +@multiLineComments = '/*' '*/'; +@wordState = '-'; + +@start = ruleset*; +ruleset = selectors openCurly decls closeCurly; +selectors = selector commaSelector*; +selector = (selectorWord | hash | dot |colon | gt | openBracket | closeBracket | eq | selectorQuotedString | tilde | pipe)+; +selectorWord = Word; +selectorQuotedString = QuotedString; +commaSelector = comma selector; +decls = Empty | actualDecls; +actualDecls = decl decl*; +decl = property colon expr semi; +property = Word; +expr = (string | constant | num | openParen | closeParen | comma | fwdSlash)+; +string = QuotedString; +constant = Word; + +openCurly = '{'; +closeCurly = '}'; +openBracket = '['; +closeBracket = ']'; +eq = '='; +comma = ','; +colon = ':'; +semi = ';'; +openParen = '('; +closeParen = ')'; +gt = '>'; +tilde = '~'; +pipe = '|'; +fwdSlash = '/'; +hash = '#'; +dot = '.'; + +num = Number; \ No newline at end of file diff --git a/res/css2_1.grammar b/res/css2_1.grammar new file mode 100644 index 0000000..7e412ca --- /dev/null +++ b/res/css2_1.grammar @@ -0,0 +1,203 @@ +/* + This is an attempt to convert the official CSS 2.1 grammar to TDParseKit +*/ + + +@start = stylesheet; + +// stylesheet +// : [ CHARSET_SYM S* STRING S* ';' ]? +// [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* +// [ [ ruleset | media | page | font_face ] [S|CDO|CDC]* ]* +// ; +charsetSymbol = '@' 'charset'; +charset = (charsetSymbol Word ';'); +stylesheet = charset? import* contents; +contents = (ruleset | media | page | fontFace)*; +stuff = (cdo|cdc)*; + + +// import +// : IMPORT_SYM S* +// [STRING|URI] S* [ medium [ ',' S* medium]* ]? ';' S* +// ; +mediaList = medium commaMedium*; +commaMedium = ',' medium; +importSymbol = '@' 'import'; +import = importSymbol (Word | uri) mediaList? ';'; + + +// media +// : MEDIA_SYM S* medium [ ',' S* medium ]* '{' S* ruleset* '}' S* +// ; + +mediaSymbol = '@' 'media'; +media = mediaSymbol mediaList '{' ruleset* '}'; + + + +// medium +// : IDENT S* +// ; +medium = identifier; + + + +// page +// : PAGE_SYM S* IDENT? pseudo_page? S* +// '{' S* declaration [ ';' S* declaration ]* '}' S* +// ; +pageSymbol = '@' 'page'; +page = pagePrefix pageBody; +pagePrefix = pageSymbol identifier? pseudoPage?; +pageBody = '{' decl decl* '}'; + + +// pseudo_page +// : ':' IDENT +// ; +pseudoPage = ':' identifier; + + +// font_face +// : FONT_FACE_SYM S* +// '{' S* declaration [ ';' S* declaration ]* '}' S* +// ; +fontFaceSymbol = '@' fontFace; +fontFace = fontFaceSymbol '{' decl decl* '}'; + + +// operator +// : '/' S* | ',' S* | /* empty * / +// ; +operator = '/' | ',' | Empty; + + + +// combinator +// : '+' S* | '>' S* | /* empty * / +// ; +combinator = '+' | '>' | Empty; + + + +// unary_operator +// : '-' | '+' +// ; +unaryOperator = '-' | '+'; + + +// property +// : IDENT S* +// ; +property = identifier; + + +// ruleset +// : selector [ ',' S* selector ]* +// '{' S* declaration [ ';' S* declaration ]* '}' S* +// ; +ruleset = selector commaSelector* '{' decl decl* '}'; +commaSelector = ',' selector; + + +// selector +// : simple_selector [ combinator simple_selector ]* +// ; +selector = simpleSelector (combinator simpleSelector)*; + + +// simple_selector +// : element_name? [ HASH | class | attrib | pseudo ]* S* +// ; +simpleSelector = elementName? (hash | class | attrib | pseudo)*; + + +// class +// : '.' IDENT +// ; +class = '.' identifier; + + +// element_name +// : IDENT | '*' +// ; +elementName = identifier | '*'; + + +// attrib +// : '[' S* IDENT S* [ [ '=' | INCLUDES | DASHMATCH ] S* +// [ IDENT | STRING ] S* ]? ']' +// ; +attrib = '[' identifier (('=' | includes | dashmatch) (identifier | Word))? ']'; + + +// pseudo +// : ':' [ IDENT | FUNCTION S* IDENT S* ')' ] +// ; +pseudo = ':' identifier | function identifier ')'; + + +// declaration +// : property ':' S* expr prio? +// | /* empty * / +// ; +decl = (property ':' expr prio?) | Empty; + + +// prio +// : IMPORTANT_SYM S* +// ; +prio = '!' 'important'; + + +// expr +// : term [ operator term ]* +// ; +expr = term (operator term)*; + + +// term +// : unary_operator? +// [ NUMBER S* | PERCENTAGE S* | LENGTH S* | EMS S* | EXS S* | ANGLE S* | +// TIME S* | FREQ S* | function ] +// | STRING S* | IDENT S* | URI S* | RGB S* | UNICODERANGE S* | hexcolor +// ; +term = unaryOperator? (Number | percentage | length | ems | exs | angle | time | freq | function) + | Word | identifier | uri | hexcolor; + + +// function +// : FUNCTION S* expr ')' S* +// ; +function = XXX expr ')'; + + +// * +// * There is a constraint on the color that it must +// * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) +// * after the "#"; e.g., "#000" is OK, but "#abcd" is not. +// * +// hexcolor +// : HASH S* +// ; +hexcolor = hash; + +cdo = ''; +includes = '~='; +dashmatch = '|='; + +identifier = Word; + +hash = '#' (Word|Number); +ems = Number 'em'; +exs = Number 'ex'; +length = Number ('px'|'cm'|'mm'|'in'|'pt'|'pc'); +angle = Number ('deg'|'rad'|'grad'); +time = Number ('s'|'ms'); +freq = Number ('hz'|'khz'); +dimension = Number identifier; +percentage = Number '%'; +uri = 'url' '(' (Word|Symbol|Number)+ ')'; +function = identifier '('; diff --git a/res/date.grammar b/res/date.grammar new file mode 100644 index 0000000..b1084a9 --- /dev/null +++ b/res/date.grammar @@ -0,0 +1,40 @@ +/* + + TDParseKit Grammar Syntax now supports regular expressions (powered by RegExKit Lite) + + So, as a trivial (and useless) example, the following TDPK grammar + specifies a tiny language which allows dates in the format of: + + 2009-06-21 + +*/ + +@start = date; // the 'date' production is the outermost production in this grammar + +date = /\d{4}/ '-' /\d{2}/ '-' /\d{2}/; // will match any sequence of tokens whose `stringValue` property matches these regexes + // separated by two '-' chars + + + + + + + + +/* +NOTE: +An equivalent grammar could be expressed in many ways. Here's an equivalent grammar with explicit ObjC assembler callbacks added: + + +@start = year dash month dash day; + +dash = '-'; + +year (matchedYear:) = /\d{4}/; // when matched, your specified `assembler` object (think delegate) will receive a + // callback to it's `-matchedYear:` method with a `PKAssembly` argument. + // the token matched by the regex will on the top of the assebly's stack ready for you + +month (matchedMonth:) = /\d{2}/; +day (matchedDay:) = /\d{2}/; + +*/ \ No newline at end of file diff --git a/res/erb.grammar b/res/erb.grammar new file mode 100644 index 0000000..a8ff87a --- /dev/null +++ b/res/erb.grammar @@ -0,0 +1,15 @@ +@symbols = '<@' '<@=' '@>'; + +@start = (ignored | importantStuff)*; +ignored = ~startMarker; + +importantStuff = print | eval; +print = printStartMarker keyPath endMarker; +eval = evalStartMarker keyPath endMarker; + +keyPath = Word dotWord*; +dotWord = ('.' Word); + +printStartMarker = '<@='; +evalStartMarker = '<@'; +endMarker = '@>'; \ No newline at end of file diff --git a/res/example.css b/res/example.css new file mode 100644 index 0000000..790775a --- /dev/null +++ b/res/example.css @@ -0,0 +1,54 @@ +.openCurly > closeCurly, +#comma[foo], +colon[foo=bar] bat, +openParen[foo="bar"], +closeParen, +name:psuedo-name, +foo[bar|=baz] +px, +px, +rgb { + -webkit-border-radius:12px; + color: rgb(178.5, 35.7, 135.15); + background-color: rgb(30, 30, 36); + font-family: 'Monaco'; + font-size: 11 em; + font-weight: bold; +} + +body { + font:14px/1.4 "Lucida Grande", LucidaGrande, Verdana, Helvetica, Arial; +} + +#content { + position:relative; + width:650px; + margin:20px auto; +} + +#icon { + float:left; + margin-right:15px; +} + +h1 { + padding-top:15px; + font-size:48px; +} + +#desc { + position:absolute; + left:170px; top:75px; +} + +#screenshot { + display:block; + width:500px; + margin:80px auto 35px; + border:1px solid silver; +} + +#copyright, #credits, #hostedby { + font-size:small; + text-align:center; +} diff --git a/res/example.html b/res/example.html new file mode 100644 index 0000000..beb23a0 --- /dev/null +++ b/res/example.html @@ -0,0 +1,28 @@ + + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + + CFBundleName + ${PRODUCT_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.parsekit.ParseKit + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + FMWK + CFBundleSignature + ???? + CFBundleVersion + 1.4 + NSPrincipalClass + + + \ No newline at end of file diff --git a/res/example1.srgs b/res/example1.srgs new file mode 100644 index 0000000..2549db4 --- /dev/null +++ b/res/example1.srgs @@ -0,0 +1,24 @@ +#ABNF 1.0 ISO-8859-1; + +// Default grammar language is US English +language en-US; + +// Single language attachment to tokens +// Note that "fr-CA" (Canadian French) is applied to only +// the word "oui" because of precedence rules +$yes = yes | oui!fr-CA; + +// Single language attachment to an expansion +$people1 = (Michel Tremblay | André Roy)!fr-CA; + +// Handling language-specific pronunciations of the same word +// A capable speech recognizer will listen for Mexican Spanish and +// US English pronunciations. +$people2 = Jose!en-US | Jose!es-MX; + +/** + * Multi-lingual input possible + * @example may I speak to André Roy + * @example may I speak to Jose + */ +public $request = may I speak to ($people1 | $people2); \ No newline at end of file diff --git a/res/html.css b/res/html.css new file mode 100644 index 0000000..43d3ba0 --- /dev/null +++ b/res/html.css @@ -0,0 +1,63 @@ +lt, gt, fwdSlash, endTagStart, eq { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +eq { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +tagName { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +attrValue { + color:rgb(84.15, 114.75, 122.4); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +attrName { + color:rgb(84.15, 114.75, 122.4); + background-color:rgb(20, 20, 26); + font-family:'Monaco'; + font-size:11px; +} + +text { +// color:rgb(61.2, 178.5, 68.85); + color:rgb(255, 255, 255); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +comment { + color:rgb(61.2, 178.5, 68.85); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +pi { + color:rgb(22.95, 158.1, 188.7); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +doctype { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} \ No newline at end of file diff --git a/res/html.grammar b/res/html.grammar new file mode 100644 index 0000000..4754f8d --- /dev/null +++ b/res/html.grammar @@ -0,0 +1,41 @@ +/* + An HTML grammar for use with TDParseKit + + this grammar is intentionally very forgiving (non-strict) + the point here is to highlight, not validate, HTML. +*/ + +@multiLineComments = ''; +@commentState = '<'; +@commentState.fallbackState = delimitState; + +@delimitedString = '' nil; +@delimitedString = '' nil; +@delimitState.fallbackState = symbolState; + +@start = any*; +any = element | text | doctype | pi | comment; + +pi = DelimitedString(''); + +doctype = DelimitedString(''); +element = emptyTag | startTag elementContent* endTag; +elementContent = element | text | comment | pi; +text = /[^<]+/; + +emptyTag = lt tagName attr* fwdSlash gt; +startTag = lt junk? tagName attr* gt; +endTag = lt fwdSlash tagName gt; + +tagName = Word; + +attr = attrName (eq attrValue)?; +attrName = Word; +attrValue = QuotedString; + +eq = '='; +lt = '<'; +gt = '>'; +fwdSlash = '/'; + +comment = Comment; diff --git a/res/javascript.grammar b/res/javascript.grammar new file mode 100644 index 0000000..af9032f --- /dev/null +++ b/res/javascript.grammar @@ -0,0 +1,430 @@ +@symbols = '||' '&&' '!=' '!==' '==' '===' '<=' '>=' '++' '--' '+=' '-=' '*=' '/=' '%=' '<<' '>>' '>>>' '<<=' '>>=' '>>>=' '&=' '^=' '|='; + +@reportsCommentTokens = YES; +@commentState = '/'; +@singleLineComments = '//'; +@multiLineComments = '/*' '*/'; + +@start = program; + +if = 'if'; +else = 'else'; +while = 'while'; +for = 'for'; +in = 'in'; +break = 'break'; +continue = 'continue'; +with = 'with'; +return = 'return'; +var = 'var'; +delete = 'delete'; +new = 'new'; +this = 'this'; +false = 'false'; +true = 'true'; +null = 'null'; +undefined = 'undefined'; +void = 'void'; +typeof = 'typeof'; +instanceof = 'instanceof'; +function = 'function'; + +openCurly = '{'; +closeCurly = '}'; +openParen = '('; +closeParen = ')'; +openBracket = '['; +closeBracket = ']'; +comma = ','; +dot = '.'; +semi = ';'; +colon = ':'; +equals = '='; +not = '!'; +lt = '<'; +gt = '>'; +amp = '&'; +pipe = '|'; +caret = '^'; +tilde = '~'; +question = '?'; +plus = '+'; +minus = '-'; +times = '*'; +div = '/'; +mod = '%'; + +or = '||'; +and = '&&'; +ne = '!='; +isnot = '!=='; +eq = '=='; +is = '==='; +le = '<='; +ge = '>='; +plusPlus = '++'; +minusMinus = '--'; +plusEq = '+='; +minusEq = '-='; +timesEq = '*='; +divEq = '/='; +modEq = '%='; +shiftLeft = '<<'; +shiftRight = '>>'; +shiftRightExt = '>>>'; +shiftLeftEq = '<<='; +shiftRightEq = '>>='; +shiftRightExtEq = '>>>='; +andEq = '&='; +xorEq = '^='; +orEq = '|='; + +assignmentOperator = equals | plusEq | minusEq | timesEq | divEq | modEq | shiftLeftEq | shiftRightEq | shiftRightExtEq | andEq | xorEq | orEq; + +relationalOperator = lt | gt | ge | le | instanceof; +equalityOperator = eq | ne | is | isnot; + +shiftOperator = shiftLeft | shiftRight | shiftRightExt; +incrementOperator = plusPlus | minusMinus; +unaryOperator = tilde | delete | typeof | void; + +multiplicativeOperator = times | div | mod; + + + +// Program: +// empty +// Element Program + +program = element+; + + + +// Element: +// function Identifier ( ParameterListOpt ) CompoundStatement +// Statement + +element = func | stmt; +func = function identifier openParen paramListOpt closeParen compoundStmt; + + + +// ParameterListOpt: +// empty +// ParameterList + +paramListOpt = Empty | paramList; + + + +// ParameterList: +// Identifier +// Identifier , ParameterList + +paramList = identifier commaIdentifier*; +commaIdentifier = comma identifier; + + + +// CompoundStatement: +// { Statements } + +compoundStmt = openCurly stmts closeCurly; + + + +// Statements: +// empty +// Statement Statements + +stmts = stmt*; + + + +// Statement: +// ; +// if Condition Statement +// if Condition Statement else Statement +// while Condition Statement +// ForParen ; ExpressionOpt ; ExpressionOpt ) Statement +// ForBegin ; ExpressionOpt ; ExpressionOpt ) Statement +// ForBegin in Expression ) Statement +// break ; +// continue ; +// with ( Expression ) Statement +// return ExpressionOpt ; +// CompoundStatement +// VariablesOrExpression ; + +stmt = semi | ifStmt | ifElseStmt | whileStmt | forParenStmt | forBeginStmt | forInStmt | breakStmt | continueStmt | withStmt | returnStmt | compoundStmt | variablesOrExprStmt; +ifStmt = if condition stmt; +ifElseStmt = if condition stmt else stmt; +whileStmt = while condition stmt; +forParenStmt = forParen semi exprOpt semi exprOpt closeParen stmt; +forBeginStmt = forBegin semi exprOpt semi exprOpt closeParen stmt; +forInStmt = forBegin in expr closeParen stmt; +breakStmt = break semi; +continueStmt = continue semi; +withStmt = with openParen expr closeParen stmt; +returnStmt = return exprOpt semi; +variablesOrExprStmt = variablesOrExpr semi; + + + +// Condition: +// ( Expression ) + +condition = openParen expr closeParen; + + + +// ForParen: +// for ( + +forParen = for openParen; + + + +// ForBegin: +// ForParen VariablesOrExpression + +forBegin = forParen variablesOrExpr; + + + +// VariablesOrExpression: +// var Variables +// Expression + +variablesOrExpr = varVariables | expr; +varVariables = var variables; + + + +// Variables: +// Variable +// Variable , Variables + +variables = variable commaVariable*; +commaVariable = comma variable; + + + +// Variable: +// Identifier +// Identifier = AssignmentExpression + +variable = identifier assignment?; +assignment = equals assignmentExpr; + + + +// ExpressionOpt: +// empty +// Expression + +exprOpt = Empty | expr; // TODO -- Empty | expr; + + + +// Expression: +// AssignmentExpression +// AssignmentExpression , Expression + +expr = assignmentExpr commaExpr?; +commaExpr = comma expr; + + + +// AssignmentExpression: +// ConditionalExpression +// ConditionalExpression AssignmentOperator AssignmentExpression + +assignmentExpr = conditionalExpr extraAssignment?; +extraAssignment = assignmentOperator assignmentExpr; + + + +// ConditionalExpression: +// OrExpression +// OrExpression ? AssignmentExpression : AssignmentExpression + +conditionalExpr = orExpr ternaryExpr?; +ternaryExpr = question assignmentExpr colon assignmentExpr; + + + +// OrExpression: +// AndExpression +// AndExpression || OrExpression + +orExpr = andExpr orAndExpr*; +orAndExpr = or andExpr; + + + +// AndExpression: +// BitwiseOrExpression +// BitwiseOrExpression && AndExpression + +andExpr = bitwiseOrExpr andAndExpr?; +andAndExpr = and andExpr; + + + +// BitwiseOrExpression: +// BitwiseXorExpression +// BitwiseXorExpression | BitwiseOrExpression + +bitwiseOrExpr = bitwiseXorExpr pipeBitwiseOrExpr?; +pipeBitwiseOrExpr = pipe bitwiseOrExpr; + + + +// BitwiseXorExpression: +// BitwiseAndExpression +// BitwiseAndExpression ^ BitwiseXorExpression + +bitwiseXorExpr = bitwiseAndExpr caretBitwiseXorExpr?; +caretBitwiseXorExpr = caret bitwiseXorExpr; + + + +// BitwiseAndExpression: +// EqualityExpression +// EqualityExpression & BitwiseAndExpression + +bitwiseAndExpr = equalityExpr ampBitwiseAndExpression?; +ampBitwiseAndExpression = amp bitwiseAndExpr; + + + +// EqualityExpression: +// RelationalExpression +// RelationalExpression EqualityualityOperator EqualityExpression + +equalityExpr = relationalExpr equalityOpEqualityExpr?; +equalityOpEqualityExpr = equalityOperator equalityExpr; + + + +// RelationalExpression: +// ShiftExpression +// RelationalExpression RelationalationalOperator ShiftExpression + +relationalExpr = shiftExpr | relationalExprRHS; +relationalExprRHS = relationalExpr relationalOperator shiftExpr; + + + +// ShiftExpression: +// AdditiveExpression +// AdditiveExpression ShiftOperator ShiftExpression + +shiftExpr = additiveExpr shiftOpShiftExpr?; +shiftOpShiftExpr = shiftOperator shiftExpr; + + + +// AdditiveExpression: +// MultiplicativeExpression +// MultiplicativeExpression + AdditiveExpression +// MultiplicativeExpression - AdditiveExpression + +additiveExpr = multiplicativeExpr plusOrMinusExpr?; +plusOrMinusExpr = plusExpr | minusExpr; +plusExpr = plus additiveExpr; +minusExpr = minus additiveExpr; + + + +// MultiplicativeExpression: +// UnaryExpression +// UnaryExpression MultiplicativeOperator MultiplicativeExpression + +multiplicativeExpr = unaryExpr (multiplicativeOperator multiplicativeExpr)?; + + + +// UnaryExpression: +// MemberExpression +// UnaryOperator UnaryExpression +// - UnaryExpression +// IncrementOperator MemberExpression +// MemberExpression IncrementOperator +// new Constructor +// delete MemberExpression + +unaryExpr = memberExpr | unaryExpr1 | unaryExpr2 | unaryExpr3 | unaryExpr4 | unaryExpr5 | unaryExpr6; +unaryExpr1 = unaryOperator unaryExpr; +unaryExpr2 = minus unaryExpr; +unaryExpr3 = incrementOperator memberExpr; +unaryExpr4 = memberExpr incrementOperator; +unaryExpr5 = new constructor; +unaryExpr6 = delete memberExpr; + + + +// Constructor: +// this . ConstructorCall +// ConstructorCall + +constructor = constructorCall; // TODO ??? + + + +// ConstructorCall: +// Identifier +// Identifier ( ArgumentListOpt ) +// Identifier . ConstructorCall + +constructorCall = identifier parenArgListParen?; // TODO +parenArgListParen = openParen argListOpt closeParen; + + + +// MemberExpression: +// PrimaryExpression +// PrimaryExpression . MemberExpression +// PrimaryExpression [ Expression ] +// PrimaryExpression ( ArgumentListOpt ) + +memberExpr = primaryExpr dotBracketOrParenExpr?; +dotBracketOrParenExpr = dotMemberExpr | bracketMemberExpr | parenMemberExpr; +dotMemberExpr = dot memberExpr; +bracketMemberExpr = openBracket expr closeBracket; +parenMemberExpr = openParen argListOpt closeParen; + + + +// ArgumentListOpt: +// empty +// ArgumentList + +argListOpt = argList?; + + + +// ArgumentList: +// AssignmentExpression +// AssignmentExpression , ArgumentList + +argList = assignmentExpr commaAssignmentExpr*; +commaAssignmentExpr = comma assignmentExpr; + + + +// PrimaryExpression: +// ( Expression ) +// Identifier +// IntegerLiteral +// FloatingPointLiteral +// StringLiteral +// false +// true +// null +// this + +primaryExpr = parenExprParen | identifier | Number | QuotedString | false | true | null | undefined | this; +parenExprParen = openParen expr closeParen; +identifier = Word; diff --git a/res/javascript_ll.txt b/res/javascript_ll.txt new file mode 100644 index 0000000..9ddb815 --- /dev/null +++ b/res/javascript_ll.txt @@ -0,0 +1,133 @@ + +JavaScript LL(1) Grammar + +This appendix contains the NQLL(1) grammar (Not Quite LL(1)) for JavaScript. +NOTE: This appendix is missing the algorithm for recovering from missing semicolon errors. + + +Program: + empty + Element Program + Element: + function Identifier ( ParameterListOpt ) CompoundStatement + Statement + ParameterListOpt: + empty + ParameterList + ParameterList: + Identifier + Identifier , ParameterList + CompoundStatement: + { Statements } + Statements: + empty + Statement Statements + Statement: + ; + if Condition Statement + if Condition Statement else Statement + while Condition Statement + ForParen ; ExpressionOpt ; ExpressionOpt ) Statement + ForBegin ; ExpressionOpt ; ExpressionOpt ) Statement + ForBegin in Expression ) Statement + break ; + continue ; + with ( Expression ) Statement + return ExpressionOpt ; + CompoundStatement + VariablesOrExpression ; + Condition: + ( Expression ) + ForParen: + for ( + ForBegin: + ForParen VariablesOrExpression + VariablesOrExpression: + var Variables + Expression + Variables: + Variable + Variable , Variables + Variable: + Identifier + Identifier = AssignmentExpression + ExpressionOpt: + empty + Expression + Expression: + AssignmentExpression + AssignmentExpression , Expression + AssignmentExpression: + ConditionalExpression + ConditionalExpression AssignmentOperator AssignmentExpression + ConditionalExpression: + OrExpression + OrExpression ? AssignmentExpression : AssignmentExpression + OrExpression: + AndExpression + AndExpression || OrExpression + AndExpression: + BitwiseOrExpression + BitwiseOrExpression && AndExpression + BitwiseOrExpression: + BitwiseXorExpression + BitwiseXorExpression | BitwiseOrExpression + BitwiseXorExpression: + BitwiseAndExpression + BitwiseAndExpression ^ BitwiseXorExpression + BitwiseAndExpression: + EqualityExpression + EqualityExpression & BitwiseAndExpression + EqualityExpression: + RelationalExpression + RelationalExpression EqualityualityOperator EqualityExpression + RelationalExpression: + ShiftExpression + RelationalExpression RelationalationalOperator ShiftExpression + ShiftExpression: + AdditiveExpression + AdditiveExpression ShiftOperator ShiftExpression + AdditiveExpression: + MultiplicativeExpression + MultiplicativeExpression + AdditiveExpression + MultiplicativeExpression - AdditiveExpression + MultiplicativeExpression: + UnaryExpression + UnaryExpression MultiplicativeOperator MultiplicativeExpression + UnaryExpression: + MemberExpression + UnaryOperator UnaryExpression + - UnaryExpression + IncrementOperator MemberExpression + MemberExpression IncrementOperator + new Constructor + delete MemberExpression + Constructor: + this . ConstructorCall + ConstructorCall + ConstructorCall: + Identifier + Identifier ( ArgumentListOpt ) + Identifier . ConstructorCall + MemberExpression: + PrimaryExpression + PrimaryExpression . MemberExpression + PrimaryExpression [ Expression ] + PrimaryExpression ( ArgumentListOpt ) + ArgumentListOpt: + empty + ArgumentList + ArgumentList: + AssignmentExpression + AssignmentExpression , ArgumentList + PrimaryExpression: + ( Expression ) + Identifier + IntegerLiteral + FloatingPointLiteral + StringLiteral + false + true + null + this +[Previous] [First] \ No newline at end of file diff --git a/res/json-old.grammar b/res/json-old.grammar new file mode 100644 index 0000000..782543c --- /dev/null +++ b/res/json-old.grammar @@ -0,0 +1,26 @@ +/** + A Grammar for JSON + + NOTE: This grammar has a fatal flaw. it does not allow for the heirarchical nature of + JSON. Objects and arrays may only be one level deep according to this grammar. + This is a limitation of my grammar parser: it does not allow circular references. + That wll be fixed soon + + */ +null = 'null'; +true = 'true'; +false = 'false'; +value = null | true | false | Num | QuotedString; // here's the flaw. should include: "array | object" + +commaValue = ',' value; +actualArray = value commaValue*; +arrayContent = Empty | actualArray; +array = '[' arrayContent ']'; + +property = QuotedString ':' value; // NOTE: property names are quoted in JSON +commaProperty = ',' property; +actualObject = property commaProperty*; +objectContent = Empty | actualObject; +object = '{' objectContent '}'; + +start = (array | object); \ No newline at end of file diff --git a/res/json.css b/res/json.css new file mode 100644 index 0000000..b5083e7 --- /dev/null +++ b/res/json.css @@ -0,0 +1,43 @@ +/** + +A CSS Stylesheet that matches the JSON grammar + +note that each terminal production from json.grammar is listed in a CSS selector below. +text that matches any of these productions will display with the css properties listed here + +*/ + +openCurly, closeCurly, openBracket, closeBracket, comma, colon { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +null, true, false { + color:rgb(196.35, 45.9, 51.0); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +propertyName { + color:rgb(84.15, 114.75, 122.4); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +string { + color:rgb(61.2, 178.5, 68.85); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +number { + color:rgb(22.95, 158.1, 188.7); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} diff --git a/res/json.grammar b/res/json.grammar new file mode 100644 index 0000000..decd888 --- /dev/null +++ b/res/json.grammar @@ -0,0 +1,60 @@ +/* + A Grammar for JSON. + +*/ + +@start = Empty | array | object; + +object = openCurly (Empty | objectContent) closeCurly; +objectContent = property commaProperty*; +property = propertyName colon value; +commaProperty = comma property; +propertyName = QuotedString; // NOTE: property names are quoted in JSON + +array = openBracket (Empty | arrayContent) closeBracket; +arrayContent = value commaValue*; +commaValue = comma value; + +value = null | boolean | array | object | number | string; + +string = QuotedString; +number = Number; +null = 'null'; +boolean = 'true' | 'false'; + +openCurly = '{'; +closeCurly = '}'; +openBracket = '['; +closeBracket = ']'; +comma = ','; +colon = ':'; + + +/* + + The built-in terminal production types are (note titlecase) : Empty, Number, QuotedString, Word, UppercaseWord, LowercaseWord + You define collections (alternations, repetitions or sequences) and literal terminals (in quotes). These should be lowercase. + The special '@start' production is the outermost production. + + you can discard tokens by following them with a bang ('!') like: + + closeCurly = '}'!; + + Feed this grammar to -[PKParserFactory parserFromGrammar:assembler:] along with a reference + to an assembler (a call back delegate), and it will return a PKParser object which can + parse strings conforming to this language/grammar. + + The when the returned parser is used, the provided assembler will receive method callbacks for each production matched, like: + + -didMatchObjectAssembly: + -didMatchObjectContentAssembly: + -didMatchPropertyAssembly: + -didMatchArrayAssembly: + -didMatchOpenCurlyAssembly: + etc. + + Each callback method must accept a single PKAssembly argument. This assembly argument + will contain information about the progress made on the the string currently being parsed. + Also the assembly's stack will contain the tokens parsed so far in the current statement. + +*/ \ No newline at end of file diff --git a/res/json_with_comments.css b/res/json_with_comments.css new file mode 100644 index 0000000..b0c9d02 --- /dev/null +++ b/res/json_with_comments.css @@ -0,0 +1,50 @@ +/** + +A CSS Stylesheet that matches the JSON grammar + +note that each terminal production from json.grammar is listed in a CSS selector below. +text that matches any of these productions will display with the css properties listed here + +*/ + +openCurly, closeCurly, openBracket, closeBracket, comma, colon { + color:rgb(178.5, 35.7, 135.15); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +null, true, false { + color:rgb(196.35, 45.9, 51.0); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +propertyName { + color:rgb(84.15, 114.75, 122.4); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +string { + color:rgb(61.2, 178.5, 68.85); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +number { + color:rgb(22.95, 158.1, 188.7); + background-color:rgb(30, 30, 36); + font-family:'Monaco'; + font-size:11px; +} + +comment { + color:rgb(72.95, 208.1, 238.7); + background-color:rgb(0, 0, 0); + font-family:'Monaco'; + font-size:11px; +} diff --git a/res/json_with_comments.grammar b/res/json_with_comments.grammar new file mode 100644 index 0000000..a397488 --- /dev/null +++ b/res/json_with_comments.grammar @@ -0,0 +1,67 @@ +/* + A Fake Grammar for JSON with comments (JSON does not have comments). + +*/ + +@singleLineComments = '#'; +@multiLineComments = '/*' '*/'; + +@start = (Empty | array | object) comment?; + +object = openCurly comment? objectContent closeCurly; +objectContent = Empty | actualObject; +actualObject = property commaProperty*; +property = propertyName colon comment? value; +commaProperty = comma comment? property; +propertyName = QuotedString; // NOTE: property names are quoted in JSON + +array = openBracket comment? arrayContent closeBracket; +arrayContent = Empty | actualArray; +actualArray = value commaValue*; +commaValue = comma comment? value; + +value = (null | true | false | number | string | array | object) comment?; + +comment = Comment; +string = QuotedString; +number = Number; +null = 'null'; +true = 'true'; +false = 'false'; + +openCurly = '{'; +closeCurly = '}'; +openBracket = '['; +closeBracket = ']'; +comma = ','; +colon = ':'; + + +/* + + The built-in terminal production types are (note titlecase) : Empty, Number, QuotedString, Word, UppercaseWord, LowercaseWord + You define collections (alternations, repetitions or sequences) and literal terminals (in quotes). These should be lowercase. + The special '@start' production is the outermost production. + + you can discard tokens by following them with a bang ('!') like: + + closeCurly = '}'!; + + Feed this grammar to -[PKParserFactory parserFromGrammar:assembler:] along with a reference + to an assembler (a call back delegate), and it will return a PKParser object which can + parse strings conforming to this language/grammar. + + The when the returned parser is used, the provided assembler will receive method callbacks for each production matched, like: + + -didMatchObjectAssembly: + -didMatchObjectContentAssembly: + -didMatchPropertyAssembly: + -didMatchArrayAssembly: + -didMatchOpenCurlyAssembly: + etc. + + Each callback method must accept a single PKAssembly argument. This assembly argument + will contain information about the progress made on the the string currently being parsed. + Also the assembly's stack will contain the tokens parsed so far in the current statement. + +*/ \ No newline at end of file diff --git a/res/json_with_discards.grammar b/res/json_with_discards.grammar new file mode 100644 index 0000000..f2afb83 --- /dev/null +++ b/res/json_with_discards.grammar @@ -0,0 +1,39 @@ +/* + A Grammar for JSON which specifies which tokens should be discarded + + Feed this to -[PKParserFactory parserFromGrammar:assembler:] along with a reference + to an assembler (a call back delegate), and it will return a PKParser object which can + parse strings conforming to this language/grammar. + + The when the returned parser is used, the provided assembler will receive method callbacks like: + + -didMatchStart: + -didMatchObject: + -didMatchProperty: + -didMatchArray: + etc. + + whenever a grammar production of the corresponding name has been matched. + + Each callback method must accept a single PKAssembly argument. The provided assembly + will contain information about the progress made on the the string currently being parsed. + Also the assembly's stack will contain the tokens parsed so far in the current statement. +*/ + +@start = Empty | array | object; + +object = '{' objectContent '}'!; +objectContent = Empty | actualObject; +actualObject = property commaProperty*; +commaProperty = ','! property; +property = QuotedString ':'! value; // NOTE: property names are quoted in JSON + +array = '[' arrayContent ']'!; +arrayContent = Empty | actualArray; +actualArray = value commaValue*; +commaValue = ','! value; + +value = null | true | false | array | object | Number | QuotedString; +null = 'null'!; +true = 'true'!; +false = 'false'!; diff --git a/res/mini_css.grammar b/res/mini_css.grammar new file mode 100644 index 0000000..12f6ecf --- /dev/null +++ b/res/mini_css.grammar @@ -0,0 +1,18 @@ +/* + A Grammar for a small subset of CSS useful for syntax highlighting in an NSTextView + NSAttributedString +*/ + +@start = ruleset*; +ruleset = selectors '{' decls '}'!; +selectors = selector commaSelector*; +selector = LowercaseWord; // forcing selectors to be lowercase words for use in a future syntax-highlight framework where i want that +commaSelector = ','! selector; +decls = Empty | actualDecls; +actualDecls = decl decl*; +decl = property ':'! expr ';'!?; +property = 'color' | 'background-color' | 'font-family' | 'font-size'; +expr = pixelValue | rgb | string | constants; +pixelValue = Number 'px'!; +rgb = 'rgb'! '(' Number ','! Number ','! Number ')'!; +string = QuotedString; +constants = 'bold' | 'normal' | 'italic'; \ No newline at end of file diff --git a/res/nasty.html b/res/nasty.html new file mode 100644 index 0000000..fa9aceb --- /dev/null +++ b/res/nasty.html @@ -0,0 +1,68 @@ + + + +http://www.apple.com/ + + + +< + + url + xmls:foo="bar" baz + + = + + "foobar">yes maam + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/nonascii.html b/res/nonascii.html new file mode 100644 index 0000000..f39658d --- /dev/null +++ b/res/nonascii.html @@ -0,0 +1 @@ +ア \ No newline at end of file diff --git a/res/nspredicate.grammar b/res/nspredicate.grammar new file mode 100644 index 0000000..8022439 --- /dev/null +++ b/res/nspredicate.grammar @@ -0,0 +1,121 @@ +/* +A Grammar for Apple's NSPredicate String Format Syntax + +See: http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html + +*/ + +@wordState = '#'; +@wordChars = '.' '[' ']'; + +@symbols = '==' '>=' '=>' '<=' '=<' '!=' '<>' '&&' '||'; + +@start = expr; + +// Expressions + expr = orTerm orOrTerm*; + orOrTerm = or orTerm; + orTerm = andTerm andAndTerm*; + andAndTerm = and andTerm; + andTerm = primaryExpr | compoundExpr; + compoundExpr = '('! expr ')'!; + primaryExpr = predicate | negatedPredicate; + negatedPredicate = not predicate; + + predicate = boolPredicate | comparisonPredicate | stringTestPredicate | collectionTestPredicate; + + +// values + value = keyPath | string | num | bool | array; + + string = QuotedString; + num = Number; + bool = true | false; + true = 'true'!; + false = 'false'!; + +// arrays + array = '{' arrayContentsOpt '}'!; + arrayContentsOpt = Empty | arrayContents; + arrayContents = value commaValue*; + commaValue = ','! value; + + +// keyPaths + keyPath = Word; + +// keyPath = key dotKey*; +// key = name memberAccess?; +// name = Word; +// dotKey = '.' key; +// memberAccess = '[' (num | 'FIRST' | 'LAST' | 'SIZE') ']'; + + +// Comparison Tests + comparisonPredicate = numComparisonPredicate | collectionComparisonPredicate; + + numComparisonPredicate = numComparisonValue comparisonOp numComparisonValue; + numComparisonValue = keyPath | num; + + comparisonOp = eq | gt | lt | gtEq | ltEq | notEq | between; + + eq = '=' | '=='; + gt = '>'; + lt = '<'; + gtEq = '>=' | '=>'; + ltEq = '<=' | '=<'; + notEq = '!=' | '<>'; + between = 'BETWEEN'; + +// breaking these out to make the assembler callbacks simpler + collectionComparisonPredicate = collectionLtPredicate | collectionGtPredicate | collectionLtEqPredicate | collectionGtEqPredicate | collectionEqPredicate | collectionNotEqPredicate; + + collectionLtPredicate = aggregateOp collection lt value; + collectionGtPredicate = aggregateOp collection gt value; + collectionLtEqPredicate = aggregateOp collection ltEq value; + collectionGtEqPredicate = aggregateOp collection gtEq value; + collectionEqPredicate = aggregateOp collection eq value; + collectionNotEqPredicate = aggregateOp collection notEq value; + + + +// Boolean Value Predicates + boolPredicate = truePredicate | falsePredicate; + + truePredicate = 'TRUEPREDICATE'!; + falsePredicate = 'FALSEPREDICATE'!; + + + +// Compound Expressions + and = 'AND'! | '&&'!; + or = 'OR'! | '||'!; + not = 'NOT'! | '!'!; + + + +// String Tests + stringTestPredicate = string stringTestOp value; + + stringTestOp = beginswith | contains | endswith | like | matches; + + beginswith = 'BEGINSWITH'; + contains = 'CONTAINS'; + endswith = 'ENDSWITH'; + like = 'LIKE'; + matches = 'MATCHES'; + + +// Collection Tests + collectionTestPredicate = value in collection; + collection = keyPath | array; + in = 'IN'!; + + +// Aggregate Operators + aggregateOp = any | some | all | none; + any = 'ANY'; + some = 'SOME'; + all = 'ALL'; + none = 'NONE'; + diff --git a/res/nyt.html b/res/nyt.html new file mode 100644 index 0000000..3cd9c5d --- /dev/null +++ b/res/nyt.html @@ -0,0 +1,1843 @@ + + + + + + + + + + + + + + + + +The New York Times - Breaking News, World News & Multimedia + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+
+ +
+
+ + +
+
+ + +
+ +
Wednesday, September 17, 2008 Last Update: 2:12 PM ET
+
+ +
+ +
+ +
+
+
+ + + +
+
+ +
+ + + + + + + + + + + + + + + + +
+ + + + + + +
+ +
+ + + + + +
+
+
+ + + + + +

+Stocks Drop Sharply Despite Bailout of Big Insurer +

+
+ +

+The Fed’s rescue of A.I.G. failed to placate investors, and a report showing a further decline in housing starts added to the gloom. +

+ + + + +
+ + + + +
+
Q & A
+
The A.I.G. Rescue
+

+David Leonhardt answers questions about the implications of the A.I.G. bailout and the economy. +

+ +
+ +
+
+ + +
+
+
+ + +
+
+ +
+ + + +
+ +
Yuriko Nakao/Reuters
+
+ +
+

A board in Tokyo displayed rising stock prices. Stock markets rallied across much of Asia in early trading in response to the rescue of A.I.G.

+ + +
+ + +
+
+ +
+ +
+ + + +
+
+In Asia, the Bloom Is Off the A.I.G. Rose +
+ +

If A.I.G.’s reputation suffers heavily, the company will face an uphill battle in Asia and its other global markets.

+ + + +
+ +
+ + + + + + + + + + +
+
+
+
+
+
+ +
+ + + +
+
American Exception
+
+Supreme Court’s Global Influence Is Waning +
+ +

A diminishing number of foreign courts seem to pay attention to the writings of American justices.

+ + + + +
+ + + + +
+
+16 Are Killed in Attack on U.S. Embassy in Yemen +
+ +

Militants opened fire on the embassy in Sana and detonated a car bomb at its gates, but no Americans were killed or injured, a Yemeni official said.

+ + + + +
+ +
+ +
+
+ + +

2008 Campaign

+ + +
+ + + +
+
+Abortion Issue Again Dividing Catholic Votes +
+ +

A struggle on how Catholics should apply their beliefs in politics is reaching swing cities like Scranton, Pa.

+ + + + +
+ + + + +
+
+New York Settles Lawsuit Over Homeless Families +
+ +

The costly litigation, over homeless families’ access to shelter in New York City, has dragged on since 1983.

+ + + +
+ +
+ + +
+
+
MORE NEWS
+ +
+
+ + + + + + +
+
+
+ +
 
+
+
+
+ +
+ + + + +
+ + +
+
+
+
+ +
+
GUEST Q & A
+
Wheels: Questions for Motocross Champion
+

James Stewart, winner of both the World Supercross and AMA Supercross championships, is taking questions from readers.

+ +
+
+ +
National Correspondent
+

+Amy Harmon, who covers the impact of science and technology on American life, is answering questions. +

+
+ +
+ +
+
+
+ + +
+ + + +
+
+
+ + +

Travel »

+
A Cultural Cornerstone

A Cultural CornerstoneCasco Viejo seems poised to become a hotbed of nightclubs, cafes, and hotels.

+ +
+
36 Hours in San Francisco

36 Hours in San Francisco Prosperity hasn’t sapped the Mission District of its eclecticism.

+
+
+ + +
+
+
+ + +
+ + + + + +
+
+ +
+ +

My Portfolios »

+ + + +
+ +
+ + +
+ +
+
+ + + + + +
+ + +
+ + +
+ + +
+
+ +
+ +
+
+ +
A Scottish House, Traditional Yet Modern
+

BerlinThe “Upside-Down House”, designed in 1959 by James Morris and Robert Steedman, holds a prominent place in Edinburgh’s recent architectural history.

+ +
+
+
+
+Find Properties +
+
+ + +Advanced Search » +
+ + +
+ + + + +
+ + +
+
+
+
General Motors at 100
+

Chevrolet VoltThe Chevrolet Volt, which G.M. unveiled on Tuesday, is intended to provide a jump-start for General Motors’ second century.

+ +
+
+ +

+Submit photos and view and comment on other readers’ cars. Also, view and submit events to the +Automotive Events Calendar. +

+ +
+
+ +
+ + +
+
+Search for new cars +
+
+ + + +
+
+
+
+Search for used cars +
+
+ + + + +
+
+
+More in Automobiles +
+ +
+ +
+
+ + +
+ + +
+

+NYtimes.com / Monster +

+
+
+
Fresh Starts
+
Navigators for the College Bound
+

Navigators for the College BoundPrivate educational consultants take up where overburdened high school guidance counselors leave off.

+
+
ADVERTISEMENT
+
+
+
+

+Find the best job in the +New York metro area +and beyond. +

+
+ + + + Advanced Search » +
+
+Tools +
+ +
+Employers +
+ +
+
+ +
+ + + + + +
+ +
+ + + + + + + + +
+ +
+ + +
+
+  +
+

Inside NYTimes.com

+
+ + + + + + + + + + + + + + + + + + + + + +

Media & Advertising »

World »

Opinion »

Music »

Opinion »

Dining & Wine »

+
+
+ +Chrysler Is Loyal to Its Pickup in a Cold Market + +
+
Chrysler Is Loyal to Its Pickup in a Cold Market
+
+
+
+
+ +Friction as India Converts Farmland Into Factories + +
+
Friction as India Converts Farmland Into Factories
+
+
+
+
+ + + +
+
+
+
+
+
+ +When Julian Schnabel Met Plácido Domingo + +
+
When Julian Schnabel Met Plácido Domingo
+
+
+
+
+ +Op-Ed: Another Country + +
+
Op-Ed: Another Country
+
+
+
+
+ +Instead of Eating to Diet, They’re Eating to Enjoy + +
+
Instead of Eating to Diet, They’re Eating to Enjoy
+
+
+ +
+ +
+ + + + + + + + + +
+ + + + + + + + + +
+ +
+ + + + + +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ + + + + + +
+
+
+ + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/res/objc.grammar b/res/objc.grammar new file mode 100644 index 0000000..5dec845 --- /dev/null +++ b/res/objc.grammar @@ -0,0 +1,236 @@ + +@symbol = '@interface'; +@symbol = '@implementation'; +@symbol = '@end'; +@symbol = '@class'; +@symbol = '@protocol'; + +// external-declaration: +// function-definition +// declaration +// class-interface +// class-implementation +// category-interface +// category-implementation +// protocol-declaration +// class-declaration-list + +externalDecl = functionDef | decl | classInterface | classImpl | categoryInterface | categoryImpl | protocolDecl | classDeclList; + +// class-interface: +// @interface class-name [ : superclass-name ] +// [ protocol-reference-list ] +// [ instance-variables ] +// [ interface-declaration-list ] +// @end + +classInterface = '@interface' className (':' superclassName)? protocolRefList? ivars? interfaceDeclList? '@end'; + +// class-implementation: +// @implementation class-name [ : superclass-name ] +// [ instance-variables ] +// [ implementation-definition-list ] +// @end + +classImpl = '@implementation' className (':' superclassName)? ivars? implementationDefList? '@end'; + +// category-interface: +// @interface class-name ( category-name ) +// [ protocol-reference-list ] +// [ interface-declaration-list ] +// @end + +categoryInterface = '@interface' className '(' categoryName ')' protocolRefList? interfaceDeclList? '@end'; + +category-implementation: +@implementation class-name ( category-name ) +[ implementation-definition-list ] +@end + +protocol-declaration: +@protocol protocol-name +[ protocol-reference-list ] +[ interface-declaration-list ] +@end + +class-declaration-list: +@class class-list ; + +class-list: +class-name +class-list , class-name + +protocol-reference-list: +< protocol-list > + +protocol-list: +protocol-name +protocol-list , protocol-name + +class-name: +identifier + +superclass-name: +identifier + +category-name: +identifier + +protocol-name: +identifier + +instance-variables: +{ [ visibility-specification ] struct-declaration-list [ instance-variables ] } + +visibility-specification: +@private +@protected +@public + +interface-declaration-list: +declaration +method-declaration +interface-declaration-list declaration +interface-declaration-list method-declaration + +method-declaration: +class-method-declaration +instance-method-declaration + +class-method-declaration: ++ [ method-type ] method-selector ; + +instance-method-declaration: +- [ method-type ] method-selector ; + +implementation-definition-list: +function-definition +declaration +method-definition +implementation-definition-list function-definition +implementation-definition-list declaration +implementation-definition-list method-definition + +method-definition: +class-method-definition +instance-method-definition + +class-method-definition: ++ [ method-type ] method-selector [ declaration-list ] compound-statement + +instance-method-definition: +- [ method-type ] method-selector [ declaration-list ] compound-statement + +method-selector: +unary-selector +keyword-selector [ , ... ] +keyword-selector [ , parameter-type-list ] + +unary-selector: +selector + +keyword-selector: +keyword-declarator +keyword-selector keyword-declarator + +keyword-declarator: +: [ method-type ] identifier +selector : [ method-type ] identifier + +selector: +identifier + +method-type: +( type-name ) + + +Type Specifiers +type-specifier: +void +char +short +int +long +float +double +signed +unsigned +id [ protocol-reference-list ] +class-name [ protocol-reference-list ] +struct-or-union-specifier +enum-specifier +typedef-name + +struct-or-union-specifier: +struct-or-union [ identifier ] { struct-declaration-list } +struct-or-union [ identifier ] { @defs ( class-name ) } +struct-or-union identifier + + +Type Qualifiers +type-qualifier: +const +volatile +protocol-qualifier + +protocol-qualifier: +in +out +inout +bycopy +byref +oneway + + +Primary Expressions +primary-expression: +identifier +constant +string +( expression ) +self +message-expression +selector-expression +protocol-expression +encode-expression + +message-expression: +[ receiver message-selector ] + +receiver: +expression +class-name +super + +message-selector: +selector +keyword-argument-list + +keyword-argument-list: +keyword-argument +keyword-argument-list keyword-argument + +keyword-argument: +selector : expression +: expression + +selector-expression: +@selector ( selector-name ) + +selector-name: +selector +keyword-name-list + +keyword-name-list: +keyword-name +keyword-name-list keyword-name + +keyword-name: +selector : +: + +protocol-expression: +@protocol ( protocol-name ) + +encode-expression: +@encode ( type-name ) \ No newline at end of file diff --git a/res/proto.grammar b/res/proto.grammar new file mode 100644 index 0000000..e9adbb7 --- /dev/null +++ b/res/proto.grammar @@ -0,0 +1,93 @@ +// proto ::= ( message | extend | enum | import | package | option | ";" )* +proto = ( message | extend | enum | import | package | option | ";" )*; + +// import ::= "import" strLit ";" +import = "import" strLit ";"; + +// package ::= "package" ident ";" +package = "package" ident ";"; + +// option ::= "option" optionBody ";" +option = "option" optionBody ";"; + +// optionBody ::= ident ( "." ident )* "=" constant +optionBody = ident ( "." ident )* "=" constant; + +// message ::= "message" ident messageBody +message = "message" ident messageBody; + +// extend ::= "extend" userType messageBody +extend = "extend" userType messageBody; + +// enum ::= "enum" ident "{" ( option | enumField | ";" )* "}" +enum = "enum" ident "{" ( option | enumField | ";" )* "}"; + +// enumField ::= ident "=" intLit ";" +enumField = ident "=" intLit ";"; + +// service ::= "service" ident "{" ( option | rpc | ";" )* "}" +service = "service" ident "{" ( option | rpc | ";" )* "}"; + +// rpc ::= "rpc" ident "(" userType ")" "returns" "(" userType ")" ";" +rpc = "rpc" ident "(" userType ")" "returns" "(" userType ")" ";"; + +// messageBody ::= "{" ( field | enum | message | extend | extensions | group | option | ":" )* "}" +messageBody = "{" ( field | enum | message | extend | extensions | group | option | ":" )* "}"; + +// group ::= modifier "group" camelIdent "=" intLit messageBody +group = modifier "group" camelIdent "=" intLit messageBody; + +// // tag number must be 2^28-1 or lower + +// field ::= modifier type ident "=" intLit ( "[" fieldOption ( "," fieldOption )* "]" )? ";" +field = modifier type ident "=" intLit ( "[" fieldOption ( "," fieldOption )* "]" )? ";"; + +// fieldOption ::= optionBody | "default" "=" constant +fieldOption = optionBody | "default" "=" constant; + +// extensions ::= "extensions" intLit "to" ( intLit | "max" ) ";" +extensions = "extensions" intLit "to" ( intLit | "max" ) ";"; + +// modifier ::= "required" | "optional" | "repeated" +modifier ::= "required" | "optional" | "repeated"; + +// type ::= "double" | "float" | "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64" | "fixed32" | "fixed64" | "sfixed32" | "sfixed64" | "bool" | "string" | "bytes" | userType +type = "double" | "float" | "int32" | "int64" | "uint32" | "uint64" | "sint32" | "sint64" | "fixed32" | "fixed64" | "sfixed32" | "sfixed64" | "bool" | "string" | "bytes" | userType; + +// // leading dot for identifiers means they're fully qualified + +// userType ::= ( "."? ident )+ +userType = ( "."? ident )+; + +// constant ::= ident | intLit | floatLit | strLit | boolLit +constant = ident | numLit | strLit | boolLit; + +// ident ::= /[A-Za-z_][\w_]*/ +ident = /[A-Za-z_][\w_]*/; + +// // according to parser.cc, group names must start with a capital letter as a +// // hack for backwards-compatibility + +// camelIdent ::= /[A-Z][\w_]*/ +camelIdent = /[A-Z][\w_]*/; + +// intLit ::= decInt | hexInt | octInt +// decInt ::= /\d+/ +// hexInt ::= /0[xX]([A-Fa-f0-9])+/ +// octInt ::= /0[0-7]+/ +// floatLit ::= /\d+(\.\d+)?([Ee][\+-]?\d+)?/ // allow_f_after_float_ is +numLit = Number; + +// disabled by default in tokenizer.cc + +// boolLit ::= "true" | "false" +boolLit = "true" | "false"; + +// strLit ::= quote ( hexEscape | octEscape | charEscape | /[^\0\n]/ )* +strLit = QuotedString; + +// quote +// quote ::= /["']/ +// hexEscape ::= /\\[Xx][A-Fa-f0-9]{1,2}/ +// octEscape ::= /\\0?[0-7]{1,3}/ +// charEscape ::= /\\[abfnrtv\\\?'"]/ diff --git a/res/rubyhash.grammar b/res/rubyhash.grammar new file mode 100644 index 0000000..e66161c --- /dev/null +++ b/res/rubyhash.grammar @@ -0,0 +1,35 @@ +/* + {"brand"=>{"name"=>"something", + "logo"=>#, + "summary"=>"wee", "content"=>"woopy doo"}, "commit"=>"Save", + "authenticity_token"=>"43a94d60304a7fb13a4ff61a5960461ce714e92b", + "action"=>"create", "controller"=>"admin/brands"} +*/ + +@reportsCommentTokens = YES; +@commentState = '#'; +@multiLineComments = '#<' '>'; +@symbols = '=>'; + +@start = Empty | object; + +object = openCurly objectContent closeCurly; +objectContent = Empty | actualObject; +actualObject = property commaProperty*; +property = propertyName arrow value; +commaProperty = comma property; +propertyName = QuotedString; // NOTE: property names are quoted + +value = null | true | false | object | number | string | fileRef; + +string = QuotedString; +number = Number; +fileRef = Comment; +null = 'null'; +true = 'true'; +false = 'false'; + +openCurly = '{'; +closeCurly = '}'; +comma = ','; +arrow = '=>'; diff --git a/res/small-xml-file.xml b/res/small-xml-file.xml new file mode 100644 index 0000000..da49760 --- /dev/null +++ b/res/small-xml-file.xml @@ -0,0 +1,6 @@ + +http://www.apple.com/ +yes maam + + + \ No newline at end of file diff --git a/res/stuff.txt b/res/stuff.txt new file mode 100644 index 0000000..17690e4 --- /dev/null +++ b/res/stuff.txt @@ -0,0 +1,8 @@ + + + +sudo /Users/itod/Downloads/checker-60/scan-build -o Desktop xcodebuild \ No newline at end of file diff --git a/res/svn-commands.txt b/res/svn-commands.txt new file mode 100644 index 0000000..9abc1e8 --- /dev/null +++ b/res/svn-commands.txt @@ -0,0 +1,23 @@ +svn copy -r1392 https://todparsekit.googlecode.com/svn/trunk/ \ + https://todparsekit.googlecode.com/svn/tags/release-1.5-tag \ + -m "Creating 1.5 release tag from -r1392" + +svn copy -r1392 https://todparsekit.googlecode.com/svn/tags/release-1.5-tag \ + https://todparsekit.googlecode.com/svn/branches/release-1.5-branch \ + -m "Creating 1.5 release branch from -r1392" + + + + +svn delete https://todparsekit.googlecode.com/svn/tags/release-1.4.2-tag \ + -m "deleting first 1.4.2 release tag" + +svn delete https://todparsekit.googlecode.com/svn/branches/release-1.4.2-branch \ + -m "deleting first 1.4.2 release branch" + + + +svn copy -r1361 https://todparsekit.googlecode.com/svn/trunk/ \ + https://todparsekit.googlecode.com/svn/branches/dev-gcd-branch \ + -m "Creating a dev branch for testing GCD stuff. from -r1361" + \ No newline at end of file diff --git a/res/xml.grammar b/res/xml.grammar new file mode 100644 index 0000000..15979d6 --- /dev/null +++ b/res/xml.grammar @@ -0,0 +1,388 @@ +/** + This is a relatively complete TDParseKit grammar for XML 1.0 derived from the XML specification: + + http://www.w3.org/TR/REC-xml/ + + You can create the parser in ObjC like: + + NSString *g = .. // fetch this grammar from disk or wherever + PKParser *p = [[PKParserFactory factory] parserFromGrammar:g assembler:self]; + + NSString *XMLString = .. // fetch some XML + [p parse:XMLString]; + + If implemented, your assembler object will receive callbacks for each production in this grammar, like: + + - (void)didMatchElement:(PKAssembly *)a; + - (void)didMatchAttribute:(PKAssembly *)a; + + + This parser is running successfully on some non-trivial real-world XML documents, + but i'm sure there are bugs (espcially in the DTD stuff). + + It's also a little too lenient about a few quoted string values in the spec, and doesnt yet forbid some chars it should. + + I have some tests, But will need many more if this is to be a serious parser: + + http://code.google.com/p/todparsekit/source/browse/trunk/test/TDXMLParserTest.m + + + (I'd like to write an ObjC SAX interface to this parser) + + (Is this the first XML parser implemented directly in Objective-C?) +*/ + +@start = document; + +@reportsWhitespaceTokens = YES; + +@symbols = '&#' '&#x' '' '' '' nil; +@delimitedString = '' nil; + + +// [1] document ::= prolog element Misc* + + document = prolog element misc*; + + +// [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ +// [3] S ::= (#x20 | #x9 | #xD | #xA)+ +// [4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] +// [4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] +// [5] Name ::= NameStartChar (NameChar)* +// [6] Names ::= Name (#x20 Name)* +// [7] Nmtoken ::= (NameChar)+ +// [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* + + @wordState = ':' '.' '-' '_'; + @wordChars = ':' '.' '-' '_'; + + nmtoken = Word; + + name = Word & /[^-:\.].*/; + + // names = name (S name)*; + // nmtokens = nmtoken (S nmtoken)*; + + + +// [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'" +// [10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" +// [11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") + + entityValue = QuotedString; // TODO + attValue = QuotedString; // TODO + systemLiteral = QuotedString; + + +// [12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" +// [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] + + pubidLiteral = QuotedString; // TODO + + +// [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) + + charData = /[^<\&]+/; + + +// [15] Comment ::= '' + + comment = DelimitedString(''); + + +// [16] PI ::= '' Char*)))? '?>' +// [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) + + pi = '/* '?>'; + piTarget = name - /xml/i; + + +// [18] CDSect ::= CDStart CData CDEnd +// [19] CDStart ::= '' Char*)) +// [21] CDEnd ::= ']]>' + + cdSect = DelimitedString(''); + + +// [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? + + prolog = xmlDecl? misc* (doctypedecl misc*)?; + + +// [23] XMLDecl ::= '' + + xmlDecl = ''; + + +// [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"') +// [26] VersionNum ::= '1.' [0-9]+ + + versionNum = /(['"])1\.[0-9]\1/; + versionInfo = S 'version' eq versionNum; + + +// [25] Eq ::= S? '=' S? + + eq = S? '=' S?; + + +// [27] Misc ::= Comment | PI | S + + misc = comment | pi | S; + + +// [28] doctypedecl ::= '' + + doctypedecl = ''; + + +// [28a] DeclSep ::= PEReference | S + + declSep = peReference | S; + + +// [28b] intSubset ::= (markupdecl | DeclSep)* + + intSubset = (markupdecl | declSep)*; + + +// [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment + + markupdecl = elementdecl | attlistDecl | entityDecl | notationDecl | pi | comment; + + +// [30] extSubset ::= TextDecl? extSubsetDecl + + extSubset = textDecl? extSubsetDecl; + +// [31] extSubsetDecl ::= ( markupdecl | conditionalSect | DeclSep)* + + extSubsetDecl = (markupdecl | conditionalSect | declSep)*; + + +// [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"')) + + sdDecl = S 'standalone' eq /(["'])(yes|no)\1/; + +// [39] element ::= EmptyElemTag | STag content ETag + + element = emptyElemTag | sTag content eTag; + + +// [40] STag ::= '<' Name (S Attribute)* S? '>' + + sTag = '<' name (S attribute)* S? '>'; + + +// [41] Attribute ::= Name Eq AttValue + + attribute = name eq attValue; + + +// [42] ETag ::= '' + + eTag = ''; + + +// [43] content ::= CharData? ((element | Reference | CDSect | PI | Comment) CharData?)* + + content = Empty | (element | reference | cdSect | pi | comment | charData)+; + + +// [44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>' + + emptyElemTag = '<' name (S attribute)* S? '/>'; + + +// [45] elementdecl ::= '' + + elementdecl = ''; + + +// [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children + + contentspec = 'EMPTY' | 'ANY' | mixed | children; + + +// [47] children ::= (choice | seq) ('?' | '*' | '+')? + + children = (choice | seq) ('?' | '*' | '+')?; + + +// [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? + + cp = (name) ('?' | '*' | '+')?; // TODO !!!!!!!!!!!!!! + + +// [49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')' + + choice = '(' S? cp ( S? '|' S? cp )+ S? ')'; + + +// [50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')' + + seq = '(' S? cp ( S? ',' S? cp )* S? ')'; + + +// [51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')' + + mixed = '(' S? '#PCDATA' (S? '|' S? name)* S? ')*' | '(' S? '#PCDATA' S? ')'; + + +// [52] AttlistDecl ::= '' + + attlistDecl = ''; + + +// AttDef ::= S Name S AttType S DefaultDecl + + attDef = S name S attType S defaultDecl; + + +// [54] AttType ::= StringType | TokenizedType | EnumeratedType + + attType = stringType | tokenizedType | enumeratedType; + + +// [55] StringType ::= 'CDATA' + + stringType = 'CDATA'; + + +// [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' + + tokenizedType = 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS'; + + +// [57] EnumeratedType ::= NotationType | Enumeration + + enumeratedType = notationType | enumeration; + + +// [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')' + + notationType = 'NOTATION' S '(' S? name (S? '|' S? name)* S? ')'; + + +// [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' + + enumeration = '(' S? nmtoken (S? '|' S? nmtoken)* S? ')'; + + +// [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue) + + defaultDecl = '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? attValue); + + +// [61] conditionalSect ::= includeSect | ignoreSect + + conditionalSect = includeSect | ignoreSect; + + +// [62] includeSect ::= '' + + includeSect = ''; + + +// [63] ignoreSect ::= '' + + ignoreSect = ''; + + +// [64] ignoreSectContents ::= Ignore ('' Ignore)* + + ignoreSectContents = ignore ('' ignore)*; + + +// [65] Ignore ::= Char* - (Char* ('') Char*) + + ignore = Word - /[^<]*().*/; + + +// [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';' + + charRef = '&#' /[0-9]+/ ';' | '&#x' /[0-9a-fA-F]+/ ';'; + + +// [67] Reference ::= EntityRef | CharRef + + reference = entityRef | charRef; + + +// [68] EntityRef ::= '&' Name ';' + + entityRef = '&' name ';'; + + +// [69] PEReference ::= '%' Name ';' + + peReference = '%' name ';'; + + +// [70] EntityDecl ::= GEDecl | PEDecl + + entityDecl = geDecl | peDecl; + + +// [71] GEDecl ::= '' + + geDecl = ''; + + +// [72] PEDecl ::= '' + + peDecl = ''; + + +// [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) + + entityDef = entityValue | (externalID nDataDecl?); + + +// [74] PEDef ::= EntityValue | ExternalID + + peDef = entityValue | externalID; + + +// [75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral + + externalID = 'SYSTEM' S systemLiteral | 'PUBLIC' S pubidLiteral S systemLiteral; + + +// [76] NDataDecl ::= S 'NDATA' S Name + + nDataDecl = S 'NDATA' S name; + + +// [77] TextDecl ::= '' + + textDecl = ''; + + +// [78] extParsedEnt ::= TextDecl? content + + extParsedEnt = textDecl? content; + + +// [80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" ) +// [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* + + encName = /[A-Za-z][-A-Za-z0-9._]*/+; + encodingDecl = S 'encoding' eq QuotedString; + + +// [82] NotationDecl ::= '' + + notationDecl = ''; + + +// [83] PublicID ::= 'PUBLIC' S PubidLiteral + + publicID = 'PUBLIC' S pubidLiteral; diff --git a/res/xml_grammar.txt b/res/xml_grammar.txt new file mode 100644 index 0000000..bd01b6b --- /dev/null +++ b/res/xml_grammar.txt @@ -0,0 +1,78 @@ +[1] document ::= prolog element Misc* +[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]/* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ +[3] S ::= (#x20 | #x9 | #xD | #xA)+ +[4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender +[5] Name ::= (Letter | '_' | ':') (NameChar)* +[6] Names ::= Name (#x20 Name)* +[7] Nmtoken ::= (NameChar)+ +[8] Nmtokens ::= Nmtoken (#x20 Nmtoken)* +[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"' | "'" ([^%&'] | PEReference | Reference)* "'" +[10] AttValue ::= '"' ([^<&"] | Reference)* '"' | "'" ([^<&'] | Reference)* "'" +[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'") +[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" +[13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] +[14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) +[15] Comment ::= '' +[16] PI ::= '' Char*)))? '?>' +[17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) +[18] CDSect ::= CDStart CData CDEnd +[19] CDStart ::= '' Char*)) +[21] CDEnd ::= ']]>' +[22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)? +[23] XMLDecl ::= '' +[24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"') +[25] Eq ::= S? '=' S? +[26] VersionNum ::= '1.0' +[27] Misc ::= Comment | PI | S +[28] doctypedecl ::= ''[VC: Root Element Type] +[28a] DeclSep ::= PEReference | S[WFC: PE Between Declarations] +[28b] intSubset ::= (markupdecl | DeclSep)* +[29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment[VC: Proper Declaration/PE Nesting] +[30] extSubset ::= TextDecl? extSubsetDecl +[31] extSubsetDecl ::= ( markupdecl | conditionalSect | DeclSep)* +[32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))[VC: Standalone Document Declaration] +[39] element ::= EmptyElemTag | STag content ETag[WFC: Element Type Match] +[40] STag ::= '<' Name (S Attribute)* S? '>'[WFC: Unique Att Spec] +[41] Attribute ::= Name Eq AttValue[VC: Attribute Value Type] +[42] ETag ::= '' +[43] content ::= CharData? ((element | Reference | CDSect | PI | Comment) CharData?)* +[44] EmptyElemTag ::= '<' Name (S Attribute)* S? '/>'[WFC: Unique Att Spec] +[45] elementdecl ::= ''[VC: Unique Element Type Declaration] +[46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | children +[47] children ::= (choice | seq) ('?' | '*' | '+')? +[48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? +[49] choice ::= '(' S? cp ( S? '|' S? cp )+ S? ')'[VC: Proper Group/PE Nesting] +[50] seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'[VC: Proper Group/PE Nesting] +[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'[VC: Proper Group/PE Nesting] +[52] AttlistDecl ::= '' +[53] AttDef ::= S Name S AttType S DefaultDecl +[54] AttType ::= StringType | TokenizedType | EnumeratedType +[55] StringType ::= 'CDATA' +[56] TokenizedType ::= 'ID'[VC: ID] +[57] EnumeratedType ::= NotationType | Enumeration +[58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'[VC: Notation Attributes] +[59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'[VC: Enumeration] +[60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)[VC: Required Attribute] +[61] conditionalSect ::= includeSect | ignoreSect +[62] includeSect ::= ''[VC: Proper Conditional Section/PE Nesting] +[63] ignoreSect ::= ''[VC: Proper Conditional Section/PE Nesting] +[64] ignoreSectContents ::= Ignore ('' Ignore)* +[65] Ignore ::= Char* - (Char* ('') Char*) +[66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'[WFC: Legal Character] +[67] Reference ::= EntityRef | CharRef +[68] EntityRef ::= '&' Name ';'[WFC: Entity Declared] +[69] PEReference ::= '%' Name ';'[VC: Entity Declared] +[70] EntityDecl ::= GEDecl | PEDecl +[71] GEDecl ::= '' +[72] PEDecl ::= '' +[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) +[74] PEDef ::= EntityValue | ExternalID +[75] ExternalID ::= 'SYSTEM' S SystemLiteral | 'PUBLIC' S PubidLiteral S SystemLiteral +[76] NDataDecl ::= S 'NDATA' S Name[VC: Notation Declared] +[77] TextDecl ::= '' +[78] extParsedEnt ::= TextDecl? content +[80] EncodingDecl ::= S 'encoding' Eq ('"' EncName '"' | "'" EncName "'" ) +[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*/* Encoding name contains only Latin characters */ +[82] NotationDecl ::= ''[VC: Unique Notation Name] +[83] PublicID ::= 'PUBLIC' S PubidLiteral \ No newline at end of file diff --git a/res/xpath1_0.grammar b/res/xpath1_0.grammar new file mode 100644 index 0000000..12e37f8 --- /dev/null +++ b/res/xpath1_0.grammar @@ -0,0 +1,80 @@ +/* + An XPath 1.0 grammar derived from the XPath 1.0 Specification: + + http://www.w3.org/TR/xpath + + + + NOTE-TO-SELF: to avoid infinite recursion, I had to eliminate this production: + + abbreviatedRelativeLocationPath = relativeLocationPath '//' step; + + and therefore remove `abbreviatedRelativeLocationPath` from `relativeLocationPath` which changed from + + relativeLocationPath = step ('/' step)* | abbreviatedRelativeLocationPath; + + to: + + relativeLocationPath = '//'? step ('/' step)*; + + +*/ + +@start = expr; + +@symbols = '//' '..' '!=' '::' '<=' '>='; + +@wordState = '_'; +@wordChars = '_' '.' '-'; + +@numberState = '.'; // numbers may start with dot +@allowsTrailingDot = YES; // numbers may end with dot +@symbolState = '+' '-'; // numbers may not start with a plus or minus sign. they're actually unary operators +@allowsScientificNotation = NO; // exponents not allowed +@allowsOctalNotation = NO; // octal not allowed +@allowsHexidecimalNotation = NO; // hex not allowed + + +expr = orExpr; + orExpr = andExpr ('or' andExpr)*; + andExpr = equalityExpr ('and' equalityExpr)*; + equalityExpr = relationalExpr (('=' | '!=') relationalExpr)*; + relationalExpr = additiveExpr (('<' | '>' | '<=' | '>=') additiveExpr)*; + additiveExpr = multiplicativeExpr (('+' | '-') multiplicativeExpr)*; + multiplicativeExpr = unaryExpr ((multiplyOperator | 'div' | 'mod') unaryExpr)*; + multiplyOperator = '*'; + unaryExpr = '-'* unionExpr; + unionExpr = pathExpr ('|' pathExpr)*; + + +pathExpr = locationPath | filterExpr (('/'| '//') relativeLocationPath)?; + locationPath = relativeLocationPath | absoluteLocationPath; + relativeLocationPath = '//'? step ('/' step)*; + absoluteLocationPath = '/' relativeLocationPath? | abbreviatedAbsoluteLocationPath; + abbreviatedAbsoluteLocationPath = '//' relativeLocationPath; + + filterExpr = primaryExpr predicate*; + primaryExpr = variableReference | literal | number | functionCall | '(' expr ')'; + variableReference = '$' qName; // note whitespace is not allowed here. also qName is optional + literal = QuotedString; + number = Number; + functionCall = functionName '(' (argument (',' argument)* )? ')'; + functionName = qName - nodeType; + qName = (prefix ':')? localPart; + prefix = ncName; + localPart = ncName; + ncName = Word; + argument = expr; + predicate = '[' predicateExpr ']'; + predicateExpr = expr; + + + step = axisSpecifier nodeTest predicate* | abbreviatedStep; + axisSpecifier = axisName '::' | abbreviatedAxisSpecifier; + axisName = 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' | 'descendant' | 'descendant-or-self' | 'following' | 'following-sibling' | 'namespace' | 'parent' | 'preceding' | 'preceding-sibling' | 'self'; + abbreviatedAxisSpecifier = '@'?; + nodeTest = nameTest | nodeType '(' ')' | 'processing-instruction' '(' literal ')'; + nameTest = '*' | ncName ':' '*' | qName; // note whitespace should not be allowed in second alt here + nodeType = 'comment' | 'text' | 'processing-instruction' | 'node'; + abbreviatedStep = '.' | '..'; + diff --git a/res/xpath_grammar.txt b/res/xpath_grammar.txt new file mode 100644 index 0000000..5aacfcf --- /dev/null +++ b/res/xpath_grammar.txt @@ -0,0 +1,88 @@ +[1] LocationPath ::= RelativeLocationPath | AbsoluteLocationPath +[2] AbsoluteLocationPath ::= '/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath +[3] RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath +[4] Step ::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep +[5] AxisSpecifier ::= AxisName '::' | AbbreviatedAxisSpecifier +[6] AxisName ::= 'ancestor' + | 'ancestor-or-self' + | 'attribute' + | 'child' + | 'descendant' + | 'descendant-or-self' + | 'following' + | 'following-sibling' + | 'namespace' + | 'parent' + | 'preceding' + | 'preceding-sibling' + | 'self' +[7] NodeTest ::= NameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' +[8] Predicate ::= '[' PredicateExpr ']' +[9] PredicateExpr ::= Expr +[10] AbbreviatedAbsoluteLocationPath ::= '//' RelativeLocationPath +[11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step +[12] AbbreviatedStep ::= '.' | '..' +[13] AbbreviatedAxisSpecifier ::= '@'? +[14] Expr ::= OrExpr +[15] PrimaryExpr ::= VariableReference + | '(' Expr ')' + | Literal + | Number + | FunctionCall +[16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument )* )? ')' +[17] Argument ::= Expr +[18] UnionExpr ::= PathExpr | UnionExpr '|' PathExpr +[19] PathExpr ::= LocationPath + | FilterExpr + | FilterExpr '/' RelativeLocationPath + | FilterExpr '//' RelativeLocationPath +[20] FilterExpr ::= PrimaryExpr | FilterExpr Predicate +[21] OrExpr ::= AndExpr | OrExpr 'or' AndExpr +[22] AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr +[23] EqualityExpr ::= RelationalExpr + | EqualityExpr '=' RelationalExpr + | EqualityExpr '!=' RelationalExpr +[24] RelationalExpr ::= AdditiveExpr + | RelationalExpr '<' AdditiveExpr + | RelationalExpr '>' AdditiveExpr + | RelationalExpr '<=' AdditiveExpr + | RelationalExpr '>=' AdditiveExpr +[25] AdditiveExpr ::= MultiplicativeExpr + | AdditiveExpr '+' MultiplicativeExpr + | AdditiveExpr '-' MultiplicativeExpr +[26] MultiplicativeExpr ::= UnaryExpr + | MultiplicativeExpr MultiplyOperator UnaryExpr + | MultiplicativeExpr 'div' UnaryExpr + | MultiplicativeExpr 'mod' UnaryExpr +[27] UnaryExpr ::= UnionExpr + | '-' UnaryExpr + +[28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' + | NameTest + | NodeType + | Operator + | FunctionName + | AxisName + | Literal + | Number + | VariableReference +[29] Literal ::= '"' [^"]* '"' + | "'" [^']* "'" +[30] Number ::= Digits ('.' Digits?)? + | '.' Digits +[31] Digits ::= [0-9]+ +[32] Operator ::= OperatorName + | MultiplyOperator + | '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>=' +[33] OperatorName ::= 'and' | 'or' | 'mod' | 'div' +[34] MultiplyOperator ::= '*' +[35] FunctionName ::= QName - NodeType +[36] VariableReference ::= '$' QName +[37] NameTest ::= '*' + | NCName ':' '*' + | QName +[38] NodeType ::= 'comment' + | 'text' + | 'processing-instruction' + | 'node' +[39] ExprWhitespace ::= S \ No newline at end of file diff --git a/res/yahoo-small.json b/res/yahoo-small.json new file mode 100755 index 0000000..210bf96 --- /dev/null +++ b/res/yahoo-small.json @@ -0,0 +1,18 @@ +{"name": "Yahoo!", + "permalink": "yahoo", + "homepage_url": "http://www.yahoo.com", + "blog_url": "http://yodel.yahoo.com/", + "blog_feed_url": "http://ycorpblog.com/feed/", + "category_code": "web", + "number_of_employees": 13600, + "founded_year": 1994, + "founded_month": null, + "founded_day": null, + "deadpooled_year": null, + "deadpooled_month": null, + "deadpooled_day": null, + "deadpooled_url": null, + "tag_list": "search, portal, webmail, photos", + "email_address": "", + "phone_number": "(408) 349-3300" +} \ No newline at end of file diff --git a/res/yahoo.json b/res/yahoo.json new file mode 100644 index 0000000..aab012a --- /dev/null +++ b/res/yahoo.json @@ -0,0 +1,370 @@ +{"name": "Yahoo!", + "permalink": "yahoo", + "homepage_url": "http://www.yahoo.com", + "blog_url": "http://yodel.yahoo.com/", + "blog_feed_url": "http://ycorpblog.com/feed/", + "category_code": "web", + "number_of_employees": 13600, + "founded_year": 1994, + "founded_month": null, + "founded_day": null, + "deadpooled_year": null, + "deadpooled_month": null, + "deadpooled_day": null, + "deadpooled_url": null, + "tag_list": "search, portal, webmail, photos", + "email_address": "", + "phone_number": "(408) 349-3300", + "overview": "Yahoo was founded in 1994 by Stanford Ph.D. students David Filo and Jerry Yang. It has since evolved into a major internet brand with search, content verticals, and other web services.", + "image": + {"available_sizes": + [[[150, + 37], + "assets/images/resized/0001/0836/10836v1-max-250x150.png"], + [[200, + 50], + "assets/images/resized/0001/0836/10836v1-max-250x250.png"], + [[200, + 50], + "assets/images/resized/0001/0836/10836v1-max-450x450.png"]], + "attribution": null}, + "products": + [{"name": "Yahoo.com", + "permalink": "yahoo-com"}, + {"name": "Yahoo! Mail", + "permalink": "yahoo-mail"}, + {"name": "Yahoo! Search", + "permalink": "yahoo-search"}, + {"name": "Yahoo! Directory", + "permalink": "yahoo-directory"}, + {"name": "Yahoo! Finance", + "permalink": "yahoo-finance"}, + {"name": "My Yahoo", + "permalink": "my-yahoo"}, + {"name": "Yahoo! News", + "permalink": "yahoo-news"}, + {"name": "Yahoo! Groups", + "permalink": "yahoo-groups"}, + {"name": "Yahoo! Messenger", + "permalink": "yahoo-messenger"}, + {"name": "Yahoo! Games", + "permalink": "yahoo-games"}, + {"name": "Yahoo! People Search", + "permalink": "yahoo-people-search"}, + {"name": "Yahoo! Movies", + "permalink": "yahoo-movies"}, + {"name": "Yahoo! Weather", + "permalink": "yahoo-weather"}, + {"name": "Yahoo! Video", + "permalink": "yahoo-video"}, + {"name": "Yahoo! Music", + "permalink": "yahoo-music"}, + {"name": "Yahoo! Sports", + "permalink": "yahoo-sports"}, + {"name": "Yahoo! Maps", + "permalink": "yahoo-maps"}, + {"name": "Yahoo! Auctions", + "permalink": "yahoo-auctions"}, + {"name": "Yahoo! Widgets", + "permalink": "yahoo-widgets"}, + {"name": "Yahoo! Shopping", + "permalink": "yahoo-shopping"}, + {"name": "Yahoo! Real Estate", + "permalink": "yahoo-real-estate"}, + {"name": "Yahoo! Travel", + "permalink": "yahoo-travel"}, + {"name": "Yahoo! Classifieds", + "permalink": "yahoo-classifieds"}, + {"name": "Yahoo! Answers", + "permalink": "yahoo-answers"}, + {"name": "Yahoo! Mobile", + "permalink": "yahoo-mobile"}, + {"name": "Yahoo! Buzz", + "permalink": "yahoo-buzz"}, + {"name": "Yahoo! Open Search Platform", + "permalink": "yahoo-open-search-platform"}, + {"name": "Fire Eagle", + "permalink": "fireeagle"}, + {"name": "Shine", + "permalink": "shine"}, + {"name": "Yahoo! Shortcuts", + "permalink": "yahoo-shortcuts"}], + "competitions": + [{"competitor": + {"name": "Google", + "permalink": "google"}}, + {"competitor": + {"name": "seesmic", + "permalink": "seesmic"}}, + {"competitor": + {"name": "BricaBox", + "permalink": "bricabox"}}, + {"competitor": + {"name": "Clickpass", + "permalink": "clickpass"}}, + {"competitor": + {"name": "Tencent", + "permalink": "tencent"}}, + {"competitor": + {"name": "Hurdan", + "permalink": "better-searcher"}}, + {"competitor": + {"name": "Powerset", + "permalink": "powerset"}}, + {"competitor": + {"name": "Baidu", + "permalink": "baidu"}}, + {"competitor": + {"name": "Zenbe", + "permalink": "zenbe"}}, + {"competitor": + {"name": "Yandex", + "permalink": "yandex"}}, + {"competitor": + {"name": "Placebase", + "permalink": "placebase"}}, + {"competitor": + {"name": "AOL", + "permalink": "aol"}}], + "providerships": + [{"title": "", + "is_past": false, + "provider": + {"name": "OutCast Communications", + "permalink": "outcast-communications"}}, + {"title": "Investment Banking", + "is_past": null, + "provider": + {"name": "Moelis \u0026 Company", + "permalink": "moelis-company"}}, + {"title": "Public Relations", + "is_past": false, + "provider": + {"name": "Powerscourt", + "permalink": "powerscourt"}}], + "funding_rounds": + [], + "investments": + [{"funding_round": + {"round_code": "c", + "source_url": "http://sanjose.bizjournals.com/sanjose/stories/2004/05/24/daily3.html", + "source_description": "Plaxo connects to more funding", + "raised_amount": 7000000.0, + "raised_currency_code": "USD", + "funded_year": 2004, + "funded_month": 4, + "funded_day": 1, + "company": + {"name": "Plaxo", + "permalink": "plaxo"}}}, + {"funding_round": + {"round_code": "b", + "source_url": "http://www.techcrunch.com/2007/08/21/vlingo-voice-enable-any-mobile-application/", + "source_description": "", + "raised_amount": 20000000.0, + "raised_currency_code": "USD", + "funded_year": 2008, + "funded_month": 4, + "funded_day": 2, + "company": + {"name": "Vlingo", + "permalink": "vlingo"}}}, + {"funding_round": + {"round_code": "b", + "source_url": "http://www.paidcontent.org/entry/419-india-deals-ebay-sells-stake-in-indian-ops-bharatmatrimony-gets-2175-mi/", + "source_description": "India Deals: eBay Sells Stake In Indian Ops; Bharatmatrimony Gets $11.75 Million From Yahoo \u0026 Others", + "raised_amount": 11750000.0, + "raised_currency_code": "USD", + "funded_year": 2008, + "funded_month": 2, + "funded_day": 5, + "company": + {"name": "Bharat Matrimony", + "permalink": "bharat-matrimony"}}}], + "acquisition": null, + "acquisitions": + [{"price_amount": null, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 12, + "acquired_day": 1, + "company": + {"name": "delicious", + "permalink": "delicious"}}, + {"price_amount": 1000000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 8, + "acquired_day": 1, + "company": + {"name": "Alibaba", + "permalink": "alibaba"}}, + {"price_amount": 160000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2004, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "Musicmatch", + "permalink": "musicmatch"}}, + {"price_amount": 350000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2007, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "Zimbra", + "permalink": "zimbra"}}, + {"price_amount": 670000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2004, + "acquired_month": 4, + "acquired_day": 1, + "company": + {"name": "Kelkoo", + "permalink": "kelkoo"}}, + {"price_amount": 35000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://arstechnica.com/news.ars/post/20050324-4732.html", + "source_description": "", + "acquired_year": 2005, + "acquired_month": 3, + "acquired_day": 1, + "company": + {"name": "Flickr", + "permalink": "flickr"}}, + {"price_amount": 1000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 10, + "acquired_day": 1, + "company": + {"name": "Upcoming", + "permalink": "upcoming"}}, + {"price_amount": 300000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2007, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "BlueLithium", + "permalink": "bluelithium"}}, + {"price_amount": 160000000.0, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2008/02/12/yahoo-confirms-maven-networks-acquisition/", + "source_description": "Yahoo Confirms Maven Networks Acquisition", + "acquired_year": 2008, + "acquired_month": 1, + "acquired_day": 31, + "company": + {"name": "Maven Networks", + "permalink": "maven-networks"}}, + {"price_amount": 800000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.techcrunch.com/2007/04/29/panama-not-enough-to-battle-google-yahoo-acquires-rightmedia/", + "source_description": "Panama Not Enough To Battle Google: Yahoo Acquires RightMedia", + "acquired_year": 2007, + "acquired_month": 4, + "acquired_day": null, + "company": + {"name": "Right Media", + "permalink": "right-media"}}, + {"price_amount": 10000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.techcrunch.com/2007/01/08/yahoo-buys-mybloglog-no-they-didnt-wait-yes/", + "source_description": "", + "acquired_year": 2007, + "acquired_month": 1, + "acquired_day": null, + "company": + {"name": "MyBlogLog", + "permalink": "mybloglog"}}, + {"price_amount": 40000000.0, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2008/02/04/yahoo-acquires-israeli-foxytunes/", + "source_description": "TechCrunch", + "acquired_year": 2008, + "acquired_month": 2, + "acquired_day": 4, + "company": + {"name": "FoxyTunes", + "permalink": "foxytunes"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2006/09/27/yahoo-has-acquired-jumpcut/", + "source_description": "Yahoo! has acquired Jumpcut", + "acquired_year": 2006, + "acquired_month": 10, + "acquired_day": 2, + "company": + {"name": "Jumpcut", + "permalink": "jumpcut"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.ysearchblog.com/archives/000581.html", + "source_description": "Inquisitor Joins the Yahoo! Search Team", + "acquired_year": 2008, + "acquired_month": 5, + "acquired_day": 9, + "company": + {"name": "Inquisitor", + "permalink": "inquisitor"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.thealarmclock.com/mt/archives/2008/04/yahoo_buys_ad_a.html", + "source_description": "Yahoo! Buys Ad Analytics Firm Indextools", + "acquired_year": 2008, + "acquired_month": 4, + "acquired_day": 10, + "company": + {"name": "Indextools", + "permalink": "indextools"}}], + "offices": + [{"description": null, + "address1": "701 First Avenue", + "address2": "", + "zip_code": "94089", + "city": "Sunnyvale", + "state_code": "CA", + "country_code": "USA", + "latitude": 37.418531, + "longitude": -122.025485}], + "milestones": + [], + "ipo": + {"valuation_amount": null, + "valuation_currency_code": "USD", + "pub_year": 1996, + "pub_month": 4, + "pub_day": 12, + "stock_symbol": "YHOO"} +} \ No newline at end of file diff --git a/res/yahoo_with_comments.json b/res/yahoo_with_comments.json new file mode 100644 index 0000000..9d11005 --- /dev/null +++ b/res/yahoo_with_comments.json @@ -0,0 +1,370 @@ +{"name": "Yahoo!" /* foo bar */ , + "permalink": "yahoo", + "homepage_url": "http://www.yahoo.com", + "blog_url": "http://yodel.yahoo.com/", + "blog_feed_url": "http://ycorpblog.com/feed/", + "category_code": "web", + "number_of_employees": 13600, + "founded_year": 1994, + "founded_month": null, + "founded_day": null, + "deadpooled_year": null, + "deadpooled_month": null, + "deadpooled_day": null, + "deadpooled_url": null, + "tag_list": "search, portal, webmail, photos", + "email_address": "", + "phone_number": "(408) 349-3300", + "overview": "Yahoo was founded in 1994 by Stanford Ph.D. students David Filo and Jerry Yang. It has since evolved into a major internet brand with search, content verticals, and other web services.", + "image": + {"available_sizes": + [[[150, + 37], + "assets/images/resized/0001/0836/10836v1-max-250x150.png"], + [[200, + 50], + "assets/images/resized/0001/0836/10836v1-max-250x250.png"], + [[200, + 50], + "assets/images/resized/0001/0836/10836v1-max-450x450.png"]], + "attribution": null}, + "products": + [{"name": "Yahoo.com", + "permalink": "yahoo-com"}, + {"name": "Yahoo! Mail", + "permalink": "yahoo-mail"}, + {"name": "Yahoo! Search", + "permalink": "yahoo-search"}, + {"name": "Yahoo! Directory", + "permalink": "yahoo-directory"}, + {"name": "Yahoo! Finance", + "permalink": "yahoo-finance"}, + {"name": "My Yahoo", + "permalink": "my-yahoo"}, + {"name": "Yahoo! News", + "permalink": "yahoo-news"}, + {"name": "Yahoo! Groups", + "permalink": "yahoo-groups"}, + {"name": "Yahoo! Messenger", + "permalink": "yahoo-messenger"}, + {"name": "Yahoo! Games", + "permalink": "yahoo-games"}, + {"name": "Yahoo! People Search", + "permalink": "yahoo-people-search"}, + {"name": "Yahoo! Movies", + "permalink": "yahoo-movies"}, + {"name": "Yahoo! Weather", + "permalink": "yahoo-weather"}, + {"name": "Yahoo! Video", + "permalink": "yahoo-video"}, + {"name": "Yahoo! Music", + "permalink": "yahoo-music"}, + {"name": "Yahoo! Sports", + "permalink": "yahoo-sports"}, + {"name": "Yahoo! Maps", + "permalink": "yahoo-maps"}, + {"name": "Yahoo! Auctions", + "permalink": "yahoo-auctions"}, + {"name": "Yahoo! Widgets", + "permalink": "yahoo-widgets"}, + {"name": "Yahoo! Shopping", + "permalink": "yahoo-shopping"}, + {"name": "Yahoo! Real Estate", + "permalink": "yahoo-real-estate"}, + {"name": "Yahoo! Travel", + "permalink": "yahoo-travel"}, + {"name": "Yahoo! Classifieds", + "permalink": "yahoo-classifieds"}, + {"name": "Yahoo! Answers", + "permalink": "yahoo-answers"}, + {"name": "Yahoo! Mobile", + "permalink": "yahoo-mobile"}, + {"name": "Yahoo! Buzz", + "permalink": "yahoo-buzz"}, + {"name": "Yahoo! Open Search Platform", + "permalink": "yahoo-open-search-platform"}, + {"name": "Fire Eagle", + "permalink": "fireeagle"}, + {"name": "Shine", + "permalink": "shine"}, + {"name": "Yahoo! Shortcuts", + "permalink": "yahoo-shortcuts"}], + "competitions": + [{"competitor": + {"name": "Google", + "permalink": "google"}}, + {"competitor": + {"name": "seesmic", + "permalink": "seesmic"}}, + {"competitor": + {"name": "BricaBox", + "permalink": "bricabox"}}, + {"competitor": + {"name": "Clickpass", + "permalink": "clickpass"}}, + {"competitor": + {"name": "Tencent", + "permalink": "tencent"}}, + {"competitor": + {"name": "Hurdan", + "permalink": "better-searcher"}}, + {"competitor": + {"name": "Powerset", + "permalink": "powerset"}}, + {"competitor": + {"name": "Baidu", + "permalink": "baidu"}}, + {"competitor": + {"name": "Zenbe", + "permalink": "zenbe"}}, + {"competitor": + {"name": "Yandex", + "permalink": "yandex"}}, + {"competitor": + {"name": "Placebase", + "permalink": "placebase"}}, + {"competitor": + {"name": "AOL", + "permalink": "aol"}}], + "providerships": + [{"title": "", + "is_past": false, + "provider": + {"name": "OutCast Communications", + "permalink": "outcast-communications"}}, + {"title": "Investment Banking", + "is_past": null, + "provider": + {"name": "Moelis \u0026 Company", + "permalink": "moelis-company"}}, + {"title": "Public Relations", + "is_past": false, + "provider": + {"name": "Powerscourt", + "permalink": "powerscourt"}}], + "funding_rounds": + [], + "investments": + [{"funding_round": + {"round_code": "c", + "source_url": "http://sanjose.bizjournals.com/sanjose/stories/2004/05/24/daily3.html", + "source_description": "Plaxo connects to more funding", + "raised_amount": 7000000.0, + "raised_currency_code": "USD", + "funded_year": 2004, + "funded_month": 4, + "funded_day": 1, + "company": + {"name": "Plaxo", + "permalink": "plaxo"}}}, + {"funding_round": + {"round_code": "b", + "source_url": "http://www.techcrunch.com/2007/08/21/vlingo-voice-enable-any-mobile-application/", + "source_description": "", + "raised_amount": 20000000.0, + "raised_currency_code": "USD", + "funded_year": 2008, + "funded_month": 4, + "funded_day": 2, + "company": + {"name": "Vlingo", + "permalink": "vlingo"}}}, + {"funding_round": + {"round_code": "b", + "source_url": "http://www.paidcontent.org/entry/419-india-deals-ebay-sells-stake-in-indian-ops-bharatmatrimony-gets-2175-mi/", + "source_description": "India Deals: eBay Sells Stake In Indian Ops; Bharatmatrimony Gets $11.75 Million From Yahoo \u0026 Others", + "raised_amount": 11750000.0, + "raised_currency_code": "USD", + "funded_year": 2008, + "funded_month": 2, + "funded_day": 5, + "company": + {"name": "Bharat Matrimony", + "permalink": "bharat-matrimony"}}}], + "acquisition": null, + "acquisitions": + [{"price_amount": null, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 12, + "acquired_day": 1, + "company": + {"name": "delicious", + "permalink": "delicious"}}, + {"price_amount": 1000000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 8, + "acquired_day": 1, + "company": + {"name": "Alibaba", + "permalink": "alibaba"}}, + {"price_amount": 160000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2004, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "Musicmatch", + "permalink": "musicmatch"}}, + {"price_amount": 350000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2007, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "Zimbra", + "permalink": "zimbra"}}, + {"price_amount": 670000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2004, + "acquired_month": 4, + "acquired_day": 1, + "company": + {"name": "Kelkoo", + "permalink": "kelkoo"}}, + {"price_amount": 35000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://arstechnica.com/news.ars/post/20050324-4732.html", + "source_description": "", + "acquired_year": 2005, + "acquired_month": 3, + "acquired_day": 1, + "company": + {"name": "Flickr", + "permalink": "flickr"}}, + {"price_amount": 1000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2005, + "acquired_month": 10, + "acquired_day": 1, + "company": + {"name": "Upcoming", + "permalink": "upcoming"}}, + {"price_amount": 300000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": null, + "source_description": null, + "acquired_year": 2007, + "acquired_month": 9, + "acquired_day": 1, + "company": + {"name": "BlueLithium", + "permalink": "bluelithium"}}, + {"price_amount": 160000000.0, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2008/02/12/yahoo-confirms-maven-networks-acquisition/", + "source_description": "Yahoo Confirms Maven Networks Acquisition", + "acquired_year": 2008, + "acquired_month": 1, + "acquired_day": 31, + "company": + {"name": "Maven Networks", + "permalink": "maven-networks"}}, + {"price_amount": 800000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.techcrunch.com/2007/04/29/panama-not-enough-to-battle-google-yahoo-acquires-rightmedia/", + "source_description": "Panama Not Enough To Battle Google: Yahoo Acquires RightMedia", + "acquired_year": 2007, + "acquired_month": 4, + "acquired_day": null, + "company": + {"name": "Right Media", + "permalink": "right-media"}}, + {"price_amount": 10000000.0, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.techcrunch.com/2007/01/08/yahoo-buys-mybloglog-no-they-didnt-wait-yes/", + "source_description": "", + "acquired_year": 2007, + "acquired_month": 1, + "acquired_day": null, + "company": + {"name": "MyBlogLog", + "permalink": "mybloglog"}}, + {"price_amount": 40000000.0, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2008/02/04/yahoo-acquires-israeli-foxytunes/", + "source_description": "TechCrunch", + "acquired_year": 2008, + "acquired_month": 2, + "acquired_day": 4, + "company": + {"name": "FoxyTunes", + "permalink": "foxytunes"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.techcrunch.com/2006/09/27/yahoo-has-acquired-jumpcut/", + "source_description": "Yahoo! has acquired Jumpcut", + "acquired_year": 2006, + "acquired_month": 10, + "acquired_day": 2, + "company": + {"name": "Jumpcut", + "permalink": "jumpcut"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": null, + "source_url": "http://www.ysearchblog.com/archives/000581.html", + "source_description": "Inquisitor Joins the Yahoo! Search Team", + "acquired_year": 2008, + "acquired_month": 5, + "acquired_day": 9, + "company": + {"name": "Inquisitor", + "permalink": "inquisitor"}}, + {"price_amount": null, + "price_currency_code": "USD", + "term_code": "cash", + "source_url": "http://www.thealarmclock.com/mt/archives/2008/04/yahoo_buys_ad_a.html", + "source_description": "Yahoo! Buys Ad Analytics Firm Indextools", + "acquired_year": 2008, + "acquired_month": 4, + "acquired_day": 10, + "company": + {"name": "Indextools", + "permalink": "indextools"}}], + "offices": + [{"description": null, + "address1": "701 First Avenue", + "address2": "", + "zip_code": "94089", + "city": "Sunnyvale", + "state_code": "CA", + "country_code": "USA", + "latitude": 37.418531, + "longitude": -122.025485}], + "milestones": + [], + "ipo": + {"valuation_amount": null, + "valuation_currency_code": "USD", + "pub_year": 1996, + "pub_month": 4, + "pub_day": 12, + "stock_symbol": "YHOO"} +} \ No newline at end of file diff --git a/src/.svn/all-wcprops b/src/.svn/all-wcprops new file mode 100644 index 0000000..71c835b --- /dev/null +++ b/src/.svn/all-wcprops @@ -0,0 +1,347 @@ +K 25 +svn:wc:ra_dav:version-url +V 28 +/svn/!svn/ver/1410/trunk/src +END +NSString+ParseKitAdditions.m +K 25 +svn:wc:ra_dav:version-url +V 57 +/svn/!svn/ver/1404/trunk/src/NSString+ParseKitAdditions.m +END +PKDifference.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1398/trunk/src/PKDifference.m +END +PKCharacterAssembly.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1405/trunk/src/PKCharacterAssembly.m +END +PKWhitespace.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1115/trunk/src/PKWhitespace.m +END +PKParser.m +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/!svn/ver/1404/trunk/src/PKParser.m +END +PKLiteral.m +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1404/trunk/src/PKLiteral.m +END +PKWhitespaceState.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1405/trunk/src/PKWhitespaceState.m +END +PKEmpty.m +K 25 +svn:wc:ra_dav:version-url +V 38 +/svn/!svn/ver/1171/trunk/src/PKEmpty.m +END +PKLetter.m +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/!svn/ver/1171/trunk/src/PKLetter.m +END +RegexKitLite.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/862/trunk/src/RegexKitLite.h +END +PKTokenArraySource.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1171/trunk/src/PKTokenArraySource.m +END +PKDigit.m +K 25 +svn:wc:ra_dav:version-url +V 38 +/svn/!svn/ver/1170/trunk/src/PKDigit.m +END +PKReader.m +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/!svn/ver/1404/trunk/src/PKReader.m +END +RegexKitLite.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1404/trunk/src/RegexKitLite.m +END +PKSymbol.m +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/!svn/ver/1404/trunk/src/PKSymbol.m +END +PKIntersection.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1398/trunk/src/PKIntersection.m +END +PKCaseInsensitiveLiteral.m +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1170/trunk/src/PKCaseInsensitiveLiteral.m +END +PKTokenizer.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1400/trunk/src/PKTokenizer.m +END +PKSymbolNode.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1170/trunk/src/PKSymbolNode.m +END +PKTokenizerState.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1213/trunk/src/PKTokenizerState.m +END +PKWordState.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1405/trunk/src/PKWordState.m +END +PKPattern.m +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1404/trunk/src/PKPattern.m +END +PKSymbolRootNode.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1404/trunk/src/PKSymbolRootNode.m +END +PKAssembly.m +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1405/trunk/src/PKAssembly.m +END +PKAlternation.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1225/trunk/src/PKAlternation.m +END +PKToken.m +K 25 +svn:wc:ra_dav:version-url +V 38 +/svn/!svn/ver/1170/trunk/src/PKToken.m +END +PKTrackException.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1171/trunk/src/PKTrackException.m +END +PKUppercaseWord.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1404/trunk/src/PKUppercaseWord.m +END +PKSpecificChar.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1170/trunk/src/PKSpecificChar.m +END +PKQuotedString.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1170/trunk/src/PKQuotedString.m +END +PKDelimitState.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1404/trunk/src/PKDelimitState.m +END +PKNumber.m +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/!svn/ver/1177/trunk/src/PKNumber.m +END +PKNumberState.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1252/trunk/src/PKNumberState.m +END +NSArray+ParseKitAdditions.h +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1170/trunk/src/NSArray+ParseKitAdditions.h +END +PKQuoteState.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1170/trunk/src/PKQuoteState.m +END +PKGrammarParser.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1275/trunk/src/PKGrammarParser.h +END +NSArray+ParseKitAdditions.m +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1405/trunk/src/NSArray+ParseKitAdditions.m +END +PKComment.m +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1170/trunk/src/PKComment.m +END +PKCommentState.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1409/trunk/src/PKCommentState.m +END +PKGrammarParser.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1276/trunk/src/PKGrammarParser.m +END +PKNegation.m +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1152/trunk/src/PKNegation.m +END +PKTrack.m +K 25 +svn:wc:ra_dav:version-url +V 38 +/svn/!svn/ver/1405/trunk/src/PKTrack.m +END +PKSymbolState.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1410/trunk/src/PKSymbolState.m +END +PKCollectionParser.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1225/trunk/src/PKCollectionParser.m +END +PKSequence.m +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1405/trunk/src/PKSequence.m +END +PKTerminal.m +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1403/trunk/src/PKTerminal.m +END +PKWord.m +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/!svn/ver/1170/trunk/src/PKWord.m +END +PKSingleLineCommentState.m +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1404/trunk/src/PKSingleLineCommentState.m +END +PKChar.m +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/!svn/ver/1170/trunk/src/PKChar.m +END +PKTokenAssembly.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1405/trunk/src/PKTokenAssembly.m +END +PKLowercaseWord.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1404/trunk/src/PKLowercaseWord.m +END +PKRepetition.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1405/trunk/src/PKRepetition.m +END +NSString+ParseKitAdditions.h +K 25 +svn:wc:ra_dav:version-url +V 57 +/svn/!svn/ver/1171/trunk/src/NSString+ParseKitAdditions.h +END +PKParserFactory.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1405/trunk/src/PKParserFactory.m +END +PKMultiLineCommentState.m +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1404/trunk/src/PKMultiLineCommentState.m +END +PKDelimitedString.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1404/trunk/src/PKDelimitedString.m +END +PKAny.m +K 25 +svn:wc:ra_dav:version-url +V 36 +/svn/!svn/ver/1178/trunk/src/PKAny.m +END diff --git a/src/.svn/entries b/src/.svn/entries new file mode 100644 index 0000000..0c268a7 --- /dev/null +++ b/src/.svn/entries @@ -0,0 +1,1966 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/src +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-11-06T01:42:40.664388Z +1410 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +NSString+ParseKitAdditions.m +file + + + + +2009-11-13T07:14:28.000000Z +5d802dc05031ec359341f5c3395c8263 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +766 + +PKDifference.m +file + + + + +2009-09-22T06:22:42.000000Z +d346a0251a0f5ecbaa3e167b088ae91d +2009-09-22T06:46:43.186228Z +1398 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2145 + +PKCharacterAssembly.m +file + + + + +2009-11-13T07:14:28.000000Z +035c20938a350b837060af3f448b41b0 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2447 + +PKWhitespace.m +file + + + + +2009-06-30T06:13:14.000000Z +660d60e2b231f6b0d83278f19d1089a5 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +411 + +PKParser.m +file + + + + +2009-11-13T07:14:28.000000Z +7f5c0f95b0d5600002c55766b5daa51f +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +4554 + +PKLiteral.m +file + + + + +2009-11-13T07:14:29.000000Z +2f177fff66e256f4577e7007ef0db940 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1219 + +PKWhitespaceState.m +file + + + + +2009-11-13T07:14:29.000000Z +5a1e3bdb5968e3e77c44c320184ffc83 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2643 + +PKEmpty.m +file + + + + +2009-07-03T19:31:18.000000Z +f06bf77fcee5905d4d623426f14a12d5 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +460 + +PKLetter.m +file + + + + +2009-07-03T19:31:16.000000Z +0467837ae9f7c846694708d8f874384b +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +398 + +RegexKitLite.h +file + + + + +2009-05-03T00:29:43.000000Z +ae5b46f2e4026b75c043053e405a3a6a +2009-06-01T01:34:02.930802Z +862 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +10196 + +PKDigit.m +file + + + + +2009-07-03T19:31:15.000000Z +148d857ec471e3756986c1d71d7625d2 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +394 + +PKTokenArraySource.m +file + + + + +2009-07-03T19:42:56.000000Z +bb44ba94ee34d93389909092d7af9f87 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1660 + +PKReader.m +file + + + + +2009-11-13T07:14:29.000000Z +fa6d0417a05dfa2c6f8fa85e1d635150 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1056 + +PKSymbol.m +file + + + + +2009-11-13T07:14:29.000000Z +f29733fcdd1d798bca1bf6ac167a7d8f +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1586 + +RegexKitLite.m +file + + + + +2009-11-13T07:14:29.000000Z +b919a5f7a23d6baebd96f532427de327 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +111385 + +PKIntersection.m +file + + + + +2009-09-22T06:21:51.000000Z +e34af22e50502e583d655127a9d49186 +2009-09-22T06:46:43.186228Z +1398 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1723 + +PKCaseInsensitiveLiteral.m +file + + + + +2009-07-03T19:31:15.000000Z +c384f4ca66162d1a8d78b439d3d776b7 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +450 + +PKTokenizer.m +file + + + + +2009-09-26T03:40:29.000000Z +d5dd2cae79fa03616ef8953ef31257fc +2009-09-26T03:50:36.795525Z +1400 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +7019 + +PKTokenizerState.m +file + + + + +2009-07-13T05:29:20.000000Z +a33121d90a0fe7f507b61c09e562b752 +2009-07-12T23:22:41.730758Z +1213 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2703 + +PKSymbolNode.m +file + + + + +2009-07-03T19:42:56.000000Z +d9d8824ece419e38d2c76b898f7886ed +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2069 + +PKWordState.m +file + + + + +2009-11-13T07:14:29.000000Z +3c1a42d8dddd4d0040b7c6bd32d3d502 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +3133 + +PKPattern.m +file + + + + +2009-11-13T07:14:29.000000Z +1a6a3d57fe08b7e809170f0e1fa1854a +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1015 + +PKAssembly.m +file + + + + +2009-11-13T07:14:28.000000Z +4ea581f12c55911ba898e00c2aa3af0e +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +4996 + +PKSymbolRootNode.m +file + + + + +2009-11-13T07:14:29.000000Z +d005e03935581e79e8d878e40efc9424 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +4368 + +PKToken.m +file + + + + +2009-07-03T19:42:56.000000Z +258a174923071fe022286c6ba0344cfd +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +5240 + +PKAlternation.m +file + + + + +2009-07-14T03:17:31.000000Z +3e5e481bbf6c40073fa372b259b02fdd +2009-07-14T03:32:39.769371Z +1225 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1057 + +PKUppercaseWord.m +file + + + + +2009-11-13T07:14:29.000000Z +ef05ad208e6e2cc8bd0a46931506347c +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +464 + +PKSpecificChar.m +file + + + + +2009-07-03T19:31:16.000000Z +2a91818aa10c4ac979cd0b6f45beadcb +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +626 + +PKTrackException.m +file + + + + +2009-07-03T19:31:18.000000Z +81391434739d55de9fbcfe5d1cf041ca +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +279 + +PKQuotedString.m +file + + + + +2009-07-03T19:31:14.000000Z +20e2d7d1ce0f72e28623d2013a22527e +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +431 + +PKDelimitState.m +file + + + + +2009-11-13T07:14:29.000000Z +4ea1de55442a1c9aca4f958b7cec7a90 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +6646 + +PKNumber.m +file + + + + +2009-07-03T22:05:22.000000Z +2c180d893d01cce39dc8883d79d0837f +2009-07-03T22:22:49.496142Z +1177 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +400 + +PKNumberState.m +file + + + + +2009-07-20T00:14:56.000000Z +b9c939ec40e779fa9cbf4c6a134a401a +2009-07-20T00:15:49.775288Z +1252 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +6024 + +NSArray+ParseKitAdditions.h +file + + + + +2009-07-03T19:31:16.000000Z +b060603f004d407b06cda05530b21b0e +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +307 + +PKQuoteState.m +file + + + + +2009-07-03T19:42:56.000000Z +11b7ca1ea0db989b5f8916839280952e +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1238 + +PKGrammarParser.h +file + + + + +2009-08-06T04:02:04.000000Z +dbfc87a2410dc1aab9f85d320f756fec +2009-08-02T22:59:20.682429Z +1275 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3546 + +NSArray+ParseKitAdditions.m +file + + + + +2009-11-13T07:14:29.000000Z +94eae1412be9f1511129aeb165950ed3 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +575 + +PKComment.m +file + + + + +2009-07-03T19:31:15.000000Z +722d3d70383bb3046e7fd2667a834190 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +406 + +PKCommentState.m +file + + + + +2009-11-13T07:14:29.000000Z +d128cb12d367971ce3630cdf81de3f0e +2009-11-06T01:14:46.569140Z +1409 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +4196 + +PKGrammarParser.m +file + + + + +2009-08-06T04:02:04.000000Z +249e47f3e4bc9630d06ac16abfe28854 +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +21972 + +PKTrack.m +file + + + + +2009-11-13T07:14:28.000000Z +7b49792a547941214f6d1324fdcab5cc +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2474 + +PKNegation.m +file + + + + +2009-07-03T19:42:56.000000Z +7d53fe34fd243d12761108deb29046d7 +2009-07-03T03:31:46.326363Z +1152 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1314 + +PKSymbolState.m +file + + + + +2009-11-13T07:14:29.000000Z +7b6d72ea6215baa32543302587d0321c +2009-11-06T01:42:40.664388Z +1410 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2625 + +PKCollectionParser.m +file + + + + +2009-07-14T03:27:02.000000Z +1eee840b8123c8b63b814857d199db89 +2009-07-14T03:32:39.769371Z +1225 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2007 + +PKSequence.m +file + + + + +2009-11-13T07:14:29.000000Z +3483d760d9c39cf92a6e5c2c1df6782f +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1034 + +PKWord.m +file + + + + +2009-07-03T19:31:12.000000Z +fb533a93566e87ea6fb63a428c43d6f0 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +391 + +PKTerminal.m +file + + + + +2009-09-26T05:52:15.000000Z +5224feed13854fe6ff34454091b6b50d +2009-09-26T19:12:29.746961Z +1403 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1813 + +PKSingleLineCommentState.m +file + + + + +2009-11-13T07:14:29.000000Z +555abbb5014e293ded6c2503e25f12c6 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2341 + +PKChar.m +file + + + + +2009-07-03T19:31:15.000000Z +ee423bfcfbb21aa5c4b8ae001c3e758e +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +320 + +PKTokenAssembly.m +file + + + + +2009-11-13T07:14:29.000000Z +1d383db70f727d232516a3e5360bcdc1 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +4257 + +PKLowercaseWord.m +file + + + + +2009-11-13T07:14:29.000000Z +6a0b11034a616262951715ff41835728 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +464 + +PKRepetition.m +file + + + + +2009-11-13T07:14:29.000000Z +7f2bb72595003f49123dd3020ee73684 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1453 + +NSString+ParseKitAdditions.h +file + + + + +2009-07-03T19:31:17.000000Z +7edce56b8eeb7c7d062702562961bdf0 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +276 + +PKParserFactory.m +file + + + + +2009-11-13T07:14:29.000000Z +57f6eb71488f2e8788c6e7d515a000fa +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +32473 + +PKMultiLineCommentState.m +file + + + + +2009-11-13T07:14:29.000000Z +ba9ecf7e58d5a5d9350cf00523036069 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +4034 + +PKDelimitedString.m +file + + + + +2009-11-13T07:14:29.000000Z +39e0d7dc6a1604338c37e30de626e6da +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1334 + +PKAny.m +file + + + + +2009-07-03T22:27:32.000000Z +01c6c4a2f249eba58ef8c0cb46f4683e +2009-07-03T22:28:26.763415Z +1178 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +380 + diff --git a/src/.svn/prop-base/PKAlternation.m.svn-base b/src/.svn/prop-base/PKAlternation.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKAlternation.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKAssembly.m.svn-base b/src/.svn/prop-base/PKAssembly.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKAssembly.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKCaseInsensitiveLiteral.m.svn-base b/src/.svn/prop-base/PKCaseInsensitiveLiteral.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKCaseInsensitiveLiteral.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKChar.m.svn-base b/src/.svn/prop-base/PKChar.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKChar.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKCharacterAssembly.m.svn-base b/src/.svn/prop-base/PKCharacterAssembly.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKCharacterAssembly.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKCollectionParser.m.svn-base b/src/.svn/prop-base/PKCollectionParser.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKCollectionParser.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKDigit.m.svn-base b/src/.svn/prop-base/PKDigit.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKDigit.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKEmpty.m.svn-base b/src/.svn/prop-base/PKEmpty.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKEmpty.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKLetter.m.svn-base b/src/.svn/prop-base/PKLetter.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKLetter.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKLiteral.m.svn-base b/src/.svn/prop-base/PKLiteral.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKLiteral.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKLowercaseWord.m.svn-base b/src/.svn/prop-base/PKLowercaseWord.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKLowercaseWord.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKNumberState.m.svn-base b/src/.svn/prop-base/PKNumberState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKNumberState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKParser.m.svn-base b/src/.svn/prop-base/PKParser.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKParser.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKParserFactory.m.svn-base b/src/.svn/prop-base/PKParserFactory.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKParserFactory.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKQuoteState.m.svn-base b/src/.svn/prop-base/PKQuoteState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKQuoteState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKQuotedString.m.svn-base b/src/.svn/prop-base/PKQuotedString.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKQuotedString.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKReader.m.svn-base b/src/.svn/prop-base/PKReader.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKReader.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKRepetition.m.svn-base b/src/.svn/prop-base/PKRepetition.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKRepetition.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKSequence.m.svn-base b/src/.svn/prop-base/PKSequence.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKSequence.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKSpecificChar.m.svn-base b/src/.svn/prop-base/PKSpecificChar.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKSpecificChar.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKSymbol.m.svn-base b/src/.svn/prop-base/PKSymbol.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKSymbol.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKSymbolNode.m.svn-base b/src/.svn/prop-base/PKSymbolNode.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKSymbolNode.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKSymbolRootNode.m.svn-base b/src/.svn/prop-base/PKSymbolRootNode.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKSymbolRootNode.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKSymbolState.m.svn-base b/src/.svn/prop-base/PKSymbolState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKSymbolState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKTerminal.m.svn-base b/src/.svn/prop-base/PKTerminal.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKTerminal.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKToken.m.svn-base b/src/.svn/prop-base/PKToken.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKToken.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKTokenArraySource.m.svn-base b/src/.svn/prop-base/PKTokenArraySource.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKTokenArraySource.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKTokenAssembly.m.svn-base b/src/.svn/prop-base/PKTokenAssembly.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKTokenAssembly.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKTokenizer.m.svn-base b/src/.svn/prop-base/PKTokenizer.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKTokenizer.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKTokenizerState.m.svn-base b/src/.svn/prop-base/PKTokenizerState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKTokenizerState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKTrack.m.svn-base b/src/.svn/prop-base/PKTrack.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKTrack.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKUppercaseWord.m.svn-base b/src/.svn/prop-base/PKUppercaseWord.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKUppercaseWord.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKWhitespaceState.m.svn-base b/src/.svn/prop-base/PKWhitespaceState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKWhitespaceState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKWord.m.svn-base b/src/.svn/prop-base/PKWord.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKWord.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/prop-base/PKWordState.m.svn-base b/src/.svn/prop-base/PKWordState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/src/.svn/prop-base/PKWordState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/src/.svn/text-base/NSArray+ParseKitAdditions.h.svn-base b/src/.svn/text-base/NSArray+ParseKitAdditions.h.svn-base new file mode 100644 index 0000000..3d11f54 --- /dev/null +++ b/src/.svn/text-base/NSArray+ParseKitAdditions.h.svn-base @@ -0,0 +1,14 @@ +// +// NSArray+ParseKitAdditions.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface NSArray (ParseKitAdditions) +- (NSArray *)reversedArray; +- (NSMutableArray *)reversedMutableArray; +@end diff --git a/src/.svn/text-base/NSArray+ParseKitAdditions.m.svn-base b/src/.svn/text-base/NSArray+ParseKitAdditions.m.svn-base new file mode 100644 index 0000000..1399c35 --- /dev/null +++ b/src/.svn/text-base/NSArray+ParseKitAdditions.m.svn-base @@ -0,0 +1,26 @@ +// +// NSArray+ParseKitAdditions.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "NSArray+ParseKitAdditions.h" + +@implementation NSArray (ParseKitAdditions) + +- (NSArray *)reversedArray { + return [[[self reversedMutableArray] copy] autorelease]; +} + + +- (NSMutableArray *)reversedMutableArray { + NSMutableArray *result = [NSMutableArray arrayWithCapacity:[self count]]; + for (id obj in [self reverseObjectEnumerator]) { + [result addObject:obj]; + } + return result; +} + +@end diff --git a/src/.svn/text-base/NSString+ParseKitAdditions.h.svn-base b/src/.svn/text-base/NSString+ParseKitAdditions.h.svn-base new file mode 100644 index 0000000..55d02a8 --- /dev/null +++ b/src/.svn/text-base/NSString+ParseKitAdditions.h.svn-base @@ -0,0 +1,13 @@ +// +// NSString+ParseKitAdditions.h +// ParseKit +// +// Created by Todd Ditchendorf on 11/5/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface NSString (ParseKitAdditions) +- (NSString *)stringByTrimmingQuotes; +@end diff --git a/src/.svn/text-base/NSString+ParseKitAdditions.m.svn-base b/src/.svn/text-base/NSString+ParseKitAdditions.m.svn-base new file mode 100644 index 0000000..304a432 --- /dev/null +++ b/src/.svn/text-base/NSString+ParseKitAdditions.m.svn-base @@ -0,0 +1,38 @@ +// +// NSString+ParseKitAdditions.m +// ParseKit +// +// Created by Todd Ditchendorf on 11/5/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "NSString+ParseKitAdditions.h" + +@implementation NSString (ParseKitAdditions) + +- (NSString *)stringByTrimmingQuotes { + NSUInteger len = [self length]; + + if (len < 2) { + return self; + } + + NSRange r = NSMakeRange(0, len); + + unichar c = [self characterAtIndex:0]; + if (!isalnum(c)) { + unichar quoteChar = c; + r.location = 1; + r.length -= 1; + + c = [self characterAtIndex:len - 1]; + if (c == quoteChar) { + r.length -= 1; + } + return [self substringWithRange:r]; + } else { + return self; + } +} + +@end diff --git a/src/.svn/text-base/PKAlternation.m.svn-base b/src/.svn/text-base/PKAlternation.m.svn-base new file mode 100644 index 0000000..73b1a93 --- /dev/null +++ b/src/.svn/text-base/PKAlternation.m.svn-base @@ -0,0 +1,48 @@ +// +// PKAlternation.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@interface PKCollectionParser () ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest; +@end + +@implementation PKAlternation + ++ (id)alternation { + return [self alternationWithSubparsers:nil]; +} + + ++ (id)alternationWithSubparsers:(PKParser *)p1, ... { + va_list vargs; + va_start(vargs, p1); + PKAlternation *alt = [self collectionParserWithFirst:p1 rest:vargs]; + va_end(vargs); + return alt; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + NSMutableSet *outAssemblies = [NSMutableSet set]; + + for (PKParser *p in subparsers) { + [outAssemblies unionSet:[p matchAndAssemble:inAssemblies]]; + } + + return outAssemblies; +} + +@end diff --git a/src/.svn/text-base/PKAny.m.svn-base b/src/.svn/text-base/PKAny.m.svn-base new file mode 100644 index 0000000..f4665c5 --- /dev/null +++ b/src/.svn/text-base/PKAny.m.svn-base @@ -0,0 +1,23 @@ +// +// PKAny.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKAny + ++ (id)any { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + return [obj isMemberOfClass:[PKToken class]]; +} + +@end diff --git a/src/.svn/text-base/PKAssembly.m.svn-base b/src/.svn/text-base/PKAssembly.m.svn-base new file mode 100644 index 0000000..de47d3e --- /dev/null +++ b/src/.svn/text-base/PKAssembly.m.svn-base @@ -0,0 +1,225 @@ +// +// PKAssembly.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +static NSString * const PKAssemblyDefaultDelimiter = @"/"; + +@interface PKAssembly () +- (id)peek; +- (id)next; +- (BOOL)hasMore; +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter; +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter; + +@property (nonatomic, readwrite, retain) NSMutableArray *stack; +@property (nonatomic) NSUInteger index; +@property (nonatomic, retain) NSString *string; +@property (nonatomic, readwrite, retain) NSString *defaultDelimiter; +@property (nonatomic, readonly) NSUInteger length; +@property (nonatomic, readonly) NSUInteger objectsConsumed; +@property (nonatomic, readonly) NSUInteger objectsRemaining; +@end + +@implementation PKAssembly + ++ (id)assemblyWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)init { + return [self initWithString:nil]; +} + + +- (id)initWithString:(NSString *)s { + if (self = [super init]) { + self.stack = [NSMutableArray array]; + self.string = s; + } + return self; +} + + +- (void)dealloc { + self.stack = nil; + self.string = nil; + self.target = nil; + self.defaultDelimiter = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + // use of NSAllocateObject() below is a *massive* optimization over calling the designated initializer -initWithString: here. + // this line (and this method in general) is *vital* to the overall performance of the framework. dont fuck with it. + PKAssembly *a = NSAllocateObject([self class], 0, zone); + a->stack = [stack mutableCopyWithZone:zone]; + a->string = [string retain]; + if (defaultDelimiter) { + a->defaultDelimiter = [defaultDelimiter retain]; + } else { + a->defaultDelimiter = nil; + } + + if (target) { + if ([target conformsToProtocol:@protocol(NSMutableCopying)]) { + a->target = [target mutableCopyWithZone:zone]; + } else { + a->target = [target copyWithZone:zone]; + } + } else { + a->target = nil; + } + + a->index = index; + return a; +} + + +- (BOOL)isEqual:(id)obj { + if (![obj isMemberOfClass:[self class]]) { + return NO; + } + + PKAssembly *a = (PKAssembly *)obj; + if ([a length] != [self length]) { + return NO; + } + + if (a->index != index) { + return NO; + } + + if ([a.stack count] != [stack count]) { + return NO; + } + + return [[self description] isEqualToString:[obj description]]; +} + + +- (id)next { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return nil; +} + + +- (BOOL)hasMore { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return NO; +} + + +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return nil; +} + + +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return nil; +} + + +- (NSUInteger)length { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return 0; +} + + +- (NSUInteger)objectsConsumed { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return 0; +} + + +- (NSUInteger)objectsRemaining { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return 0; +} + + +- (id)peek { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return nil; +} + + +- (id)pop { + id result = nil; + if (![self isStackEmpty]) { + result = [[[stack lastObject] retain] autorelease]; + [stack removeLastObject]; + } + return result; +} + + +- (void)push:(id)object { + if (object) { + [stack addObject:object]; + } +} + + +- (BOOL)isStackEmpty { + return 0 == [stack count]; +} + + +- (NSArray *)objectsAbove:(id)fence { + NSMutableArray *result = [NSMutableArray array]; + + while (![self isStackEmpty]) { + id obj = [self pop]; + + if ([obj isEqual:fence]) { + [self push:obj]; + break; + } else { + [result addObject:obj]; + } + } + + return result; +} + + +- (NSString *)description { + NSMutableString *s = [NSMutableString string]; + [s appendString:@"["]; + + NSUInteger i = 0; + NSUInteger len = [stack count]; + + for (id obj in stack) { + [s appendString:[obj description]]; + if (len - 1 != i++) { + [s appendString:@", "]; + } + } + + [s appendString:@"]"]; + + NSString *d = defaultDelimiter ? defaultDelimiter : PKAssemblyDefaultDelimiter; + [s appendString:[self consumedObjectsJoinedByString:d]]; + [s appendString:@"^"]; + [s appendString:[self remainingObjectsJoinedByString:d]]; + + return [[s copy] autorelease]; +} + +@synthesize stack; +@synthesize target; +@synthesize index; +@synthesize string; +@synthesize defaultDelimiter; +@end diff --git a/src/.svn/text-base/PKCaseInsensitiveLiteral.m.svn-base b/src/.svn/text-base/PKCaseInsensitiveLiteral.m.svn-base new file mode 100644 index 0000000..99ba2ca --- /dev/null +++ b/src/.svn/text-base/PKCaseInsensitiveLiteral.m.svn-base @@ -0,0 +1,19 @@ +// +// PKCaseInsensitiveLiteral.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKCaseInsensitiveLiteral + +- (BOOL)qualifies:(id)obj { + return NSOrderedSame == [literal.stringValue caseInsensitiveCompare:[obj stringValue]]; +// return [literal isEqualIgnoringCase:obj]; +} + +@end diff --git a/src/.svn/text-base/PKChar.m.svn-base b/src/.svn/text-base/PKChar.m.svn-base new file mode 100644 index 0000000..e663813 --- /dev/null +++ b/src/.svn/text-base/PKChar.m.svn-base @@ -0,0 +1,22 @@ +// +// PKChar.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@implementation PKChar + ++ (id)char { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + return YES; +} + +@end diff --git a/src/.svn/text-base/PKCharacterAssembly.m.svn-base b/src/.svn/text-base/PKCharacterAssembly.m.svn-base new file mode 100644 index 0000000..3baddd9 --- /dev/null +++ b/src/.svn/text-base/PKCharacterAssembly.m.svn-base @@ -0,0 +1,121 @@ +// +// PKCharacterAssembly.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKAssembly () +@property (nonatomic, readwrite, retain) NSString *defaultDelimiter; +@end + +@implementation PKCharacterAssembly + +- (id)init { + return [self initWithString:nil]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.defaultDelimiter = @""; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + PKCharacterAssembly *a = (PKCharacterAssembly *)[super copyWithZone:zone]; + return a; +} + + +- (id)peek { + if (index >= [string length]) { + return nil; + } + PKUniChar c = [string characterAtIndex:index]; + return [NSNumber numberWithInt:c]; +} + + +- (id)next { + id obj = [self peek]; + if (obj) { + index++; + } + return obj; +} + + +- (BOOL)hasMore { + return (index < [string length]); +} + + +- (NSUInteger)length { + return [string length]; +} + + +- (NSUInteger)objectsConsumed { + return index; +} + + +- (NSUInteger)objectsRemaining { + return ([string length] - index); +} + + +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter { + NSParameterAssert(delimiter); + return [string substringToIndex:self.objectsConsumed]; +} + + +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter { + NSParameterAssert(delimiter); + return [string substringFromIndex:self.objectsConsumed]; +} + + +// overriding simply to print NSNumber objects as their unichar values +- (NSString *)description { + NSMutableString *s = [NSMutableString string]; + [s appendString:@"["]; + + NSUInteger i = 0; + NSUInteger len = [stack count]; + + for (id obj in self.stack) { + if ([obj isKindOfClass:[NSNumber class]]) { // ***this is needed for Char Assemblies + [s appendFormat:@"%C", [obj integerValue]]; + } else { + [s appendString:[obj description]]; + } + if (len - 1 != i++) { + [s appendString:@", "]; + } + } + + [s appendString:@"]"]; + + [s appendString:[self consumedObjectsJoinedByString:self.defaultDelimiter]]; + [s appendString:@"^"]; + [s appendString:[self remainingObjectsJoinedByString:self.defaultDelimiter]]; + + return [[s copy] autorelease]; +} + +@end diff --git a/src/.svn/text-base/PKCollectionParser.m.svn-base b/src/.svn/text-base/PKCollectionParser.m.svn-base new file mode 100644 index 0000000..6fabdb8 --- /dev/null +++ b/src/.svn/text-base/PKCollectionParser.m.svn-base @@ -0,0 +1,98 @@ +// +// PKCollectionParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface PKCollectionParser () ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest; + +@property (nonatomic, readwrite, retain) NSMutableArray *subparsers; +@end + +@implementation PKCollectionParser + ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest { + PKCollectionParser *cp = [[[self alloc] init] autorelease]; + + if (p1) { + [cp add:p1]; + + PKParser *p = nil; + while (p = va_arg(rest, PKParser *)) { + [cp add:p]; + } + } + + return cp; +} + + +- (id)init { + return [self initWithSubparsers:nil]; +} + + +- (id)initWithSubparsers:(PKParser *)p1, ... { + if (self = [super init]) { + self.subparsers = [NSMutableArray array]; + + if (p1) { + [subparsers addObject:p1]; + + va_list vargs; + va_start(vargs, p1); + + PKParser *p = nil; + while (p = va_arg(vargs, PKParser *)) { + [subparsers addObject:p]; + } + + va_end(vargs); + } + } + return self; +} + + +- (void)dealloc { + self.subparsers = nil; + [super dealloc]; +} + + +- (void)add:(PKParser *)p { + if (![p isKindOfClass:[PKParser class]]) { + NSLog(@"p: %@", p); + } + NSParameterAssert([p isKindOfClass:[PKParser class]]); + [subparsers addObject:p]; +} + + +- (PKParser *)parserNamed:(NSString *)s { + if ([name isEqualToString:s]) { + return self; + } else { + // do bredth-first search + for (PKParser *p in subparsers) { + if ([p.name isEqualToString:s]) { + return p; + } + } + for (PKParser *p in subparsers) { + PKParser *sub = [p parserNamed:s]; + if (sub) { + return sub; + } + } + } + return nil; +} + +@synthesize subparsers; +@end diff --git a/src/.svn/text-base/PKComment.m.svn-base b/src/.svn/text-base/PKComment.m.svn-base new file mode 100644 index 0000000..0d0eb1f --- /dev/null +++ b/src/.svn/text-base/PKComment.m.svn-base @@ -0,0 +1,24 @@ +// +// PKComment.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/31/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKComment + ++ (id)comment { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isComment; +} + +@end \ No newline at end of file diff --git a/src/.svn/text-base/PKCommentState.m.svn-base b/src/.svn/text-base/PKCommentState.m.svn-base new file mode 100644 index 0000000..9eeb341 --- /dev/null +++ b/src/.svn/text-base/PKCommentState.m.svn-base @@ -0,0 +1,141 @@ +// +// PKCommentState.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/28/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t; +@end + +@interface PKCommentState () +@property (nonatomic, retain) PKSymbolRootNode *rootNode; +@property (nonatomic, retain) PKSingleLineCommentState *singleLineState; +@property (nonatomic, retain) PKMultiLineCommentState *multiLineState; +@end + +@interface PKSingleLineCommentState () +- (void)addStartMarker:(NSString *)start; +- (void)removeStartMarker:(NSString *)start; +@property (nonatomic, retain) NSMutableArray *startMarkers; +@property (nonatomic, retain) NSString *currentStartMarker; +@end + +@interface PKMultiLineCommentState () +- (void)addStartMarker:(NSString *)start endMarker:(NSString *)end; +- (void)removeStartMarker:(NSString *)start; +@property (nonatomic, retain) NSMutableArray *startMarkers; +@property (nonatomic, retain) NSMutableArray *endMarkers; +@property (nonatomic, copy) NSString *currentStartMarker; +@end + +@implementation PKCommentState + +- (id)init { + if (self = [super init]) { + self.rootNode = [[[PKSymbolRootNode alloc] init] autorelease]; + self.singleLineState = [[[PKSingleLineCommentState alloc] init] autorelease]; + self.multiLineState = [[[PKMultiLineCommentState alloc] init] autorelease]; + } + return self; +} + + +- (void)dealloc { + self.rootNode = nil; + self.singleLineState = nil; + self.multiLineState = nil; + [super dealloc]; +} + + +- (void)addSingleLineStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [rootNode add:start]; + [singleLineState addStartMarker:start]; +} + + +- (void)removeSingleLineStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [rootNode remove:start]; + [singleLineState removeStartMarker:start]; +} + + +- (void)addMultiLineStartMarker:(NSString *)start endMarker:(NSString *)end { + NSParameterAssert([start length]); + NSParameterAssert([end length]); + [rootNode add:start]; + [rootNode add:end]; + [multiLineState addStartMarker:start endMarker:end]; +} + + +- (void)removeMultiLineStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [rootNode remove:start]; + [multiLineState removeStartMarker:start]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + [self resetWithReader:r]; + + NSString *symbol = [rootNode nextSymbol:r startingWith:cin]; + PKToken *tok = nil; + + while ([symbol length]) { + if ([multiLineState.startMarkers containsObject:symbol]) { + multiLineState.currentStartMarker = symbol; + tok = [multiLineState nextTokenFromReader:r startingWith:cin tokenizer:t]; + if (tok.isComment) { + tok.offset = offset; + } + } else if ([singleLineState.startMarkers containsObject:symbol]) { + singleLineState.currentStartMarker = symbol; + tok = [singleLineState nextTokenFromReader:r startingWith:cin tokenizer:t]; + if (tok.isComment) { + tok.offset = offset; + } + } + + if (tok) { + return tok; + } else { + if ([symbol length] > 1) { + symbol = [symbol substringToIndex:[symbol length] -1]; + } else { + break; + } + [r unread:1]; + } + } + + return [[self nextTokenizerStateFor:cin tokenizer:t] nextTokenFromReader:r startingWith:cin tokenizer:t]; +} + +@synthesize rootNode; +@synthesize singleLineState; +@synthesize multiLineState; +@synthesize reportsCommentTokens; +@synthesize balancesEOFTerminatedComments; +@end diff --git a/src/.svn/text-base/PKDelimitState.m.svn-base b/src/.svn/text-base/PKDelimitState.m.svn-base new file mode 100644 index 0000000..ce2896e --- /dev/null +++ b/src/.svn/text-base/PKDelimitState.m.svn-base @@ -0,0 +1,208 @@ +// +// PKDelimitState.m +// ParseKit +// +// Created by Todd Ditchendorf on 5/21/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (void)appendString:(NSString *)s; +- (NSString *)bufferedString; +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t; +@end + +@interface PKDelimitState () +- (NSString *)endMarkerForStartMarker:(NSString *)startMarker; +- (NSCharacterSet *)allowedCharacterSetForStartMarker:(NSString *)startMarker; +@property (nonatomic, retain) PKSymbolRootNode *rootNode; +@property (nonatomic, retain) NSMutableArray *startMarkers; +@property (nonatomic, retain) NSMutableArray *endMarkers; +@property (nonatomic, retain) NSMutableArray *characterSets; +@end + +@implementation PKDelimitState + +- (id)init { + if (self = [super init]) { + self.rootNode = [[[PKSymbolRootNode alloc] init] autorelease]; + self.startMarkers = [NSMutableArray array]; + self.endMarkers = [NSMutableArray array]; + self.characterSets = [NSMutableArray array]; + } + return self; +} + + +- (void)dealloc { + self.rootNode = nil; + self.startMarkers = nil; + self.endMarkers = nil; + self.characterSets = nil; + [super dealloc]; +} + + +- (void)addStartMarker:(NSString *)start endMarker:(NSString *)end allowedCharacterSet:(NSCharacterSet *)set { + NSParameterAssert([start length]); + [rootNode add:start]; + [startMarkers addObject:start]; + + if ([end length]) { + [rootNode add:end]; + [endMarkers addObject:end]; + } else { + [endMarkers addObject:[NSNull null]]; + } + + if (set) { + [characterSets addObject:set]; + } else { + [characterSets addObject:[NSNull null]]; + } +} + + +- (void)removeStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [rootNode remove:start]; + NSUInteger i = [startMarkers indexOfObject:start]; + if (NSNotFound != i) { + [startMarkers removeObject:start]; + [characterSets removeObjectAtIndex:i]; + + id endOrNull = [endMarkers objectAtIndex:i]; + if ([NSNull null] != endOrNull) { + [rootNode remove:endOrNull]; + } + [endMarkers removeObjectAtIndex:i]; // this should always be in range. + } +} + + +- (NSString *)endMarkerForStartMarker:(NSString *)startMarker { + NSParameterAssert([startMarkers containsObject:startMarker]); + NSUInteger i = [startMarkers indexOfObject:startMarker]; + return [endMarkers objectAtIndex:i]; +} + + +- (NSCharacterSet *)allowedCharacterSetForStartMarker:(NSString *)startMarker { + NSParameterAssert([startMarkers containsObject:startMarker]); + NSCharacterSet *characterSet = nil; + NSUInteger i = [startMarkers indexOfObject:startMarker]; + id csOrNull = [characterSets objectAtIndex:i]; + if ([NSNull null] != csOrNull) { + characterSet = csOrNull; + } + return characterSet; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + NSString *startMarker = [rootNode nextSymbol:r startingWith:cin]; + + if (![startMarker length] || ![startMarkers containsObject:startMarker]) { + [r unread:[startMarker length] - 1]; + return [[self nextTokenizerStateFor:cin tokenizer:t] nextTokenFromReader:r startingWith:cin tokenizer:t]; + } + + [self resetWithReader:r]; + [self appendString:startMarker]; + + id endMarkerOrNull = [self endMarkerForStartMarker:startMarker]; + NSString *endMarker = nil; + NSCharacterSet *characterSet = [self allowedCharacterSetForStartMarker:startMarker]; + + PKUniChar c, e; + if ([NSNull null] == endMarkerOrNull) { + e = PKEOF; + } else { + endMarker = endMarkerOrNull; + e = [endMarker characterAtIndex:0]; + } + while (1) { + c = [r read]; + if (PKEOF == c) { + if (balancesEOFTerminatedStrings && endMarker) { + [self appendString:endMarker]; + } else if (endMarker && !allowsUnbalancedStrings) { + [r unread:[[self bufferedString] length] - 1]; + return [[self nextTokenizerStateFor:cin tokenizer:t] nextTokenFromReader:r startingWith:cin tokenizer:t]; + } + break; + } + + if (!endMarker && [t.whitespaceState isWhitespaceChar:c]) { + // if only the start marker was matched, dont return delimited string token. instead, defer tokenization + if ([startMarker isEqualToString:[self bufferedString]]) { + [r unread:[startMarker length] - 1]; + return [[self nextTokenizerStateFor:cin tokenizer:t] nextTokenFromReader:r startingWith:cin tokenizer:t]; + } + // else, return delimited string tok + break; + } + + if (e == c) { + NSString *peek = [rootNode nextSymbol:r startingWith:e]; + if (endMarker && [endMarker isEqualToString:peek]) { + [self appendString:endMarker]; + c = [r read]; + break; + } else { + [r unread:[peek length] - 1]; + if (e != [peek characterAtIndex:0]) { + [self append:c]; + c = [r read]; + } + } + } + + + // check if char is not in allowed character set (if given) + if (characterSet && ![characterSet characterIsMember:c]) { + if (allowsUnbalancedStrings) { + break; + } else { + // if not, unwind and return a symbol tok for cin + [r unread:[[self bufferedString] length]]; + return [[self nextTokenizerStateFor:cin tokenizer:t] nextTokenFromReader:r startingWith:cin tokenizer:t]; + } + } + + [self append:c]; + } + + if (PKEOF != c) { + [r unread]; + } + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeDelimitedString stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; +} + +@synthesize rootNode; +@synthesize balancesEOFTerminatedStrings; +@synthesize allowsUnbalancedStrings; +@synthesize startMarkers; +@synthesize endMarkers; +@synthesize characterSets; +@end diff --git a/src/.svn/text-base/PKDelimitedString.m.svn-base b/src/.svn/text-base/PKDelimitedString.m.svn-base new file mode 100644 index 0000000..1b3186e --- /dev/null +++ b/src/.svn/text-base/PKDelimitedString.m.svn-base @@ -0,0 +1,58 @@ +// +// PKDelimitedString.m +// ParseKit +// +// Created by Todd Ditchendorf on 5/21/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKDelimitedString () +@property (nonatomic, retain) NSString *startMarker; +@property (nonatomic, retain) NSString *endMarker; +@end + +@implementation PKDelimitedString + ++ (id)delimitedString { + return [self delimitedStringWithStartMarker:nil]; +} + + ++ (id)delimitedStringWithStartMarker:(NSString *)start { + return [self delimitedStringWithStartMarker:start endMarker:nil]; +} + + ++ (id)delimitedStringWithStartMarker:(NSString *)start endMarker:(NSString *)end { + PKDelimitedString *ds = [[[self alloc] initWithString:nil] autorelease]; + ds.startMarker = start; + ds.endMarker = end; + return ds; +} + + +- (void)dealloc { + self.startMarker = nil; + self.endMarker = nil; + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + BOOL result = tok.isDelimitedString; + if (result && [startMarker length]) { + result = [tok.stringValue hasPrefix:startMarker]; + if (result && [endMarker length]) { + result = [tok.stringValue hasSuffix:endMarker]; + } + } + return result; +} + +@synthesize startMarker; +@synthesize endMarker; +@end \ No newline at end of file diff --git a/src/.svn/text-base/PKDifference.m.svn-base b/src/.svn/text-base/PKDifference.m.svn-base new file mode 100644 index 0000000..a8b6f9a --- /dev/null +++ b/src/.svn/text-base/PKDifference.m.svn-base @@ -0,0 +1,98 @@ +// +// PKDifference.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/26/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKDifference.h" + +@interface NSMutableSet (PKDifferenceAdditions) +- (void)minusSetTestingEquality:(NSSet *)s; +@end + +@implementation NSMutableSet (PKDifferenceAdditions) + +- (void)minusSetTestingEquality:(NSSet *)s { + for (id a1 in self) { + for (id a2 in s) { + if ([a1 isEqual:a2]) { + [self removeObject:a1]; + } + } + } +} + +@end + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@interface PKDifference () +@property (nonatomic, retain, readwrite) PKParser *subparser; +@property (nonatomic, retain, readwrite) PKParser *minus; +@end + +@implementation PKDifference + ++ (id)differenceWithSubparser:(PKParser *)s minus:(PKParser *)m { + return [[[self alloc] initWithSubparser:s minus:m] autorelease]; +} + + +- (id)initWithSubparser:(PKParser *)s minus:(PKParser *)m { + if (self = [super init]) { + self.subparser = s; + self.minus = m; + } + return self; +} + + +- (void)dealloc { + self.subparser = nil; + self.minus = nil; + [super dealloc]; +} + + +- (PKParser *)parserNamed:(NSString *)s { + if ([name isEqualToString:s]) { + return self; + } else { + // do bredth-first search + if ([subparser.name isEqualToString:s]) { + return subparser; + } + if ([minus.name isEqualToString:s]) { + return minus; + } + + PKParser *sub = [subparser parserNamed:s]; + if (sub) { + return sub; + } + sub = [minus parserNamed:s]; + if (sub) { + return sub; + } + } + return nil; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + + NSMutableSet *outAssemblies = [[[subparser matchAndAssemble:inAssemblies] mutableCopy] autorelease]; + [outAssemblies minusSetTestingEquality:[minus allMatchesFor:inAssemblies]]; + + return outAssemblies; +} + +@synthesize subparser; +@synthesize minus; +@end diff --git a/src/.svn/text-base/PKDigit.m.svn-base b/src/.svn/text-base/PKDigit.m.svn-base new file mode 100644 index 0000000..d1e9798 --- /dev/null +++ b/src/.svn/text-base/PKDigit.m.svn-base @@ -0,0 +1,24 @@ +// +// PKDigit.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKDigit + ++ (id)digit { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKUniChar c = [obj intValue]; + return isdigit(c); +} + +@end diff --git a/src/.svn/text-base/PKEmpty.m.svn-base b/src/.svn/text-base/PKEmpty.m.svn-base new file mode 100644 index 0000000..7dcc3fb --- /dev/null +++ b/src/.svn/text-base/PKEmpty.m.svn-base @@ -0,0 +1,24 @@ +// +// PKEmpty.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@implementation PKEmpty + ++ (id)empty { + return [[[self alloc] init] autorelease]; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + //return [[[NSSet alloc] initWithSet:inAssemblies copyItems:YES] autorelease]; + return inAssemblies; +} + +@end diff --git a/src/.svn/text-base/PKGrammarParser.h.svn-base b/src/.svn/text-base/PKGrammarParser.h.svn-base new file mode 100644 index 0000000..8a4ba4a --- /dev/null +++ b/src/.svn/text-base/PKGrammarParser.h.svn-base @@ -0,0 +1,77 @@ +// +// PKGrammarParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface PKGrammarParser : NSObject { + id assembler; + PKCollectionParser *statementParser; + PKCollectionParser *declarationParser; + PKCollectionParser *callbackParser; + PKCollectionParser *selectorParser; + PKCollectionParser *exprParser; + PKCollectionParser *termParser; + PKCollectionParser *orTermParser; + PKCollectionParser *factorParser; + PKCollectionParser *nextFactorParser; + PKCollectionParser *phraseParser; + PKCollectionParser *phraseStarParser; + PKCollectionParser *phrasePlusParser; + PKCollectionParser *phraseQuestionParser; + PKCollectionParser *phraseCardinalityParser; + PKCollectionParser *cardinalityParser; + PKCollectionParser *primaryExprParser; + PKCollectionParser *negatedPrimaryExprParser; + PKCollectionParser *barePrimaryExprParser; + PKCollectionParser *predicateParser; + PKCollectionParser *intersectionParser; + PKCollectionParser *differenceParser; + PKCollectionParser *atomicValueParser; + PKCollectionParser *parserParser; + PKCollectionParser *discardParser; + PKCollectionParser *patternParser; + PKCollectionParser *delimitedStringParser; + PKParser *literalParser; + PKParser *variableParser; + PKParser *constantParser; +} + +- (id)initWithAssembler:(id)a; + +@property (nonatomic, retain) PKCollectionParser *statementParser; +@property (nonatomic, retain) PKCollectionParser *declarationParser; +@property (nonatomic, retain) PKCollectionParser *callbackParser; +@property (nonatomic, retain) PKCollectionParser *selectorParser; +@property (nonatomic, retain) PKCollectionParser *exprParser; +@property (nonatomic, retain) PKCollectionParser *termParser; +@property (nonatomic, retain) PKCollectionParser *orTermParser; +@property (nonatomic, retain) PKCollectionParser *factorParser; +@property (nonatomic, retain) PKCollectionParser *nextFactorParser; +@property (nonatomic, retain) PKCollectionParser *phraseParser; +@property (nonatomic, retain) PKCollectionParser *phraseStarParser; +@property (nonatomic, retain) PKCollectionParser *phrasePlusParser; +@property (nonatomic, retain) PKCollectionParser *phraseQuestionParser; +@property (nonatomic, retain) PKCollectionParser *phraseCardinalityParser; +@property (nonatomic, retain) PKCollectionParser *cardinalityParser; +@property (nonatomic, retain) PKCollectionParser *primaryExprParser; +@property (nonatomic, retain) PKCollectionParser *negatedPrimaryExprParser; +@property (nonatomic, retain) PKCollectionParser *barePrimaryExprParser; +@property (nonatomic, retain) PKCollectionParser *predicateParser; +@property (nonatomic, retain) PKCollectionParser *intersectionParser; +@property (nonatomic, retain) PKCollectionParser *differenceParser; +@property (nonatomic, retain) PKCollectionParser *atomicValueParser; +@property (nonatomic, retain) PKCollectionParser *parserParser; +@property (nonatomic, retain) PKCollectionParser *discardParser; +@property (nonatomic, retain) PKCollectionParser *patternParser; +@property (nonatomic, retain) PKCollectionParser *delimitedStringParser; +@property (nonatomic, retain) PKParser *literalParser; +@property (nonatomic, retain) PKParser *variableParser; +@property (nonatomic, retain) PKParser *constantParser; +@property (nonatomic, retain, readonly) PKParser *whitespaceParser; +@property (nonatomic, retain, readonly) PKCollectionParser *optionalWhitespaceParser; +@end diff --git a/src/.svn/text-base/PKGrammarParser.m.svn-base b/src/.svn/text-base/PKGrammarParser.m.svn-base new file mode 100644 index 0000000..132af55 --- /dev/null +++ b/src/.svn/text-base/PKGrammarParser.m.svn-base @@ -0,0 +1,640 @@ +// +// PKGrammarParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKGrammarParser.h" +#import + +@interface NSObject (PKGrammarParserAdditions) +- (void)didMatchStatement:(PKAssembly *)a; +- (void)didMatchCallback:(PKAssembly *)a; +- (void)didMatchExpression:(PKAssembly *)a; +- (void)didMatchAnd:(PKAssembly *)a; +- (void)didMatchIntersection:(PKAssembly *)a; +- (void)didMatchDifference:(PKAssembly *)a; +- (void)didMatchPatternOptions:(PKAssembly *)a; +- (void)didMatchPattern:(PKAssembly *)a; +- (void)didMatchDiscard:(PKAssembly *)a; +- (void)didMatchLiteral:(PKAssembly *)a; +- (void)didMatchVariable:(PKAssembly *)a; +- (void)didMatchConstant:(PKAssembly *)a; +- (void)didMatchDelimitedString:(PKAssembly *)a; +- (void)didMatchNum:(PKAssembly *)a; +- (void)didMatchStar:(PKAssembly *)a; +- (void)didMatchPlus:(PKAssembly *)a; +- (void)didMatchQuestion:(PKAssembly *)a; +- (void)didMatchPhraseCardinality:(PKAssembly *)a; +- (void)didMatchCardinality:(PKAssembly *)a; +- (void)didMatchOr:(PKAssembly *)a; +- (void)didMatchNegation:(PKAssembly *)a; +@end + +@interface PKGrammarParser () +- (PKAlternation *)zeroOrOne:(PKParser *)p; +- (PKSequence *)oneOrMore:(PKParser *)p; +@end + +@implementation PKGrammarParser + +- (id)initWithAssembler:(id)a { + if (self = [super init]) { + assembler = a; + } + return self; +} + + +- (void)dealloc { + assembler = nil; // appease clang static analyzer + + PKReleaseSubparserTree(statementParser); + PKReleaseSubparserTree(exprParser); + + self.statementParser = nil; + self.declarationParser = nil; + self.callbackParser = nil; + self.selectorParser = nil; + self.exprParser = nil; + self.termParser = nil; + self.orTermParser = nil; + self.factorParser = nil; + self.nextFactorParser = nil; + self.phraseParser = nil; + self.phraseStarParser = nil; + self.phrasePlusParser = nil; + self.phraseQuestionParser = nil; + self.phraseCardinalityParser = nil; + self.cardinalityParser = nil; + self.primaryExprParser = nil; + self.negatedPrimaryExprParser = nil; + self.barePrimaryExprParser = nil; + self.predicateParser = nil; + self.intersectionParser = nil; + self.differenceParser = nil; + self.atomicValueParser = nil; + self.parserParser = nil; + self.discardParser = nil; + self.patternParser = nil; + self.delimitedStringParser = nil; + self.literalParser = nil; + self.variableParser = nil; + self.constantParser = nil; + [super dealloc]; +} + + +- (PKAlternation *)zeroOrOne:(PKParser *)p { + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:p]; + return a; +} + + +- (PKSequence *)oneOrMore:(PKParser *)p { + PKSequence *s = [PKSequence sequence]; + [s add:p]; + [s add:[PKRepetition repetitionWithSubparser:p]]; + return s; +} + + +// @start = statement*; +// satement = S* declaration S* '=' expr; +// callback = S* '(' S* selector S* ')'; +// selector = Word ':'; +// expr = S* term orTerm* S*; +// term = factor nextFactor*; +// orTerm = S* '|' S* term; +// factor = phrase | phraseStar | phrasePlus | phraseQuestion | phraseCardinality; +// nextFactor = S factor; + +// phrase = primaryExpr predicate*; +// phraseStar = phrase S* '*'; +// phrasePlus = phrase S* '+'; +// phraseQuestion = phrase S* '?'; +// phraseCardinality = phrase S* cardinality; +// cardinality = '{' S* Number (S* ',' S* Number)? S* '}'; + +// predicate = S* (intersection | difference); +// intersection = '&' S* primaryExpr; +// difference = '-' S* primaryExpr; + +// primaryExpr = negatedPrimaryExpr | barePrimaryExpr; +// negatedPrimaryExpr = '~' barePrimaryExpr; +// barePrimaryExpr = atomicValue | '(' expr ')'; +// atomicValue = parser discard?; +// parser = pattern | literal | variable | constant | delimitedString; +// discard = S* '!'; +// pattern = DelimitedString('/', '/') (Word & /[imxsw]+/)?; +// delimitedString = 'DelimitedString' S* '(' S* QuotedString (S* ',' QuotedString)? S* ')'; +// literal = QuotedString; +// variable = LowercaseWord; +// constant = UppercaseWord; + + +// satement = S* declaration S* '=' expr; +- (PKCollectionParser *)statementParser { + if (!statementParser) { + self.statementParser = [PKSequence sequence]; + statementParser.name = @"statement"; + [statementParser add:self.optionalWhitespaceParser]; + + PKTrack *tr = [PKTrack track]; + [tr add:self.declarationParser]; + [tr add:self.optionalWhitespaceParser]; + [tr add:[PKSymbol symbolWithString:@"="]]; + + // accept any tokens in the parser expr the first time around. just gather tokens for later + [tr add:[self oneOrMore:[PKAny any]]]; + + [statementParser add:tr]; + [statementParser setAssembler:assembler selector:@selector(didMatchStatement:)]; + } + return statementParser; +} + + +// declaration = Word callback?; +- (PKCollectionParser *)declarationParser { + if (!declarationParser) { + self.declarationParser = [PKSequence sequence]; + declarationParser.name = @"declaration"; + [declarationParser add:[PKWord word]]; + [declarationParser add:[self zeroOrOne:self.callbackParser]]; + } + return declarationParser; +} + + +// callback = S* '(' S* selector S* ')'; +- (PKCollectionParser *)callbackParser { + if (!callbackParser) { + self.callbackParser = [PKSequence sequence]; + callbackParser.name = @"callback"; + [callbackParser add:self.optionalWhitespaceParser]; + + PKTrack *tr = [PKTrack track]; + [tr add:[[PKSymbol symbolWithString:@"("] discard]]; + [tr add:self.optionalWhitespaceParser]; + [tr add:self.selectorParser]; + [tr add:self.optionalWhitespaceParser]; + [tr add:[[PKSymbol symbolWithString:@")"] discard]]; + + [callbackParser add:tr]; + [callbackParser setAssembler:assembler selector:@selector(didMatchCallback:)]; + } + return callbackParser; +} + + +// selector = Word ':'; +- (PKCollectionParser *)selectorParser { + if (!selectorParser) { + self.selectorParser = [PKTrack track]; + selectorParser.name = @"selector"; + [selectorParser add:[PKLowercaseWord word]]; + [selectorParser add:[[PKSymbol symbolWithString:@":"] discard]]; + } + return selectorParser; +} + + +// expr = S* term orTerm* S*; +- (PKCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [PKSequence sequence]; + exprParser.name = @"expr"; + [exprParser add:self.optionalWhitespaceParser]; + [exprParser add:self.termParser]; + [exprParser add:[PKRepetition repetitionWithSubparser:self.orTermParser]]; + [exprParser add:self.optionalWhitespaceParser]; + [exprParser setAssembler:assembler selector:@selector(didMatchExpression:)]; + } + return exprParser; +} + + +// term = factor nextFactor*; +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + termParser.name = @"term"; + [termParser add:self.factorParser]; + [termParser add:[PKRepetition repetitionWithSubparser:self.nextFactorParser]]; + [termParser setAssembler:assembler selector:@selector(didMatchAnd:)]; + } + return termParser; +} + + +// orTerm = S* '|' S* term; +- (PKCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [PKSequence sequence]; + orTermParser.name = @"orTerm"; + [orTermParser add:self.optionalWhitespaceParser]; + + PKTrack *tr = [PKTrack track]; + [tr add:[PKSymbol symbolWithString:@"|"]]; // preserve as fence + [tr add:self.optionalWhitespaceParser]; + [tr add:self.termParser]; + + [orTermParser add:tr]; + [orTermParser setAssembler:assembler selector:@selector(didMatchOr:)]; + } + return orTermParser; +} + + +// factor = phrase | phraseStar | phrasePlus | phraseQuestion | phraseCardinality; +- (PKCollectionParser *)factorParser { + if (!factorParser) { + self.factorParser = [PKAlternation alternation]; + factorParser.name = @"factor"; + [factorParser add:self.phraseParser]; + [factorParser add:self.phraseStarParser]; + [factorParser add:self.phrasePlusParser]; + [factorParser add:self.phraseQuestionParser]; + [factorParser add:self.phraseCardinalityParser]; + } + return factorParser; +} + + +// nextFactor = S factor; +- (PKCollectionParser *)nextFactorParser { + if (!nextFactorParser) { + self.nextFactorParser = [PKSequence sequence]; + nextFactorParser.name = @"nextFactor"; + [nextFactorParser add:self.whitespaceParser]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:self.phraseParser]; + [a add:self.phraseStarParser]; + [a add:self.phrasePlusParser]; + [a add:self.phraseQuestionParser]; + [a add:self.phraseCardinalityParser]; + + [nextFactorParser add:a]; + } + return nextFactorParser; +} + + +// phrase = primaryExpr predicate*; +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + self.phraseParser = [PKSequence sequence]; + phraseParser.name = @"phrase"; + [phraseParser add:self.primaryExprParser]; + [phraseParser add:[PKRepetition repetitionWithSubparser:self.predicateParser]]; + } + return phraseParser; +} + + +// primaryExpr = negatedPrimaryExpr | barePrimaryExpr; +- (PKCollectionParser *)primaryExprParser { + if (!primaryExprParser) { + self.primaryExprParser = [PKAlternation alternation]; + primaryExprParser.name = @"primaryExpr"; + [primaryExprParser add:self.negatedPrimaryExprParser]; + [primaryExprParser add:self.barePrimaryExprParser]; + } + return primaryExprParser; +} + + +// negatedPrimaryExpr = '~' barePrimaryExpr; +- (PKCollectionParser *)negatedPrimaryExprParser { + if (!negatedPrimaryExprParser) { + self.negatedPrimaryExprParser = [PKSequence sequence]; + negatedPrimaryExprParser.name = @"negatedPrimaryExpr"; + [negatedPrimaryExprParser add:[[PKLiteral literalWithString:@"~"] discard]]; + [negatedPrimaryExprParser add:self.barePrimaryExprParser]; + [negatedPrimaryExprParser setAssembler:assembler selector:@selector(didMatchNegation:)]; + } + return negatedPrimaryExprParser; +} + + +// barePrimaryExpr = atomicValue | '(' expr ')'; +- (PKCollectionParser *)barePrimaryExprParser { + if (!barePrimaryExprParser) { + self.barePrimaryExprParser = [PKAlternation alternation]; + barePrimaryExprParser.name = @"barePrimaryExpr"; + [barePrimaryExprParser add:self.atomicValueParser]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:self.exprParser]; + [s add:[[PKSymbol symbolWithString:@")"] discard]]; + + [barePrimaryExprParser add:s]; + } + return barePrimaryExprParser; +} + + +// predicate = S* (intersection | difference); +- (PKCollectionParser *)predicateParser { + if (!predicateParser) { + self.predicateParser = [PKSequence sequence]; + predicateParser.name = @"predicate"; + [predicateParser add:self.optionalWhitespaceParser]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:self.intersectionParser]; + [a add:self.differenceParser]; + + [predicateParser add:a]; + } + return predicateParser; +} + + +// intersection = '&' S* primaryExpr; +- (PKCollectionParser *)intersectionParser { + if (!intersectionParser) { + self.intersectionParser = [PKTrack track]; + intersectionParser.name = @"intersection"; + + PKTrack *tr = [PKTrack track]; + [tr add:[[PKSymbol symbolWithString:@"&"] discard]]; + [tr add:self.optionalWhitespaceParser]; + [tr add:self.primaryExprParser]; + + [intersectionParser add:tr]; + [intersectionParser setAssembler:assembler selector:@selector(didMatchIntersection:)]; + } + return intersectionParser; +} + + +// difference = '-' S* primaryExpr; +- (PKCollectionParser *)differenceParser { + if (!differenceParser) { + self.differenceParser = [PKTrack track]; + differenceParser.name = @"difference"; + + PKTrack *tr = [PKTrack track]; + [tr add:[[PKSymbol symbolWithString:@"-"] discard]]; + [tr add:self.optionalWhitespaceParser]; + [tr add:self.primaryExprParser]; + + [differenceParser add:tr]; + [differenceParser setAssembler:assembler selector:@selector(didMatchDifference:)]; + } + return differenceParser; +} + + +// phraseStar = phrase S* '*'; +- (PKCollectionParser *)phraseStarParser { + if (!phraseStarParser) { + self.phraseStarParser = [PKSequence sequence]; + phraseStarParser.name = @"phraseStar"; + [phraseStarParser add:self.phraseParser]; + [phraseStarParser add:self.optionalWhitespaceParser]; + [phraseStarParser add:[[PKSymbol symbolWithString:@"*"] discard]]; + [phraseStarParser setAssembler:assembler selector:@selector(didMatchStar:)]; + } + return phraseStarParser; +} + + +// phrasePlus = phrase S* '+'; +- (PKCollectionParser *)phrasePlusParser { + if (!phrasePlusParser) { + self.phrasePlusParser = [PKSequence sequence]; + phrasePlusParser.name = @"phrasePlus"; + [phrasePlusParser add:self.phraseParser]; + [phrasePlusParser add:self.optionalWhitespaceParser]; + [phrasePlusParser add:[[PKSymbol symbolWithString:@"+"] discard]]; + [phrasePlusParser setAssembler:assembler selector:@selector(didMatchPlus:)]; + } + return phrasePlusParser; +} + + +// phraseQuestion = phrase S* '?'; +- (PKCollectionParser *)phraseQuestionParser { + if (!phraseQuestionParser) { + self.phraseQuestionParser = [PKSequence sequence]; + phraseQuestionParser.name = @"phraseQuestion"; + [phraseQuestionParser add:self.phraseParser]; + [phraseQuestionParser add:self.optionalWhitespaceParser]; + [phraseQuestionParser add:[[PKSymbol symbolWithString:@"?"] discard]]; + [phraseQuestionParser setAssembler:assembler selector:@selector(didMatchQuestion:)]; + } + return phraseQuestionParser; +} + + +// phraseCardinality = phrase S* cardinality; +- (PKCollectionParser *)phraseCardinalityParser { + if (!phraseCardinalityParser) { + self.phraseCardinalityParser = [PKSequence sequence]; + phraseCardinalityParser.name = @"phraseCardinality"; + [phraseCardinalityParser add:self.phraseParser]; + [phraseCardinalityParser add:self.optionalWhitespaceParser]; + [phraseCardinalityParser add:self.cardinalityParser]; + [phraseCardinalityParser setAssembler:assembler selector:@selector(didMatchPhraseCardinality:)]; + } + return phraseCardinalityParser; +} + + +// cardinality = '{' S* Number (S* ',' S* Number)? S* '}'; +- (PKCollectionParser *)cardinalityParser { + if (!cardinalityParser) { + self.cardinalityParser = [PKSequence sequence]; + cardinalityParser.name = @"cardinality"; + + PKTrack *commaNum = [PKSequence sequence]; + [commaNum add:self.optionalWhitespaceParser]; + [commaNum add:[[PKSymbol symbolWithString:@","] discard]]; + [commaNum add:self.optionalWhitespaceParser]; + [commaNum add:[PKNumber number]]; + + PKTrack *tr = [PKTrack track]; + [tr add:[PKSymbol symbolWithString:@"{"]]; // serves as fence. dont discard + [tr add:self.optionalWhitespaceParser]; + [tr add:[PKNumber number]]; + [tr add:[self zeroOrOne:commaNum]]; + [tr add:self.optionalWhitespaceParser]; + [tr add:[[PKSymbol symbolWithString:@"}"] discard]]; + + [cardinalityParser add:tr]; + [cardinalityParser setAssembler:assembler selector:@selector(didMatchCardinality:)]; + } + return cardinalityParser; +} + + +// atomicValue = parser discard?; +- (PKCollectionParser *)atomicValueParser { + if (!atomicValueParser) { + self.atomicValueParser = [PKSequence sequence]; + atomicValueParser.name = @"atomicValue"; + [atomicValueParser add:self.parserParser]; + [atomicValueParser add:[self zeroOrOne:self.discardParser]]; + } + return atomicValueParser; +} + + +// parser = pattern | literal | variable | constant | delimitedString; +- (PKCollectionParser *)parserParser { + if (!parserParser) { + self.parserParser = [PKAlternation alternation]; + parserParser.name = @"parser"; + [parserParser add:self.patternParser]; + [parserParser add:self.literalParser]; + [parserParser add:self.variableParser]; + [parserParser add:self.constantParser]; + [parserParser add:self.delimitedStringParser]; + } + return parserParser; +} + + +// discard = S* '!'; +- (PKCollectionParser *)discardParser { + if (!discardParser) { + self.discardParser = [PKSequence sequence]; + discardParser.name = @"discard"; + [discardParser add:self.optionalWhitespaceParser]; + [discardParser add:[[PKSymbol symbolWithString:@"!"] discard]]; + [discardParser setAssembler:assembler selector:@selector(didMatchDiscard:)]; + } + return discardParser; +} + + +// pattern = DelimitedString('/', '/') (Word & /[imxsw]+/)?; +- (PKCollectionParser *)patternParser { + if (!patternParser) { + patternParser.name = @"pattern"; + self.patternParser = [PKSequence sequence]; + [patternParser add:[PKDelimitedString delimitedStringWithStartMarker:@"/" endMarker:@"/"]]; + + PKParser *opts = [PKPattern patternWithString:@"[imxsw]+" options:PKPatternOptionsNone]; + PKIntersection *inter = [PKIntersection intersection]; + [inter add:[PKWord word]]; + [inter add:opts]; + [inter setAssembler:assembler selector:@selector(didMatchPatternOptions:)]; + + [patternParser add:[self zeroOrOne:inter]]; + [patternParser setAssembler:assembler selector:@selector(didMatchPattern:)]; + } + return patternParser; +} + + +// delimitedString = 'DelimitedString' S* '(' S* QuotedString (S* ',' QuotedString)? S* ')'; +- (PKCollectionParser *)delimitedStringParser { + if (!delimitedStringParser) { + self.delimitedStringParser = [PKTrack track]; + delimitedStringParser.name = @"delimitedString"; + + PKSequence *secondArg = [PKSequence sequence]; + [secondArg add:self.optionalWhitespaceParser]; + + PKTrack *tr = [PKTrack track]; + [tr add:[[PKSymbol symbolWithString:@","] discard]]; + [tr add:self.optionalWhitespaceParser]; + [tr add:[PKQuotedString quotedString]]; // endMarker + [secondArg add:tr]; + + [delimitedStringParser add:[[PKLiteral literalWithString:@"DelimitedString"] discard]]; + [delimitedStringParser add:self.optionalWhitespaceParser]; + [delimitedStringParser add:[PKSymbol symbolWithString:@"("]]; // preserve as fence + [delimitedStringParser add:self.optionalWhitespaceParser]; + [delimitedStringParser add:[PKQuotedString quotedString]]; // startMarker + [delimitedStringParser add:[self zeroOrOne:secondArg]]; + [delimitedStringParser add:self.optionalWhitespaceParser]; + [delimitedStringParser add:[[PKSymbol symbolWithString:@")"] discard]]; + + [delimitedStringParser setAssembler:assembler selector:@selector(didMatchDelimitedString:)]; + } + return delimitedStringParser; +} + + +// literal = QuotedString; +- (PKParser *)literalParser { + if (!literalParser) { + self.literalParser = [PKQuotedString quotedString]; + [literalParser setAssembler:assembler selector:@selector(didMatchLiteral:)]; + } + return literalParser; +} + + +// variable = LowercaseWord; +- (PKParser *)variableParser { + if (!variableParser) { + self.variableParser = [PKLowercaseWord word]; + variableParser.name = @"variable"; + [variableParser setAssembler:assembler selector:@selector(didMatchVariable:)]; + } + return variableParser; +} + + +// constant = UppercaseWord; +- (PKParser *)constantParser { + if (!constantParser) { + self.constantParser = [PKUppercaseWord word]; + constantParser.name = @"constant"; + [constantParser setAssembler:assembler selector:@selector(didMatchConstant:)]; + } + return constantParser; +} + + +- (PKParser *)whitespaceParser { + return [[PKWhitespace whitespace] discard]; +} + + +- (PKCollectionParser *)optionalWhitespaceParser { + return [PKRepetition repetitionWithSubparser:self.whitespaceParser]; +} + +@synthesize statementParser; +@synthesize declarationParser; +@synthesize callbackParser; +@synthesize selectorParser; +@synthesize exprParser; +@synthesize termParser; +@synthesize orTermParser; +@synthesize factorParser; +@synthesize nextFactorParser; +@synthesize phraseParser; +@synthesize phraseStarParser; +@synthesize phrasePlusParser; +@synthesize phraseQuestionParser; +@synthesize phraseCardinalityParser; +@synthesize cardinalityParser; +@synthesize primaryExprParser; +@synthesize negatedPrimaryExprParser; +@synthesize barePrimaryExprParser; +@synthesize predicateParser; +@synthesize intersectionParser; +@synthesize differenceParser; +@synthesize atomicValueParser; +@synthesize parserParser; +@synthesize discardParser; +@synthesize patternParser; +@synthesize delimitedStringParser; +@synthesize literalParser; +@synthesize variableParser; +@synthesize constantParser; +@end diff --git a/src/.svn/text-base/PKIntersection.m.svn-base b/src/.svn/text-base/PKIntersection.m.svn-base new file mode 100644 index 0000000..926f354 --- /dev/null +++ b/src/.svn/text-base/PKIntersection.m.svn-base @@ -0,0 +1,76 @@ +// +// PKIntersection.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/27/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKIntersection.h" +#import + +@interface NSMutableSet (PKIntersectionAdditions) +- (void)intersectSetTestingEquality:(NSSet *)s; +@end + +@implementation NSMutableSet (PKIntersectionAdditions) + +- (void)intersectSetTestingEquality:(NSSet *)s { + for (id a1 in self) { + BOOL found = NO; + for (id a2 in s) { + if ([a1 isEqual:a2]) { + found = YES; + break; + } + } + if (!found) { + [self removeObject:a1]; + } + } +} + +@end + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@interface PKCollectionParser () ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest; +@end + +@implementation PKIntersection + ++ (id)intersection { + return [self intersectionWithSubparsers:nil]; +} + + ++ (id)intersectionWithSubparsers:(PKParser *)p1, ... { + va_list vargs; + va_start(vargs, p1); + PKIntersection *inter = [self collectionParserWithFirst:p1 rest:vargs]; + va_end(vargs); + return inter; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + NSMutableSet *outAssemblies = [NSMutableSet set]; + + NSInteger i = 0; + for (PKParser *p in subparsers) { + if (0 == i++) { + outAssemblies = [[[p matchAndAssemble:inAssemblies] mutableCopy] autorelease]; + } else { + [outAssemblies intersectSetTestingEquality:[p allMatchesFor:inAssemblies]]; + } + } + + return outAssemblies; +} + +@end diff --git a/src/.svn/text-base/PKLetter.m.svn-base b/src/.svn/text-base/PKLetter.m.svn-base new file mode 100644 index 0000000..9fbf2fe --- /dev/null +++ b/src/.svn/text-base/PKLetter.m.svn-base @@ -0,0 +1,24 @@ +// +// PKLetter.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKLetter + ++ (id)letter { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKUniChar c = [obj intValue]; + return isalpha(c); +} + +@end diff --git a/src/.svn/text-base/PKLiteral.m.svn-base b/src/.svn/text-base/PKLiteral.m.svn-base new file mode 100644 index 0000000..2ac0e87 --- /dev/null +++ b/src/.svn/text-base/PKLiteral.m.svn-base @@ -0,0 +1,55 @@ +// +// PKLiteral.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKLiteral () +@property (nonatomic, retain) PKToken *literal; +@end + +@implementation PKLiteral + ++ (id)literalWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + //NSParameterAssert(s); + self = [super initWithString:s]; + if (self) { + self.literal = [PKToken tokenWithTokenType:PKTokenTypeWord stringValue:s floatValue:0.0]; + } + return self; +} + + +- (void)dealloc { + self.literal = nil; + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + return [literal.stringValue isEqualToString:[obj stringValue]]; + //return [literal isEqual:obj]; +} + + +- (NSString *)description { + NSString *className = [NSStringFromClass([self class]) substringFromIndex:2]; + if ([name length]) { + return [NSString stringWithFormat:@"%@ (%@) %@", className, name, literal.stringValue]; + } else { + return [NSString stringWithFormat:@"%@ %@", className, literal.stringValue]; + } +} + +@synthesize literal; +@end diff --git a/src/.svn/text-base/PKLowercaseWord.m.svn-base b/src/.svn/text-base/PKLowercaseWord.m.svn-base new file mode 100644 index 0000000..bef5385 --- /dev/null +++ b/src/.svn/text-base/PKLowercaseWord.m.svn-base @@ -0,0 +1,24 @@ +// +// PKLowercaseWord.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKLowercaseWord + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + if (!tok.isWord) { + return NO; + } + + NSString *s = tok.stringValue; + return [s length] && islower([s characterAtIndex:0]); +} + +@end diff --git a/src/.svn/text-base/PKMultiLineCommentState.m.svn-base b/src/.svn/text-base/PKMultiLineCommentState.m.svn-base new file mode 100644 index 0000000..643d8d0 --- /dev/null +++ b/src/.svn/text-base/PKMultiLineCommentState.m.svn-base @@ -0,0 +1,146 @@ +// +// PKMultiLineCommentState.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/28/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (void)appendString:(NSString *)s; +- (NSString *)bufferedString; +@end + +@interface PKCommentState () +@property (nonatomic, retain) PKSymbolRootNode *rootNode; +@end + +@interface PKMultiLineCommentState () +- (void)addStartMarker:(NSString *)start endMarker:(NSString *)end; +- (void)removeStartMarker:(NSString *)start; +@property (nonatomic, retain) NSMutableArray *startMarkers; +@property (nonatomic, retain) NSMutableArray *endMarkers; +@property (nonatomic, copy) NSString *currentStartMarker; +@end + +@implementation PKMultiLineCommentState + +- (id)init { + if (self = [super init]) { + self.startMarkers = [NSMutableArray array]; + self.endMarkers = [NSMutableArray array]; + } + return self; +} + + +- (void)dealloc { + self.startMarkers = nil; + self.endMarkers = nil; + self.currentStartMarker = nil; + [super dealloc]; +} + + +- (void)addStartMarker:(NSString *)start endMarker:(NSString *)end { + NSParameterAssert([start length]); + NSParameterAssert([end length]); + [startMarkers addObject:start]; + [endMarkers addObject:end]; +} + + +- (void)removeStartMarker:(NSString *)start { + NSParameterAssert([start length]); + NSUInteger i = [startMarkers indexOfObject:start]; + if (NSNotFound != i) { + [startMarkers removeObject:start]; + [endMarkers removeObjectAtIndex:i]; // this should always be in range. + } +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + BOOL balanceEOF = t.commentState.balancesEOFTerminatedComments; + BOOL reportTokens = t.commentState.reportsCommentTokens; + if (reportTokens) { + [self resetWithReader:r]; + [self appendString:currentStartMarker]; + } + + NSUInteger i = [startMarkers indexOfObject:currentStartMarker]; + NSString *currentEndSymbol = [endMarkers objectAtIndex:i]; + PKUniChar e = [currentEndSymbol characterAtIndex:0]; + + // get the definitions of all multi-char comment start and end symbols from the commentState + PKSymbolRootNode *rootNode = t.commentState.rootNode; + + PKUniChar c; + while (1) { + c = [r read]; + if (PKEOF == c) { + if (balanceEOF) { + [self appendString:currentEndSymbol]; + } + break; + } + + if (e == c) { + NSString *peek = [rootNode nextSymbol:r startingWith:e]; + if ([currentEndSymbol isEqualToString:peek]) { + if (reportTokens) { + [self appendString:currentEndSymbol]; + } + c = [r read]; + break; + } else { + [r unread:[peek length] - 1]; + if (e != [peek characterAtIndex:0]) { + if (reportTokens) { + [self append:c]; + } + c = [r read]; + } + } + } + if (reportTokens) { + [self append:c]; + } + } + + if (PKEOF != c) { + [r unread]; + } + + self.currentStartMarker = nil; + + if (reportTokens) { + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeComment stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; + } else { + return [t nextToken]; + } +} + +@synthesize startMarkers; +@synthesize endMarkers; +@synthesize currentStartMarker; +@end diff --git a/src/.svn/text-base/PKNegation.m.svn-base b/src/.svn/text-base/PKNegation.m.svn-base new file mode 100644 index 0000000..6761bd3 --- /dev/null +++ b/src/.svn/text-base/PKNegation.m.svn-base @@ -0,0 +1,63 @@ +// +// PKNegation.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKNegation.h" +#import +#import + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@interface PKNegation () +@property (nonatomic, retain, readwrite) PKParser *subparser; +@property (nonatomic, retain) PKParser *difference; +@end + +@implementation PKNegation + ++ (id)negationWithSubparser:(PKParser *)s { + return [[[self alloc] initWithSubparser:s] autorelease]; +} + + +- (id)initWithSubparser:(PKParser *)s { + if (self = [super init]) { + self.subparser = s; + self.difference = [PKDifference differenceWithSubparser:[PKAny any] minus:subparser]; + } + return self; +} + + +- (void)dealloc { + self.subparser = nil; + self.difference = nil; + [super dealloc]; +} + + +- (PKParser *)parserNamed:(NSString *)s { + if ([name isEqualToString:s]) { + return self; + } else { + return [subparser parserNamed:s]; + } +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + + return [difference allMatchesFor:inAssemblies]; +} + +@synthesize subparser; +@synthesize difference; +@end diff --git a/src/.svn/text-base/PKNumber.m.svn-base b/src/.svn/text-base/PKNumber.m.svn-base new file mode 100644 index 0000000..914a61c --- /dev/null +++ b/src/.svn/text-base/PKNumber.m.svn-base @@ -0,0 +1,24 @@ +// +// PKNumber.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKNumber + ++ (id)number { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isNumber; +} + +@end \ No newline at end of file diff --git a/src/.svn/text-base/PKNumberState.m.svn-base b/src/.svn/text-base/PKNumberState.m.svn-base new file mode 100644 index 0000000..90e8f73 --- /dev/null +++ b/src/.svn/text-base/PKNumberState.m.svn-base @@ -0,0 +1,258 @@ +// +// PKNumberState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface PKNumberState () +- (CGFloat)absorbDigitsFromReader:(PKReader *)r; +- (CGFloat)value; +- (void)parseLeftSideFromReader:(PKReader *)r; +- (void)parseRightSideFromReader:(PKReader *)r; +- (void)parseExponentFromReader:(PKReader *)r; +- (void)reset:(PKUniChar)cin; +- (void)checkForHex:(PKReader *)r; +- (void)checkForOctal; +@end + +@implementation PKNumberState + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + [self resetWithReader:r]; + isNegative = NO; + originalCin = cin; + + if ('-' == cin) { + isNegative = YES; + cin = [r read]; + [self append:'-']; + } else if ('+' == cin) { + cin = [r read]; + [self append:'+']; + } + + [self reset:cin]; + if ('.' == c) { + [self parseRightSideFromReader:r]; + } else { + [self parseLeftSideFromReader:r]; + if (isDecimal) { + [self parseRightSideFromReader:r]; + } + } + + // erroneous ., +, -, or 0x + if (!gotADigit) { + if (isHex) { + [r unread]; + return [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:@"0" floatValue:0.0]; + } else { + if (isNegative && PKEOF != c) { // ?? + [r unread]; + } + return [t.symbolState nextTokenFromReader:r startingWith:originalCin tokenizer:t]; + } + } + + if (PKEOF != c) { + [r unread]; + } + + if (isNegative) { + floatValue = -floatValue; + } + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:[self bufferedString] floatValue:[self value]]; + tok.offset = offset; + return tok; +} + + +- (CGFloat)value { + CGFloat result = (CGFloat)floatValue; + + NSUInteger i = 0; + for ( ; i < exp; i++) { + if (isNegativeExp) { + result /= (CGFloat)10.0; + } else { + result *= (CGFloat)10.0; + } + } + + return (CGFloat)result; +} + + +- (CGFloat)absorbDigitsFromReader:(PKReader *)r { + CGFloat divideBy = 1.0; + CGFloat v = 0.0; + BOOL isHexAlpha = NO; + + while (1) { + isHexAlpha = NO; + if (allowsHexadecimalNotation) { + [self checkForHex:r]; + if (c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F') { + isHexAlpha = YES; + } + } + + if (isdigit(c) || isHexAlpha) { + [self append:c]; + len++; + gotADigit = YES; + + if (allowsOctalNotation) { + [self checkForOctal]; + } + + if (isHexAlpha) { + if (c >= 'a' && c <= 'f') { + c = toupper(c); + } + c -= 7; + } + v = v * base + (c - '0'); + c = [r read]; + if (isFraction) { + divideBy *= base; + } + } else { + break; + } + } + + if (isFraction) { + v = v / divideBy; + } + + return (CGFloat)v; +} + + +- (void)parseLeftSideFromReader:(PKReader *)r { + isFraction = NO; + floatValue = [self absorbDigitsFromReader:r]; +} + + +- (void)parseRightSideFromReader:(PKReader *)r { + if ('.' == c) { + PKUniChar n = [r read]; + BOOL nextIsDigit = isdigit(n); + if (PKEOF != n) { + [r unread]; + } + + if (nextIsDigit || allowsTrailingDot) { + [self append:'.']; + if (nextIsDigit) { + c = [r read]; + isFraction = YES; + floatValue += [self absorbDigitsFromReader:r]; + } + } + } + + if (allowsScientificNotation) { + [self parseExponentFromReader:r]; + } +} + + +- (void)parseExponentFromReader:(PKReader *)r { + NSParameterAssert(r); + if ('e' == c || 'E' == c) { + PKUniChar e = c; + c = [r read]; + + BOOL hasExp = isdigit(c); + isNegativeExp = ('-' == c); + BOOL positiveExp = ('+' == c); + + if (!hasExp && (isNegativeExp || positiveExp)) { + c = [r read]; + hasExp = isdigit(c); + } + if (PKEOF != c) { + [r unread]; + } + if (hasExp) { + [self append:e]; + if (isNegativeExp) { + [self append:'-']; + } else if (positiveExp) { + [self append:'+']; + } + c = [r read]; + isFraction = NO; + exp = [self absorbDigitsFromReader:r]; + } + } +} + + +- (void)reset:(PKUniChar)cin { + c = cin; + firstNum = cin; + gotADigit = NO; + isFraction = NO; + isDecimal = YES; + isHex = NO; + len = 0; + base = (CGFloat)10.0; + floatValue = (CGFloat)0.0; + exp = (CGFloat)0.0; + isNegativeExp = NO; +} + + +- (void)checkForHex:(PKReader *)r { + if ('x' == c && '0' == firstNum && !isFraction && 1 == len) { + [self append:c]; + len++; + c = [r read]; + isDecimal = NO; + base = (CGFloat)16.0; + isHex = YES; + gotADigit = NO; + } +} + + +- (void)checkForOctal { + if ('0' == firstNum && !isFraction && isDecimal && 2 == len) { + isDecimal = NO; + base = (CGFloat)8.0; + } +} + +@synthesize allowsTrailingDot; +@synthesize allowsScientificNotation; +@synthesize allowsOctalNotation; +@synthesize allowsHexadecimalNotation; +@end diff --git a/src/.svn/text-base/PKParser.m.svn-base b/src/.svn/text-base/PKParser.m.svn-base new file mode 100644 index 0000000..b43bc15 --- /dev/null +++ b/src/.svn/text-base/PKParser.m.svn-base @@ -0,0 +1,197 @@ +// +// PKParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import + +@interface PKAssembly () +- (BOOL)hasMore; +@property (nonatomic, readonly) NSUInteger objectsConsumed; +@end + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (PKAssembly *)best:(NSSet *)inAssemblies; +@end + +@interface PKParser (PKParserFactoryAdditionsFriend) +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@implementation PKParser + ++ (id)parser { + return [[[self alloc] init] autorelease]; +} + + +- (void)dealloc { +#ifdef TARGET_OS_SNOW_LEOPARD + self.assemblerBlock = nil; + self.preassemblerBlock = nil; +#endif + self.assembler = nil; + self.assemblerSelector = nil; + self.preassembler = nil; + self.preassemblerSelector = nil; + self.name = nil; + self.tokenizer = nil; + [super dealloc]; +} + + +- (void)setAssembler:(id)a selector:(SEL)sel { + self.assembler = a; + self.assemblerSelector = sel; +} + + +- (void)setPreassembler:(id)a selector:(SEL)sel { + self.preassembler = a; + self.preassemblerSelector = sel; +} + + +- (PKParser *)parserNamed:(NSString *)s { + if ([name isEqualToString:s]) { + return self; + } + return nil; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSAssert1(0, @"-[PKParser %s] must be overriden", _cmd); + return nil; +} + + +- (PKAssembly *)bestMatchFor:(PKAssembly *)a { + NSParameterAssert(a); + NSSet *initialState = [NSSet setWithObject:a]; + NSSet *finalState = [self matchAndAssemble:initialState]; + return [self best:finalState]; +} + + +- (PKAssembly *)completeMatchFor:(PKAssembly *)a { + NSParameterAssert(a); + PKAssembly *best = [self bestMatchFor:a]; + if (best && ![best hasMore]) { + return best; + } + return nil; +} + + +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + +#ifdef TARGET_OS_SNOW_LEOPARD + if (preassemblerBlock) { + for (PKAssembly *a in inAssemblies) { + preassemblerBlock(a); + } + } else +#endif + if (preassembler) { + NSAssert2([preassembler respondsToSelector:preassemblerSelector], @"provided preassembler %@ should respond to %s", preassembler, preassemblerSelector); + for (PKAssembly *a in inAssemblies) { + [preassembler performSelector:preassemblerSelector withObject:a]; + } + } + + NSSet *outAssemblies = [self allMatchesFor:inAssemblies]; + +#ifdef TARGET_OS_SNOW_LEOPARD + if (assemblerBlock) { + for (PKAssembly *a in outAssemblies) { + assemblerBlock(a); + } + } else +#endif + if (assembler) { + NSAssert2([assembler respondsToSelector:assemblerSelector], @"provided assembler %@ should respond to %s", assembler, assemblerSelector); + for (PKAssembly *a in outAssemblies) { + [assembler performSelector:assemblerSelector withObject:a]; + } + } + return outAssemblies; +} + + +- (PKAssembly *)best:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + PKAssembly *best = nil; + + for (PKAssembly *a in inAssemblies) { + if (![a hasMore]) { + best = a; + break; + } + if (!best || a.objectsConsumed > best.objectsConsumed) { + best = a; + } + } + + return best; +} + + +- (NSString *)description { + NSString *className = [NSStringFromClass([self class]) substringFromIndex:2]; + if ([name length]) { + return [NSString stringWithFormat:@"%@ (%@)", className, name]; + } else { + return [NSString stringWithFormat:@"%@", className]; + } +} + +#ifdef TARGET_OS_SNOW_LEOPARD +@synthesize assemblerBlock; +@synthesize preassemblerBlock; +#endif +@synthesize assembler; +@synthesize assemblerSelector; +@synthesize preassembler; +@synthesize preassemblerSelector; +@synthesize name; +@end + +@implementation PKParser (PKParserFactoryAdditions) + +- (id)parse:(NSString *)s { + PKTokenizer *t = self.tokenizer; + if (!t) { + t = [PKTokenizer tokenizer]; + } + t.string = s; + PKAssembly *a = [self completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + if (a.target) { + return a.target; + } else { + return [a pop]; + } +} + + +- (PKTokenizer *)tokenizer { + return [[tokenizer retain] autorelease]; +} + + +- (void)setTokenizer:(PKTokenizer *)t { + if (tokenizer != t) { + [tokenizer autorelease]; + tokenizer = [t retain]; + } +} + +@end diff --git a/src/.svn/text-base/PKParserFactory.m.svn-base b/src/.svn/text-base/PKParserFactory.m.svn-base new file mode 100644 index 0000000..4f16b59 --- /dev/null +++ b/src/.svn/text-base/PKParserFactory.m.svn-base @@ -0,0 +1,979 @@ +// +// PKParserFactory.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2009 Todd Ditchendorf All rights reserved. +// + +#import "PKParserFactory.h" +#import +#import "PKGrammarParser.h" +#import "NSString+ParseKitAdditions.h" +#import "NSArray+ParseKitAdditions.h" + +@interface PKParser (PKParserFactoryAdditionsFriend) +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@interface PKCollectionParser () +@property (nonatomic, readwrite, retain) NSMutableArray *subparsers; +@end + +@interface PKRepetition () +@property (nonatomic, readwrite, retain) PKParser *subparser; +@end + +@interface PKNegation () +@property (nonatomic, readwrite, retain) PKParser *subparser; +@end + +@interface PKDifference () +@property (nonatomic, readwrite, retain) PKParser *subparser; +@property (nonatomic, readwrite, retain) PKParser *minus; +@end + +@interface PKPattern () +@property (nonatomic, assign) PKTokenType tokenType; +@end + +void PKReleaseSubparserTree(PKParser *p) { + if ([p isKindOfClass:[PKCollectionParser class]]) { + PKCollectionParser *c = (PKCollectionParser *)p; + NSArray *subs = c.subparsers; + if (subs) { + [subs retain]; + c.subparsers = nil; + for (PKParser *s in subs) { + PKReleaseSubparserTree(s); + } + [subs release]; + } + } else if ([p isMemberOfClass:[PKRepetition class]]) { + PKRepetition *r = (PKRepetition *)p; + PKParser *sub = r.subparser; + if (sub) { + [sub retain]; + r.subparser = nil; + PKReleaseSubparserTree(sub); + [sub release]; + } + } else if ([p isMemberOfClass:[PKNegation class]]) { + PKNegation *n = (PKNegation *)p; + PKParser *sub = n.subparser; + if (sub) { + [sub retain]; + n.subparser = nil; + PKReleaseSubparserTree(sub); + [sub release]; + } + } else if ([p isMemberOfClass:[PKDifference class]]) { + PKDifference *d = (PKDifference *)p; + PKParser *sub = d.subparser; + if (sub) { + [sub retain]; + d.subparser = nil; + PKReleaseSubparserTree(sub); + [sub release]; + } + PKParser *m = d.minus; + if (m) { + [m retain]; + d.minus = nil; + PKReleaseSubparserTree(m); + [m release]; + } + } +} + +@interface PKParserFactory () +- (PKTokenizer *)tokenizerForParsingGrammar; +- (BOOL)isAllWhitespace:(NSArray *)toks; +- (id)parserTokensTableFromParsingStatementsInString:(NSString *)s; +- (void)gatherParserClassNamesFromTokens; +- (NSString *)parserClassNameFromTokenArray:(NSArray *)toks; + +- (PKTokenizer *)tokenizerFromGrammarSettings; +- (BOOL)boolForTokenForKey:(NSString *)key; +- (void)setTokenizerState:(PKTokenizerState *)state onTokenizer:(PKTokenizer *)t forTokensForKey:(NSString *)key; +- (void)setFallbackStateOn:(PKTokenizerState *)state withTokenizer:(PKTokenizer *)t forTokensForKey:(NSString *)key; + +- (id)expandParser:(PKParser *)p fromTokenArray:(NSArray *)toks; +- (PKParser *)expandedParserForName:(NSString *)parserName; +- (void)setAssemblerForParser:(PKParser *)p; +- (NSArray *)tokens:(NSArray *)toks byRemovingTokensOfType:(PKTokenType)tt; +- (NSString *)defaultAssemblerSelectorNameForParserName:(NSString *)parserName; +- (NSString *)defaultPreassemblerSelectorNameForParserName:(NSString *)parserName; + +// this is only for unit tests? can it go away? +- (PKSequence *)parserFromExpression:(NSString *)s; + +- (PKAlternation *)zeroOrOne:(PKParser *)p; +- (PKSequence *)oneOrMore:(PKParser *)p; + +- (void)didMatchStatement:(PKAssembly *)a; +- (void)didMatchCallback:(PKAssembly *)a; +- (void)didMatchExpression:(PKAssembly *)a; +- (void)didMatchAnd:(PKAssembly *)a; +- (void)didMatchIntersection:(PKAssembly *)a; +- (void)didMatchDifference:(PKAssembly *)a; +- (void)didMatchPatternOptions:(PKAssembly *)a; +- (void)didMatchPattern:(PKAssembly *)a; +- (void)didMatchDiscard:(PKAssembly *)a; +- (void)didMatchLiteral:(PKAssembly *)a; +- (void)didMatchVariable:(PKAssembly *)a; +- (void)didMatchConstant:(PKAssembly *)a; +- (void)didMatchDelimitedString:(PKAssembly *)a; +- (void)didMatchNum:(PKAssembly *)a; +- (void)didMatchStar:(PKAssembly *)a; +- (void)didMatchPlus:(PKAssembly *)a; +- (void)didMatchQuestion:(PKAssembly *)a; +- (void)didMatchPhraseCardinality:(PKAssembly *)a; +- (void)didMatchCardinality:(PKAssembly *)a; +- (void)didMatchOr:(PKAssembly *)a; +- (void)didMatchNegation:(PKAssembly *)a; + +@property (nonatomic, retain) PKGrammarParser *grammarParser; +@property (nonatomic, assign) id assembler; +@property (nonatomic, assign) id preassembler; +@property (nonatomic, retain) NSMutableDictionary *parserTokensTable; +@property (nonatomic, retain) NSMutableDictionary *parserClassTable; +@property (nonatomic, retain) NSMutableDictionary *selectorTable; +@property (nonatomic, retain) PKToken *equals; +@property (nonatomic, retain) PKToken *curly; +@property (nonatomic, retain) PKToken *paren; +@end + +@implementation PKParserFactory + ++ (id)factory { + return [[[PKParserFactory alloc] init] autorelease]; +} + + +- (id)init { + if (self = [super init]) { + self.grammarParser = [[[PKGrammarParser alloc] initWithAssembler:self] autorelease]; + self.equals = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"=" floatValue:0.0]; + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0.0]; + self.paren = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"(" floatValue:0.0]; + self.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnAll; + } + return self; +} + + +- (void)dealloc { + self.grammarParser = nil; + self.assembler = nil; + self.preassembler = nil; + self.parserTokensTable = nil; + self.parserClassTable = nil; + self.selectorTable = nil; + self.equals = nil; + self.curly = nil; + self.paren = nil; + [super dealloc]; +} + + +- (PKCollectionParser *)exprParser { + return grammarParser.exprParser; +} + + +- (PKParser *)parserFromGrammar:(NSString *)s assembler:(id)a { + return [self parserFromGrammar:s assembler:a preassembler:nil]; +} + + +- (PKParser *)parserFromGrammar:(NSString *)s assembler:(id)a preassembler:(id)pa { + self.assembler = a; + self.preassembler = pa; + self.selectorTable = [NSMutableDictionary dictionary]; + self.parserClassTable = [NSMutableDictionary dictionary]; + self.parserTokensTable = [self parserTokensTableFromParsingStatementsInString:s]; + + PKTokenizer *t = [self tokenizerFromGrammarSettings]; + + [self gatherParserClassNamesFromTokens]; + + PKParser *start = [self expandedParserForName:@"@start"]; + + assembler = nil; + self.selectorTable = nil; + self.parserClassTable = nil; + self.parserTokensTable = nil; + + if (start && [start isKindOfClass:[PKParser class]]) { + start.tokenizer = t; + return start; + } else { + [NSException raise:@"GrammarException" format:@"The provided language grammar was invalid"]; + return nil; + } +} + + +- (PKTokenizer *)tokenizerForParsingGrammar { + PKTokenizer *t = [PKTokenizer tokenizer]; + + t.whitespaceState.reportsWhitespaceTokens = YES; + + // customize tokenizer to find tokenizer customization directives + [t setTokenizerState:t.wordState from:'@' to:'@']; + + // add support for tokenizer directives like @commentState.fallbackState + [t.wordState setWordChars:YES from:'.' to:'.']; + [t.wordState setWordChars:NO from:'-' to:'-']; + + // setup comments + [t setTokenizerState:t.commentState from:'/' to:'/']; + [t.commentState addSingleLineStartMarker:@"//"]; + [t.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + // comment state should fallback to delimit state to match regex delimited strings + t.commentState.fallbackState = t.delimitState; + + // regex delimited strings + [t.delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:[[NSCharacterSet whitespaceCharacterSet] invertedSet]]; + + return t; +} + + +- (BOOL)isAllWhitespace:(NSArray *)toks { + for (PKToken *tok in toks) { + if (PKTokenTypeWhitespace != tok.tokenType) { + return NO; + } + } + return YES; +} + + +- (id)parserTokensTableFromParsingStatementsInString:(NSString *)s { + PKTokenizer *t = [self tokenizerForParsingGrammar]; + t.string = s; + + PKTokenArraySource *src = [[PKTokenArraySource alloc] initWithTokenizer:t delimiter:@";"]; + id target = [NSMutableDictionary dictionary]; // setup the variable lookup table + + while ([src hasMore]) { + NSArray *toks = [src nextTokenArray]; + if (![self isAllWhitespace:toks]) { + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenArray:toks]; + //a.preservesWhitespaceTokens = YES; + a.target = target; + PKAssembly *res = [grammarParser.statementParser completeMatchFor:a]; + target = res.target; + } + } + + [src release]; + + return target; +} + + +- (void)gatherParserClassNamesFromTokens { + isGatheringClasses = YES; + // discover the actual parser class types + for (NSString *parserName in parserTokensTable) { + NSString *className = [self parserClassNameFromTokenArray:[parserTokensTable objectForKey:parserName]]; + NSAssert1([className length], @"Could not build ClassName from token array for parserName: %@", parserName); + [parserClassTable setObject:className forKey:parserName]; + } + isGatheringClasses = NO; +} + + +- (NSString *)parserClassNameFromTokenArray:(NSArray *)toks { + PKAssembly *a = [PKTokenAssembly assemblyWithTokenArray:toks]; + a.target = parserTokensTable; + a = [grammarParser.exprParser completeMatchFor:a]; + PKParser *res = [a pop]; + a.target = nil; + return NSStringFromClass([res class]); +} + + +- (PKTokenizer *)tokenizerFromGrammarSettings { + PKTokenizer *t = [PKTokenizer tokenizer]; + [t.commentState removeSingleLineStartMarker:@"//"]; + [t.commentState removeMultiLineStartMarker:@"/*"]; + + t.whitespaceState.reportsWhitespaceTokens = [self boolForTokenForKey:@"@reportsWhitespaceTokens"]; + t.commentState.reportsCommentTokens = [self boolForTokenForKey:@"@reportsCommentTokens"]; + t.commentState.balancesEOFTerminatedComments = [self boolForTokenForKey:@"balancesEOFTerminatedComments"]; + t.quoteState.balancesEOFTerminatedQuotes = [self boolForTokenForKey:@"@balancesEOFTerminatedQuotes"]; + t.delimitState.balancesEOFTerminatedStrings = [self boolForTokenForKey:@"@balancesEOFTerminatedStrings"]; + t.numberState.allowsTrailingDot = [self boolForTokenForKey:@"@allowsTrailingDot"]; + t.numberState.allowsScientificNotation = [self boolForTokenForKey:@"@allowsScientificNotation"]; + t.numberState.allowsOctalNotation = [self boolForTokenForKey:@"@allowsOctalNotation"]; + t.numberState.allowsHexadecimalNotation = [self boolForTokenForKey:@"@allowsHexadecimalNotation"]; + + [self setTokenizerState:t.wordState onTokenizer:t forTokensForKey:@"@wordState"]; + [self setTokenizerState:t.numberState onTokenizer:t forTokensForKey:@"@numberState"]; + [self setTokenizerState:t.quoteState onTokenizer:t forTokensForKey:@"@quoteState"]; + [self setTokenizerState:t.delimitState onTokenizer:t forTokensForKey:@"@delimitState"]; + [self setTokenizerState:t.symbolState onTokenizer:t forTokensForKey:@"@symbolState"]; + [self setTokenizerState:t.commentState onTokenizer:t forTokensForKey:@"@commentState"]; + [self setTokenizerState:t.whitespaceState onTokenizer:t forTokensForKey:@"@whitespaceState"]; + + [self setFallbackStateOn:t.commentState withTokenizer:t forTokensForKey:@"@commentState.fallbackState"]; + [self setFallbackStateOn:t.delimitState withTokenizer:t forTokensForKey:@"@delimitState.fallbackState"]; + + NSArray *toks = nil; + + // muli-char symbols + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@symbol"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@symbols"]]; + [parserTokensTable removeObjectForKey:@"@symbol"]; + [parserTokensTable removeObjectForKey:@"@symbols"]; + for (PKToken *tok in toks) { + if (tok.isQuotedString) { + [t.symbolState add:[tok.stringValue stringByTrimmingQuotes]]; + } + } + + // wordChars + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@wordChar"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@wordChars"]]; + [parserTokensTable removeObjectForKey:@"@wordChar"]; + [parserTokensTable removeObjectForKey:@"@wordChars"]; + for (PKToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + if ([s length]) { + NSInteger c = [s characterAtIndex:0]; + [t.wordState setWordChars:YES from:c to:c]; + } + } + } + + // whitespaceChars + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@whitespaceChar"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@whitespaceChars"]]; + [parserTokensTable removeObjectForKey:@"@whitespaceChar"]; + [parserTokensTable removeObjectForKey:@"@whitespaceChars"]; + for (PKToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + if ([s length]) { + NSInteger c = 0; + if ([s hasPrefix:@"#x"]) { + c = [s integerValue]; + } else { + c = [s characterAtIndex:0]; + } + [t.whitespaceState setWhitespaceChars:YES from:c to:c]; + } + } + } + + // single-line comments + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@singleLineComment"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@singleLineComments"]]; + [parserTokensTable removeObjectForKey:@"@singleLineComment"]; + [parserTokensTable removeObjectForKey:@"@singleLineComments"]; + for (PKToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + [t.commentState addSingleLineStartMarker:s]; + } + } + + // multi-line comments + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@multiLineComment"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@multiLineComments"]]; + NSAssert(0 == [toks count] % 2, @"@multiLineComments must be specified as quoted strings in multiples of 2"); + [parserTokensTable removeObjectForKey:@"@multiLineComment"]; + [parserTokensTable removeObjectForKey:@"@multiLineComments"]; + if ([toks count] > 1) { + NSInteger i = 0; + for ( ; i < [toks count] - 1; i++) { + PKToken *startTok = [toks objectAtIndex:i]; + PKToken *endTok = [toks objectAtIndex:++i]; + if (startTok.isQuotedString && endTok.isQuotedString) { + NSString *start = [startTok.stringValue stringByTrimmingQuotes]; + NSString *end = [endTok.stringValue stringByTrimmingQuotes]; + [t.commentState addMultiLineStartMarker:start endMarker:end]; + } + } + } + + // delimited strings + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@delimitedString"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@delimitedStrings"]]; + NSAssert(0 == [toks count] % 3, @"@delimitedString must be specified as quoted strings in multiples of 3"); + [parserTokensTable removeObjectForKey:@"@delimitedString"]; + [parserTokensTable removeObjectForKey:@"@delimitedStrings"]; + if ([toks count] > 1) { + NSInteger i = 0; + for ( ; i < [toks count] - 2; i++) { + PKToken *startTok = [toks objectAtIndex:i]; + PKToken *endTok = [toks objectAtIndex:++i]; + PKToken *charSetTok = [toks objectAtIndex:++i]; + if (startTok.isQuotedString && endTok.isQuotedString) { + NSString *start = [startTok.stringValue stringByTrimmingQuotes]; + NSString *end = [endTok.stringValue stringByTrimmingQuotes]; + NSCharacterSet *charSet = nil; + if (charSetTok.isQuotedString) { + charSet = [NSCharacterSet characterSetWithCharactersInString:[charSetTok.stringValue stringByTrimmingQuotes]]; + } + [t.delimitState addStartMarker:start endMarker:end allowedCharacterSet:charSet]; + } + } + } + + return t; +} + + +- (BOOL)boolForTokenForKey:(NSString *)key { + BOOL result = NO; + NSArray *toks = [parserTokensTable objectForKey:key]; + if ([toks count]) { + PKToken *tok = [toks objectAtIndex:0]; + if (tok.isWord && [tok.stringValue isEqualToString:@"YES"]) { + result = YES; + } + } + [parserTokensTable removeObjectForKey:key]; + return result; +} + + +- (void)setTokenizerState:(PKTokenizerState *)state onTokenizer:(PKTokenizer *)t forTokensForKey:(NSString *)key { + NSArray *toks = [parserTokensTable objectForKey:key]; + for (PKToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + if (1 == [s length]) { + NSInteger c = [s characterAtIndex:0]; + [t setTokenizerState:state from:c to:c]; + } + } + } + [parserTokensTable removeObjectForKey:key]; +} + + +- (void)setFallbackStateOn:(PKTokenizerState *)state withTokenizer:(PKTokenizer *)t forTokensForKey:(NSString *)key { + NSArray *toks = [parserTokensTable objectForKey:key]; + if ([toks count]) { + PKToken *tok = [toks objectAtIndex:0]; + if (tok.isWord) { + PKTokenizerState *fallbackState = [t valueForKey:tok.stringValue]; + if (state != fallbackState) { + state.fallbackState = fallbackState; + } + } + } + [parserTokensTable removeObjectForKey:key]; +} + + +- (PKParser *)expandedParserForName:(NSString *)parserName { + id obj = [parserTokensTable objectForKey:parserName]; + if ([obj isKindOfClass:[PKParser class]]) { + return obj; + } else { + // prevent infinite loops by creating a parser of the correct type first, and putting it in the table + NSString *className = [parserClassTable objectForKey:parserName]; + + PKParser *p = [[NSClassFromString(className) alloc] init]; + [parserTokensTable setObject:p forKey:parserName]; + [p release]; + + p = [self expandParser:p fromTokenArray:obj]; + p.name = parserName; + + [self setAssemblerForParser:p]; + + [parserTokensTable setObject:p forKey:parserName]; + return p; + } +} + + +- (void)setAssemblerForParser:(PKParser *)p { + NSString *parserName = p.name; + NSString *selName = [selectorTable objectForKey:parserName]; + + BOOL setOnAll = (assemblerSettingBehavior & PKParserFactoryAssemblerSettingBehaviorOnAll); + + if (setOnAll) { + // continue + } else { + BOOL setOnExplicit = (assemblerSettingBehavior & PKParserFactoryAssemblerSettingBehaviorOnExplicit); + if (setOnExplicit && selName) { + // continue + } else { + BOOL isTerminal = [p isKindOfClass:[PKTerminal class]]; + if (!isTerminal && !setOnExplicit) return; + + BOOL setOnTerminals = (assemblerSettingBehavior & PKParserFactoryAssemblerSettingBehaviorOnTerminals); + if (setOnTerminals && isTerminal) { + // continue + } else { + return; + } + } + } + + if (!selName) { + selName = [self defaultAssemblerSelectorNameForParserName:parserName]; + } + + if (selName) { + SEL sel = NSSelectorFromString(selName); + if (assembler && [assembler respondsToSelector:sel]) { + [p setAssembler:assembler selector:sel]; + } + if (preassembler && [preassembler respondsToSelector:sel]) { + NSString *selName = [self defaultPreassemblerSelectorNameForParserName:parserName]; + [p setPreassembler:preassembler selector:NSSelectorFromString(selName)]; + } + } +} + + +- (id)expandParser:(PKParser *)p fromTokenArray:(NSArray *)toks { + PKAssembly *a = [PKTokenAssembly assemblyWithTokenArray:toks]; + a.target = parserTokensTable; + a = [grammarParser.exprParser completeMatchFor:a]; + PKParser *res = [a pop]; + if ([p isKindOfClass:[PKCollectionParser class]]) { + PKCollectionParser *cp = (PKCollectionParser *)p; + [cp add:res]; + return cp; + } else { + return res; + } +} + + +// this is just a utility for unit-testing +- (PKSequence *)parserFromExpression:(NSString *)s { + PKTokenizer *t = [self tokenizerForParsingGrammar]; + t.string = s; + PKAssembly *a = [PKTokenAssembly assemblyWithTokenizer:t]; + a.target = [NSMutableDictionary dictionary]; // setup the variable lookup table + a = [grammarParser.exprParser completeMatchFor:a]; + return [a pop]; +} + + +- (PKAlternation *)zeroOrOne:(PKParser *)p { + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:p]; + return a; +} + + +- (PKSequence *)oneOrMore:(PKParser *)p { + PKSequence *s = [PKSequence sequence]; + [s add:p]; + [s add:[PKRepetition repetitionWithSubparser:p]]; + return s; +} + + +- (void)didMatchStatement:(PKAssembly *)a { + NSArray *toks = [[a objectsAbove:equals] reversedArray]; + [a pop]; // discard '=' tok + + NSString *parserName = nil; + NSString *selName = nil; + id obj = [a pop]; + if ([obj isKindOfClass:[NSString class]]) { // a callback was provided + selName = obj; + parserName = [[a pop] stringValue]; + } else { + parserName = [obj stringValue]; + } + + if (selName) { + NSAssert([selName length], @""); + [selectorTable setObject:selName forKey:parserName]; + } + NSMutableDictionary *d = a.target; + //NSLog(@"parserName: %@", parserName); + NSAssert([toks count], @""); + + // support for multiple @delimitedString = ... tokenizer directives + if ([parserName hasPrefix:@"@"]) { + // remove whitespace toks from tokenizer directives + if (![parserName isEqualToString:@"@start"]) { + toks = [self tokens:toks byRemovingTokensOfType:PKTokenTypeWhitespace]; + } + + NSArray *existingToks = [d objectForKey:parserName]; + if ([existingToks count]) { + toks = [toks arrayByAddingObjectsFromArray:existingToks]; + } + } + + [d setObject:toks forKey:parserName]; +} + + +- (NSArray *)tokens:(NSArray *)toks byRemovingTokensOfType:(PKTokenType)tt { + NSMutableArray *res = [NSMutableArray array]; + for (PKToken *tok in toks) { + if (PKTokenTypeWhitespace != tok.tokenType) { + [res addObject:tok]; + } + } + return res; +} + + +- (NSString *)defaultAssemblerSelectorNameForParserName:(NSString *)parserName { + NSString *prefix = nil; + if ([parserName hasPrefix:@"@"]) { + // parserName = [parserName substringFromIndex:1]; + // prefix = @"didMatch_"; + return nil; + } else { + prefix = @"didMatch"; + } + NSString *s = [NSString stringWithFormat:@"%@%@", [[parserName substringToIndex:1] uppercaseString], [parserName substringFromIndex:1]]; + return [NSString stringWithFormat:@"%@%@:", prefix, s]; +} + + +- (NSString *)defaultPreassemblerSelectorNameForParserName:(NSString *)parserName { + NSString *prefix = nil; + if ([parserName hasPrefix:@"@"]) { + return nil; + } else { + prefix = @"willMatch"; + } + NSString *s = [NSString stringWithFormat:@"%@%@", [[parserName substringToIndex:1] uppercaseString], [parserName substringFromIndex:1]]; + return [NSString stringWithFormat:@"%@%@:", prefix, s]; +} + + +- (void)didMatchCallback:(PKAssembly *)a { + PKToken *selNameTok = [a pop]; + NSString *selName = [NSString stringWithFormat:@"%@:", selNameTok.stringValue]; + [a push:selName]; +} + + +- (void)didMatchExpression:(PKAssembly *)a { + NSArray *objs = [a objectsAbove:paren]; + NSAssert([objs count], @""); + [a pop]; // pop '(' + + if ([objs count] > 1) { + PKSequence *seq = [PKSequence sequence]; + for (id obj in [objs reverseObjectEnumerator]) { + [seq add:obj]; + } + [a push:seq]; + } else if ([objs count]) { + [a push:[objs objectAtIndex:0]]; + } +} + + +- (void)didMatchDifference:(PKAssembly *)a { + PKParser *minus = [a pop]; + PKParser *sub = [a pop]; + NSAssert([minus isKindOfClass:[PKParser class]], @""); + NSAssert([sub isKindOfClass:[PKParser class]], @""); + + [a push:[PKDifference differenceWithSubparser:sub minus:minus]]; +} + + +- (void)didMatchIntersection:(PKAssembly *)a { + PKParser *predicate = [a pop]; + PKParser *sub = [a pop]; + NSAssert([predicate isKindOfClass:[PKParser class]], @""); + NSAssert([sub isKindOfClass:[PKParser class]], @""); + + PKIntersection *inter = [PKIntersection intersection]; + [inter add:sub]; + [inter add:predicate]; + + [a push:inter]; +} + + +- (void)didMatchPatternOptions:(PKAssembly *)a { + PKToken *tok = [a pop]; + NSAssert(tok.isWord, @""); + + NSString *s = tok.stringValue; + NSAssert([s length] > 0, @""); + + PKPatternOptions opts = PKPatternOptionsNone; + if (NSNotFound != [s rangeOfString:@"i"].location) { + opts |= PKPatternOptionsIgnoreCase; + } + if (NSNotFound != [s rangeOfString:@"m"].location) { + opts |= PKPatternOptionsMultiline; + } + if (NSNotFound != [s rangeOfString:@"x"].location) { + opts |= PKPatternOptionsComments; + } + if (NSNotFound != [s rangeOfString:@"s"].location) { + opts |= PKPatternOptionsDotAll; + } + if (NSNotFound != [s rangeOfString:@"w"].location) { + opts |= PKPatternOptionsUnicodeWordBoundaries; + } + + [a push:[NSNumber numberWithInteger:opts]]; +} + + +- (void)didMatchPattern:(PKAssembly *)a { + id obj = [a pop]; // opts (as Number*) or DelimitedString('/', '/') + + PKPatternOptions opts = PKPatternOptionsNone; + if ([obj isKindOfClass:[NSNumber class]]) { + opts = [obj integerValue]; + obj = [a pop]; + } + + NSAssert([obj isMemberOfClass:[PKToken class]], @""); + PKToken *tok = (PKToken *)obj; + NSAssert(tok.isDelimitedString, @""); + + NSString *s = tok.stringValue; + NSAssert([s length] > 2, @""); + + NSAssert([s hasPrefix:@"/"], @""); + NSAssert([s hasSuffix:@"/"], @""); + + NSString *re = [s stringByTrimmingQuotes]; + + PKTerminal *t = [PKPattern patternWithString:re options:opts]; + + [a push:t]; +} + + +- (void)didMatchDiscard:(PKAssembly *)a { + id obj = [a pop]; + if ([obj isKindOfClass:[PKTerminal class]]) { + PKTerminal *t = (PKTerminal *)obj; + [t discard]; + } + [a push:obj]; +} + + +- (void)didMatchLiteral:(PKAssembly *)a { + PKToken *tok = [a pop]; + + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + PKTerminal *t = [PKCaseInsensitiveLiteral literalWithString:s]; + + [a push:t]; +} + + +- (void)didMatchVariable:(PKAssembly *)a { + PKToken *tok = [a pop]; + NSString *parserName = tok.stringValue; + PKParser *p = nil; + if (isGatheringClasses) { + // lookup the actual possible parser. + // if its not there, or still a token array, just spoof it with a sequence + NSMutableDictionary *d = a.target; + p = [d objectForKey:parserName]; + if (![p isKindOfClass:[PKParser parser]]) { + p = [PKSequence sequence]; + } + } else { + if ([parserTokensTable objectForKey:parserName]) { + p = [self expandedParserForName:parserName]; + } + } + [a push:p]; +} + + +- (void)didMatchConstant:(PKAssembly *)a { + PKToken *tok = [a pop]; + NSString *s = tok.stringValue; + id p = nil; + if ([s isEqualToString:@"Word"]) { + p = [PKWord word]; + } else if ([s isEqualToString:@"LowercaseWord"]) { + p = [PKLowercaseWord word]; + } else if ([s isEqualToString:@"UppercaseWord"]) { + p = [PKUppercaseWord word]; + } else if ([s isEqualToString:@"Number"]) { + p = [PKNumber number]; + } else if ([s isEqualToString:@"S"]) { + p = [PKWhitespace whitespace]; + } else if ([s isEqualToString:@"QuotedString"]) { + p = [PKQuotedString quotedString]; + } else if ([s isEqualToString:@"Symbol"]) { + p = [PKSymbol symbol]; + } else if ([s isEqualToString:@"Comment"]) { + p = [PKComment comment]; + } else if ([s isEqualToString:@"Any"]) { + p = [PKAny any]; + } else if ([s isEqualToString:@"Empty"]) { + p = [PKEmpty empty]; + } else if ([s isEqualToString:@"Pattern"]) { + p = tok; + } else if ([s isEqualToString:@"DelimitedString"]) { + p = tok; + } else if ([s isEqualToString:@"YES"] || [s isEqualToString:@"NO"]) { + p = tok; + } else { + [NSException raise:@"Grammar Exception" format: + @"User Grammar referenced a constant parser name (uppercase word) which is not supported: %@. Must be one of: Word, LowercaseWord, UppercaseWord, QuotedString, Number, Symbol, Empty.", s]; + } + + [a push:p]; +} + + +- (void)didMatchDelimitedString:(PKAssembly *)a { + NSArray *toks = [a objectsAbove:paren]; + [a pop]; // discard '(' fence + + NSAssert([toks count] > 0 && [toks count] < 3, @""); + NSString *start = [[[toks lastObject] stringValue] stringByTrimmingQuotes]; + NSString *end = nil; + if ([toks count] > 1) { + end = [[[toks objectAtIndex:0] stringValue] stringByTrimmingQuotes]; + } + + PKTerminal *t = [PKDelimitedString delimitedStringWithStartMarker:start endMarker:end]; + + [a push:t]; +} + + +- (void)didMatchNum:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)didMatchStar:(PKAssembly *)a { + id top = [a pop]; + PKRepetition *rep = [PKRepetition repetitionWithSubparser:top]; + [a push:rep]; +} + + +- (void)didMatchPlus:(PKAssembly *)a { + id top = [a pop]; + [a push:[self oneOrMore:top]]; +} + + +- (void)didMatchQuestion:(PKAssembly *)a { + id top = [a pop]; + [a push:[self zeroOrOne:top]]; +} + + +- (void)didMatchPhraseCardinality:(PKAssembly *)a { + NSRange r = [[a pop] rangeValue]; + PKParser *p = [a pop]; + PKSequence *s = [PKSequence sequence]; + + NSInteger start = r.location; + NSInteger end = r.length; + + NSInteger i = 0; + for ( ; i < start; i++) { + [s add:p]; + } + + for ( ; i < end; i++) { + [s add:[self zeroOrOne:p]]; + } + + [a push:s]; +} + + +- (void)didMatchCardinality:(PKAssembly *)a { + NSArray *toks = [a objectsAbove:self.curly]; + [a pop]; // discard '{' tok + + NSAssert([toks count] > 0, @""); + + PKToken *tok = [toks lastObject]; + CGFloat start = tok.floatValue; + CGFloat end = start; + if ([toks count] > 1) { + tok = [toks objectAtIndex:0]; + end = tok.floatValue; + } + + NSAssert(start <= end, @""); + + NSRange r = NSMakeRange(start, end); + [a push:[NSValue valueWithRange:r]]; +} + + +- (void)didMatchOr:(PKAssembly *)a { + id second = [a pop]; + [a pop]; // pop '|' + id first = [a pop]; + PKAlternation *p = [PKAlternation alternation]; + [p add:first]; + [p add:second]; + [a push:p]; +} + + +- (void)didMatchAnd:(PKAssembly *)a { + NSMutableArray *parsers = [NSMutableArray array]; + while (![a isStackEmpty]) { + id obj = [a pop]; + if ([obj isKindOfClass:[PKParser class]]) { + [parsers addObject:obj]; + } else { + [a push:obj]; + break; + } + } + + if ([parsers count] > 1) { + PKSequence *seq = [PKSequence sequence]; + for (PKParser *p in [parsers reverseObjectEnumerator]) { + [seq add:p]; + } + + [a push:seq]; + } else if (1 == [parsers count]) { + [a push:[parsers objectAtIndex:0]]; + } +} + + +- (void)didMatchNegation:(PKAssembly *)a { + PKParser *p = [a pop]; + [a push:[PKNegation negationWithSubparser:p]]; +} + +@synthesize grammarParser; +@synthesize assembler; +@synthesize preassembler; +@synthesize parserTokensTable; +@synthesize parserClassTable; +@synthesize selectorTable; +@synthesize equals; +@synthesize curly; +@synthesize paren; +@synthesize assemblerSettingBehavior; +@end diff --git a/src/.svn/text-base/PKPattern.m.svn-base b/src/.svn/text-base/PKPattern.m.svn-base new file mode 100644 index 0000000..014e7b1 --- /dev/null +++ b/src/.svn/text-base/PKPattern.m.svn-base @@ -0,0 +1,45 @@ +// +// PKPattern.m +// ParseKit +// +// Created by Todd Ditchendorf on 5/31/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import "RegexKitLite.h" + +@implementation PKPattern + ++ (id)patternWithString:(NSString *)s { + return [self patternWithString:s options:PKPatternOptionsNone]; +} + + ++ (id)patternWithString:(NSString *)s options:(PKPatternOptions)opts { + return [[[self alloc] initWithString:s options:opts] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + return [self initWithString:s options:PKPatternOptionsNone]; +} + + +- (id)initWithString:(NSString *)s options:(PKPatternOptions)opts { + if (self = [super initWithString:s]) { + options = opts; + } + return self; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + + NSRange r = NSMakeRange(0, [tok.stringValue length]); + + return NSEqualRanges(r, [tok.stringValue rangeOfRegex:self.string options:(uint32_t)options inRange:r capture:0 error:nil]); +} + +@end diff --git a/src/.svn/text-base/PKQuoteState.m.svn-base b/src/.svn/text-base/PKQuoteState.m.svn-base new file mode 100644 index 0000000..36c006c --- /dev/null +++ b/src/.svn/text-base/PKQuoteState.m.svn-base @@ -0,0 +1,56 @@ +// +// PKQuoteState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@implementation PKQuoteState + +- (void)dealloc { + [super dealloc]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + [self resetWithReader:r]; + + [self append:cin]; + PKUniChar c; + do { + c = [r read]; + if (PKEOF == c) { + c = cin; + if (balancesEOFTerminatedQuotes) { + [self append:c]; + } + } else { + [self append:c]; + } + + } while (c != cin); + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeQuotedString stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; +} + +@synthesize balancesEOFTerminatedQuotes; +@end diff --git a/src/.svn/text-base/PKQuotedString.m.svn-base b/src/.svn/text-base/PKQuotedString.m.svn-base new file mode 100644 index 0000000..358d7d9 --- /dev/null +++ b/src/.svn/text-base/PKQuotedString.m.svn-base @@ -0,0 +1,24 @@ +// +// PKQuotedString.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKQuotedString + ++ (id)quotedString { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isQuotedString; +} + +@end diff --git a/src/.svn/text-base/PKReader.m.svn-base b/src/.svn/text-base/PKReader.m.svn-base new file mode 100644 index 0000000..477f207 --- /dev/null +++ b/src/.svn/text-base/PKReader.m.svn-base @@ -0,0 +1,69 @@ +// +// PKReader.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/21/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@implementation PKReader + +- (id)init { + return [self initWithString:nil]; +} + + +- (id)initWithString:(NSString *)s { + if (self = [super init]) { + self.string = s; + } + return self; +} + + +- (void)dealloc { + self.string = nil; + [super dealloc]; +} + + +- (NSString *)string { + return [[string retain] autorelease]; +} + + +- (void)setString:(NSString *)s { + if (string != s) { + [string autorelease]; + string = [s copy]; + length = [string length]; + } + // reset cursor + offset = 0; +} + + +- (PKUniChar)read { + if (0 == length || offset > length - 1) { + return PKEOF; + } + return [string characterAtIndex:offset++]; +} + + +- (void)unread { + offset = (0 == offset) ? 0 : offset - 1; +} + + +- (void)unread:(NSUInteger)count { + NSUInteger i = 0; + for ( ; i < count; i++) { + [self unread]; + } +} + +@synthesize offset; +@end diff --git a/src/.svn/text-base/PKRepetition.m.svn-base b/src/.svn/text-base/PKRepetition.m.svn-base new file mode 100644 index 0000000..96b1491 --- /dev/null +++ b/src/.svn/text-base/PKRepetition.m.svn-base @@ -0,0 +1,71 @@ +// +// PKRepetition.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +@end + +@interface PKRepetition () +@property (nonatomic, readwrite, retain) PKParser *subparser; +@end + +@implementation PKRepetition + ++ (id)repetitionWithSubparser:(PKParser *)p { + return [[[self alloc] initWithSubparser:p] autorelease]; +} + + +- (id)init { + return [self initWithSubparser:nil]; +} + + +- (id)initWithSubparser:(PKParser *)p { + //NSParameterAssert(p); + if (self = [super init]) { + self.subparser = p; + } + return self; +} + + +- (void)dealloc { + self.subparser = nil; + [super dealloc]; +} + + +- (PKParser *)parserNamed:(NSString *)s { + if ([name isEqualToString:s]) { + return self; + } else { + return [subparser parserNamed:s]; + } +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + //NSMutableSet *outAssemblies = [[[NSMutableSet alloc] initWithSet:inAssemblies copyItems:YES] autorelease]; + NSMutableSet *outAssemblies = [[inAssemblies mutableCopy] autorelease]; + + NSSet *s = inAssemblies; + while ([s count]) { + s = [subparser matchAndAssemble:s]; + [outAssemblies unionSet:s]; + } + + return outAssemblies; +} + +@synthesize subparser; +@end diff --git a/src/.svn/text-base/PKSequence.m.svn-base b/src/.svn/text-base/PKSequence.m.svn-base new file mode 100644 index 0000000..5c7fb4f --- /dev/null +++ b/src/.svn/text-base/PKSequence.m.svn-base @@ -0,0 +1,50 @@ +// +// PKSequence.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +@end + +@interface PKCollectionParser () ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest; +@end + +@implementation PKSequence + ++ (id)sequence { + return [self sequenceWithSubparsers:nil]; +} + + ++ (id)sequenceWithSubparsers:(PKParser *)p1, ... { + va_list vargs; + va_start(vargs, p1); + PKSequence *seq = [self collectionParserWithFirst:p1 rest:vargs]; + va_end(vargs); + return seq; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + NSSet *outAssemblies = inAssemblies; + + for (PKParser *p in subparsers) { + outAssemblies = [p matchAndAssemble:outAssemblies]; + if (![outAssemblies count]) { + break; + } + } + + return outAssemblies; +} + +@end diff --git a/src/.svn/text-base/PKSingleLineCommentState.m.svn-base b/src/.svn/text-base/PKSingleLineCommentState.m.svn-base new file mode 100644 index 0000000..49c0feb --- /dev/null +++ b/src/.svn/text-base/PKSingleLineCommentState.m.svn-base @@ -0,0 +1,101 @@ +// +// PKSingleLineCommentState.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/28/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (void)appendString:(NSString *)s; +- (NSString *)bufferedString; +@end + +@interface PKSingleLineCommentState () +- (void)addStartMarker:(NSString *)start; +- (void)removeStartMarker:(NSString *)start; +@property (nonatomic, retain) NSMutableArray *startMarkers; +@property (nonatomic, retain) NSString *currentStartMarker; +@end + +@implementation PKSingleLineCommentState + +- (id)init { + if (self = [super init]) { + self.startMarkers = [NSMutableArray array]; + } + return self; +} + + +- (void)dealloc { + self.startMarkers = nil; + self.currentStartMarker = nil; + [super dealloc]; +} + + +- (void)addStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [startMarkers addObject:start]; +} + + +- (void)removeStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [startMarkers removeObject:start]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + BOOL reportTokens = t.commentState.reportsCommentTokens; + if (reportTokens) { + [self resetWithReader:r]; + [self appendString:currentStartMarker]; + } + + PKUniChar c; + while (1) { + c = [r read]; + if ('\n' == c || '\r' == c || PKEOF == c) { + break; + } + if (reportTokens) { + [self append:c]; + } + } + + if (PKEOF != c) { + [r unread]; + } + + self.currentStartMarker = nil; + + if (reportTokens) { + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeComment stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; + } else { + return [t nextToken]; + } +} + +@synthesize startMarkers; +@synthesize currentStartMarker; +@end diff --git a/src/.svn/text-base/PKSpecificChar.m.svn-base b/src/.svn/text-base/PKSpecificChar.m.svn-base new file mode 100644 index 0000000..47941e0 --- /dev/null +++ b/src/.svn/text-base/PKSpecificChar.m.svn-base @@ -0,0 +1,32 @@ +// +// PKSpecificChar.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKSpecificChar + ++ (id)specificCharWithChar:(PKUniChar)c { + return [[[self alloc] initWithSpecificChar:c] autorelease]; +} + + +- (id)initWithSpecificChar:(PKUniChar)c { + self = [super initWithString:[NSString stringWithFormat:@"%C", c]]; + if (self) { + } + return self; +} + + +- (BOOL)qualifies:(id)obj { + PKUniChar c = [obj intValue]; + return c == [string characterAtIndex:0]; +} + +@end diff --git a/src/.svn/text-base/PKSymbol.m.svn-base b/src/.svn/text-base/PKSymbol.m.svn-base new file mode 100644 index 0000000..237a311 --- /dev/null +++ b/src/.svn/text-base/PKSymbol.m.svn-base @@ -0,0 +1,73 @@ +// +// PKSymbol.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKSymbol () +@property (nonatomic, retain) PKToken *symbol; +@end + +@implementation PKSymbol + ++ (id)symbol { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)symbolWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + if ([s length]) { + self.symbol = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:s floatValue:0.0]; + } + } + return self; +} + + +- (void)dealloc { + self.symbol = nil; + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + if (symbol) { + return [symbol isEqual:obj]; + } else { + PKToken *tok = (PKToken *)obj; + return tok.isSymbol; + } +} + + +- (NSString *)description { + NSString *className = [NSStringFromClass([self class]) substringFromIndex:2]; + if ([name length]) { + if (symbol) { + return [NSString stringWithFormat:@"%@ (%@) %@", className, name, symbol.stringValue]; + } else { + return [NSString stringWithFormat:@"%@ (%@)", className, name]; + } + } else { + if (symbol) { + return [NSString stringWithFormat:@"%@ %@", className, symbol.stringValue]; + } else { + return [NSString stringWithFormat:@"%@", className]; + } + } +} + +@synthesize symbol; +@end diff --git a/src/.svn/text-base/PKSymbolNode.m.svn-base b/src/.svn/text-base/PKSymbolNode.m.svn-base new file mode 100644 index 0000000..20ba02e --- /dev/null +++ b/src/.svn/text-base/PKSymbolNode.m.svn-base @@ -0,0 +1,76 @@ +// +// PKSymbolNode.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKSymbolNode () +@property (nonatomic, readwrite, retain) NSString *ancestry; +@property (nonatomic, assign) PKSymbolNode *parent; // this must be 'assign' to avoid retain loop leak +@property (nonatomic, retain) NSMutableDictionary *children; +@property (nonatomic) PKUniChar character; +@property (nonatomic, retain) NSString *string; + +- (void)determineAncestry; +@end + +@implementation PKSymbolNode + +- (id)initWithParent:(PKSymbolNode *)p character:(PKUniChar)c { + if (self = [super init]) { + self.parent = p; + self.character = c; + self.children = [NSMutableDictionary dictionary]; + + // this private property is an optimization. + // cache the NSString for the char to prevent it being constantly recreated in -determinAncestry + self.string = [NSString stringWithFormat:@"%C", character]; + + [self determineAncestry]; + } + return self; +} + + +- (void)dealloc { + parent = nil; // makes clang static analyzer happy + self.ancestry = nil; + self.string = nil; + self.children = nil; + [super dealloc]; +} + + +- (void)determineAncestry { + if (PKEOF == parent.character) { // optimization for sinlge-char symbol (parent is symbol root node) + self.ancestry = string; + } else { + NSMutableString *result = [NSMutableString string]; + + PKSymbolNode *n = self; + while (PKEOF != n.character) { + [result insertString:n.string atIndex:0]; + n = n.parent; + } + + //self.ancestry = [[result copy] autorelease]; // assign an immutable copy + self.ancestry = result; // optimization + } +} + + +- (NSString *)description { + return [NSString stringWithFormat:@"", self.ancestry]; +} + +@synthesize ancestry; +@synthesize parent; +@synthesize character; +@synthesize string; +@synthesize children; +@end diff --git a/src/.svn/text-base/PKSymbolRootNode.m.svn-base b/src/.svn/text-base/PKSymbolRootNode.m.svn-base new file mode 100644 index 0000000..5a9d259 --- /dev/null +++ b/src/.svn/text-base/PKSymbolRootNode.m.svn-base @@ -0,0 +1,147 @@ +// +// PKSymbolRootNode.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKSymbolNode () +@property (nonatomic, retain) NSMutableDictionary *children; +@end + +@interface PKSymbolRootNode () +- (void)addWithFirst:(PKUniChar)c rest:(NSString *)s parent:(PKSymbolNode *)p; +- (void)removeWithFirst:(PKUniChar)c rest:(NSString *)s parent:(PKSymbolNode *)p; +- (NSString *)nextWithFirst:(PKUniChar)c rest:(PKReader *)r parent:(PKSymbolNode *)p; +@end + +@implementation PKSymbolRootNode + +- (id)init { + self = [super initWithParent:nil character:PKEOF]; + if (self) { + + } + return self; +} + + +- (void)add:(NSString *)s { + NSParameterAssert(s); + if ([s length] < 2) return; + + [self addWithFirst:[s characterAtIndex:0] rest:[s substringFromIndex:1] parent:self]; +} + + +- (void)remove:(NSString *)s { + NSParameterAssert(s); + if ([s length] < 2) return; + + [self removeWithFirst:[s characterAtIndex:0] rest:[s substringFromIndex:1] parent:self]; +} + + +- (void)addWithFirst:(PKUniChar)c rest:(NSString *)s parent:(PKSymbolNode *)p { + NSParameterAssert(p); + NSNumber *key = [NSNumber numberWithInteger:c]; + PKSymbolNode *child = [p.children objectForKey:key]; + if (!child) { + child = [[PKSymbolNode alloc] initWithParent:p character:c]; + [p.children setObject:child forKey:key]; + [child release]; + } + + NSString *rest = nil; + + if (0 == [s length]) { + return; + } else if ([s length] > 1) { + rest = [s substringFromIndex:1]; + } + + [self addWithFirst:[s characterAtIndex:0] rest:rest parent:child]; +} + + +- (void)removeWithFirst:(PKUniChar)c rest:(NSString *)s parent:(PKSymbolNode *)p { + NSParameterAssert(p); + NSNumber *key = [NSNumber numberWithInteger:c]; + PKSymbolNode *child = [p.children objectForKey:key]; + if (child) { + NSString *rest = nil; + + if (0 == [s length]) { + return; + } else if ([s length] > 1) { + rest = [s substringFromIndex:1]; + [self removeWithFirst:[s characterAtIndex:0] rest:rest parent:child]; + } + + [p.children removeObjectForKey:key]; + } +} + + +- (NSString *)nextSymbol:(PKReader *)r startingWith:(PKUniChar)cin { + NSParameterAssert(r); + return [self nextWithFirst:cin rest:r parent:self]; +} + + +- (NSString *)nextWithFirst:(PKUniChar)c rest:(PKReader *)r parent:(PKSymbolNode *)p { + NSParameterAssert(p); + NSString *result = [NSString stringWithFormat:@"%C", c]; + + // this also works. +// NSString *result = [[[NSString alloc] initWithCharacters:(const unichar *)&c length:1] autorelease]; + + // none of these work. + //NSString *result = [[[NSString alloc] initWithBytes:&c length:1 encoding:NSUTF8StringEncoding] autorelease]; + +// NSLog(@"c: %d", c); +// NSLog(@"string for c: %@", result); +// NSString *chars = [[[NSString alloc] initWithCharacters:(const unichar *)&c length:1] autorelease]; +// NSString *utfs = [[[NSString alloc] initWithUTF8String:(const char *)&c] autorelease]; +// NSString *utf8 = [[[NSString alloc] initWithBytes:&c length:1 encoding:NSUTF8StringEncoding] autorelease]; +// NSString *utf16 = [[[NSString alloc] initWithBytes:&c length:1 encoding:NSUTF16StringEncoding] autorelease]; +// NSString *ascii = [[[NSString alloc] initWithBytes:&c length:1 encoding:NSASCIIStringEncoding] autorelease]; +// NSString *iso = [[[NSString alloc] initWithBytes:&c length:1 encoding:NSISOLatin1StringEncoding] autorelease]; +// +// NSLog(@"chars: '%@'", chars); +// NSLog(@"utfs: '%@'", utfs); +// NSLog(@"utf8: '%@'", utf8); +// NSLog(@"utf16: '%@'", utf16); +// NSLog(@"ascii: '%@'", ascii); +// NSLog(@"iso: '%@'", iso); + + NSNumber *key = [NSNumber numberWithInteger:c]; + PKSymbolNode *child = [p.children objectForKey:key]; + + if (!child) { + if (p == self) { + return result; + } else { + [r unread]; + return @""; + } + } + + c = [r read]; + if (PKEOF == c) { + return result; + } + + return [result stringByAppendingString:[self nextWithFirst:c rest:r parent:child]]; +} + + +- (NSString *)description { + return @""; +} + +@end diff --git a/src/.svn/text-base/PKSymbolState.m.svn-base b/src/.svn/text-base/PKSymbolState.m.svn-base new file mode 100644 index 0000000..c406d57 --- /dev/null +++ b/src/.svn/text-base/PKSymbolState.m.svn-base @@ -0,0 +1,107 @@ +// +// PKSymbolState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t; +@end + +@interface PKSymbolState () +- (PKToken *)symbolTokenWith:(PKUniChar)cin; +- (PKToken *)symbolTokenWithSymbol:(NSString *)s; + +@property (nonatomic, retain) PKSymbolRootNode *rootNode; +@property (nonatomic, retain) NSMutableArray *addedSymbols; +@end + +@implementation PKSymbolState + +- (id)init { + if (self = [super init]) { + self.rootNode = [[[PKSymbolRootNode alloc] init] autorelease]; + self.addedSymbols = [NSMutableArray array]; + } + return self; +} + + +- (void)dealloc { + self.rootNode = nil; + self.addedSymbols = nil; + [super dealloc]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + [self resetWithReader:r]; + + NSString *symbol = [rootNode nextSymbol:r startingWith:cin]; + NSUInteger len = [symbol length]; + + while (len > 1) { + if ([addedSymbols containsObject:symbol]) { + return [self symbolTokenWithSymbol:symbol]; + } + + symbol = [symbol substringToIndex:[symbol length] - 1]; + len = [symbol length]; + [r unread:1]; + } + + if (1 == len) { + return [self symbolTokenWith:cin]; + } else { + PKTokenizerState *state = [self nextTokenizerStateFor:cin tokenizer:t]; + if (!state || state == self) { + return [self symbolTokenWith:cin]; + } else { + return [state nextTokenFromReader:r startingWith:cin tokenizer:t]; + } + } +} + + +- (void)add:(NSString *)s { + NSParameterAssert(s); + [rootNode add:s]; + [addedSymbols addObject:s]; +} + + +- (void)remove:(NSString *)s { + NSParameterAssert(s); + [rootNode remove:s]; + [addedSymbols removeObject:s]; +} + + +- (PKToken *)symbolTokenWith:(PKUniChar)cin { + return [self symbolTokenWithSymbol:[NSString stringWithFormat:@"%C", cin]]; +} + + +- (PKToken *)symbolTokenWithSymbol:(NSString *)s { + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:s floatValue:0.0]; + tok.offset = offset; + return tok; +} + +@synthesize rootNode; +@synthesize addedSymbols; +@end diff --git a/src/.svn/text-base/PKTerminal.m.svn-base b/src/.svn/text-base/PKTerminal.m.svn-base new file mode 100644 index 0000000..ce0e7df --- /dev/null +++ b/src/.svn/text-base/PKTerminal.m.svn-base @@ -0,0 +1,95 @@ +// +// PKTerminal.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import + +@interface PKAssembly () +- (id)peek; +- (id)next; +- (BOOL)hasMore; +@property (nonatomic, readonly) NSUInteger objectsConsumed; +@end + +@interface PKTerminal () +- (PKAssembly *)matchOneAssembly:(PKAssembly *)inAssembly; +- (BOOL)qualifies:(id)obj; + +@property (nonatomic, readwrite, copy) NSString *string; +@end + +@implementation PKTerminal + +- (id)init { + return [self initWithString:nil]; +} + + +- (id)initWithString:(NSString *)s { + if (self = [super init]) { + self.string = s; + } + return self; +} + + +- (void)dealloc { + self.string = nil; + [super dealloc]; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + NSMutableSet *outAssemblies = [NSMutableSet set]; + + for (PKAssembly *a in inAssemblies) { + PKAssembly *b = [self matchOneAssembly:a]; + if (b) { + [outAssemblies addObject:b]; + } + } + + return outAssemblies; +} + + +- (PKAssembly *)matchOneAssembly:(PKAssembly *)inAssembly { + NSParameterAssert(inAssembly); + if (![inAssembly hasMore]) { + return nil; + } + + PKAssembly *outAssembly = nil; + + if ([self qualifies:[inAssembly peek]]) { + outAssembly = [[inAssembly copy] autorelease]; + id obj = [outAssembly next]; + if (!discardFlag) { + [outAssembly push:obj]; + } + } + + return outAssembly; +} + + +- (BOOL)qualifies:(id)obj { + NSAssert1(0, @"-[PKTerminal %s] must be overriden", _cmd); + return NO; +} + + +- (PKTerminal *)discard { + discardFlag = YES; + return self; +} + +@synthesize string; +@end diff --git a/src/.svn/text-base/PKToken.m.svn-base b/src/.svn/text-base/PKToken.m.svn-base new file mode 100644 index 0000000..7ac0adf --- /dev/null +++ b/src/.svn/text-base/PKToken.m.svn-base @@ -0,0 +1,233 @@ +// +// PKToken.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface PKTokenEOF : PKToken {} ++ (PKTokenEOF *)instance; +@end + +@implementation PKTokenEOF + +static PKTokenEOF *EOFToken = nil; + ++ (PKTokenEOF *)instance { + @synchronized(self) { + if (!EOFToken) { + [[self alloc] init]; // assignment not done here + } + } + return EOFToken; +} + + ++ (id)allocWithZone:(NSZone *)zone { + @synchronized(self) { + if (!EOFToken) { + EOFToken = [super allocWithZone:zone]; + return EOFToken; // assignment and return on first allocation + } + } + return nil; //on subsequent allocation attempts return nil +} + + +- (id)copyWithZone:(NSZone *)zone { + return self; +} + + +- (id)retain { + return self; +} + + +- (void)release { + // do nothing +} + + +- (id)autorelease { + return self; +} + + +- (NSUInteger)retainCount { + return UINT_MAX; // denotes an object that cannot be released +} + + +- (NSString *)description { + return [NSString stringWithFormat:@"", self]; +} + + +- (NSString *)debugDescription { + return [self description]; +} + + +- (NSUInteger)offset { + return -1; +} + +@end + +@interface PKToken () +- (BOOL)isEqual:(id)obj ignoringCase:(BOOL)ignoringCase; + +@property (nonatomic, readwrite, getter=isNumber) BOOL number; +@property (nonatomic, readwrite, getter=isQuotedString) BOOL quotedString; +@property (nonatomic, readwrite, getter=isSymbol) BOOL symbol; +@property (nonatomic, readwrite, getter=isWord) BOOL word; +@property (nonatomic, readwrite, getter=isWhitespace) BOOL whitespace; +@property (nonatomic, readwrite, getter=isComment) BOOL comment; +@property (nonatomic, readwrite, getter=isDelimitedString) BOOL delimitedString; + +@property (nonatomic, readwrite) CGFloat floatValue; +@property (nonatomic, readwrite, copy) NSString *stringValue; +@property (nonatomic, readwrite) PKTokenType tokenType; +@property (nonatomic, readwrite, copy) id value; + +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@implementation PKToken + ++ (PKToken *)EOFToken { + return [PKTokenEOF instance]; +} + + ++ (id)tokenWithTokenType:(PKTokenType)t stringValue:(NSString *)s floatValue:(CGFloat)n { + return [[[self alloc] initWithTokenType:t stringValue:s floatValue:n] autorelease]; +} + + +// designated initializer +- (id)initWithTokenType:(PKTokenType)t stringValue:(NSString *)s floatValue:(CGFloat)n { + //NSParameterAssert(s); + if (self = [super init]) { + self.tokenType = t; + self.stringValue = s; + self.floatValue = n; + + self.number = (PKTokenTypeNumber == t); + self.quotedString = (PKTokenTypeQuotedString == t); + self.symbol = (PKTokenTypeSymbol == t); + self.word = (PKTokenTypeWord == t); + self.whitespace = (PKTokenTypeWhitespace == t); + self.comment = (PKTokenTypeComment == t); + self.delimitedString = (PKTokenTypeDelimitedString == t); + } + return self; +} + + +- (void)dealloc { + self.stringValue = nil; + self.value = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + return [self retain]; // tokens are immutable +} + + +- (NSUInteger)hash { + return [stringValue hash]; +} + + +- (BOOL)isEqual:(id)obj { + return [self isEqual:obj ignoringCase:NO]; +} + + +- (BOOL)isEqualIgnoringCase:(id)obj { + return [self isEqual:obj ignoringCase:YES]; +} + + +- (BOOL)isEqual:(id)obj ignoringCase:(BOOL)ignoringCase { + if (![obj isMemberOfClass:[PKToken class]]) { + return NO; + } + + PKToken *tok = (PKToken *)obj; + if (tokenType != tok.tokenType) { + return NO; + } + + if (self.isNumber) { + return floatValue == tok.floatValue; + } else { + if (ignoringCase) { + return (NSOrderedSame == [stringValue caseInsensitiveCompare:tok.stringValue]); + } else { + return [stringValue isEqualToString:tok.stringValue]; + } + } +} + + +- (id)value { + if (!value) { + id v = nil; + if (self.isNumber) { + v = [NSNumber numberWithFloat:floatValue]; + } else { + v = stringValue; + } + self.value = v; + } + return value; +} + + +- (NSString *)debugDescription { + NSString *typeString = nil; + if (self.isNumber) { + typeString = @"Number"; + } else if (self.isQuotedString) { + typeString = @"Quoted String"; + } else if (self.isSymbol) { + typeString = @"Symbol"; + } else if (self.isWord) { + typeString = @"Word"; + } else if (self.isWhitespace) { + typeString = @"Whitespace"; + } else if (self.isComment) { + typeString = @"Comment"; + } else if (self.isDelimitedString) { + typeString = @"Delimited String"; + } + return [NSString stringWithFormat:@"<%@ %C%@%C>", typeString, 0x00AB, self.value, 0x00BB]; +} + + +- (NSString *)description { + return stringValue; +} + +@synthesize number; +@synthesize quotedString; +@synthesize symbol; +@synthesize word; +@synthesize whitespace; +@synthesize comment; +@synthesize delimitedString; +@synthesize floatValue; +@synthesize stringValue; +@synthesize tokenType; +@synthesize value; +@synthesize offset; +@end diff --git a/src/.svn/text-base/PKTokenArraySource.m.svn-base b/src/.svn/text-base/PKTokenArraySource.m.svn-base new file mode 100644 index 0000000..916c6da --- /dev/null +++ b/src/.svn/text-base/PKTokenArraySource.m.svn-base @@ -0,0 +1,79 @@ +// +// PKTokenArraySource.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/11/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import + +@interface PKTokenArraySource () +@property (nonatomic, retain) PKTokenizer *tokenizer; +@property (nonatomic, retain) NSString *delimiter; +@property (nonatomic, retain) PKToken *nextToken; +@end + +@implementation PKTokenArraySource + +- (id)init { + return [self initWithTokenizer:nil delimiter:nil]; +} + + +- (id)initWithTokenizer:(PKTokenizer *)t delimiter:(NSString *)s { + NSParameterAssert(t); + NSParameterAssert(s); + if (self = [super init]) { + self.tokenizer = t; + self.delimiter = s; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.delimiter = nil; + self.nextToken = nil; + [super dealloc]; +} + + +- (BOOL)hasMore { + if (!nextToken) { + self.nextToken = [tokenizer nextToken]; + } + + return ([PKToken EOFToken] != nextToken); +} + + +- (NSArray *)nextTokenArray { + if (![self hasMore]) { + return nil; + } + + NSMutableArray *res = [NSMutableArray arrayWithObject:nextToken]; + self.nextToken = nil; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + while ((tok = [tokenizer nextToken]) != eof) { + if ([tok.stringValue isEqualToString:delimiter]) { + break; // discard delimiter tok + } + [res addObject:tok]; + } + + //return [[res copy] autorelease]; + return res; // optimization +} + +@synthesize tokenizer; +@synthesize delimiter; +@synthesize nextToken; +@end diff --git a/src/.svn/text-base/PKTokenAssembly.m.svn-base b/src/.svn/text-base/PKTokenAssembly.m.svn-base new file mode 100644 index 0000000..52d5774 --- /dev/null +++ b/src/.svn/text-base/PKTokenAssembly.m.svn-base @@ -0,0 +1,198 @@ +// +// PKTokenAssembly.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import + +@interface PKTokenAssembly () +- (id)initWithString:(NSString *)s tokenzier:(PKTokenizer *)t tokenArray:(NSArray *)a; +- (void)tokenize; +- (NSString *)objectsFrom:(PKUniChar)start to:(PKUniChar)end separatedBy:(NSString *)delimiter; + +@property (nonatomic, retain) PKTokenizer *tokenizer; +@property (nonatomic, copy) NSArray *tokens; +@end + +@implementation PKTokenAssembly + ++ (id)assemblyWithTokenizer:(PKTokenizer *)t { + return [[[self alloc] initWithTokenzier:t] autorelease]; +} + + +- (id)initWithTokenzier:(PKTokenizer *)t { + return [self initWithString:t.string tokenzier:t tokenArray:nil]; +} + + ++ (id)assemblyWithTokenArray:(NSArray *)a { + return [[[self alloc] initWithTokenArray:a] autorelease]; +} + + +- (id)initWithTokenArray:(NSArray *)a { + return [self initWithString:[a componentsJoinedByString:@""] tokenzier:nil tokenArray:a]; +} + + +- (id)initWithString:(NSString *)s { + return [self initWithTokenzier:[[[PKTokenizer alloc] initWithString:s] autorelease]]; +} + + +// designated initializer. this method is private and should not be called from other classes +- (id)initWithString:(NSString *)s tokenzier:(PKTokenizer *)t tokenArray:(NSArray *)a { + self = [super initWithString:s]; + if (self) { + if (t) { + self.tokenizer = t; + } else { + self.tokens = a; + } + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.tokens = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + PKTokenAssembly *a = (PKTokenAssembly *)[super copyWithZone:zone]; + a->tokenizer = nil; // optimization + if (tokens) { + a->tokens = [tokens copyWithZone:zone]; + } else { + a->tokens = nil; + } + + a->preservesWhitespaceTokens = preservesWhitespaceTokens; + return a; +} + + +- (NSArray *)tokens { + if (!tokens) { + [self tokenize]; + } + return tokens; +} + + +- (id)peek { + PKToken *tok = nil; + NSArray *toks = self.tokens; + + while (1) { + if (index >= [toks count]) { + tok = nil; + break; + } + + tok = [toks objectAtIndex:index]; + if (!preservesWhitespaceTokens) { + break; + } + if (PKTokenTypeWhitespace == tok.tokenType) { + [self push:tok]; + index++; + } else { + break; + } + } + + return tok; +} + + +- (id)next { + id tok = [self peek]; + if (tok) { + index++; + } + return tok; +} + + +- (BOOL)hasMore { + return (index < [self.tokens count]); +} + + +- (NSUInteger)length { + return [self.tokens count]; +} + + +- (NSUInteger)objectsConsumed { + return index; +} + + +- (NSUInteger)objectsRemaining { + return ([self.tokens count] - index); +} + + +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter { + NSParameterAssert(delimiter); + return [self objectsFrom:0 to:self.objectsConsumed separatedBy:delimiter]; +} + + +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter { + NSParameterAssert(delimiter); + return [self objectsFrom:self.objectsConsumed to:[self length] separatedBy:delimiter]; +} + + +#pragma mark - +#pragma mark Private + +- (void)tokenize { + if (!tokenizer) { + self.tokenizer = [PKTokenizer tokenizerWithString:string]; + } + + NSMutableArray *a = [NSMutableArray array]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + while ((tok = [tokenizer nextToken]) != eof) { + [a addObject:tok]; + } + + self.tokens = a; +} + + +- (NSString *)objectsFrom:(PKUniChar)start to:(PKUniChar)end separatedBy:(NSString *)delimiter { + NSMutableString *s = [NSMutableString string]; + NSArray *toks = self.tokens; + + NSInteger i = start; + for ( ; i < end; i++) { + PKToken *tok = [toks objectAtIndex:i]; + [s appendString:tok.stringValue]; + if (end - 1 != i) { + [s appendString:delimiter]; + } + } + + return [[s copy] autorelease]; +} + +@synthesize tokenizer; +@synthesize tokens; +@synthesize preservesWhitespaceTokens; +@end diff --git a/src/.svn/text-base/PKTokenizer.m.svn-base b/src/.svn/text-base/PKTokenizer.m.svn-base new file mode 100644 index 0000000..e9b3efc --- /dev/null +++ b/src/.svn/text-base/PKTokenizer.m.svn-base @@ -0,0 +1,233 @@ +// +// ParseKit.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +#define STATE_COUNT 256 + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizer () +- (PKTokenizerState *)tokenizerStateFor:(PKUniChar)c; +- (PKTokenizerState *)defaultTokenizerStateFor:(PKUniChar)c; +@property (nonatomic, retain) PKReader *reader; +@property (nonatomic, retain) NSMutableArray *tokenizerStates; +@end + +@implementation PKTokenizer + ++ (id)tokenizer { + return [self tokenizerWithString:nil]; +} + + ++ (id)tokenizerWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)init { + return [self initWithString:nil]; +} + + +- (id)initWithString:(NSString *)s { + if (self = [super init]) { + self.string = s; + self.reader = [[[PKReader alloc] init] autorelease]; + + self.numberState = [[[PKNumberState alloc] init] autorelease]; + self.quoteState = [[[PKQuoteState alloc] init] autorelease]; + self.commentState = [[[PKCommentState alloc] init] autorelease]; + self.symbolState = [[[PKSymbolState alloc] init] autorelease]; + self.whitespaceState = [[[PKWhitespaceState alloc] init] autorelease]; + self.wordState = [[[PKWordState alloc] init] autorelease]; + self.delimitState = [[[PKDelimitState alloc] init] autorelease]; + + self.tokenizerStates = [NSMutableArray arrayWithCapacity:STATE_COUNT]; + + NSInteger i = 0; + for ( ; i < STATE_COUNT; i++) { + [tokenizerStates addObject:[self defaultTokenizerStateFor:i]]; + } + + [symbolState add:@"<="]; + [symbolState add:@">="]; + [symbolState add:@"!="]; + [symbolState add:@"=="]; + + [commentState addSingleLineStartMarker:@"//"]; + [commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + [self setTokenizerState:commentState from:'/' to:'/']; + } + return self; +} + + +- (void)dealloc { + self.string = nil; + self.reader = nil; + self.tokenizerStates = nil; + self.numberState = nil; + self.quoteState = nil; + self.commentState = nil; + self.symbolState = nil; + self.whitespaceState = nil; + self.wordState = nil; + self.delimitState = nil; + [super dealloc]; +} + + +- (PKToken *)nextToken { + PKUniChar c = [reader read]; + + PKToken *result = nil; + + if (PKEOF == c) { + result = [PKToken EOFToken]; + } else { + PKTokenizerState *state = [self tokenizerStateFor:c]; + if (state) { + result = [state nextTokenFromReader:reader startingWith:c tokenizer:self]; + } else { + result = [PKToken EOFToken]; + } + } + + return result; +} + + +#ifdef TARGET_OS_SNOW_LEOPARD +- (void)enumerateTokensUsingBlock:(void (^)(PKToken *tok, BOOL *stop))block { + PKToken *eof = [PKToken EOFToken]; + + PKToken *tok = nil; + BOOL stop = NO; + + while ((tok = [self nextToken]) != eof) { + block(tok, &stop); + if (stop) break; + } +} +#endif + + +- (void)setTokenizerState:(PKTokenizerState *)state from:(PKUniChar)start to:(PKUniChar)end { + NSParameterAssert(state); + + NSInteger i = start; + for ( ; i <= end; i++) { + [tokenizerStates replaceObjectAtIndex:i withObject:state]; + } +} + + +- (void)setReader:(PKReader *)r { + if (reader != r) { + [reader release]; + reader = [r retain]; + reader.string = string; + } +} + + +- (void)setString:(NSString *)s { + if (string != s) { + [string release]; + string = [s retain]; + } + reader.string = string; +} + + +#pragma mark - + +- (PKTokenizerState *)tokenizerStateFor:(PKUniChar)c { + if (c < 0 || c > 255) { + // customization above 255 is not supported, so fetch default. + return [self defaultTokenizerStateFor:c]; + } else { + // customization below 255 is supported, so be sure to get the (possibly) customized state from `tokenizerStates` + return [tokenizerStates objectAtIndex:c]; + } +} + +- (PKTokenizerState *)defaultTokenizerStateFor:(PKUniChar)c { + if (c >= 0 && c <= ' ') { // From: 0 to: 32 From:0x00 to:0x20 + return whitespaceState; + } else if (c == 33) { + return symbolState; + } else if (c == '"') { // From: 34 to: 34 From:0x22 to:0x22 + return quoteState; + } else if (c >= 35 && c <= 38) { + return symbolState; + } else if (c == '\'') { // From: 39 to: 39 From:0x27 to:0x27 + return quoteState; + } else if (c >= 40 && c <= 42) { + return symbolState; + } else if (c == '+') { // From: 43 to: 43 From:0x2B to:0x2B + return symbolState; + } else if (c == 44) { + return symbolState; + } else if (c == '-') { // From: 45 to: 45 From:0x2D to:0x2D + return numberState; + } else if (c == '.') { // From: 46 to: 46 From:0x2E to:0x2E + return numberState; + } else if (c == '/') { // From: 47 to: 47 From:0x2F to:0x2F + return symbolState; + } else if (c >= '0' && c <= '9') { // From: 48 to: 57 From:0x30 to:0x39 + return numberState; + } else if (c >= 58 && c <= 64) { + return symbolState; + } else if (c >= 'A' && c <= 'Z') { // From: 65 to: 90 From:0x41 to:0x5A + return wordState; + } else if (c >= 91 && c <= 96) { + return symbolState; + } else if (c >= 'a' && c <= 'z') { // From: 97 to:122 From:0x61 to:0x7A + return wordState; + } else if (c >= 123 && c <= 191) { + return symbolState; + } else if (c >= 0xC0 && c <= 0xFF) { // From:192 to:255 From:0xC0 to:0xFF + return wordState; + } else if (c >= 0x19E0 && c <= 0x19FF) { // khmer symbols + return symbolState; + } else if (c >= 0x2000 && c <= 0x2BFF) { // various symbols + return symbolState; + } else if (c >= 0x2E00 && c <= 0x2E7F) { // supplemental punctuation + return symbolState; + } else if (c >= 0x3000 && c <= 0x303F) { // cjk symbols & punctuation + return symbolState; + } else if (c >= 0x3200 && c <= 0x33FF) { // enclosed cjk letters and months, cjk compatibility + return symbolState; + } else if (c >= 0x4DC0 && c <= 0x4DFF) { // yijing hexagram symbols + return symbolState; + } else if (c >= 0xFE30 && c <= 0xFE6F) { // cjk compatibility forms, small form variants + return symbolState; + } else if (c >= 0xFF00 && c <= 0xFFFF) { // hiragana & katakana halfwitdh & fullwidth forms, Specials + return symbolState; + } else { + return wordState; + } +} + +@synthesize numberState; +@synthesize quoteState; +@synthesize commentState; +@synthesize symbolState; +@synthesize whitespaceState; +@synthesize wordState; +@synthesize delimitState; +@synthesize string; +@synthesize reader; +@synthesize tokenizerStates; +@end diff --git a/src/.svn/text-base/PKTokenizerState.m.svn-base b/src/.svn/text-base/PKTokenizerState.m.svn-base new file mode 100644 index 0000000..f700b15 --- /dev/null +++ b/src/.svn/text-base/PKTokenizerState.m.svn-base @@ -0,0 +1,113 @@ +// +// PKTokenizerState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import + +#define STATE_COUNT 256 + +@interface PKTokenizer () +- (PKTokenizerState *)defaultTokenizerStateFor:(PKUniChar)c; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (void)appendString:(NSString *)s; +- (NSString *)bufferedString; +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t; + +@property (nonatomic, retain) NSMutableString *stringbuf; +@property (nonatomic) NSUInteger offset; +@property (nonatomic, retain) NSMutableArray *fallbackStates; +@end + +@implementation PKTokenizerState + +- (void)dealloc { + self.stringbuf = nil; + self.fallbackState = nil; + self.fallbackStates = nil; + [super dealloc]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSAssert1(0, @"PKTokenizerState is an abstract classs. %s must be overriden", _cmd); + return nil; +} + + +- (void)setFallbackState:(PKTokenizerState *)state from:(PKUniChar)start to:(PKUniChar)end { + NSParameterAssert(start >= 0 && start < STATE_COUNT); + NSParameterAssert(end >= 0 && end < STATE_COUNT); + + if (!fallbackStates) { + self.fallbackStates = [NSMutableArray arrayWithCapacity:STATE_COUNT]; + + NSInteger i = 0; + for ( ; i < STATE_COUNT; i++) { + [fallbackStates addObject:[NSNull null]]; + } + + } + + NSInteger i = start; + for ( ; i <= end; i++) { + [fallbackStates replaceObjectAtIndex:i withObject:state]; + } +} + + +- (void)resetWithReader:(PKReader *)r { + self.stringbuf = [NSMutableString string]; + self.offset = r.offset - 1; +} + + +- (void)append:(PKUniChar)c { + NSParameterAssert(c > -1); + [stringbuf appendFormat:@"%C", c]; +} + + +- (void)appendString:(NSString *)s { + NSParameterAssert(s); + [stringbuf appendString:s]; +} + + +- (NSString *)bufferedString { + return [[stringbuf copy] autorelease]; +} + + +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t { + NSParameterAssert(c < STATE_COUNT); + + if (fallbackStates) { + id obj = [fallbackStates objectAtIndex:c]; + if ([NSNull null] != obj) { + return obj; + } + } + + if (fallbackState) { + return fallbackState; + } else { + return [t defaultTokenizerStateFor:c]; + } +} + +@synthesize stringbuf; +@synthesize offset; +@synthesize fallbackState; +@synthesize fallbackStates; +@end diff --git a/src/.svn/text-base/PKTrack.m.svn-base b/src/.svn/text-base/PKTrack.m.svn-base new file mode 100644 index 0000000..2599575 --- /dev/null +++ b/src/.svn/text-base/PKTrack.m.svn-base @@ -0,0 +1,91 @@ +// +// PKTrack.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import + +@interface PKAssembly () +- (id)peek; +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter; +@end + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (PKAssembly *)best:(NSSet *)inAssemblies; +@end + +@interface PKTrack () +- (void)throwTrackExceptionWithPreviousState:(NSSet *)inAssemblies parser:(PKParser *)p; +@end + +@interface PKCollectionParser () ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest; +@end + +@implementation PKTrack + ++ (id)track { + return [self trackWithSubparsers:nil]; +} + + ++ (id)trackWithSubparsers:(PKParser *)p1, ... { + va_list vargs; + va_start(vargs, p1); + PKTrack *tr = [self collectionParserWithFirst:p1 rest:vargs]; + va_end(vargs); + return tr; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + BOOL inTrack = NO; + NSSet *lastAssemblies = inAssemblies; + NSSet *outAssemblies = inAssemblies; + + for (PKParser *p in subparsers) { + outAssemblies = [p matchAndAssemble:outAssemblies]; + if (![outAssemblies count]) { + if (inTrack) { + [self throwTrackExceptionWithPreviousState:lastAssemblies parser:p]; + } + break; + } + inTrack = YES; + lastAssemblies = outAssemblies; + } + + return outAssemblies; +} + + +- (void)throwTrackExceptionWithPreviousState:(NSSet *)inAssemblies parser:(PKParser *)p { + PKAssembly *best = [self best:inAssemblies]; + + NSString *after = [best consumedObjectsJoinedByString:@" "]; + if (![after length]) { + after = @"-nothing-"; + } + + NSString *expected = [p description]; + + id next = [best peek]; + NSString *found = next ? [next description] : @"-nothing-"; + + NSString *reason = [NSString stringWithFormat:@"\n\nAfter : %@\nExpected : %@\nFound : %@\n\n", after, expected, found]; + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + after, @"after", + expected, @"expected", + found, @"found", + nil]; + [[PKTrackException exceptionWithName:PKTrackExceptionName reason:reason userInfo:userInfo] raise]; +} + +@end diff --git a/src/.svn/text-base/PKTrackException.m.svn-base b/src/.svn/text-base/PKTrackException.m.svn-base new file mode 100644 index 0000000..6e2a9a5 --- /dev/null +++ b/src/.svn/text-base/PKTrackException.m.svn-base @@ -0,0 +1,15 @@ +// +// PKTrackException.m +// ParseKit +// +// Created by Todd Ditchendorf on 10/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKTrackException.h" + +NSString * const PKTrackExceptionName = @"Track Exception"; + +@implementation PKTrackException + +@end diff --git a/src/.svn/text-base/PKUppercaseWord.m.svn-base b/src/.svn/text-base/PKUppercaseWord.m.svn-base new file mode 100644 index 0000000..e816465 --- /dev/null +++ b/src/.svn/text-base/PKUppercaseWord.m.svn-base @@ -0,0 +1,24 @@ +// +// PKUppercaseWord.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKUppercaseWord + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + if (!tok.isWord) { + return NO; + } + + NSString *s = tok.stringValue; + return [s length] && isupper([s characterAtIndex:0]); +} + +@end diff --git a/src/.svn/text-base/PKWhitespace.m.svn-base b/src/.svn/text-base/PKWhitespace.m.svn-base new file mode 100644 index 0000000..91c16af --- /dev/null +++ b/src/.svn/text-base/PKWhitespace.m.svn-base @@ -0,0 +1,24 @@ +// +// PKWhitespace.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/19/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKWhitespace.h" +#import + +@implementation PKWhitespace + ++ (id)whitespace { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isWhitespace; +} + +@end \ No newline at end of file diff --git a/src/.svn/text-base/PKWhitespaceState.m.svn-base b/src/.svn/text-base/PKWhitespaceState.m.svn-base new file mode 100644 index 0000000..a7b1ac4 --- /dev/null +++ b/src/.svn/text-base/PKWhitespaceState.m.svn-base @@ -0,0 +1,106 @@ +// +// PKWhitespaceState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import + +#define PKTRUE (id)kCFBooleanTrue +#define PKFALSE (id)kCFBooleanFalse + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface PKWhitespaceState () +@property (nonatomic, retain) NSMutableArray *whitespaceChars; +@end + +@implementation PKWhitespaceState + +- (id)init { + if (self = [super init]) { + const NSUInteger len = 255; + self.whitespaceChars = [NSMutableArray arrayWithCapacity:len]; + NSUInteger i = 0; + for ( ; i <= len; i++) { + [whitespaceChars addObject:PKFALSE]; + } + + [self setWhitespaceChars:YES from:0 to:' ']; + } + return self; +} + + +- (void)dealloc { + self.whitespaceChars = nil; + [super dealloc]; +} + + +- (void)setWhitespaceChars:(BOOL)yn from:(PKUniChar)start to:(PKUniChar)end { + NSUInteger len = [whitespaceChars count]; + if (start > len || end > len || start < 0 || end < 0) { + [NSException raise:@"PKWhitespaceStateNotSupportedException" format:@"PKWhitespaceState only supports setting word chars for chars in the latin1 set (under 256)"]; + } + + id obj = yn ? PKTRUE : PKFALSE; + NSUInteger i = start; + for ( ; i <= end; i++) { + [whitespaceChars replaceObjectAtIndex:i withObject:obj]; + } +} + + +- (BOOL)isWhitespaceChar:(PKUniChar)cin { + if (cin < 0 || cin > [whitespaceChars count] - 1) { + return NO; + } + return PKTRUE == [whitespaceChars objectAtIndex:cin]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + if (reportsWhitespaceTokens) { + [self resetWithReader:r]; + } + + PKUniChar c = cin; + while ([self isWhitespaceChar:c]) { + if (reportsWhitespaceTokens) { + [self append:c]; + } + c = [r read]; + } + if (PKEOF != c) { + [r unread]; + } + + if (reportsWhitespaceTokens) { + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeWhitespace stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; + } else { + return [t nextToken]; + } +} + +@synthesize whitespaceChars; +@synthesize reportsWhitespaceTokens; +@end + diff --git a/src/.svn/text-base/PKWord.m.svn-base b/src/.svn/text-base/PKWord.m.svn-base new file mode 100644 index 0000000..6756f1e --- /dev/null +++ b/src/.svn/text-base/PKWord.m.svn-base @@ -0,0 +1,24 @@ +// +// PKWord.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@implementation PKWord + ++ (id)word { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isWord; +} + +@end diff --git a/src/.svn/text-base/PKWordState.m.svn-base b/src/.svn/text-base/PKWordState.m.svn-base new file mode 100644 index 0000000..0f3d984 --- /dev/null +++ b/src/.svn/text-base/PKWordState.m.svn-base @@ -0,0 +1,120 @@ +// +// PKWordState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import + +#define PKTRUE (id)kCFBooleanTrue +#define PKFALSE (id)kCFBooleanFalse + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface PKWordState () +- (BOOL)isWordChar:(PKUniChar)c; + +@property (nonatomic, retain) NSMutableArray *wordChars; +@end + +@implementation PKWordState + +- (id)init { + if (self = [super init]) { + self.wordChars = [NSMutableArray arrayWithCapacity:256]; + NSInteger i = 0; + for ( ; i < 256; i++) { + [wordChars addObject:PKFALSE]; + } + + [self setWordChars:YES from: 'a' to: 'z']; + [self setWordChars:YES from: 'A' to: 'Z']; + [self setWordChars:YES from: '0' to: '9']; + [self setWordChars:YES from: '-' to: '-']; + [self setWordChars:YES from: '_' to: '_']; + [self setWordChars:YES from:'\'' to:'\'']; + [self setWordChars:YES from:0xC0 to:0xFF]; + } + return self; +} + + +- (void)dealloc { + self.wordChars = nil; + [super dealloc]; +} + + +- (void)setWordChars:(BOOL)yn from:(PKUniChar)start to:(PKUniChar)end { + NSUInteger len = [wordChars count]; + if (start > len || end > len || start < 0 || end < 0) { + [NSException raise:@"PKWordStateNotSupportedException" format:@"PKWordState only supports setting word chars for chars in the latin1 set (under 256)"]; + } + + id obj = yn ? PKTRUE : PKFALSE; + NSInteger i = start; + for ( ; i <= end; i++) { + [wordChars replaceObjectAtIndex:i withObject:obj]; + } +} + + +- (BOOL)isWordChar:(PKUniChar)c { + if (c > PKEOF && c < [wordChars count] - 1) { + return (PKTRUE == [wordChars objectAtIndex:c]); + } + + if (c >= 0x2000 && c <= 0x2BFF) { // various symbols + return NO; + } else if (c >= 0xFE30 && c <= 0xFE6F) { // general punctuation + return NO; + } else if (c >= 0xFE30 && c <= 0xFE6F) { // western musical symbols + return NO; + } else if (c >= 0xFF00 && c <= 0xFF65) { // symbols within Hiragana & Katakana + return NO; + } else if (c >= 0xFFF0 && c <= 0xFFFF) { // specials + return NO; + } else if (c < 0) { + return NO; + } else { + return YES; + } +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + [self resetWithReader:r]; + + PKUniChar c = cin; + do { + [self append:c]; + c = [r read]; + } while ([self isWordChar:c]); + + if (PKEOF != c) { + [r unread]; + } + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeWord stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; +} + + +@synthesize wordChars; +@end diff --git a/src/.svn/text-base/Reader.h.svn-base b/src/.svn/text-base/Reader.h.svn-base new file mode 100644 index 0000000..16f3983 --- /dev/null +++ b/src/.svn/text-base/Reader.h.svn-base @@ -0,0 +1,60 @@ +// +// TDReader.h +// TDParseKit +// +// Created by Todd Ditchendorf on 1/21/06. +// Copyright 2008 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class TDReader + @brief A character-stream reader that allows characters to be pushed back into the stream. +*/ +@interface TDReader : NSObject { + NSString *string; + NSUInteger offset; + NSUInteger length; +} + +/*! + @brief Designated Initializer. Initializes a reader with a given string. + @details Designated Initializer. + @param s string from which to read + @result an initialized reader +*/ +- (id)initWithString:(NSString *)s; + +/*! + @brief Read a single UTF-16 unicode character + @result The character read, or TDEOF (-1) if the end of the stream has been reached +*/ +- (TDUniChar)read; + +/*! + @brief Push back a single character + @details moves the offset back one position +*/ +- (void)unread; + +/*! + @brief Push back count characters + @param count of characters to push back + @details moves the offset back count positions +*/ +- (void)unread:(NSUInteger)count; + +/*! + @property string + @brief This reader's string. +*/ +@property (nonatomic, retain) NSString *string; + +/*! + @property offset + @brief This reader's current offset in string +*/ +@property (nonatomic, readonly) NSUInteger offset; +@end diff --git a/src/.svn/text-base/RegexKitLite.h.svn-base b/src/.svn/text-base/RegexKitLite.h.svn-base new file mode 100644 index 0000000..0161a71 --- /dev/null +++ b/src/.svn/text-base/RegexKitLite.h.svn-base @@ -0,0 +1,220 @@ +// +// RegexKitLite.h +// http://regexkit.sourceforge.net/ +// Licensed under the terms of the BSD License, as specified below. +// + +/* + Copyright (c) 2008-2009, John Engelhart + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the Zang Industries nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifdef __OBJC__ +#import +#import +#import +#import +#import +#endif // __OBJC__ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef REGEXKITLITE_VERSION_DEFINED +#define REGEXKITLITE_VERSION_DEFINED + +#define _RKL__STRINGIFY(b) #b +#define _RKL_STRINGIFY(a) _RKL__STRINGIFY(a) +#define _RKL_JOIN_VERSION(a,b) _RKL_STRINGIFY(a##.##b) +#define _RKL_VERSION_STRING(a,b) _RKL_JOIN_VERSION(a,b) + +#define REGEXKITLITE_VERSION_MAJOR 3 +#define REGEXKITLITE_VERSION_MINOR 0 + +#define REGEXKITLITE_VERSION_CSTRING _RKL_VERSION_STRING(REGEXKITLITE_VERSION_MAJOR, REGEXKITLITE_VERSION_MINOR) +#define REGEXKITLITE_VERSION_NSSTRING @REGEXKITLITE_VERSION_CSTRING + +#endif // REGEXKITLITE_VERSION_DEFINED + +// For Mac OS X < 10.5. +#ifndef NSINTEGER_DEFINED +#define NSINTEGER_DEFINED +#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) +typedef long NSInteger; +typedef unsigned long NSUInteger; +#define NSIntegerMin LONG_MIN +#define NSIntegerMax LONG_MAX +#define NSUIntegerMax ULONG_MAX +#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) +typedef int NSInteger; +typedef unsigned int NSUInteger; +#define NSIntegerMin INT_MIN +#define NSIntegerMax INT_MAX +#define NSUIntegerMax UINT_MAX +#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) +#endif // NSINTEGER_DEFINED + +#ifndef RKLREGEXOPTIONS_DEFINED +#define RKLREGEXOPTIONS_DEFINED + +// These must be idential to their ICU regex counterparts. See http://www.icu-project.org/userguide/regexp.html +enum { + RKLNoOptions = 0, + RKLCaseless = 2, + RKLComments = 4, + RKLDotAll = 32, + RKLMultiline = 8, + RKLUnicodeWordBoundaries = 256 +}; +typedef uint32_t RKLRegexOptions; // This must be identical to the ICU 'flags' argument type. + +#endif // RKLREGEXOPTIONS_DEFINED + +#ifndef _REGEXKITLITE_H_ +#define _REGEXKITLITE_H_ + +#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465) +#define RKL_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#else +#define RKL_DEPRECATED_ATTRIBUTE +#endif + +// This requires a few levels of rewriting to get the desired results. +#define _RKL_CONCAT_2(c,d) c ## d +#define _RKL_CONCAT(a,b) _RKL_CONCAT_2(a,b) + +#ifdef RKL_PREPEND_TO_METHODS +#define RKL_METHOD_PREPEND(x) _RKL_CONCAT(RKL_PREPEND_TO_METHODS, x) +#else // RKL_PREPEND_TO_METHODS +#define RKL_METHOD_PREPEND(x) x +#endif // RKL_PREPEND_TO_METHODS + +// If it looks like low memory notifications might be available, add code to register and respond to them. +// This is (should be) harmless if it turns out that this isn't the case, since the notification that we register for, +// UIApplicationDidReceiveMemoryWarningNotification, is dynamically looked up via dlsym(). +#if ((defined(TARGET_OS_EMBEDDED) && (TARGET_OS_EMBEDDED != 0)) || (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0))) && (!defined(RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS) || (RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS != 0)) +#define RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS 1 +#endif + +#ifdef __OBJC__ + +// NSException exception name. +extern NSString * const RKLICURegexException; + +// NSError error domains and user info keys. +extern NSString * const RKLICURegexErrorDomain; + +extern NSString * const RKLICURegexErrorCodeErrorKey; +extern NSString * const RKLICURegexErrorNameErrorKey; +extern NSString * const RKLICURegexLineErrorKey; +extern NSString * const RKLICURegexOffsetErrorKey; +extern NSString * const RKLICURegexPreContextErrorKey; +extern NSString * const RKLICURegexPostContextErrorKey; +extern NSString * const RKLICURegexRegexErrorKey; +extern NSString * const RKLICURegexRegexOptionsErrorKey; + +@interface NSString (RegexKitLiteAdditions) + ++ (void)RKL_METHOD_PREPEND(clearStringCache); + +// Although these are marked as deprecated, a bug in GCC prevents a warning from being issues for + class methods. Filed bug with Apple, #6736857. ++ (NSInteger)RKL_METHOD_PREPEND(captureCountForRegex):(NSString *)regex RKL_DEPRECATED_ATTRIBUTE; ++ (NSInteger)RKL_METHOD_PREPEND(captureCountForRegex):(NSString *)regex options:(RKLRegexOptions)options error:(NSError **)error RKL_DEPRECATED_ATTRIBUTE; + +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex; +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex range:(NSRange)range; +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error; + +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex; +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex inRange:(NSRange)range; +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range error:(NSError **)error; + +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex; +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex capture:(NSInteger)capture; +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex inRange:(NSRange)range; +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error; + +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex; +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex capture:(NSInteger)capture; +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex inRange:(NSRange)range; +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error; + +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement; +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement range:(NSRange)searchRange; +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement options:(RKLRegexOptions)options range:(NSRange)searchRange error:(NSError **)error; + + //// + +- (NSInteger)RKL_METHOD_PREPEND(captureCount); +- (NSInteger)RKL_METHOD_PREPEND(captureCountWithOptions):(RKLRegexOptions)options error:(NSError **)error; + +- (BOOL)RKL_METHOD_PREPEND(isRegexValid); +- (BOOL)RKL_METHOD_PREPEND(isRegexValidWithOptions):(RKLRegexOptions)options error:(NSError **)error; + +- (void)RKL_METHOD_PREPEND(flushCachedRegexData); + +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex; +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex capture:(NSInteger)capture; +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex range:(NSRange)range; +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range capture:(NSInteger)capture error:(NSError **)error; + + +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex; +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex range:(NSRange)range; +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error; + +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex; +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex range:(NSRange)range; +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error; + +@end + +@interface NSMutableString (RegexKitLiteAdditions) + +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement; +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement range:(NSRange)searchRange; +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement options:(RKLRegexOptions)options range:(NSRange)searchRange error:(NSError **)error; + +@end + +#endif // __OBJC__ + +#endif // _REGEXKITLITE_H_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/src/.svn/text-base/RegexKitLite.m.svn-base b/src/.svn/text-base/RegexKitLite.m.svn-base new file mode 100644 index 0000000..de1eca4 --- /dev/null +++ b/src/.svn/text-base/RegexKitLite.m.svn-base @@ -0,0 +1,1634 @@ +// +// RegexKitLite.m +// http://regexkit.sourceforge.net/ +// Licensed under the terms of the BSD License, as specified below. +// + +/* + Copyright (c) 2008-2009, John Engelhart + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the Zang Industries nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include +#include +#import +#import +#import +#import +#import +#import +#ifdef __OBJC_GC__ +#import +#define RKL_STRONG_REF __strong +#else // __OBJC_GC__ +#define RKL_STRONG_REF +#endif // __OBJC_GC__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#import "RegexKitLite.h" + +// If the gcc flag -mmacosx-version-min is used with, for example, '=10.2', give a warning that the libicucore.dylib is only available on >= 10.3. +// If you are reading this comment because of this warning, this is to let you know that linking to /usr/lib/libicucore.dylib will cause your executable to fail on < 10.3. +// You will need to build your own version of the ICU library and link to that in order for RegexKitLite to work successfully on < 10.3. This is not simple. + +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1030 +#warning The ICU dynamic shared library, /usr/lib/libicucore.dylib, is only available on Mac OS X 10.3 and later. +#warning You will need to supply a version of the ICU library to use RegexKitLite on Mac OS X 10.2 and earlier. +#endif + +//////////// +#pragma mark Compile time tuneables + +#ifndef RKL_CACHE_SIZE +#define RKL_CACHE_SIZE (23UL) +#endif + +#ifndef RKL_FIXED_LENGTH +#define RKL_FIXED_LENGTH (2048UL) +#endif + +#ifndef RKL_STACK_LIMIT +#define RKL_STACK_LIMIT (128UL * 1024UL) +#endif + +#ifdef RKL_APPEND_TO_ICU_FUNCTIONS +#define RKL_ICU_FUNCTION_APPEND(x) _RKL_CONCAT(x, RKL_APPEND_TO_ICU_FUNCTIONS) +#else // RKL_APPEND_TO_ICU_FUNCTIONS +#define RKL_ICU_FUNCTION_APPEND(x) x +#endif // RKL_APPEND_TO_ICU_FUNCTIONS + +#if defined(RKL_DTRACE) && (RKL_DTRACE != 0) +#define _RKL_DTRACE_ENABLED +#endif // defined(RKL_DTRACE) && (RKL_DTRACE != 0) + +// These are internal, non-public tuneables. +#define RKL_SCRATCH_BUFFERS (4UL) +#define RKL_CACHE_LINE_SIZE (64UL) +#define RKL_DTRACE_REGEXUTF8_SIZE (64UL) + +////////////// +#pragma mark - +#pragma mark GCC / Compiler macros + +#if defined (__GNUC__) && (__GNUC__ >= 4) +#define RKL_ATTRIBUTES(attr, ...) __attribute__((attr, ##__VA_ARGS__)) +#define RKL_EXPECTED(cond, expect) __builtin_expect((long)(cond), (expect)) +#define RKL_PREFETCH(ptr) __builtin_prefetch(ptr) +#define RKL_PREFETCH_UNICHAR(ptr, off) { const char *p = ((const char *)(ptr)) + ((off) * sizeof(UniChar)) + RKL_CACHE_LINE_SIZE; RKL_PREFETCH(p); RKL_PREFETCH(p + RKL_CACHE_LINE_SIZE); } +#define RKL_HAVE_CLEANUP +#define RKL_CLEANUP(func) __attribute__((cleanup(func))) +#else // defined (__GNUC__) && (__GNUC__ >= 4) +#define RKL_ATTRIBUTES(attr, ...) +#define RKL_EXPECTED(cond, expect) cond +#define RKL_PREFETCH(ptr) +#define RKL_PREFETCH_UNICHAR(ptr, off) +#define RKL_CLEANUP(func) +#endif // defined (__GNUC__) && (__GNUC__ >= 4) + +#define RKL_STATIC_INLINE static __inline__ RKL_ATTRIBUTES(always_inline) +#define RKL_UNUSED_ARG RKL_ATTRIBUTES(unused) +#define RKL_NONNULL_ARGS(arg, ...) RKL_ATTRIBUTES(nonnull(arg, ##__VA_ARGS__)) +#define RKL_NONNULL_ARGS_WARN_UNUSED(arg, ...) RKL_ATTRIBUTES(warn_unused_result, nonnull(arg, ##__VA_ARGS__)) + +#if defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) +#define RKL_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(as, nn, ...) RKL_ATTRIBUTES(warn_unused_result, nonnull(nn, ##__VA_ARGS__), alloc_size(as)) +#else // defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) +#define RKL_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(as, nn, ...) RKL_ATTRIBUTES(warn_unused_result, nonnull(nn, ##__VA_ARGS__)) +#endif // defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) + + +//////////// +#pragma mark - +#pragma mark Assertion macros + +// These macros are nearly identical to their NSCParameterAssert siblings. +// This is required because nearly everything is done while cacheSpinLock is locked. +// We need to safely unlock before throwing any of these exceptions. +// @try {} @finally {} significantly slows things down so it's not used. + +#define RKLCAssertDictionary(d, ...) rkl_makeAssertDictionary(__PRETTY_FUNCTION__, __FILE__, __LINE__, (d), ##__VA_ARGS__) +#define RKLCDelayedHardAssert(c, e, g) do { id *_e=(e); int _c=(c); if(RKL_EXPECTED(_e == NULL, 0L) || RKL_EXPECTED(*_e != NULL, 0L)) { goto g; } if(RKL_EXPECTED(!_c, 0L)) { *_e = RKLCAssertDictionary(@"Invalid parameter not satisfying: %s", #c); goto g; } } while(0) + +#ifdef NS_BLOCK_ASSERTIONS +#define RKLCDelayedAssert(c, e, g) +#define RKL_UNUSED_ASSERTION_ARG RKL_ATTRIBUTES(unused) +#else // NS_BLOCK_ASSERTIONS +#define RKLCDelayedAssert(c, e, g) RKLCDelayedHardAssert(c, e, g) +#define RKL_UNUSED_ASSERTION_ARG +#endif // NS_BLOCK_ASSERTIONS + +#define RKL_EXCEPTION(e, f, ...) [NSException exceptionWithName:(e) reason:rkl_stringFromClassAndMethod((self), (_cmd), (f), ##__VA_ARGS__) userInfo:NULL] +#define RKL_RAISE_EXCEPTION(e, f, ...) [RKL_EXCEPTION(e, f, ##__VA_ARGS__) raise] + +//////////// +#pragma mark - +#pragma mark Utility functions and macros + +RKL_STATIC_INLINE BOOL NSRangeInsideRange(NSRange cin, NSRange win) RKL_ATTRIBUTES(warn_unused_result); +RKL_STATIC_INLINE BOOL NSRangeInsideRange(NSRange cin, NSRange win) { return((((cin.location - win.location) <= win.length) && ((NSMaxRange(cin) - win.location) <= win.length)) ? YES : NO); } + +#define NSMakeRange(loc, len) ((NSRange){.location=(NSUInteger)(loc), .length=(NSUInteger)(len)}) +#define CFMakeRange(loc, len) ((CFRange){.location= (CFIndex)(loc), .length= (CFIndex)(len)}) +#define NSNotFoundRange ((NSRange){.location= NSNotFound, .length= 0UL}) +#define NSMaxiumRange ((NSRange){.location= 0UL, .length= NSUIntegerMax}) + +//////////// +#pragma mark - +#pragma mark Exported NSString symbols for exception names, error domains, error keys, etc + +NSString * const RKLICURegexException = @"RKLICURegexException"; + +NSString * const RKLICURegexErrorDomain = @"RKLICURegexErrorDomain"; + +NSString * const RKLICURegexErrorCodeErrorKey = @"RKLICURegexErrorCode"; +NSString * const RKLICURegexErrorNameErrorKey = @"RKLICURegexErrorName"; +NSString * const RKLICURegexLineErrorKey = @"RKLICURegexLine"; +NSString * const RKLICURegexOffsetErrorKey = @"RKLICURegexOffset"; +NSString * const RKLICURegexPreContextErrorKey = @"RKLICURegexPreContext"; +NSString * const RKLICURegexPostContextErrorKey = @"RKLICURegexPostContext"; +NSString * const RKLICURegexRegexErrorKey = @"RKLICURegexRegex"; +NSString * const RKLICURegexRegexOptionsErrorKey = @"RKLICURegexRegexOptions"; + +//////////// +#pragma mark - +#pragma mark Type / struct definitions + +// In general, the ICU bits and pieces here must exactly match the definition in the ICU sources. + +#define U_ZERO_ERROR 0 +#define U_INDEX_OUTOFBOUNDS_ERROR 8 +#define U_BUFFER_OVERFLOW_ERROR 15 + +#define U_PARSE_CONTEXT_LEN 16 + +typedef struct uregex uregex; // Opaque ICU regex type. + +typedef struct UParseError { // This must be exactly the same as the 'real' ICU declaration. + int32_t line; + int32_t offset; + UniChar preContext[U_PARSE_CONTEXT_LEN]; + UniChar postContext[U_PARSE_CONTEXT_LEN]; +} UParseError; + +// For use with GCC's cleanup() __attribute__. +#define RKLLockedCacheSpinLock ((NSUInteger)(1UL<<0)) +#define RKLUnlockedCacheSpinLock ((NSUInteger)(1UL<<1)) + +enum { + RKLSplitOp = 1, + RKLReplaceOp = 2, + RKLRangeOp = 3, + RKLArrayOfStringsOp = 4, + RKLArrayOfCapturesOp = 5, + RKLCapturesArrayOp = 6, + RKLMaskOp = 0xf, + RKLReplaceMutable = 1 << 4, + RKLSubcapturesArray = 1 << 5, +}; +typedef NSUInteger RKLRegexOp; + +typedef struct { + NSRange *ranges, findInRange; + NSInteger capacity, found, findUpTo, capture; + size_t size, stackUsed; + void **rangesScratchBuffer; + RKL_STRONG_REF void **stringsScratchBuffer; + RKL_STRONG_REF void **arraysScratchBuffer; +} RKLFindAll; + +typedef struct { + CFStringRef string; + CFHashCode hash; + CFIndex length; + RKL_STRONG_REF UniChar *uniChar; +} RKLBuffer; + +typedef struct { + CFStringRef regexString; + RKLRegexOptions options; + uregex *icu_regex; + NSInteger captureCount; + + CFStringRef setToString; + CFHashCode setToHash; + CFIndex setToLength; + NSUInteger setToIsImmutable:1; + NSUInteger setToNeedsConversion:1; + const UniChar *setToUniChar; + NSRange setToRange, lastFindRange, lastMatchRange; +#ifndef __LP64__ + NSUInteger pad[1]; // For 32 bits, this makes the struct 64 bytes exactly, which is good for cache line alignment. +#endif // __LP64__ +} RKLCacheSlot; + +//////////// +#pragma mark - +#pragma mark Translation unit scope global variables + +static UniChar fixedUniChar[(RKL_FIXED_LENGTH)]; // This is the fixed sized UTF-16 conversion buffer. +static RKLCacheSlot rkl_cacheSlots[(RKL_CACHE_SIZE)], *lastCacheSlot; +static OSSpinLock cacheSpinLock = OS_SPINLOCK_INIT; +static RKLBuffer dynamicBuffer, fixedBuffer = {NULL, 0UL, 0L, &fixedUniChar[0]}; +static const UniChar emptyUniCharString[1]; // For safety, icu_regexes are 'set' to this when the string they were searched is cleared. +static RKL_STRONG_REF void *scratchBuffer[(RKL_SCRATCH_BUFFERS)]; // Used to hold temporary allocations that are allocated via reallocf(). + +//////////// +#pragma mark - +#pragma mark CFArray call backs + +// These are used when running under manual memory management for the array that rkl_splitArray creates. +// The split strings are created, but not autoreleased. The (immutable) array is created using these callbacks, which skips the CFRetain() call, effectively transferring ownership to the CFArray object. +// For each split string this saves the overhead of an autorelease, then an array retain, then an NSAutoreleasePool release. This is good for a ~30% speed increase. + +static void RKLCFArrayRelease (CFAllocatorRef allocator RKL_UNUSED_ARG, const void *ptr) { CFRelease((CFTypeRef)ptr); } +static CFArrayCallBacks transferOwnershipArrayCallBacks = { (CFIndex)0L, NULL, RKLCFArrayRelease, CFCopyDescription, CFEqual }; + +#if defined(__OBJC_GC__) || defined(RKL_FORCE_GC) +//////////// +#pragma mark - +#pragma mark Low-level Garbage Collection aware memory/resource allocation utilities +// If compiled with Garbage Collection, we need to be able to do a few things slightly differently. +// The basic premiss is that under GC we use a trampoline function pointer which is set to a _start function to catch the first invocation. +// The _start function checks if GC is running and then overwrites the function pointer with the appropriate routine. Think of it as 'lazy linking'. + +enum { RKLScannedOption = NSScannedOption }; + +// rkl_collectingEnabled uses objc_getClass() to get the NSGarbageCollector class, which doesn't exist on earlier systems. +// This allows for graceful failure should we find ourselves running on an earlier version of the OS without NSGarbageCollector. +static BOOL rkl_collectingEnabled_first (void); +static BOOL rkl_collectingEnabled_yes (void) { return(YES); } +static BOOL rkl_collectingEnabled_no (void) { return(NO); } +static BOOL(*rkl_collectingEnabled) (void) = rkl_collectingEnabled_first; +static BOOL rkl_collectingEnabled_first (void) { + BOOL gcEnabled = ([objc_getClass("NSGarbageCollector") defaultCollector] != NULL) ? YES : NO; + if(gcEnabled == YES) { + // This section of code is required due to what I consider to be a fundamental design flaw in Cocoas GC system. + // Earlier versions of "Garbage Collection Programming Guide" stated that (paraphrased) "all globals are automatically roots". + // Current versions of the guide now include the following warning: + // "You may pass addresses of strong globals or statics into routines expecting pointers to object pointers (such as id* or NSError**) + // only if they have first been assigned to directly, rather than through a pointer dereference." + // This is a surprisingly non-trivial condition to actually meet in practice and is a recipe for impossible to debug race condition bugs. + // We just happen to be very, very, very lucky in the fact that we can initilize our root set before the first use. + int x; + for(x = 0; x < (int)(RKL_SCRATCH_BUFFERS); x++) { scratchBuffer[x] = NSAllocateCollectable(16UL, 0UL); scratchBuffer[x] = NULL; } + dynamicBuffer.uniChar = (RKL_STRONG_REF UniChar *)NSAllocateCollectable(16UL, 0UL); dynamicBuffer.uniChar = NULL; + } + return((rkl_collectingEnabled = (gcEnabled == YES) ? rkl_collectingEnabled_yes : rkl_collectingEnabled_no)()); +} + +// rkl_realloc() +static void *rkl_realloc_first (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags); +static void *rkl_realloc_std (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags RKL_UNUSED_ARG) { return((*ptr = reallocf(*ptr, size))); } +static void *rkl_realloc_gc (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags) { return((*ptr = NSReallocateCollectable(*ptr, (NSUInteger)size, flags))); } +static void *(*rkl_realloc) (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags) RKL_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(2,1) = rkl_realloc_first; +static void *rkl_realloc_first (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags) { return((rkl_realloc = (rkl_collectingEnabled()==YES) ? rkl_realloc_gc : rkl_realloc_std)(ptr, size, flags)); } + +// rkl_free() +static void * rkl_free_first (RKL_STRONG_REF void **ptr); +static void * rkl_free_std (RKL_STRONG_REF void **ptr) { if(*ptr != NULL) { free(*ptr); *ptr = NULL; } return(NULL); } +static void * rkl_free_gc (RKL_STRONG_REF void **ptr) { if(*ptr != NULL) { *ptr = NULL; } return(NULL); } +static void *(*rkl_free) (RKL_STRONG_REF void **ptr) RKL_NONNULL_ARGS(1) = rkl_free_first; +static void * rkl_free_first (RKL_STRONG_REF void **ptr) { return((rkl_free = (rkl_collectingEnabled()==YES) ? rkl_free_gc : rkl_free_std)(ptr)); } + +// rkl_CFAutorelease() +static id rkl_CFAutorelease_first (CFTypeRef obj); +static id rkl_CFAutorelease_std (CFTypeRef obj) { return([(id)obj autorelease]); } +static id rkl_CFAutorelease_gc (CFTypeRef obj) { return(NSMakeCollectable(obj)); } +static id(*rkl_CFAutorelease) (CFTypeRef obj) = rkl_CFAutorelease_first; +static id rkl_CFAutorelease_first (CFTypeRef obj) { return((rkl_CFAutorelease = (rkl_collectingEnabled()==YES) ? rkl_CFAutorelease_gc : rkl_CFAutorelease_std)(obj)); } + +// rkl_CreateStringWithSubstring() +static id rkl_CreateStringWithSubstring_first (id string, NSRange range); +static id rkl_CreateStringWithSubstring_std (id string, NSRange range) { return((id)CFStringCreateWithSubstring(NULL, (CFStringRef)string, CFMakeRange((CFIndex)range.location, (CFIndex)range.length))); } +static id rkl_CreateStringWithSubstring_gc (id string, NSRange range) { return([string substringWithRange:range]); } +static id(*rkl_CreateStringWithSubstring) (id string, NSRange range) RKL_NONNULL_ARGS_WARN_UNUSED(1) = rkl_CreateStringWithSubstring_first; +static id rkl_CreateStringWithSubstring_first (id string, NSRange range) { return((rkl_CreateStringWithSubstring = (rkl_collectingEnabled()==YES) ? rkl_CreateStringWithSubstring_gc : rkl_CreateStringWithSubstring_std)(string, range)); } + +// rkl_ReleaseObject() +static id rkl_ReleaseObject_first (id obj); +static id rkl_ReleaseObject_std (id obj) { CFRelease((CFTypeRef)obj); return(NULL); } +static id rkl_ReleaseObject_gc (id obj RKL_UNUSED_ARG) { return(NULL); } +static id (*rkl_ReleaseObject) (id obj) RKL_NONNULL_ARGS(1) = rkl_ReleaseObject_first; +static id rkl_ReleaseObject_first (id obj) { return((rkl_ReleaseObject = (rkl_collectingEnabled()==YES) ? rkl_ReleaseObject_gc : rkl_ReleaseObject_std)(obj)); } + +// rkl_CreateArrayWithObjects() +static id rkl_CreateArrayWithObjects_first (void **objects, NSUInteger count); +static id rkl_CreateArrayWithObjects_std (void **objects, NSUInteger count) { return((id)CFArrayCreate(NULL, (const void **)objects, (CFIndex)count, &transferOwnershipArrayCallBacks)); } +static id rkl_CreateArrayWithObjects_gc (void **objects, NSUInteger count) { return([NSArray arrayWithObjects:(const id *)objects count:count]); } +static id(*rkl_CreateArrayWithObjects) (void **objects, NSUInteger count) RKL_NONNULL_ARGS_WARN_UNUSED(1) = rkl_CreateArrayWithObjects_first; +static id rkl_CreateArrayWithObjects_first (void **objects, NSUInteger count) { return((rkl_CreateArrayWithObjects = (rkl_collectingEnabled()==YES) ? rkl_CreateArrayWithObjects_gc : rkl_CreateArrayWithObjects_std)(objects, count)); } + +// rkl_CreateAutoreleasedArray() +static id rkl_CreateAutoreleasedArray_first (void **objects, NSUInteger count); +static id rkl_CreateAutoreleasedArray_std (void **objects, NSUInteger count) { return((id)rkl_CFAutorelease(rkl_CreateArrayWithObjects(objects, count))); } +static id rkl_CreateAutoreleasedArray_gc (void **objects, NSUInteger count) { return(rkl_CreateArrayWithObjects(objects, count)); } +static id(*rkl_CreateAutoreleasedArray) (void **objects, NSUInteger count) RKL_NONNULL_ARGS_WARN_UNUSED(1) = rkl_CreateAutoreleasedArray_first; +static id rkl_CreateAutoreleasedArray_first (void **objects, NSUInteger count) { return((rkl_CreateAutoreleasedArray = (rkl_collectingEnabled()==YES) ? rkl_CreateAutoreleasedArray_gc : rkl_CreateAutoreleasedArray_std)(objects, count)); } + +#else // __OBJC_GC__ not defined +//////////// +#pragma mark - +#pragma mark Low-level explicit memory/resource allocation utilities + +enum { RKLScannedOption = 0 }; + +#define rkl_collectingEnabled() (NO) + +RKL_STATIC_INLINE void *rkl_realloc (void **ptr, size_t size, NSUInteger flags) RKL_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(2,1); +RKL_STATIC_INLINE void *rkl_free (void **ptr) RKL_NONNULL_ARGS(1); +RKL_STATIC_INLINE id rkl_CFAutorelease (CFTypeRef obj); +RKL_STATIC_INLINE id rkl_CreateAutoreleasedArray (void **objects, NSUInteger count) RKL_NONNULL_ARGS_WARN_UNUSED(1); +RKL_STATIC_INLINE id rkl_CreateArrayWithObjects (void **objects, NSUInteger count) RKL_NONNULL_ARGS_WARN_UNUSED(1); +RKL_STATIC_INLINE id rkl_CreateStringWithSubstring (id string, NSRange range) RKL_NONNULL_ARGS_WARN_UNUSED(1); +RKL_STATIC_INLINE id rkl_ReleaseObject (id obj) RKL_NONNULL_ARGS(1); + +RKL_STATIC_INLINE void *rkl_realloc (void **ptr, size_t size, NSUInteger flags RKL_UNUSED_ARG) { return((*ptr = reallocf(*ptr, size))); } +RKL_STATIC_INLINE void *rkl_free (void **ptr) { if(*ptr != NULL) { free(*ptr); *ptr = NULL; } return(NULL); } +RKL_STATIC_INLINE id rkl_CFAutorelease (CFTypeRef obj) { return([(id)obj autorelease]); } +RKL_STATIC_INLINE id rkl_CreateArrayWithObjects (void **objects, NSUInteger count) { return((id)CFArrayCreate(NULL, (const void **)objects, (CFIndex)count, &transferOwnershipArrayCallBacks)); } +RKL_STATIC_INLINE id rkl_CreateAutoreleasedArray (void **objects, NSUInteger count) { return(rkl_CFAutorelease(rkl_CreateArrayWithObjects(objects, count))); } +RKL_STATIC_INLINE id rkl_CreateStringWithSubstring (id string, NSRange range) { return((id)CFStringCreateWithSubstring(NULL, (CFStringRef)string, CFMakeRange((CFIndex)range.location, (CFIndex)[range length]))); } +RKL_STATIC_INLINE id rkl_ReleaseObject (id obj) { CFRelease((CFTypeRef)obj); return(NULL); } + +#endif // __OBJC_GC__ + +//////////// +#pragma mark - +#pragma mark ICU function prototypes + +// ICU functions. See http://www.icu-project.org/apiref/icu4c/uregex_8h.html Tweaked slightly from the originals, but functionally identical. +const char *RKL_ICU_FUNCTION_APPEND(u_errorName) (int32_t status) RKL_ATTRIBUTES(pure); +int32_t RKL_ICU_FUNCTION_APPEND(u_strlen) (const UniChar *s) RKL_ATTRIBUTES(nonnull(1), pure); +int32_t RKL_ICU_FUNCTION_APPEND(uregex_appendReplacement) (uregex *regexp, const UniChar *replacementText, int32_t replacementLength, UniChar **destBuf, int32_t *destCapacity, int32_t *status) RKL_NONNULL_ARGS(1,2,4,5,6); +int32_t RKL_ICU_FUNCTION_APPEND(uregex_appendTail) (uregex *regexp, UniChar **destBuf, int32_t *destCapacity, int32_t *status) RKL_NONNULL_ARGS(1,2,3,4); +void RKL_ICU_FUNCTION_APPEND(uregex_close) (uregex *regexp) RKL_NONNULL_ARGS(1); +int32_t RKL_ICU_FUNCTION_APPEND(uregex_end) (uregex *regexp, int32_t groupNum, int32_t *status) RKL_NONNULL_ARGS(1,3); +BOOL RKL_ICU_FUNCTION_APPEND(uregex_find) (uregex *regexp, int32_t location, int32_t *status) RKL_NONNULL_ARGS(1,3); +BOOL RKL_ICU_FUNCTION_APPEND(uregex_findNext) (uregex *regexp, int32_t *status) RKL_NONNULL_ARGS(1,2); +int32_t RKL_ICU_FUNCTION_APPEND(uregex_groupCount) (uregex *regexp, int32_t *status) RKL_NONNULL_ARGS(1,2); +uregex *RKL_ICU_FUNCTION_APPEND(uregex_open) (const UniChar *pattern, int32_t patternLength, RKLRegexOptions flags, UParseError *parseError, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,4,5); +void RKL_ICU_FUNCTION_APPEND(uregex_reset) (uregex *regexp, int32_t newIndex, int32_t *status) RKL_NONNULL_ARGS(1,3); +void RKL_ICU_FUNCTION_APPEND(uregex_setText) (uregex *regexp, const UniChar *text, int32_t textLength, int32_t *status) RKL_NONNULL_ARGS(1,2,4); +int32_t RKL_ICU_FUNCTION_APPEND(uregex_start) (uregex *regexp, int32_t groupNum, int32_t *status) RKL_NONNULL_ARGS(1,3); + +//////////// +#pragma mark - +#pragma mark RegexKitLite internal, private function prototypes + +static RKLCacheSlot *rkl_getCachedRegex (NSString *regexString, RKLRegexOptions options, NSError **error, id *exception) RKL_NONNULL_ARGS_WARN_UNUSED(1,4); +static NSUInteger rkl_setCacheSlotToString (RKLCacheSlot *cacheSlot, const NSRange *range, int32_t *status, id *exception RKL_UNUSED_ASSERTION_ARG) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,3,4); +static RKLCacheSlot *rkl_getCachedRegexSetToString (NSString *regexString, RKLRegexOptions options, NSString *matchString, NSUInteger *matchLengthPtr, NSRange *matchRange, NSError **error, id *exception, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,3,4,5,7,8); +static id rkl_performRegexOp (id self, SEL _cmd, RKLRegexOp regexOp, NSString *regexString, RKLRegexOptions options, NSInteger capture, id matchString, NSRange *matchRange, NSString *replacementString, NSError **error, void *result) RKL_NONNULL_ARGS(1,2); +static void rkl_handleDelayedAssert (id self, SEL _cmd, id exception) RKL_NONNULL_ARGS(1,2,3); + +static NSUInteger rkl_search (RKLCacheSlot *cacheSlot, NSRange *searchRange, NSUInteger updateSearchRange, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4,5); + +static BOOL rkl_findRanges (RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindAll *findAll, id *exception, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,3,4,5); +static NSUInteger rkl_growFindRanges (RKLCacheSlot *cacheSlot, NSUInteger lastLocation, RKLFindAll *findAll, id *exception RKL_UNUSED_ASSERTION_ARG) RKL_NONNULL_ARGS_WARN_UNUSED(1,3,4); +static NSArray *rkl_makeArray (RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindAll *findAll, id *exception RKL_UNUSED_ASSERTION_ARG) RKL_NONNULL_ARGS_WARN_UNUSED(1,3,4); + +static NSString *rkl_replaceString (RKLCacheSlot *cacheSlot, id searchString, NSUInteger searchU16Length, NSString *replacementString, NSUInteger replacementU16Length, NSUInteger *replacedCount, NSUInteger replaceMutable, id *exception, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4,8,9); +static int32_t rkl_replaceAll (RKLCacheSlot *cacheSlot, const UniChar *replacementUniChar, int32_t replacementU16Length, UniChar *replacedUniChar, int32_t replacedU16Capacity, NSUInteger *replacedCount, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4,7,8); + +static NSUInteger rkl_isRegexValid (id self, SEL _cmd, NSString *regex, RKLRegexOptions options, NSInteger *captureCountPtr, NSError **error) RKL_NONNULL_ARGS(1,2); + +static void rkl_clearStringCache (void); +static void rkl_clearBuffer (RKLBuffer *buffer, NSUInteger freeDynamicBuffer) RKL_NONNULL_ARGS(1); +static void rkl_clearCacheSlotRegex (RKLCacheSlot *cacheSlot) RKL_NONNULL_ARGS(1); +static void rkl_clearCacheSlotSetTo (RKLCacheSlot *cacheSlot) RKL_NONNULL_ARGS(1); + +static NSDictionary *rkl_userInfoDictionary (NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status, ...) RKL_ATTRIBUTES(sentinel, nonnull(1), warn_unused_result); +static NSError *rkl_NSErrorForRegex (NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status) RKL_NONNULL_ARGS_WARN_UNUSED(1); +static NSException *rkl_NSExceptionForRegex (NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status) RKL_NONNULL_ARGS_WARN_UNUSED(1); +static NSDictionary *rkl_makeAssertDictionary (const char *function, const char *file, int line, NSString *format, ...) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4); +static NSString *rkl_stringFromClassAndMethod (id object, SEL selector, NSString *format, ...) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,3); + +RKL_STATIC_INLINE int32_t rkl_getRangeForCapture(RKLCacheSlot *cs, int32_t *s, int32_t c, NSRange *r) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4); +RKL_STATIC_INLINE int32_t rkl_getRangeForCapture(RKLCacheSlot *cs, int32_t *s, int32_t c, NSRange *r) { uregex *re = cs->icu_regex; int32_t start = RKL_ICU_FUNCTION_APPEND(uregex_start)(re, c, s); if(RKL_EXPECTED((*s > U_ZERO_ERROR), 0L) || (start == -1)) { *r = NSNotFoundRange; } else { r->location = (NSUInteger)start; r->length = (NSUInteger)RKL_ICU_FUNCTION_APPEND(uregex_end)(re, c, s) - r->location; r->location += cs->setToRange.location; } return(*s); } + +RKL_STATIC_INLINE RKLFindAll rkl_makeFindAll(NSRange *r, NSRange fir, NSInteger c, size_t s, size_t su, void **rsb, RKL_STRONG_REF void **ssb, RKL_STRONG_REF void **asb, NSInteger f, NSInteger cap, NSInteger fut) RKL_ATTRIBUTES(warn_unused_result); +RKL_STATIC_INLINE RKLFindAll rkl_makeFindAll(NSRange *r, NSRange fir, NSInteger c, size_t s, size_t su, void **rsb, RKL_STRONG_REF void **ssb, RKL_STRONG_REF void **asb, NSInteger f, NSInteger cap, NSInteger fut) { return(((RKLFindAll){ .ranges=r, .findInRange=fir, .capacity=c, .found=f, .findUpTo=fut, .capture=cap, .size=s, .stackUsed=su, .rangesScratchBuffer=rsb, .stringsScratchBuffer=ssb, .arraysScratchBuffer=asb})); } + +//////////// +#pragma mark - +#pragma mark RKL_FAST_MUTABLE_CHECK implementation + +#ifdef RKL_FAST_MUTABLE_CHECK +// We use a trampoline function pointer to check at run time if the function __CFStringIsMutable is available. +// If it is, the trampoline function pointer is replaced with the address of that function. +// Otherwise, we assume the worst case that every string is mutable. +// This hopefully helps to protect us since we're using an undocumented, non-public API call. +// We will keep on working if it ever does go away, just with a bit less performance due to the overhead of mutable checks. + +static BOOL rkl_CFStringIsMutable_first (CFStringRef str); +static BOOL rkl_CFStringIsMutable_yes (CFStringRef str RKL_UNUSED_ARG) { return(YES); } +static BOOL(*rkl_CFStringIsMutable) (CFStringRef str) = rkl_CFStringIsMutable_first; +static BOOL rkl_CFStringIsMutable_first (CFStringRef str) { if((rkl_CFStringIsMutable = (BOOL(*)(CFStringRef))dlsym(RTLD_DEFAULT, "__CFStringIsMutable")) == NULL) { rkl_CFStringIsMutable = rkl_CFStringIsMutable_yes; } return(rkl_CFStringIsMutable(str)); } +#else // RKL_FAST_MUTABLE_CHECK is not defined. Assume that all strings are potentially mutable. +#define rkl_CFStringIsMutable(s) (YES) +#endif // RKL_FAST_MUTABLE_CHECK + + +//////////// +#pragma mark - +#pragma mark iPhone / iPod touch low memory notification handler + +#if defined(RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS) && (RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS == 1) + +// The next few lines are specifically for the iPhone to catch low memory conditions. +// The basic idea is that rkl_RegisterForLowMemoryNotifications() is set to be run once by the linker at load time via __attribute((constructor)). +// rkl_RegisterForLowMemoryNotifications() tries to find the iPhone low memory notification symbol. If it can find it, +// it registers with the default NSNotificationCenter to call the RKLLowMemoryWarningObserver class method +lowMemoryWarning:. +// rkl_RegisterForLowMemoryNotifications() uses an atomic compare and swap to guarantee that it initalizes exactly once. +// +lowMemoryWarning tries to acquire the cache lock. If it gets the lock, it clears the cache. If it can't, it calls performSelector: +// with a delay of half a second to try again. This will hopefully prevent any deadlocks, such as a RegexKitLite request for +// memory triggering a notifcation while the lock is held. + +static void rkl_RegisterForLowMemoryNotifications(void) RKL_ATTRIBUTES(used); + +@interface RKLLowMemoryWarningObserver : NSObject +(void)lowMemoryWarning:(id)notification; @end +@implementation RKLLowMemoryWarningObserver ++(void)lowMemoryWarning:(id)notification { + if(OSSpinLockTry(&cacheSpinLock)) { rkl_clearStringCache(); OSSpinLockUnlock(&cacheSpinLock); } + else { [[RKLLowMemoryWarningObserver class] performSelector:@selector(lowMemoryWarning:) withObject:NULL afterDelay:(NSTimeInterval)0.1]; } +} +@end + +static int rkl_HaveRegisteredForLowMemoryNotifications = 0; + +__attribute__((constructor)) static void rkl_RegisterForLowMemoryNotifications(void) { + void **memoryWarningNotification = NULL; + + if(OSAtomicCompareAndSwapIntBarrier(0, 1, &rkl_HaveRegisteredForLowMemoryNotifications)) { + if((memoryWarningNotification = (void **)dlsym(RTLD_DEFAULT, "UIApplicationDidReceiveMemoryWarningNotification")) != NULL) { + [[NSNotificationCenter defaultCenter] addObserver:[RKLLowMemoryWarningObserver class] selector:@selector(lowMemoryWarning:) name:(NSString *)*memoryWarningNotification object:NULL]; + } + } +} + +#endif // defined(RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS) && (RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS == 1) + +#ifdef _RKL_DTRACE_ENABLED + +// compiledRegexCache(unsigned long eventID, const char *regexUTF8, int options, int captures, int hitMiss, int icuStatusCode, const char *icuErrorMessage, double *hitRate); +// utf16ConversionCache(unsigned long eventID, unsigned int lookupResultFlags, double *hitRate, const void *string, unsigned long NSRange.location, unsigned long [NSRange length], long length); + +/* +provider RegexKitLite { + probe compiledRegexCache(unsigned long, const char *, unsigned int, int, int, int, const char *, double *); + probe utf16ConversionCache(unsigned long, unsigned int, double *, const void *, unsigned long, unsigned long, long); +}; + +#pragma D attributes Unstable/Unstable/Common provider RegexKitLite provider +#pragma D attributes Private/Private/Common provider RegexKitLite module +#pragma D attributes Private/Private/Common provider RegexKitLite function +#pragma D attributes Unstable/Unstable/Common provider RegexKitLite name +#pragma D attributes Unstable/Unstable/Common provider RegexKitLite args +*/ + +#define REGEXKITLITE_STABILITY "___dtrace_stability$RegexKitLite$v1$4_4_5_1_1_5_1_1_5_4_4_5_4_4_5" +#define REGEXKITLITE_TYPEDEFS "___dtrace_typedefs$RegexKitLite$v1" +#define REGEXKITLITE_COMPILEDREGEXCACHE(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { __asm__ volatile(".reference " REGEXKITLITE_TYPEDEFS); __dtrace_probe$RegexKitLite$compiledRegexCache$v1$756e7369676e6564206c6f6e67$63686172202a$756e7369676e656420696e74$696e74$696e74$696e74$63686172202a$646f75626c65202a(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); __asm__ volatile(".reference " REGEXKITLITE_STABILITY); } +#define REGEXKITLITE_COMPILEDREGEXCACHE_ENABLED() __dtrace_isenabled$RegexKitLite$compiledRegexCache$v1() +#define REGEXKITLITE_CONVERTEDSTRINGU16CACHE(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { __asm__ volatile(".reference " REGEXKITLITE_TYPEDEFS); __dtrace_probe$RegexKitLite$utf16ConversionCache$v1$756e7369676e6564206c6f6e67$756e7369676e656420696e74$646f75626c65202a$766f6964202a$756e7369676e6564206c6f6e67$756e7369676e6564206c6f6e67$6c6f6e67(arg0, arg1, arg2, arg3, arg4, arg5, arg6); __asm__ volatile(".reference " REGEXKITLITE_STABILITY); } +#define REGEXKITLITE_CONVERTEDSTRINGU16CACHE_ENABLED() __dtrace_isenabled$RegexKitLite$utf16ConversionCache$v1() + +extern void __dtrace_probe$RegexKitLite$compiledRegexCache$v1$756e7369676e6564206c6f6e67$63686172202a$756e7369676e656420696e74$696e74$696e74$696e74$63686172202a$646f75626c65202a(unsigned long, const char *, unsigned int, int, int, int, const char *, double *); +extern int __dtrace_isenabled$RegexKitLite$compiledRegexCache$v1(void); +extern void __dtrace_probe$RegexKitLite$utf16ConversionCache$v1$756e7369676e6564206c6f6e67$756e7369676e656420696e74$646f75626c65202a$766f6964202a$756e7369676e6564206c6f6e67$756e7369676e6564206c6f6e67$6c6f6e67(unsigned long, unsigned int, double *, const void *, unsigned long, unsigned long, long); +extern int __dtrace_isenabled$RegexKitLite$utf16ConversionCache$v1(void); + +//////////////////////////// + +enum { + RKLCacheHitLookupFlag = 1 << 0, + RKLConversionRequiredLookupFlag = 1 << 1, + RKLSetTextLookupFlag = 1 << 2, + RKLDynamicBufferLookupFlag = 1 << 3, + RKLErrorLookupFlag = 1 << 4, +}; + +#define rkl_dtrace_addLookupFlag(a,b) do { a |= (unsigned int)(b); } while(0) + +static char rkl_dtrace_regexUTF8[(RKL_CACHE_SIZE) + 1][(RKL_DTRACE_REGEXUTF8_SIZE)]; +static NSUInteger rkl_dtrace_eventID, rkl_dtrace_compiledCacheLookups, rkl_dtrace_compiledCacheHits, rkl_dtrace_conversionBufferLookups, rkl_dtrace_conversionBufferHits; + +#define rkl_dtrace_incrementEventID() do { rkl_dtrace_eventID++; } while(0) +#define rkl_dtrace_compiledRegexCache(a0, a1, a2, a3, a4, a5) do { int _a3 = (a3); rkl_dtrace_compiledCacheLookups++; if(_a3 == 1) { rkl_dtrace_compiledCacheHits++; } if(RKL_EXPECTED(REGEXKITLITE_COMPILEDREGEXCACHE_ENABLED(), 0L)) { double hitRate = 0.0; if(rkl_dtrace_compiledCacheLookups > 0UL) { hitRate = ((double)rkl_dtrace_compiledCacheHits / (double)rkl_dtrace_compiledCacheLookups) * 100.0; } REGEXKITLITE_COMPILEDREGEXCACHE(rkl_dtrace_eventID, a0, a1, a2, _a3, a4, a5, &hitRate); } } while(0) +#define rkl_dtrace_utf16ConversionCache(a0, a1, a2, a3, a4) do { unsigned int _a0 = (a0); if((_a0 & RKLConversionRequiredLookupFlag) != 0U) { rkl_dtrace_conversionBufferLookups++; if((_a0 & RKLCacheHitLookupFlag) != 0U) { rkl_dtrace_conversionBufferHits++; } } if(RKL_EXPECTED(REGEXKITLITE_CONVERTEDSTRINGU16CACHE_ENABLED(), 0L)) { double hitRate = 0.0; if(rkl_dtrace_conversionBufferLookups > 0UL) { hitRate = ((double)rkl_dtrace_conversionBufferHits / (double)rkl_dtrace_conversionBufferLookups) * 100.0; } REGEXKITLITE_CONVERTEDSTRINGU16CACHE(rkl_dtrace_eventID, _a0, &hitRate, a1, a2, a3, a4); } } while(0) + + +// \342\200\246 == UTF8 for HORIZONTAL ELLIPSIS, aka triple dots '...' +#define RKL_UTF8_ELLIPSE "\342\200\246" + +// rkl_dtrace_getRegexUTF8 will copy the str argument to utf8Buffer using UTF8 as the string encoding. +// If the utf8 encoding would take up more bytes than the utf8Buffers length, then the unicode character 'HORIZONTAL ELLIPSIS' ('...') is appened to indicate truncation occured. +static void rkl_dtrace_getRegexUTF8(CFStringRef str, char *utf8Buffer) RKL_NONNULL_ARGS(2); +static void rkl_dtrace_getRegexUTF8(CFStringRef str, char *utf8Buffer) { + if((str == NULL) || (utf8Buffer == NULL)) { return; } + CFIndex maxLength = ((CFIndex)(RKL_DTRACE_REGEXUTF8_SIZE) - 2L), maxBytes = (maxLength - (CFIndex)sizeof(RKL_UTF8_ELLIPSE) - 1L), stringU16Length = CFStringGetLength(str), usedBytes = 0L; + CFStringGetBytes(str, CFMakeRange(0L, ((stringU16Length < maxLength) ? stringU16Length : maxLength)), kCFStringEncodingUTF8, (UInt8)'?', (Boolean)0, (UInt8 *)utf8Buffer, maxBytes, &usedBytes); + if(usedBytes == maxBytes) { strncpy(utf8Buffer + usedBytes, RKL_UTF8_ELLIPSE, ((size_t)(RKL_DTRACE_REGEXUTF8_SIZE) - (size_t)usedBytes) - 2UL); } else { utf8Buffer[usedBytes] = (char)0; } +} + +#else // _RKL_DTRACE_ENABLED + +#define rkl_dtrace_incrementEventID() +#define rkl_dtrace_compiledRegexCache(a0, a1, a2, a3, a4, a5) +#define rkl_dtrace_utf16ConversionCache(a0, a1, a2, a3, a4) +#define rkl_dtrace_getRegexUTF8(str, buf) +#define rkl_dtrace_addLookupFlag(a,b) + +#endif // _RKL_DTRACE_ENABLED + +//////////// +#pragma mark - +#pragma mark RegexKitLite low-level internal functions + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called with cacheSpinLock already locked! +// ---------- + +static RKLCacheSlot *rkl_getCachedRegex(NSString *regexString, RKLRegexOptions options, NSError **error, id *exception) { + RKLCacheSlot *cacheSlot = NULL; + CFHashCode regexHash = 0UL; + int32_t status = 0; + + RKLCDelayedAssert((cacheSpinLock != 0) && (regexString != NULL), exception, exitNow); + + // Fast path the common case where this regex is exactly the same one used last time. + // The pointer equality test is valid under these circumstances since the cacheSlot->regexString is an immutable copy. + // If the regexString argument is mutable, this test will fail, and we'll use the the slow path cache check below. + if(RKL_EXPECTED(lastCacheSlot != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->options == options, 1L) && RKL_EXPECTED(lastCacheSlot->icu_regex != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->regexString != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->regexString == (CFStringRef)regexString, 1L)) { + rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(lastCacheSlot - &rkl_cacheSlots[0])][0], lastCacheSlot->options, (int)lastCacheSlot->captureCount, 1, 0, NULL); + return(lastCacheSlot); + } + + lastCacheSlot = NULL; + regexHash = CFHash((CFTypeRef)regexString); + cacheSlot = &rkl_cacheSlots[(regexHash % (CFHashCode)(RKL_CACHE_SIZE))]; // Retrieve the cache slot for this regex. + + // Return the cached entry if it's a match, otherwise clear the slot and create a new ICU regex in its place. + // If regexString is mutable, the pointer equality test will fail, and CFEqual() is used to determine true + // equality with the immutable cacheSlot copy. CFEqual() performs a slow character by character check. + if(RKL_EXPECTED(cacheSlot->options == options, 1L) && RKL_EXPECTED(cacheSlot->icu_regex != NULL, 1L) && RKL_EXPECTED(cacheSlot->regexString != NULL, 1L) && (RKL_EXPECTED(cacheSlot->regexString == (CFStringRef)regexString, 1L) || RKL_EXPECTED(CFEqual((CFTypeRef)regexString, (CFTypeRef)cacheSlot->regexString) == YES, 1L))) { + lastCacheSlot = cacheSlot; + rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(lastCacheSlot - &rkl_cacheSlots[0])][0], lastCacheSlot->options, (int)lastCacheSlot->captureCount, 1, 0, NULL); + return(cacheSlot); + } + + rkl_clearCacheSlotRegex(cacheSlot); + + if(RKL_EXPECTED((cacheSlot->regexString = CFStringCreateCopy(NULL, (CFStringRef)regexString)) == NULL, 0L)) { goto exitNow; } ; // Get a cheap immutable copy. + rkl_dtrace_getRegexUTF8(cacheSlot->regexString, &rkl_dtrace_regexUTF8[(cacheSlot - &rkl_cacheSlots[0])][0]); + cacheSlot->options = options; + + CFIndex regexStringU16Length = CFStringGetLength(cacheSlot->regexString); // In UTF16 code units. + UParseError parseError = (UParseError){-1, -1, {0}, {0}}; + const UniChar *regexUniChar = NULL; + + if(RKL_EXPECTED(regexStringU16Length >= (CFIndex)INT_MAX, 0L)) { *exception = [NSException exceptionWithName:NSRangeException reason:@"Regex string length exceeds INT_MAX" userInfo:NULL]; goto exitNow; } + + // Try to quickly obtain regexString in UTF16 format. + if((regexUniChar = CFStringGetCharactersPtr(cacheSlot->regexString)) == NULL) { // We didn't get the UTF16 pointer quickly and need to perform a full conversion in a temp buffer. + UniChar *uniCharBuffer = NULL; + if(((size_t)regexStringU16Length * sizeof(UniChar)) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((uniCharBuffer = (UniChar *)alloca( (size_t)regexStringU16Length * sizeof(UniChar) )) == NULL, 0L)) { goto exitNow; } } // Try to use the stack. + else { if(RKL_EXPECTED((uniCharBuffer = (UniChar *)rkl_realloc(&scratchBuffer[0], (size_t)regexStringU16Length * sizeof(UniChar), 0UL)) == NULL, 0L)) { goto exitNow; } } // Otherwise use the heap. + CFStringGetCharacters(cacheSlot->regexString, CFMakeRange(0L, regexStringU16Length), uniCharBuffer); // Convert regexString to UTF16. + regexUniChar = uniCharBuffer; + } + + // Create the ICU regex. + if(RKL_EXPECTED((cacheSlot->icu_regex = RKL_ICU_FUNCTION_APPEND(uregex_open)(regexUniChar, (int32_t)regexStringU16Length, options, &parseError, &status)) == NULL, 0L)) { goto exitNow; } + if(RKL_EXPECTED(status <= U_ZERO_ERROR, 1L)) { cacheSlot->captureCount = (NSInteger)RKL_ICU_FUNCTION_APPEND(uregex_groupCount)(cacheSlot->icu_regex, &status); } + if(RKL_EXPECTED(status <= U_ZERO_ERROR, 1L)) { lastCacheSlot = cacheSlot; } + +exitNow: + if(RKL_EXPECTED(scratchBuffer[0] != NULL, 0L)) { scratchBuffer[0] = rkl_free(&scratchBuffer[0]); } + if(RKL_EXPECTED(status > U_ZERO_ERROR, 0L)) { rkl_clearCacheSlotRegex(cacheSlot); cacheSlot = NULL; if(error != NULL) { *error = rkl_NSErrorForRegex(regexString, options, &parseError, status); } } + +#ifdef _RKL_DTRACE_ENABLED + if(RKL_EXPECTED(cacheSlot != NULL, 1L)) { rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(cacheSlot - &rkl_cacheSlots[0])][0], cacheSlot->options, (int)cacheSlot->captureCount, 0, status, NULL); } + else { char regexUTF8[(RKL_DTRACE_REGEXUTF8_SIZE)]; const char *err = NULL; if(status != U_ZERO_ERROR) { err = RKL_ICU_FUNCTION_APPEND(u_errorName)(status); } rkl_dtrace_getRegexUTF8((CFStringRef)regexString, regexUTF8); rkl_dtrace_compiledRegexCache(regexUTF8, options, -1, -1, status, err); } +#endif // _RKL_DTRACE_ENABLED + + return(cacheSlot); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called with cacheSpinLock already locked! +// ---------- + +static NSUInteger rkl_setCacheSlotToString(RKLCacheSlot *cacheSlot, const NSRange *range, int32_t *status, id *exception RKL_UNUSED_ASSERTION_ARG) { + RKLCDelayedAssert((cacheSlot != NULL) && (cacheSlot->setToString != NULL) && ((range != NULL) && (NSEqualRanges(*range, NSNotFoundRange) == NO)) && (status != NULL), exception, exitNow); + const UniChar *stringUniChar = NULL; +#ifdef _RKL_DTRACE_ENABLED + unsigned int lookupResultFlags = 0U; +#endif + + if(cacheSlot->setToNeedsConversion == 0U) { + if(RKL_EXPECTED((stringUniChar = CFStringGetCharactersPtr(cacheSlot->setToString)) == NULL, 0L)) { cacheSlot->setToNeedsConversion = 1U; } + else { if(RKL_EXPECTED(cacheSlot->setToUniChar != stringUniChar, 0L)) { cacheSlot->setToRange = NSNotFoundRange; cacheSlot->setToUniChar = stringUniChar; } goto setRegexText; } + } + rkl_dtrace_addLookupFlag(lookupResultFlags, RKLConversionRequiredLookupFlag); + + NSUInteger useFixedBuffer = (cacheSlot->setToLength < (CFIndex)(RKL_FIXED_LENGTH)) ? 1UL : 0UL; + RKLBuffer *buffer = useFixedBuffer ? &fixedBuffer : &dynamicBuffer; + rkl_dtrace_addLookupFlag(lookupResultFlags, (useFixedBuffer ? 0U : RKLDynamicBufferLookupFlag)); + + if((cacheSlot->setToUniChar != NULL) && ((cacheSlot->setToString == buffer->string) || ((cacheSlot->setToLength == buffer->length) && (cacheSlot->setToHash == buffer->hash)))) { rkl_dtrace_addLookupFlag(lookupResultFlags, RKLCacheHitLookupFlag); goto setRegexText; } + + if(RKL_EXPECTED((stringUniChar = CFStringGetCharactersPtr(cacheSlot->setToString)) != NULL, 0L)) { cacheSlot->setToNeedsConversion = 0U; cacheSlot->setToRange = NSNotFoundRange; cacheSlot->setToUniChar = stringUniChar; goto setRegexText; } + + rkl_clearBuffer(buffer, 0UL); + + if(useFixedBuffer == 0U) { + RKLCDelayedAssert(buffer == &dynamicBuffer, exception, exitNow); + RKL_STRONG_REF void *p = (RKL_STRONG_REF void *)dynamicBuffer.uniChar; + if(RKL_EXPECTED((dynamicBuffer.uniChar = (RKL_STRONG_REF UniChar *)rkl_realloc(&p, ((size_t)cacheSlot->setToLength * sizeof(UniChar)), 0UL)) == NULL, 0L)) { goto exitNow; } // Resize the buffer. + } + + RKLCDelayedAssert(buffer->uniChar != NULL, exception, exitNow); + CFStringGetCharacters(cacheSlot->setToString, CFMakeRange(0L, cacheSlot->setToLength), (UniChar *)buffer->uniChar); // Convert to a UTF16 string. + + RKLCDelayedAssert(buffer->string == NULL, exception, exitNow); + if(RKL_EXPECTED((buffer->string = (CFStringRef)CFRetain((CFTypeRef)cacheSlot->setToString)) == NULL, 0L)) { goto exitNow; } + buffer->hash = cacheSlot->setToHash; + buffer->length = cacheSlot->setToLength; + + cacheSlot->setToUniChar = buffer->uniChar; + cacheSlot->setToRange = NSNotFoundRange; + +setRegexText: + if(NSEqualRanges(cacheSlot->setToRange, *range) == NO) { + RKLCDelayedAssert((cacheSlot->icu_regex != NULL) && (cacheSlot->setToUniChar != NULL) && (NSMaxRange(*range) <= (NSUInteger)cacheSlot->setToLength) && (cacheSlot->setToRange.length <= INT_MAX), exception, exitNow); + cacheSlot->lastFindRange = cacheSlot->lastMatchRange = NSNotFoundRange; + cacheSlot->setToRange = *range; + RKL_ICU_FUNCTION_APPEND(uregex_setText)(cacheSlot->icu_regex, cacheSlot->setToUniChar + cacheSlot->setToRange.location, (int32_t)cacheSlot->setToRange.length, status); + rkl_dtrace_addLookupFlag(lookupResultFlags, RKLSetTextLookupFlag); + if(RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto exitNow; } + } + + rkl_dtrace_utf16ConversionCache(lookupResultFlags, cacheSlot->setToString, cacheSlot->setToRange.location, cacheSlot->setToRange.length, cacheSlot->setToLength); + return(1UL); + +exitNow: + return(0UL); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called with cacheSpinLock already locked! +// ---------- + +static RKLCacheSlot *rkl_getCachedRegexSetToString(NSString *regexString, RKLRegexOptions options, NSString *matchString, NSUInteger *matchLengthPtr, NSRange *matchRange, NSError **error, id *exception, int32_t *status) { + RKLCacheSlot *cacheSlot = NULL; + RKLCDelayedAssert((regexString != NULL) && (exception != NULL) && (status != NULL) && (matchLengthPtr != NULL), exception, exitNow); + + // Fast path the common case where this regex is exactly the same one used last time. + if(RKL_EXPECTED(lastCacheSlot != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->icu_regex != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->regexString == (CFStringRef)regexString, 1L) && RKL_EXPECTED(lastCacheSlot->options == options, 1L)) { cacheSlot = lastCacheSlot; rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(cacheSlot - &rkl_cacheSlots[0])][0], cacheSlot->options, (int)cacheSlot->captureCount, 1, 0, NULL); } + else { lastCacheSlot = NULL; if(RKL_EXPECTED((cacheSlot = rkl_getCachedRegex(regexString, options, error, exception)) == NULL, 0L)) { goto exitNow; } } + RKLCDelayedAssert((cacheSlot != NULL) && (cacheSlot->icu_regex != NULL) && (cacheSlot->regexString != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot == lastCacheSlot), exception, exitNow); + + // Optimize the case where the string to search (matchString) is immutable and the setToString immutable copy is the same string with its reference count incremented. + NSUInteger isSetTo = ((cacheSlot->setToString != NULL) && (cacheSlot->setToString == (CFStringRef)matchString)) ? 1UL : 0UL; + CFIndex matchLength = ((isSetTo == 1UL) && (cacheSlot->setToIsImmutable == 1U)) ? cacheSlot->setToLength : CFStringGetLength((CFStringRef)matchString); + + *matchLengthPtr = (NSUInteger)matchLength; + if(matchRange->length == NSUIntegerMax) { matchRange->length = (NSUInteger)matchLength; } // For convenience, allow NSUIntegerMax == string length. + + if(RKL_EXPECTED((NSUInteger)matchLength < NSMaxRange(*matchRange), 0L)) { goto exitNow; } // The match range is out of bounds for the string. performRegexOp will catch and report the problem. + + if((cacheSlot->setToIsImmutable == 0U) && (cacheSlot->setToString != NULL) && ((cacheSlot->setToLength != CFStringGetLength(cacheSlot->setToString)) || (cacheSlot->setToHash != CFHash((CFTypeRef)cacheSlot->setToString)))) { isSetTo = 0UL; } + else { // If the first pointer equality check failed, check the hash and length. + if(((isSetTo == 0UL) || (cacheSlot->setToIsImmutable == 0U)) && (cacheSlot->setToString != NULL)) { isSetTo = ((cacheSlot->setToLength == matchLength) && (cacheSlot->setToHash == CFHash((CFTypeRef)matchString))) ? 1UL : 0UL; } + + if(isSetTo == 1UL) { if(RKL_EXPECTED(rkl_setCacheSlotToString(cacheSlot, matchRange, status, exception) == 0UL, 0L)) { cacheSlot = NULL; if(*exception == NULL) { *exception = (id)RKLCAssertDictionary(@"Failed to set up UTF16 buffer."); } } goto exitNow; } + } + + // Sometimes the range that the regex is set to isn't right, in which case we don't want to clear the cache slot. Otherwise, flush it out. + if((cacheSlot->setToString != NULL) && (isSetTo == 0UL)) { rkl_clearCacheSlotSetTo(cacheSlot); } + + if(cacheSlot->setToString == NULL) { + cacheSlot->setToString = (CFStringRef)CFRetain((CFTypeRef)matchString); + RKLCDelayedAssert(cacheSlot->setToString != NULL, exception, exitNow); + cacheSlot->setToUniChar = CFStringGetCharactersPtr(cacheSlot->setToString); + cacheSlot->setToNeedsConversion = (cacheSlot->setToUniChar == NULL) ? 1U : 0U; + cacheSlot->setToIsImmutable = (rkl_CFStringIsMutable(cacheSlot->setToString) == YES) ? 0U : 1U; // If RKL_FAST_MUTABLE_CHECK is not defined then setToIsImmutable will always be set to '0', or in other words mutable.. + cacheSlot->setToHash = CFHash((CFTypeRef)cacheSlot->setToString); + cacheSlot->setToRange = NSNotFoundRange; + cacheSlot->setToLength = matchLength; + } + + if(RKL_EXPECTED(rkl_setCacheSlotToString(cacheSlot, matchRange, status, exception) == 0UL, 0L)) { cacheSlot = NULL; if(*exception == NULL) { *exception = (id)RKLCAssertDictionary(@"Failed to set up UTF16 buffer."); } goto exitNow; } + +exitNow: + return(cacheSlot); +} + +#ifdef RKL_HAVE_CLEANUP + +// rkl_cleanup_cacheSpinLockStatus takes advantage of GCC's 'cleanup' variable attribute. When an 'auto' variable with the 'cleanup' attribute goes out of scope, +// GCC arranges to have the designated function called. In this case, we make sure that if rkl_cacheSpinLock was locked that it was also unlocked. +// If rkl_cacheSpinLock was locked, but the cacheSpinLockStatus unlocked flag was not set, we force cacheSpinLock unlocked with a call to OSSpinLockUnlock. +// This is not a panacea for preventing mutex usage errors. Old style ObjC exceptions will bypass the cleanup call, but newer C++ style ObjC exceptions should cause the cleanup function to be called during the stack unwind. + +// We do not depend on this cleanup function being called. It is used only as an extra safety net. It is probably a bug in RegexKitLite if it is ever invoked and forced to take some kind of protective action. + +volatile NSUInteger rkl_debugCacheSpinLockCount = 0UL; + +void rkl_debugCacheSpinLock (void) RKL_ATTRIBUTES(used, noinline, visibility("default")); +static void rkl_cleanup_cacheSpinLockStatus (volatile NSUInteger *cacheSpinLockStatusPtr) RKL_ATTRIBUTES(used); + +void rkl_debugCacheSpinLock(void) { + rkl_debugCacheSpinLockCount++; // This is here primarily to prevent the optimizer from optimizing away the function. +} + +static void rkl_cleanup_cacheSpinLockStatus(volatile NSUInteger *cacheSpinLockStatusPtr) { + static NSUInteger didPrintForcedUnlockWarning = 0UL, didPrintNotLockedWarning = 0UL; + NSUInteger cacheSpinLockStatus = *cacheSpinLockStatusPtr; + + if(RKL_EXPECTED((cacheSpinLockStatus & RKLUnlockedCacheSpinLock) == 0UL, 0L) && RKL_EXPECTED((cacheSpinLockStatus & RKLLockedCacheSpinLock) != 0UL, 1L)) { + if(cacheSpinLock != 0) { + if(didPrintForcedUnlockWarning == 0UL) { didPrintForcedUnlockWarning = 1UL; NSLog(@"[RegexKitLite] Unusual condition detected: Recorded that cacheSpinLock was locked, but for some reason it was not unlocked. Forcibly unlocking cacheSpinLock. Set a breakpoint at rkl_debugCacheSpinLock to debug. This warning is only printed once."); } + rkl_debugCacheSpinLock(); // Since this is an unusual condition, offer an attempt to catch it before we unlock. + OSSpinLockUnlock(&cacheSpinLock); + } else { + if(didPrintNotLockedWarning == 0UL) { didPrintNotLockedWarning = 1UL; NSLog(@"[RegexKitLite] Unusual condition detected: Recorded that cacheSpinLock was locked, but for some reason it was not unlocked, yet cacheSpinLock is currently not locked? Set a breakpoint at rkl_debugCacheSpinLock to debug. This warning is only printed once."); } + rkl_debugCacheSpinLock(); + } + } +} + +#endif // RKL_HAVE_CLEANUP + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// ---------- + +static id rkl_performRegexOp(id self, SEL _cmd, RKLRegexOp regexOp, NSString *regexString, RKLRegexOptions options, NSInteger capture, id matchString, NSRange *matchRange, NSString *replacementString, NSError **error, void *result) { + volatile NSUInteger RKL_CLEANUP(rkl_cleanup_cacheSpinLockStatus) cacheSpinLockStatus = 0UL; + + NSUInteger replaceMutable = 0UL; + RKLRegexOp maskedRegexOp = (regexOp & RKLMaskOp); + + if((error != NULL) && (*error != NULL)) { *error = NULL; } + + if(RKL_EXPECTED(regexString == NULL, 0L)) { RKL_RAISE_EXCEPTION(NSInvalidArgumentException, @"The regular expression argument is NULL."); } + if(RKL_EXPECTED(matchString == NULL, 0L)) { RKL_RAISE_EXCEPTION(NSInternalInconsistencyException, @"The match string argument is NULL."); } + if((maskedRegexOp == RKLReplaceOp) && (replacementString == NULL)) { RKL_RAISE_EXCEPTION(NSInvalidArgumentException, @"The replacement string argument is NULL."); } + + id resultObject = NULL, exception = NULL; + int32_t status = U_ZERO_ERROR; + RKLCacheSlot *cacheSlot = NULL; + NSUInteger stringU16Length = 0UL; + NSRange stackRanges[2048]; + RKLFindAll findAll; + + + // IMPORTANT! Once we have obtained the lock, code MUST exit via 'goto exitNow;' to unlock the lock! NO EXCEPTIONS! + // ---------- + OSSpinLockLock(&cacheSpinLock); // Grab the lock and get cache entry. + cacheSpinLockStatus |= RKLLockedCacheSpinLock; + rkl_dtrace_incrementEventID(); + + if(RKL_EXPECTED((cacheSlot = rkl_getCachedRegexSetToString(regexString, options, matchString, &stringU16Length, matchRange, error, &exception, &status)) == NULL, 0L)) { stringU16Length = (NSUInteger)CFStringGetLength((CFStringRef)matchString); } + if(RKL_EXPECTED(matchRange->length == NSUIntegerMax, 1L)) { matchRange->length = stringU16Length; } // For convenience. + if(RKL_EXPECTED(stringU16Length < NSMaxRange(*matchRange), 0L) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSRangeException, @"Range or index out of bounds"); goto exitNow; } + if(RKL_EXPECTED(stringU16Length >= (NSUInteger)INT_MAX, 0L) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSRangeException, @"String length exceeds INT_MAX"); goto exitNow; } + if(((maskedRegexOp == RKLRangeOp) || (maskedRegexOp == RKLArrayOfStringsOp)) && RKL_EXPECTED(cacheSlot != NULL, 1L) && (RKL_EXPECTED(capture < 0L, 0L) || RKL_EXPECTED(capture > cacheSlot->captureCount, 0L)) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSInvalidArgumentException, @"The capture argument is not valid."); goto exitNow; } + if(RKL_EXPECTED(cacheSlot == NULL, 0L) || RKL_EXPECTED(status > U_ZERO_ERROR, 0L) || RKL_EXPECTED(exception != NULL, 0L)) { goto exitNow; } + + RKLCDelayedAssert((cacheSlot != NULL) && (cacheSlot->icu_regex != NULL) && (cacheSlot->regexString != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot->setToString != NULL) && (cacheSlot->setToLength >= 0L) && (cacheSlot->setToUniChar != NULL) && ((CFIndex)NSMaxRange(cacheSlot->setToRange) <= cacheSlot->setToLength), &exception, exitNow); + +#ifndef NS_BLOCK_ASSERTIONS + if(cacheSlot->setToNeedsConversion == 0U) { RKLCDelayedAssert((cacheSlot->setToUniChar == CFStringGetCharactersPtr(cacheSlot->setToString)), &exception, exitNow); } + else { + RKLBuffer *buffer = (cacheSlot->setToLength < (CFIndex)(RKL_FIXED_LENGTH)) ? &fixedBuffer : &dynamicBuffer; + RKLCDelayedAssert((cacheSlot->setToHash == buffer->hash) && (cacheSlot->setToLength == buffer->length) && (cacheSlot->setToUniChar == buffer->uniChar), &exception, exitNow); + } +#endif + + switch(maskedRegexOp) { + case RKLRangeOp: + if((rkl_search(cacheSlot, matchRange, 0UL, &exception, &status) == NO) || (RKL_EXPECTED(status > U_ZERO_ERROR, 0L))) { *(NSRange *)result = NSNotFoundRange; goto exitNow; } + if(RKL_EXPECTED(capture == 0L, 1L)) { *(NSRange *)result = cacheSlot->lastMatchRange; } else { if(RKL_EXPECTED(rkl_getRangeForCapture(cacheSlot, &status, (int32_t)capture, (NSRange *)result) > U_ZERO_ERROR, 0L)) { goto exitNow; } } + break; + + case RKLSplitOp: // Fall-thru... + case RKLArrayOfStringsOp: // Fall-thru... + case RKLCapturesArrayOp: // Fall-thru... + case RKLArrayOfCapturesOp: + findAll = rkl_makeFindAll(stackRanges, *matchRange, 2048L, (2048UL * sizeof(NSRange)), 0UL, (void **)&scratchBuffer[0], &scratchBuffer[1], &scratchBuffer[2], 0L, capture, ((maskedRegexOp == RKLCapturesArrayOp) ? 1L : NSIntegerMax)); + + if(RKL_EXPECTED(rkl_findRanges(cacheSlot, regexOp, &findAll, &exception, &status) == NO, 1L)) { + if(RKL_EXPECTED(findAll.found == 0L, 0L)) { resultObject = [NSArray array]; } else { resultObject = rkl_makeArray(cacheSlot, regexOp, &findAll, &exception); } + } + + if(RKL_EXPECTED(scratchBuffer[0] != NULL, 0L)) { scratchBuffer[0] = rkl_free(&scratchBuffer[0]); } + if(RKL_EXPECTED(scratchBuffer[1] != NULL, 0L)) { scratchBuffer[1] = rkl_free(&scratchBuffer[1]); } + if(RKL_EXPECTED(scratchBuffer[2] != NULL, 0L)) { scratchBuffer[2] = rkl_free(&scratchBuffer[2]); } + + break; + + case RKLReplaceOp: resultObject = rkl_replaceString(cacheSlot, matchString, stringU16Length, replacementString, (NSUInteger)CFStringGetLength((CFStringRef)replacementString), (NSUInteger *)result, (replaceMutable = (((regexOp & RKLReplaceMutable) != 0) ? 1UL : 0UL)), &exception, &status); break; + default: exception = RKLCAssertDictionary(@"Unknown regexOp code."); break; + } + +exitNow: + OSSpinLockUnlock(&cacheSpinLock); + cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; + + if(RKL_EXPECTED(status > U_ZERO_ERROR, 0L) && RKL_EXPECTED(exception == NULL, 0L)) { exception = rkl_NSExceptionForRegex(regexString, options, NULL, status); } // If we had a problem, prepare an exception to be thrown. + if(RKL_EXPECTED(exception != NULL, 0L)) { rkl_handleDelayedAssert(self, _cmd, exception); } // If there is an exception, throw it at this point. + // If we're working on a mutable string and there were successful matches/replacements, then we still have work to do. + // This is done outside the cache lock and with the objc replaceCharactersInRange:withString: method because Core Foundation + // does not assert that the string we are attempting to update is actually a mutable string, whereas Foundation ensures + // the object receiving the message is a mutable string and throws an exception if we're attempting to modify an immutable string. + if(RKL_EXPECTED(replaceMutable == 1UL, 0L) && RKL_EXPECTED(*((NSUInteger *)result) > 0UL, 1L)) { NSCParameterAssert(resultObject != NULL); [matchString replaceCharactersInRange:*matchRange withString:resultObject]; } + + return(resultObject); +} + +static void rkl_handleDelayedAssert(id self, SEL _cmd, id exception) { + if(RKL_EXPECTED(exception != NULL, 0L)) { + if([exception isKindOfClass:[NSException class]]) { [[NSException exceptionWithName:[exception name] reason:rkl_stringFromClassAndMethod(self, _cmd, [exception reason]) userInfo:[exception userInfo]] raise]; } + else { + id functionString = [exception objectForKey:@"function"], fileString = [exception objectForKey:@"file"], descriptionString = [exception objectForKey:@"description"], lineNumber = [exception objectForKey:@"line"]; + NSCParameterAssert((functionString != NULL) && (fileString != NULL) && (descriptionString != NULL) && (lineNumber != NULL)); + [[NSAssertionHandler currentHandler] handleFailureInFunction:functionString file:fileString lineNumber:(NSInteger)[lineNumber longValue] description:descriptionString]; + } + } +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called from rkl_performRegexOp() or rkl_findRanges(). +// ---------- + +static NSUInteger rkl_search(RKLCacheSlot *cacheSlot, NSRange *searchRange, NSUInteger updateSearchRange, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) { + NSUInteger foundMatch = 0UL, searchEqualsEndOfRange = (RKL_EXPECTED(NSEqualRanges(*searchRange, NSMakeRange(NSMaxRange(cacheSlot->setToRange), 0UL)) == YES, 0L) ? 1UL : 0UL); + + if((NSEqualRanges(*searchRange, cacheSlot->lastFindRange) == YES) || (searchEqualsEndOfRange == 1UL)) { foundMatch = (((cacheSlot->lastMatchRange.location == NSNotFound) || (searchEqualsEndOfRange == 1UL)) ? 0UL : 1UL);} + else { // Only perform an expensive 'find' operation iff the current find range is different than the last find range. + NSUInteger findLocation = (searchRange->location - cacheSlot->setToRange.location); + RKLCDelayedAssert(((searchRange->location >= cacheSlot->setToRange.location)) && (NSRangeInsideRange(*searchRange, cacheSlot->setToRange) == YES) && (findLocation < INT_MAX) && (findLocation <= cacheSlot->setToRange.length), exception, exitNow); + + RKL_PREFETCH_UNICHAR(cacheSlot->setToUniChar, searchRange->location); // Spool up the CPU caches. + + // Using uregex_findNext can be a slight performance win. + NSUInteger useFindNext = ((searchRange->location == (NSMaxRange(cacheSlot->lastMatchRange) + (((cacheSlot->lastMatchRange.length == 0UL) && (cacheSlot->lastMatchRange.location < NSMaxRange(cacheSlot->setToRange))) ? 1UL : 0UL))) ? 1UL : 0UL); + + cacheSlot->lastFindRange = *searchRange; + if(RKL_EXPECTED(useFindNext == 0UL, 0L)) { if(RKL_EXPECTED((RKL_ICU_FUNCTION_APPEND(uregex_find) (cacheSlot->icu_regex, (int32_t)findLocation, status) == NO), 0L) || RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto finishedFind; } } + else { if(RKL_EXPECTED((RKL_ICU_FUNCTION_APPEND(uregex_findNext)(cacheSlot->icu_regex, status) == NO), 0L) || RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto finishedFind; } } + foundMatch = 1UL; + + if(RKL_EXPECTED(rkl_getRangeForCapture(cacheSlot, status, 0, &cacheSlot->lastMatchRange) > U_ZERO_ERROR, 0L)) { goto finishedFind; } + RKLCDelayedAssert(NSRangeInsideRange(cacheSlot->lastMatchRange, *searchRange) == YES, exception, exitNow); + } + +finishedFind: + if(RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { foundMatch = 0UL; cacheSlot->lastFindRange = NSNotFoundRange; } + + if(foundMatch == 0UL) { cacheSlot->lastMatchRange = NSNotFoundRange; if(updateSearchRange == 1UL) { *searchRange = NSMakeRange(NSMaxRange(*searchRange), 0UL); } } + else { + RKLCDelayedAssert(NSRangeInsideRange(cacheSlot->lastMatchRange, *searchRange) == YES, exception, exitNow); + if(updateSearchRange == 1UL) { + NSUInteger nextLocation = (NSMaxRange(cacheSlot->lastMatchRange) + (((cacheSlot->lastMatchRange.length == 0UL) && (cacheSlot->lastMatchRange.location < NSMaxRange(cacheSlot->setToRange))) ? 1UL : 0UL)), locationDiff = nextLocation - searchRange->location; + RKLCDelayedAssert((((locationDiff > 0UL) || ((locationDiff == 0UL) && (cacheSlot->lastMatchRange.location == NSMaxRange(cacheSlot->setToRange)))) && (locationDiff <= searchRange->length)), exception, exitNow); + searchRange->location = nextLocation; + searchRange->length -= locationDiff; + } + } + +#ifndef NS_BLOCK_ASSERTIONS +exitNow: +#endif + return(foundMatch); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called from rkl_doFindOp(). +// ---------- + +static BOOL rkl_findRanges(RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindAll *findAll, id *exception, int32_t *status) { + BOOL returnWithError = YES; + RKLCDelayedAssert((((cacheSlot != NULL) && (cacheSlot->icu_regex != NULL) && (cacheSlot->setToUniChar != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot->setToRange.location != NSNotFound)) && (status != NULL) && ((findAll != NULL) && (findAll->found == 0L) && ((findAll->capacity >= 0L) && (((findAll->capacity > 0L) || (findAll->size > 0UL)) ? ((findAll->ranges != NULL) && (findAll->capacity > 0L) && (findAll->size > 0UL)) : 1)) && (findAll->rangesScratchBuffer != NULL) && ((findAll->capture >= 0L) && (findAll->capture <= cacheSlot->captureCount)))), exception, exitNow); + + if(RKL_EXPECTED(cacheSlot->setToLength == 0L, 0L) || RKL_EXPECTED(cacheSlot->setToRange.length == 0UL, 0L)) { returnWithError = NO; goto exitNow; } + + NSInteger captureCount = cacheSlot->captureCount; + RKLRegexOp maskedRegexOp = (regexOp & RKLMaskOp); + NSUInteger lastLocation = findAll->findInRange.location; + NSRange searchRange = findAll->findInRange; + + for(findAll->found = 0L; (findAll->found < findAll->findUpTo) && ((findAll->found < findAll->capacity) || (findAll->found == 0L)); findAll->found++) { + NSInteger loopCapture, shouldBreak = 0L; + + if(RKL_EXPECTED(findAll->found >= ((findAll->capacity - ((captureCount + 2L) * 4L)) - 4L), 0L)) { if(RKL_EXPECTED(rkl_growFindRanges(cacheSlot, lastLocation, findAll, exception) == 0UL, 0L)) { goto exitNow; } } + + RKLCDelayedAssert((searchRange.location != NSNotFound) && (NSRangeInsideRange(searchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(findAll->findInRange, cacheSlot->setToRange) == YES), exception, exitNow); + + // This fixes a 'bug' that is also present in ICU's uregex_split(). 'Bug', in this case, means that the results of a split operation can differ from those that perl's split() creates for the same input. + // "I|at|ice I eat rice" split using the regex "\b\s*" demonstrates the problem. ICU bug http://bugs.icu-project.org/trac/ticket/6826 + // ICU : "", "I", "|", "at", "|", "ice", "", "I", "", "eat", "", "rice" <- Results that RegexKitLite used to produce. + // PERL: "I", "|", "at", "|", "ice", "I", "eat", "rice" <- Results that RegexKitLite now produces. + do { if((rkl_search(cacheSlot, &searchRange, 1UL, exception, status) == NO) || (RKL_EXPECTED(*status > U_ZERO_ERROR, 0L))) { shouldBreak = 1L; } } + while((maskedRegexOp == RKLSplitOp) && RKL_EXPECTED(shouldBreak == 0L, 1L) && RKL_EXPECTED(cacheSlot->lastMatchRange.length == 0UL, 0L) && RKL_EXPECTED((cacheSlot->lastMatchRange.location - lastLocation) == 0UL, 0L)); + if(RKL_EXPECTED(shouldBreak == 1L, 0L)) { break; } + + RKLCDelayedAssert((searchRange.location != NSNotFound) && (NSRangeInsideRange(searchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(findAll->findInRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(searchRange, findAll->findInRange) == YES), exception, exitNow); + RKLCDelayedAssert((NSRangeInsideRange(cacheSlot->lastFindRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(cacheSlot->lastMatchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(cacheSlot->lastMatchRange, findAll->findInRange) == YES), exception, exitNow); + RKLCDelayedAssert((findAll->ranges != NULL) && (findAll->found >= 0L) && (findAll->capacity >= 0L) && ((findAll->found + (captureCount + 3L) + 1L) < (findAll->capacity - 2L)), exception, exitNow); + + switch(maskedRegexOp) { + case RKLArrayOfStringsOp: + if(findAll->capture == 0L) { findAll->ranges[findAll->found] = cacheSlot->lastMatchRange; } else { if(RKL_EXPECTED(rkl_getRangeForCapture(cacheSlot, status, (int32_t)findAll->capture, &findAll->ranges[findAll->found]) > U_ZERO_ERROR, 0L)) { goto exitNow; } } + break; + + case RKLSplitOp: // Fall-thru... + case RKLCapturesArrayOp: // Fall-thru... + case RKLArrayOfCapturesOp: + findAll->ranges[findAll->found] = ((maskedRegexOp == RKLSplitOp) ? NSMakeRange(lastLocation, cacheSlot->lastMatchRange.location - lastLocation) : cacheSlot->lastMatchRange); + + for(loopCapture = 1L; loopCapture <= captureCount; loopCapture++) { + RKLCDelayedAssert((findAll->found >= 0L) && (findAll->found < (findAll->capacity - 2L)) && (loopCapture < INT_MAX), exception, exitNow); + if(RKL_EXPECTED(rkl_getRangeForCapture(cacheSlot, status, (int32_t)loopCapture, &findAll->ranges[++findAll->found]) > U_ZERO_ERROR, 0L)) { goto exitNow; } + } + break; + + default: if(*exception != NULL) { *exception = RKLCAssertDictionary(@"Unknown regexOp."); } goto exitNow; break; + } + + lastLocation = NSMaxRange(cacheSlot->lastMatchRange); + } + + if(RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto exitNow; } + + RKLCDelayedAssert((findAll->ranges != NULL) && (findAll->found >= 0L) && (findAll->found < (findAll->capacity - 2L)), exception, exitNow); + if((maskedRegexOp == RKLSplitOp) && (lastLocation != NSMaxRange(findAll->findInRange))) { findAll->ranges[findAll->found++] = NSMakeRange(lastLocation, NSMaxRange(findAll->findInRange) - lastLocation); } + + RKLCDelayedAssert((findAll->ranges != NULL) && (findAll->found >= 0L) && (findAll->found < (findAll->capacity - 2L)), exception, exitNow); + returnWithError = NO; + +exitNow: + return(returnWithError); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called from rkl_findRanges(). +// ---------- + +static NSUInteger rkl_growFindRanges(RKLCacheSlot *cacheSlot, NSUInteger lastLocation, RKLFindAll *findAll, id *exception RKL_UNUSED_ASSERTION_ARG) { + NSUInteger didGrowRanges = 0UL; + RKLCDelayedAssert((((cacheSlot != NULL) && (cacheSlot->captureCount >= 0L)) && ((findAll != NULL) && (findAll->capacity >= 0L) && (findAll->rangesScratchBuffer != NULL) && (findAll->found >= 0L) && (((findAll->capacity > 0L) || (findAll->size > 0UL) || (findAll->ranges != NULL)) ? ((findAll->capacity > 0L) && (findAll->size > 0UL) && (findAll->ranges != NULL) && (((size_t)findAll->capacity * sizeof(NSRange)) == findAll->size)) : 1))), exception, exitNow); + + // Attempt to guesstimate the required capacity based on: the total length needed to search / (length we've searched so far / ranges found so far). + NSInteger newCapacity = (findAll->capacity + (findAll->capacity / 2L)), estimate = (NSInteger)((float)cacheSlot->setToLength / (((float)lastLocation + 1.0f) / ((float)findAll->found + 1.0f))); + newCapacity = (((newCapacity + ((estimate > newCapacity) ? estimate : newCapacity)) / 2L) + ((cacheSlot->captureCount + 2L) * 4L) + 4L); + + NSUInteger needToCopy = ((findAll->ranges != NULL) && (*findAll->rangesScratchBuffer != findAll->ranges)) ? 1UL : 0UL; // If findAll->ranges is set to a stack allocation then we need to manually copy the data from the stack to the new heap allocation. + size_t newSize = ((size_t)newCapacity * sizeof(NSRange)); + NSRange *newRanges = NULL; + + if(RKL_EXPECTED((newRanges = (NSRange *)rkl_realloc((RKL_STRONG_REF void **)findAll->rangesScratchBuffer, newSize, 0UL)) == NULL, 0L)) { findAll->capacity = 0L; findAll->size = 0UL; findAll->ranges = NULL; *findAll->rangesScratchBuffer = rkl_free((RKL_STRONG_REF void **)findAll->rangesScratchBuffer); goto exitNow; } else { didGrowRanges = 1UL; } + if(needToCopy == 1UL) { memcpy(newRanges, findAll->ranges, findAll->size); } // If necessary, copy the existing data to the new heap allocation. + + findAll->capacity = newCapacity; + findAll->size = newSize; + findAll->ranges = newRanges; + +exitNow: + return(didGrowRanges); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called from rkl_doFindOp(). +// ---------- + +static NSArray *rkl_makeArray(RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindAll *findAll, id *exception RKL_UNUSED_ASSERTION_ARG) { + NSUInteger createdStringsCount = 0UL, createdArraysCount = 0UL, transferedStringsCount = 0UL; + id *matchedStrings = NULL, *subcaptureArrays = NULL, emptyString = @""; + NSArray *resultArray = NULL; + + RKLCDelayedAssert((cacheSlot != NULL) && ((findAll != NULL) && (findAll->found >= 0L) && (findAll->stringsScratchBuffer != NULL) && (findAll->arraysScratchBuffer != NULL)), exception, exitNow); + + size_t matchedStringsSize = ((size_t)findAll->found * sizeof(id)); + CFStringRef setToString = cacheSlot->setToString; + + if((findAll->stackUsed + matchedStringsSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((matchedStrings = (id *)alloca(matchedStringsSize)) == NULL, 0L)) { goto exitNow; } findAll->stackUsed += matchedStringsSize; } + else { if(RKL_EXPECTED((matchedStrings = (id *)rkl_realloc(findAll->stringsScratchBuffer, matchedStringsSize, (NSUInteger)RKLScannedOption)) == NULL, 0L)) { goto exitNow; } } + + { // This sub-block (and its local variables) is here for the benefit of the optimizer. + NSUInteger found = (NSUInteger)findAll->found; + const NSRange *rangePtr = findAll->ranges; + id *matchedStringsPtr = matchedStrings; + + for(createdStringsCount = 0UL; createdStringsCount < found; createdStringsCount++) { + NSRange range = *rangePtr++; + if(RKL_EXPECTED(((*matchedStringsPtr++ = RKL_EXPECTED(range.length == 0UL, 0L) ? emptyString : rkl_CreateStringWithSubstring((id)setToString, range)) == NULL), 0L)) { goto exitNow; } + } + } + + NSUInteger arrayCount = createdStringsCount; + id *arrayObjects = matchedStrings; + + if((regexOp & RKLSubcapturesArray) != 0UL) { + RKLCDelayedAssert(((createdStringsCount % ((NSUInteger)cacheSlot->captureCount + 1UL)) == 0UL) && (createdArraysCount == 0UL), exception, exitNow); + + NSUInteger captureCount = ((NSUInteger)cacheSlot->captureCount + 1UL); + NSUInteger subcaptureArraysCount = (createdStringsCount / captureCount); + size_t subcaptureArraysSize = ((size_t)subcaptureArraysCount * sizeof(id)); + + if((findAll->stackUsed + subcaptureArraysSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((subcaptureArrays = (id *)alloca(subcaptureArraysSize)) == NULL, 0L)) { goto exitNow; } findAll->stackUsed += subcaptureArraysSize; } + else { if(RKL_EXPECTED((subcaptureArrays = (id *)rkl_realloc(findAll->arraysScratchBuffer, subcaptureArraysSize, (NSUInteger)RKLScannedOption)) == NULL, 0L)) { goto exitNow; } } + + { // This sub-block (and its local variables) is here for the benefit of the optimizer. + id *subcaptureArraysPtr = subcaptureArrays; + id *matchedStringsPtr = matchedStrings; + + for(createdArraysCount = 0UL; createdArraysCount < subcaptureArraysCount; createdArraysCount++) { + if(RKL_EXPECTED((*subcaptureArraysPtr++ = rkl_CreateArrayWithObjects((void **)matchedStringsPtr, captureCount)) == NULL, 0L)) { goto exitNow; } + matchedStringsPtr += captureCount; + transferedStringsCount += captureCount; + } + } + + RKLCDelayedAssert((transferedStringsCount == createdStringsCount), exception, exitNow); + arrayCount = createdArraysCount; + arrayObjects = subcaptureArrays; + } + + RKLCDelayedAssert((arrayObjects != NULL), exception, exitNow); + resultArray = rkl_CreateAutoreleasedArray((void **)arrayObjects, (NSUInteger)arrayCount); + +exitNow: + if(RKL_EXPECTED(resultArray == NULL, 0L) && (rkl_collectingEnabled() == NO)) { // If we did not create an array then we need to make sure that we release any objects we created. + NSUInteger x; + if(matchedStrings != NULL) { for(x = transferedStringsCount; x < createdStringsCount; x++) { if((matchedStrings[x] != NULL) && (matchedStrings[x] != emptyString)) { matchedStrings[x] = rkl_ReleaseObject(matchedStrings[x]); } } } + if(subcaptureArrays != NULL) { for(x = 0UL; x < createdArraysCount; x++) { if(subcaptureArrays[x] != NULL) { subcaptureArrays[x] = rkl_ReleaseObject(subcaptureArrays[x]); } } } + } + + return(resultArray); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called from rkl_performRegexOp(). +// ---------- + +static NSString *rkl_replaceString(RKLCacheSlot *cacheSlot, id searchString, NSUInteger searchU16Length, NSString *replacementString, NSUInteger replacementU16Length, NSUInteger *replacedCountPtr, NSUInteger replaceMutable, id *exception, int32_t *status) { + uint64_t searchU16Length64 = (uint64_t)searchU16Length, replacementU16Length64 = (uint64_t)replacementU16Length; + int32_t resultU16Length = 0, tempUniCharBufferU16Capacity = 0; + UniChar *tempUniCharBuffer = NULL; + const UniChar *replacementUniChar = NULL; + id resultObject = NULL; + NSUInteger replacedCount = 0UL; + + if((RKL_EXPECTED(replacementU16Length64 >= (uint64_t)INT_MAX, 0L) || RKL_EXPECTED(((searchU16Length64 / 2ULL) + (replacementU16Length64 * 2ULL)) >= (uint64_t)INT_MAX, 0L))) { *exception = [NSException exceptionWithName:NSRangeException reason:@"Replacement string length exceeds INT_MAX" userInfo:NULL]; goto exitNow; } + + RKLCDelayedAssert((searchU16Length64 < (uint64_t)INT_MAX) && (replacementU16Length64 < (uint64_t)INT_MAX) && (((searchU16Length64 / 2ULL) + (replacementU16Length64 * 2ULL)) < (uint64_t)INT_MAX), exception, exitNow); + + // Zero order approximation of the buffer sizes for holding the replaced string or split strings and split strings pointer offsets. As UTF16 code units. + tempUniCharBufferU16Capacity = (int32_t)(16UL + (searchU16Length + (searchU16Length / 2UL)) + (replacementU16Length * 2UL)); + + // Buffer sizes converted from native units to bytes. + size_t stackSize = 0UL, replacementSize = ((size_t)replacementU16Length * sizeof(UniChar)), tempUniCharBufferSize = ((size_t)tempUniCharBufferU16Capacity * sizeof(UniChar)); + + // For the various buffers we require, we first try to allocate from the stack if we're not over the RKL_STACK_LIMIT. If we are, switch to using the heap for the buffer. + if((stackSize + tempUniCharBufferSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)alloca(tempUniCharBufferSize)) == NULL, 0L)) { goto exitNow; } stackSize += tempUniCharBufferSize; } + else { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)rkl_realloc(&scratchBuffer[0], tempUniCharBufferSize, 0UL)) == NULL, 0L)) { goto exitNow; } } + + // Try to get the pointer to the replacement strings UTF16 data. If we can't, allocate some buffer space, then covert to UTF16. + if((replacementUniChar = CFStringGetCharactersPtr((CFStringRef)replacementString)) == NULL) { + UniChar *uniCharBuffer = NULL; + if((stackSize + replacementSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((uniCharBuffer = (UniChar *)alloca(replacementSize)) == NULL, 0L)) { goto exitNow; } stackSize += replacementSize; } + else { if(RKL_EXPECTED((uniCharBuffer = (UniChar *)rkl_realloc(&scratchBuffer[1], replacementSize, 0UL)) == NULL, 0L)) { goto exitNow; } } + CFStringGetCharacters((CFStringRef)replacementString, CFMakeRange(0L, replacementU16Length), uniCharBuffer); // Convert to a UTF16 string. + replacementUniChar = uniCharBuffer; + } + + resultU16Length = rkl_replaceAll(cacheSlot, replacementUniChar, (int32_t)replacementU16Length, tempUniCharBuffer, tempUniCharBufferU16Capacity, &replacedCount, exception, status); + + if(RKL_EXPECTED(*status == U_BUFFER_OVERFLOW_ERROR, 0L)) { // Our buffer guess(es) were too small. Resize the buffers and try again. + tempUniCharBufferSize = ((size_t)(tempUniCharBufferU16Capacity = resultU16Length + 4) * sizeof(UniChar)); + if((stackSize + tempUniCharBufferSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)alloca(tempUniCharBufferSize)) == NULL, 0L)) { goto exitNow; } stackSize += tempUniCharBufferSize; } + else { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)rkl_realloc(&scratchBuffer[0], tempUniCharBufferSize, 0UL)) == NULL, 0L)) { goto exitNow; } } + + *status = U_ZERO_ERROR; // Make sure the status var is cleared and try again. + resultU16Length = rkl_replaceAll(cacheSlot, replacementUniChar, (int32_t)replacementU16Length, tempUniCharBuffer, tempUniCharBufferU16Capacity, &replacedCount, exception, status); + } + + if(RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto exitNow; } // Something went wrong. + + if(resultU16Length == 0) { resultObject = @""; } // Optimize the case where the replaced text length == 0 with a @"" string. + else if(((NSUInteger)resultU16Length == searchU16Length) && (replacedCount == 0UL)) { // Optimize the case where the replacement == original by creating a copy. Very fast if self is immutable. + if(replaceMutable == 0UL) { resultObject = rkl_CFAutorelease(CFStringCreateCopy(NULL, (CFStringRef)searchString)); } // .. but only if this is not replacing a mutable self. + } else { resultObject = rkl_CFAutorelease(CFStringCreateWithCharacters(NULL, tempUniCharBuffer, (CFIndex)resultU16Length)); } // otherwise, create a new string. + + // If replaceMutable == 1UL, we don't do the replacement here. We wait until after we return and unlock the cache lock. + // This is because we may be trying to mutate an immutable string object. + if((replacedCount > 0UL) && (replaceMutable == 1UL)) { // We're working on a mutable string and there were successfull matches with replaced text, so there's work to do. + rkl_clearBuffer((cacheSlot->setToLength < (CFIndex)(RKL_FIXED_LENGTH)) ? &fixedBuffer : &dynamicBuffer, 0UL); + rkl_clearCacheSlotSetTo(cacheSlot); // Flush any cached information about this string since it will mutate. + } + +exitNow: + if(scratchBuffer[0] != NULL) { scratchBuffer[0] = rkl_free(&scratchBuffer[0]); } + if(scratchBuffer[1] != NULL) { scratchBuffer[1] = rkl_free(&scratchBuffer[1]); } + if(replacedCountPtr != NULL) { *replacedCountPtr = replacedCount; } + return(resultObject); +} + +// IMPORTANT! Should only be called from rkl_replaceString(). +// ---------- +// Modified version of the ICU libraries uregex_replaceAll() that keeps count of the number of replacements made. + +static int32_t rkl_replaceAll(RKLCacheSlot *cacheSlot, const UniChar *replacementUniChar, int32_t replacementU16Length, UniChar *replacedUniChar, int32_t replacedU16Capacity, NSUInteger *replacedCount, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) { + NSUInteger replaced = 0UL, bufferOverflowed = 0UL; + int32_t u16Length = 0; + RKLCDelayedAssert((cacheSlot != NULL) && (replacementUniChar != NULL) && (replacedUniChar != NULL) && (status != NULL) && (replacementU16Length >= 0) && (replacedU16Capacity >= 0), exception, exitNow); + + cacheSlot->lastFindRange = cacheSlot->lastMatchRange = NSNotFoundRange; // Clear the cached find information for this regex so a subsequent find works correctly. + RKL_ICU_FUNCTION_APPEND(uregex_reset)(cacheSlot->icu_regex, 0, status); + + // Work around for ICU uregex_reset() bug, see http://bugs.icu-project.org/trac/ticket/6545 + // http://sourceforge.net/tracker/index.php?func=detail&aid=2105213&group_id=204582&atid=990188 + if(RKL_EXPECTED(cacheSlot->setToRange.length == 0L, 0L) && (*status == U_INDEX_OUTOFBOUNDS_ERROR)) { *status = U_ZERO_ERROR; } + + // This loop originally came from ICU source/i18n/uregex.cpp, uregex_replaceAll. + // There is a bug in that code which causes the size of the buffer required for the replaced text to not be calculated correctly. + // This contains a work around using the variable bufferOverflowed. + // ICU bug: http://bugs.icu-project.org/trac/ticket/6656 + // http://sourceforge.net/tracker/index.php?func=detail&aid=2408447&group_id=204582&atid=990188 + while(RKL_ICU_FUNCTION_APPEND(uregex_findNext)(cacheSlot->icu_regex, status)) { + replaced++; + u16Length += RKL_ICU_FUNCTION_APPEND(uregex_appendReplacement)(cacheSlot->icu_regex, replacementUniChar, replacementU16Length, &replacedUniChar, &replacedU16Capacity, status); + if(RKL_EXPECTED(*status == U_BUFFER_OVERFLOW_ERROR, 0L)) { bufferOverflowed = 1UL; *status = U_ZERO_ERROR; } + } + if(RKL_EXPECTED(*status == U_BUFFER_OVERFLOW_ERROR, 0L)) { bufferOverflowed = 1UL; *status = U_ZERO_ERROR; } + u16Length += RKL_ICU_FUNCTION_APPEND(uregex_appendTail)(cacheSlot->icu_regex, &replacedUniChar, &replacedU16Capacity, status); + + if(RKL_EXPECTED(*status == U_ZERO_ERROR, 1L) && RKL_EXPECTED(bufferOverflowed == 1UL, 0L)) { *status = U_BUFFER_OVERFLOW_ERROR; } + if(replacedCount != NULL) { *replacedCount = replaced; } + +#ifndef NS_BLOCK_ASSERTIONS +exitNow: +#endif + return(u16Length); +} + +static NSUInteger rkl_isRegexValid(id self, SEL _cmd, NSString *regex, RKLRegexOptions options, NSInteger *captureCountPtr, NSError **error) { + volatile NSUInteger RKL_CLEANUP(rkl_cleanup_cacheSpinLockStatus) cacheSpinLockStatus = 0UL; + + RKLCacheSlot *cacheSlot = NULL; + NSUInteger gotCacheSlot = 0UL; + NSInteger captureCount = -1L; + id exception = NULL; + + if((error != NULL) && (*error != NULL)) { *error = NULL; } + if(regex == NULL) { RKL_RAISE_EXCEPTION(NSInvalidArgumentException, @"The regular expression argument is NULL."); } + + OSSpinLockLock(&cacheSpinLock); + cacheSpinLockStatus |= RKLLockedCacheSpinLock; + rkl_dtrace_incrementEventID(); + if((cacheSlot = rkl_getCachedRegex(regex, options, error, &exception)) != NULL) { gotCacheSlot = 1UL; captureCount = cacheSlot->captureCount; } + cacheSlot = NULL; + OSSpinLockUnlock(&cacheSpinLock); + cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; + + if(captureCountPtr != NULL) { *captureCountPtr = captureCount; } + if(RKL_EXPECTED(exception != NULL, 0L)) { rkl_handleDelayedAssert(self, _cmd, exception); } + return(gotCacheSlot); +} + +static void rkl_clearStringCache(void) { + NSCParameterAssert(cacheSpinLock != 0); + lastCacheSlot = NULL; + NSUInteger x = 0UL; + for(x = 0UL; x < (NSUInteger)(RKL_SCRATCH_BUFFERS); x++) { if(scratchBuffer[x] != NULL) { scratchBuffer[x] = rkl_free(&scratchBuffer[x]); } } + for(x = 0UL; x < (NSUInteger)(RKL_CACHE_SIZE); x++) { rkl_clearCacheSlotRegex(&rkl_cacheSlots[x]); } + rkl_clearBuffer(&fixedBuffer, 0UL); + rkl_clearBuffer(&dynamicBuffer, 1UL); +} + +static void rkl_clearBuffer(RKLBuffer *buffer, NSUInteger freeDynamicBuffer) { + if(buffer == NULL) { return; } + if((freeDynamicBuffer == 1UL) && (buffer->uniChar != NULL) && (buffer == &dynamicBuffer)) { RKL_STRONG_REF void *p = (RKL_STRONG_REF void *)dynamicBuffer.uniChar; dynamicBuffer.uniChar = (RKL_STRONG_REF UniChar *)rkl_free(&p); } + if(buffer->string != NULL) { CFRelease((CFTypeRef)buffer->string); buffer->string = NULL; } + buffer->length = 0L; + buffer->hash = 0UL; +} + +static void rkl_clearCacheSlotRegex(RKLCacheSlot *cacheSlot) { + if(cacheSlot == NULL) { return; } + if(cacheSlot->setToString != NULL) { rkl_clearCacheSlotSetTo(cacheSlot); } + if(cacheSlot->icu_regex != NULL) { RKL_ICU_FUNCTION_APPEND(uregex_close)(cacheSlot->icu_regex); cacheSlot->icu_regex = NULL; cacheSlot->captureCount = -1L; } + if(cacheSlot->regexString != NULL) { CFRelease((CFTypeRef)cacheSlot->regexString); cacheSlot->regexString = NULL; cacheSlot->options = 0U; } +} + +static void rkl_clearCacheSlotSetTo(RKLCacheSlot *cacheSlot) { + if(cacheSlot == NULL) { return; } + if(cacheSlot->icu_regex != NULL) { int32_t status = 0; RKL_ICU_FUNCTION_APPEND(uregex_setText)(cacheSlot->icu_regex, &emptyUniCharString[0], 0, &status); } + if(cacheSlot->setToString != NULL) { CFRelease((CFTypeRef)cacheSlot->setToString); cacheSlot->setToString = NULL; } + cacheSlot->lastFindRange = cacheSlot->lastMatchRange = cacheSlot->setToRange = NSNotFoundRange; + cacheSlot->setToIsImmutable = cacheSlot->setToNeedsConversion = 0U; + cacheSlot->setToUniChar = NULL; + cacheSlot->setToHash = 0UL; + cacheSlot->setToLength = 0L; +} + +// Helps to keep things tidy. +#define addKeyAndObject(objs, keys, i, k, o) ({id _o=(o), _k=(k); if((_o != NULL) && (_k != NULL)) { objs[i] = _o; keys[i] = _k; i++; } }) + +static NSDictionary *rkl_userInfoDictionary(NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status, ...) { + va_list varArgsList; + va_start(varArgsList, status); + if(regexString == NULL) { va_end(varArgsList); return(NULL); } + + id objects[64], keys[64]; + NSUInteger count = 0UL; + + NSString *errorNameString = [NSString stringWithUTF8String:RKL_ICU_FUNCTION_APPEND(u_errorName)(status)]; + + addKeyAndObject(objects, keys, count, RKLICURegexRegexErrorKey, regexString); + addKeyAndObject(objects, keys, count, RKLICURegexRegexOptionsErrorKey, [NSNumber numberWithUnsignedInt:options]); + addKeyAndObject(objects, keys, count, RKLICURegexErrorCodeErrorKey, [NSNumber numberWithInt:status]); + addKeyAndObject(objects, keys, count, RKLICURegexErrorNameErrorKey, errorNameString); + + if((parseError != NULL) && (parseError->line != -1)) { + NSString *preContextString = [NSString stringWithCharacters:&parseError->preContext[0] length:(NSUInteger)RKL_ICU_FUNCTION_APPEND(u_strlen)(&parseError->preContext[0])]; + NSString *postContextString = [NSString stringWithCharacters:&parseError->postContext[0] length:(NSUInteger)RKL_ICU_FUNCTION_APPEND(u_strlen)(&parseError->postContext[0])]; + + addKeyAndObject(objects, keys, count, RKLICURegexLineErrorKey, [NSNumber numberWithInt:parseError->line]); + addKeyAndObject(objects, keys, count, RKLICURegexOffsetErrorKey, [NSNumber numberWithInt:parseError->offset]); + addKeyAndObject(objects, keys, count, RKLICURegexPreContextErrorKey, preContextString); + addKeyAndObject(objects, keys, count, RKLICURegexPostContextErrorKey, postContextString); + addKeyAndObject(objects, keys, count, @"NSLocalizedFailureReason", ([NSString stringWithFormat:@"The error %@ occurred at line %d, column %d: %@<>%@", errorNameString, parseError->line, parseError->offset, preContextString, postContextString])); + } else { + addKeyAndObject(objects, keys, count, @"NSLocalizedFailureReason", ([NSString stringWithFormat:@"The error %@ occurred.", errorNameString])); + } + + while(count < 62UL) { id obj = va_arg(varArgsList, id), key = va_arg(varArgsList, id); if((obj != NULL) && (key != NULL)) { addKeyAndObject(objects, keys, count, key, obj); } else { break; } } + va_end(varArgsList); + + return([NSDictionary dictionaryWithObjects:&objects[0] forKeys:&keys[0] count:count]); +} + +static NSError *rkl_NSErrorForRegex(NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status) { + return([NSError errorWithDomain:RKLICURegexErrorDomain code:(NSInteger)status userInfo:rkl_userInfoDictionary(regexString, options, parseError, status, @"There was an error compiling the regular expression.", @"NSLocalizedDescription", NULL)]); +} + +static NSException *rkl_NSExceptionForRegex(NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status) { + return([NSException exceptionWithName:RKLICURegexException reason:[NSString stringWithFormat:@"ICU regular expression error #%d, %s", status, RKL_ICU_FUNCTION_APPEND(u_errorName)(status)] userInfo:rkl_userInfoDictionary(regexString, options, parseError, status, NULL)]); +} + +static NSDictionary *rkl_makeAssertDictionary(const char *function, const char *file, int line, NSString *format, ...) { + va_list varArgsList; + va_start(varArgsList, format); + NSString *formatString = [[[NSString alloc] initWithFormat:format arguments:varArgsList] autorelease]; + va_end(varArgsList); + NSString *functionString = [NSString stringWithUTF8String:function], *fileString = [NSString stringWithUTF8String:file]; + return([NSDictionary dictionaryWithObjectsAndKeys:formatString, @"description", functionString, @"function", fileString, @"file", [NSNumber numberWithInt:line], @"line", NSInternalInconsistencyException, @"exceptionName", NULL]); +} + +static NSString *rkl_stringFromClassAndMethod(id object, SEL selector, NSString *format, ...) { + va_list varArgsList; + va_start(varArgsList, format); + NSString *formatString = [[[NSString alloc] initWithFormat:format arguments:varArgsList] autorelease]; + va_end(varArgsList); + Class objectsClass = [object class]; + return([NSString stringWithFormat:@"*** %c[%@ %@]: %@", (object == objectsClass) ? '+' : '-', NSStringFromClass(objectsClass), NSStringFromSelector(selector), formatString]); +} + +#pragma mark - +#pragma mark Objective-C Public Interface +#pragma mark - + +@implementation NSString (RegexKitLiteAdditions) + +#pragma mark +clearStringCache + ++ (void)RKL_METHOD_PREPEND(clearStringCache) +{ + volatile NSUInteger RKL_CLEANUP(rkl_cleanup_cacheSpinLockStatus) cacheSpinLockStatus = 0UL; + OSSpinLockLock(&cacheSpinLock); + cacheSpinLockStatus |= RKLLockedCacheSpinLock; + rkl_clearStringCache(); + OSSpinLockUnlock(&cacheSpinLock); + cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; +} + +#pragma mark +captureCountForRegex: + ++ (NSInteger)RKL_METHOD_PREPEND(captureCountForRegex):(NSString *)regex +{ + NSInteger captureCount = -1L; + rkl_isRegexValid(self, _cmd, regex, RKLNoOptions, &captureCount, NULL); + return(captureCount); +} + ++ (NSInteger)RKL_METHOD_PREPEND(captureCountForRegex):(NSString *)regex options:(RKLRegexOptions)options error:(NSError **)error +{ + NSInteger captureCount = -1L; + rkl_isRegexValid(self, _cmd, regex, options, &captureCount, error); + return(captureCount); +} + +#pragma mark -captureCount: + +- (NSInteger)RKL_METHOD_PREPEND(captureCount) +{ + NSInteger captureCount = -1L; + rkl_isRegexValid(self, _cmd, self, RKLNoOptions, &captureCount, NULL); + return(captureCount); +} + +- (NSInteger)RKL_METHOD_PREPEND(captureCountWithOptions):(RKLRegexOptions)options error:(NSError **)error +{ + NSInteger captureCount = -1L; + rkl_isRegexValid(self, _cmd, self, options, &captureCount, error); + return(captureCount); +} + +#pragma mark -componentsSeparatedByRegex: + +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex +{ + NSRange range = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLSplitOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex range:(NSRange)range +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLSplitOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLSplitOp, regex, options, 0L, self, &range, NULL, error, NULL)); +} + +#pragma mark -isMatchedByRegex: + +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex +{ + NSRange result = NSNotFoundRange, range = NSMaxiumRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &result); + return((result.location == NSNotFound) ? NO : YES); +} + +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex inRange:(NSRange)range +{ + NSRange result = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &result); + return((result.location == NSNotFound) ? NO : YES); +} + +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range error:(NSError **)error +{ + NSRange result = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, options, 0L, self, &range, NULL, error, &result); + return((result.location == NSNotFound) ? NO : YES); +} + +#pragma mark -isRegexValid + +- (BOOL)RKL_METHOD_PREPEND(isRegexValid) +{ + return(rkl_isRegexValid(self, _cmd, self, RKLNoOptions, NULL, NULL) == 1UL ? YES : NO); +} + +- (BOOL)RKL_METHOD_PREPEND(isRegexValidWithOptions):(RKLRegexOptions)options error:(NSError **)error +{ + return(rkl_isRegexValid(self, _cmd, self, options, NULL, error) == 1UL ? YES : NO); +} + +#pragma mark -flushCachedRegexData + +- (void)RKL_METHOD_PREPEND(flushCachedRegexData) +{ + volatile NSUInteger RKL_CLEANUP(rkl_cleanup_cacheSpinLockStatus) cacheSpinLockStatus = 0UL; + + CFIndex selfLength = CFStringGetLength((CFStringRef)self); + CFHashCode selfHash = CFHash((CFTypeRef)self); + + OSSpinLockLock(&cacheSpinLock); + cacheSpinLockStatus |= RKLLockedCacheSpinLock; + rkl_dtrace_incrementEventID(); + + NSUInteger slot; + for(slot = 0UL; slot < (NSUInteger)(RKL_CACHE_SIZE); slot++) { + RKLCacheSlot *cacheSlot = &rkl_cacheSlots[slot]; + if((cacheSlot->setToString != NULL) && ( (cacheSlot->setToString == (CFStringRef)self) || ((cacheSlot->setToLength == selfLength) && (cacheSlot->setToHash == selfHash)) ) ) { rkl_clearCacheSlotSetTo(cacheSlot); } + } + + RKLBuffer *buffer = (selfLength < (CFIndex)(RKL_FIXED_LENGTH)) ? &fixedBuffer : &dynamicBuffer; + if((buffer->string != NULL) && ((buffer->string == (CFStringRef)self) || ((buffer->length == selfLength) && (buffer->hash == selfHash)))) { rkl_clearBuffer(buffer, 0UL); } + + OSSpinLockUnlock(&cacheSpinLock); + cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; +} + +#pragma mark -rangeOfRegex: + +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex +{ + NSRange result = NSNotFoundRange, range = NSMaxiumRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &result); + return(result); +} + +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex capture:(NSInteger)capture +{ + NSRange result = NSNotFoundRange, range = NSMaxiumRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, capture, self, &range, NULL, NULL, &result); + return(result); +} + +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex inRange:(NSRange)range +{ + NSRange result = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &result); + return(result); +} + +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error +{ + NSRange result = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, options, capture, self, &range, NULL, error, &result); + return(result); +} + +#pragma mark -stringByMatching: + +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex +{ + NSRange matchedRange = NSNotFoundRange, range = NSMaxiumRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &matchedRange); + return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length)))); +} + +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex capture:(NSInteger)capture +{ + NSRange matchedRange = NSNotFoundRange, range = NSMaxiumRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, capture, self, &range, NULL, NULL, &matchedRange); + return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length)))); +} + +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex inRange:(NSRange)range +{ + NSRange matchedRange = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &matchedRange); + return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length)))); +} + +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error +{ + NSRange matchedRange = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, options, capture, self, &range, NULL, error, &matchedRange); + return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length)))); +} + +#pragma mark -stringByReplacingOccurrencesOfRegex: + +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement +{ + NSRange searchRange = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLReplaceOp, regex, RKLNoOptions, 0L, self, &searchRange, replacement, NULL, NULL)); +} + +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement range:(NSRange)searchRange +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLReplaceOp, regex, RKLNoOptions, 0L, self, &searchRange, replacement, NULL, NULL)); +} + +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement options:(RKLRegexOptions)options range:(NSRange)searchRange error:(NSError **)error +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLReplaceOp, regex, options, 0L, self, &searchRange, replacement, error, NULL)); +} + +#pragma mark -componentsMatchedByRegex: + +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex +{ + NSRange searchRange = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLArrayOfStringsOp, regex, RKLNoOptions, 0L, self, &searchRange, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex capture:(NSInteger)capture +{ + NSRange searchRange = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLArrayOfStringsOp, regex, RKLNoOptions, capture, self, &searchRange, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex range:(NSRange)range +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLArrayOfStringsOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range capture:(NSInteger)capture error:(NSError **)error +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLArrayOfStringsOp, regex, options, capture, self, &range, NULL, error, NULL)); +} + +#pragma mark -captureComponentsMatchedByRegex: + +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex +{ + NSRange searchRange = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLCapturesArrayOp, regex, RKLNoOptions, 0L, self, &searchRange, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex range:(NSRange)range +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLCapturesArrayOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLCapturesArrayOp, regex, options, 0L, self, &range, NULL, error, NULL)); +} + +#pragma mark -arrayOfCaptureComponentsMatchedByRegex: + +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex +{ + NSRange searchRange = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLArrayOfCapturesOp | RKLSubcapturesArray), regex, RKLNoOptions, 0L, self, &searchRange, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex range:(NSRange)range +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLArrayOfCapturesOp | RKLSubcapturesArray), regex, RKLNoOptions, 0L, self, &range, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLArrayOfCapturesOp | RKLSubcapturesArray), regex, options, 0L, self, &range, NULL, error, NULL)); +} + +@end + + +@implementation NSMutableString (RegexKitLiteAdditions) + +#pragma mark -replaceOccurrencesOfRegex: + +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement +{ + NSRange searchRange = NSMaxiumRange; + NSUInteger replacedCount = 0UL; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLReplaceOp | RKLReplaceMutable), regex, RKLNoOptions, 0L, self, &searchRange, replacement, NULL, (void **)((void *)&replacedCount)); + return(replacedCount); +} + +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement range:(NSRange)searchRange +{ + NSUInteger replacedCount = 0UL; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLReplaceOp | RKLReplaceMutable), regex, RKLNoOptions, 0L, self, &searchRange, replacement, NULL, (void **)((void *)&replacedCount)); + return(replacedCount); +} + +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement options:(RKLRegexOptions)options range:(NSRange)searchRange error:(NSError **)error +{ + NSUInteger replacedCount = 0UL; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLReplaceOp | RKLReplaceMutable), regex, options, 0L, self, &searchRange, replacement, error, (void **)((void *)&replacedCount)); + return(replacedCount); +} + +@end diff --git a/src/.svn/text-base/TAssembly.h.svn-base b/src/.svn/text-base/TAssembly.h.svn-base new file mode 100644 index 0000000..8ce5efe --- /dev/null +++ b/src/.svn/text-base/TAssembly.h.svn-base @@ -0,0 +1,138 @@ +// +// TDAssembly.h +// TDParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2008 Todd Ditchendorf. All rights reserved. +// + +#import + +/*! + @class TDAssembly + @brief An Abstract class. A TDAssembly maintains a stream of language elements along with stack and target objects. + @details

Parsers use assemblers to record progress at recognizing language elements from assembly's string.

+

Note that TDAssembly is an abstract class and may not be instantiated directly. Subclasses include TDTokenAssembly and TDCharAssembly.

+*/ +@interface TDAssembly : NSObject { + NSMutableArray *stack; + id target; + NSUInteger index; + NSString *string; + NSString *defaultDelimiter; +} + +/*! + @brief Convenience factory method for initializing an autoreleased assembly. + @param s string to be worked on + @result an initialized autoreleased assembly +*/ ++ (id)assemblyWithString:(NSString *)s; + +/*! + @brief Designated Initializer. Initializes an assembly with a given string. + @details Designated Initializer. + @param s string to be worked on + @result an initialized assembly +*/ +- (id)initWithString:(NSString *)s; + +/*! + @brief Shows the next object in the assembly, without removing it + @details Note this is not the next object in this assembly's stack, but rather the next object from this assembly's stream of elements (tokens or chars depending on the type of concrete TDAssembly subclass of this object). + @result the next object in the assembly. +*/ +- (id)peek; + +/*! + @brief Returns the next object in the assembly. + @details Note this is not the next object in this assembly's stack, but rather the next object from this assembly's stream of elements (tokens or chars depending on the type of concrete TDAssembly subclass of this object). + @result the next object in the assembly. +*/ +- (id)next; + +/*! + @brief Returns true if this assembly has unconsumed elements. + @result true, if this assembly has unconsumed elements +*/ +- (BOOL)hasMore; + +/*! + @brief Returns the elements of this assembly that have been consumed, separated by the specified delimiter. + @param delimiter string with which to separate elements of this assembly + @result string representing the elements of this assembly that have been consumed, separated by the specified delimiter +*/ +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter; + +/*! + @brief Returns the elements of this assembly that remain to be consumed, separated by the specified delimiter. + @param delimiter string with which to separate elements of this assembly + @result string representing the elements of this assembly that remain to be consumed, separated by the specified delimiter +*/ +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter; + +/*! + @brief Removes the object at the top of this assembly's stack and returns it. + @details Note this returns an object from this assembly's stack, not from its stream of elements (tokens or chars depending on the type of concrete TDAssembly subclass of this object). + @result the object at the top of this assembly's stack +*/ +- (id)pop; + +/*! + @brief Pushes an object onto the top of this assembly's stack. + @param object object to push +*/ +- (void)push:(id)object; + +/*! + @brief Returns true if this assembly's stack is empty. + @result true, if this assembly's stack is empty +*/ +- (BOOL)isStackEmpty; + +/*! + @brief Returns a vector of the elements on this assembly's stack that appear before a specified fence. + @details

Returns a vector of the elements on this assembly's stack that appear before a specified fence.

+

Sometimes a parser will recognize a list from within a pair of parentheses or brackets. The parser can mark the beginning of the list with a fence, and then retrieve all the items that come after the fence with this method.

+ @param fence object that indicates the limit of elements returned from this assembly's stack + @result Array of the elements above the specified fence +*/ +- (NSArray *)objectsAbove:(id)fence; + +/*! + @property length + @brief The number of elements in this assembly. +*/ +@property (nonatomic, readonly) NSUInteger length; + +/*! + @property objectsConsumed + @brief The number of elements that have been consumed. +*/ +@property (nonatomic, readonly) NSUInteger objectsConsumed; + +/*! + @property objectsRemaining + @brief The number of elements that have not been consumed +*/ +@property (nonatomic, readonly) NSUInteger objectsRemaining; + +/*! + @property defaultDelimiter + @brief The default string to show between elements +*/ +@property (nonatomic, readonly, retain) NSString *defaultDelimiter; + +/*! + @property stack + @brief This assembly's stack. +*/ +@property (nonatomic, readonly, retain) NSMutableArray *stack; + +/*! + @property target + @brief This assembly's target. + @details The object identified as this assembly's "target". Clients can set and retrieve a target, which can be a convenient supplement as a place to work, in addition to the assembly's stack. For example, a parser for an HTML file might use a web page object as its "target". As the parser recognizes markup commands like <head>, it could apply its findings to the target. +*/ +@property (nonatomic, retain) id target; +@end diff --git a/src/NSArray+ParseKitAdditions.h b/src/NSArray+ParseKitAdditions.h new file mode 100644 index 0000000..3d11f54 --- /dev/null +++ b/src/NSArray+ParseKitAdditions.h @@ -0,0 +1,14 @@ +// +// NSArray+ParseKitAdditions.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface NSArray (ParseKitAdditions) +- (NSArray *)reversedArray; +- (NSMutableArray *)reversedMutableArray; +@end diff --git a/src/NSArray+ParseKitAdditions.m b/src/NSArray+ParseKitAdditions.m new file mode 100644 index 0000000..1399c35 --- /dev/null +++ b/src/NSArray+ParseKitAdditions.m @@ -0,0 +1,26 @@ +// +// NSArray+ParseKitAdditions.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "NSArray+ParseKitAdditions.h" + +@implementation NSArray (ParseKitAdditions) + +- (NSArray *)reversedArray { + return [[[self reversedMutableArray] copy] autorelease]; +} + + +- (NSMutableArray *)reversedMutableArray { + NSMutableArray *result = [NSMutableArray arrayWithCapacity:[self count]]; + for (id obj in [self reverseObjectEnumerator]) { + [result addObject:obj]; + } + return result; +} + +@end diff --git a/src/NSString+ParseKitAdditions.h b/src/NSString+ParseKitAdditions.h new file mode 100644 index 0000000..55d02a8 --- /dev/null +++ b/src/NSString+ParseKitAdditions.h @@ -0,0 +1,13 @@ +// +// NSString+ParseKitAdditions.h +// ParseKit +// +// Created by Todd Ditchendorf on 11/5/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface NSString (ParseKitAdditions) +- (NSString *)stringByTrimmingQuotes; +@end diff --git a/src/NSString+ParseKitAdditions.m b/src/NSString+ParseKitAdditions.m new file mode 100644 index 0000000..304a432 --- /dev/null +++ b/src/NSString+ParseKitAdditions.m @@ -0,0 +1,38 @@ +// +// NSString+ParseKitAdditions.m +// ParseKit +// +// Created by Todd Ditchendorf on 11/5/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "NSString+ParseKitAdditions.h" + +@implementation NSString (ParseKitAdditions) + +- (NSString *)stringByTrimmingQuotes { + NSUInteger len = [self length]; + + if (len < 2) { + return self; + } + + NSRange r = NSMakeRange(0, len); + + unichar c = [self characterAtIndex:0]; + if (!isalnum(c)) { + unichar quoteChar = c; + r.location = 1; + r.length -= 1; + + c = [self characterAtIndex:len - 1]; + if (c == quoteChar) { + r.length -= 1; + } + return [self substringWithRange:r]; + } else { + return self; + } +} + +@end diff --git a/src/PKAlternation.m b/src/PKAlternation.m new file mode 100644 index 0000000..d866307 --- /dev/null +++ b/src/PKAlternation.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@interface PKCollectionParser () ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest; +@end + +@implementation PKAlternation + ++ (id)alternation { + return [self alternationWithSubparsers:nil]; +} + + ++ (id)alternationWithSubparsers:(PKParser *)p1, ... { + va_list vargs; + va_start(vargs, p1); + PKAlternation *alt = [self collectionParserWithFirst:p1 rest:vargs]; + va_end(vargs); + return alt; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + NSMutableSet *outAssemblies = [NSMutableSet set]; + + for (PKParser *p in subparsers) { + [outAssemblies unionSet:[p matchAndAssemble:inAssemblies]]; + } + + return outAssemblies; +} + +@end diff --git a/src/PKAny.m b/src/PKAny.m new file mode 100644 index 0000000..dcd8bfd --- /dev/null +++ b/src/PKAny.m @@ -0,0 +1,29 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKAny + ++ (id)any { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + return [obj isMemberOfClass:[PKToken class]]; +} + +@end diff --git a/src/PKAssembly.m b/src/PKAssembly.m new file mode 100644 index 0000000..8f56302 --- /dev/null +++ b/src/PKAssembly.m @@ -0,0 +1,231 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +static NSString * const PKAssemblyDefaultDelimiter = @"/"; + +@interface PKAssembly () +- (id)peek; +- (id)next; +- (BOOL)hasMore; +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter; +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter; + +@property (nonatomic, readwrite, retain) NSMutableArray *stack; +@property (nonatomic) NSUInteger index; +@property (nonatomic, retain) NSString *string; +@property (nonatomic, readwrite, retain) NSString *defaultDelimiter; +@property (nonatomic, readonly) NSUInteger length; +@property (nonatomic, readonly) NSUInteger objectsConsumed; +@property (nonatomic, readonly) NSUInteger objectsRemaining; +@end + +@implementation PKAssembly + ++ (id)assemblyWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)init { + return [self initWithString:nil]; +} + + +- (id)initWithString:(NSString *)s { + if (self = [super init]) { + self.stack = [NSMutableArray array]; + self.string = s; + } + return self; +} + + +- (void)dealloc { + self.stack = nil; + self.string = nil; + self.target = nil; + self.defaultDelimiter = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + // use of NSAllocateObject() below is a *massive* optimization over calling the designated initializer -initWithString: here. + // this line (and this method in general) is *vital* to the overall performance of the framework. dont fuck with it. + PKAssembly *a = NSAllocateObject([self class], 0, zone); + a->stack = [stack mutableCopyWithZone:zone]; + a->string = [string retain]; + if (defaultDelimiter) { + a->defaultDelimiter = [defaultDelimiter retain]; + } else { + a->defaultDelimiter = nil; + } + + if (target) { + if ([target conformsToProtocol:@protocol(NSMutableCopying)]) { + a->target = [target mutableCopyWithZone:zone]; + } else { + a->target = [target copyWithZone:zone]; + } + } else { + a->target = nil; + } + + a->index = index; + return a; +} + + +- (BOOL)isEqual:(id)obj { + if (![obj isMemberOfClass:[self class]]) { + return NO; + } + + PKAssembly *a = (PKAssembly *)obj; + if ([a length] != [self length]) { + return NO; + } + + if (a->index != index) { + return NO; + } + + if ([a.stack count] != [stack count]) { + return NO; + } + + return [[self description] isEqualToString:[obj description]]; +} + + +- (id)next { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return nil; +} + + +- (BOOL)hasMore { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return NO; +} + + +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return nil; +} + + +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return nil; +} + + +- (NSUInteger)length { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return 0; +} + + +- (NSUInteger)objectsConsumed { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return 0; +} + + +- (NSUInteger)objectsRemaining { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return 0; +} + + +- (id)peek { + NSAssert1(0, @"-[PKAssembly %s] must be overriden", _cmd); + return nil; +} + + +- (id)pop { + id result = nil; + if (![self isStackEmpty]) { + result = [[[stack lastObject] retain] autorelease]; + [stack removeLastObject]; + } + return result; +} + + +- (void)push:(id)object { + if (object) { + [stack addObject:object]; + } +} + + +- (BOOL)isStackEmpty { + return 0 == [stack count]; +} + + +- (NSArray *)objectsAbove:(id)fence { + NSMutableArray *result = [NSMutableArray array]; + + while (![self isStackEmpty]) { + id obj = [self pop]; + + if ([obj isEqual:fence]) { + [self push:obj]; + break; + } else { + [result addObject:obj]; + } + } + + return result; +} + + +- (NSString *)description { + NSMutableString *s = [NSMutableString string]; + [s appendString:@"["]; + + NSUInteger i = 0; + NSUInteger len = [stack count]; + + for (id obj in stack) { + [s appendString:[obj description]]; + if (len - 1 != i++) { + [s appendString:@", "]; + } + } + + [s appendString:@"]"]; + + NSString *d = defaultDelimiter ? defaultDelimiter : PKAssemblyDefaultDelimiter; + [s appendString:[self consumedObjectsJoinedByString:d]]; + [s appendString:@"^"]; + [s appendString:[self remainingObjectsJoinedByString:d]]; + + return [[s copy] autorelease]; +} + +@synthesize stack; +@synthesize target; +@synthesize index; +@synthesize string; +@synthesize defaultDelimiter; +@end diff --git a/src/PKCaseInsensitiveLiteral.m b/src/PKCaseInsensitiveLiteral.m new file mode 100644 index 0000000..25dcf59 --- /dev/null +++ b/src/PKCaseInsensitiveLiteral.m @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKCaseInsensitiveLiteral + +- (BOOL)qualifies:(id)obj { + return NSOrderedSame == [literal.stringValue caseInsensitiveCompare:[obj stringValue]]; +// return [literal isEqualIgnoringCase:obj]; +} + +@end diff --git a/src/PKChar.m b/src/PKChar.m new file mode 100644 index 0000000..e194788 --- /dev/null +++ b/src/PKChar.m @@ -0,0 +1,28 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@implementation PKChar + ++ (id)char { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + return YES; +} + +@end diff --git a/src/PKCharacterAssembly.m b/src/PKCharacterAssembly.m new file mode 100644 index 0000000..ffffd2b --- /dev/null +++ b/src/PKCharacterAssembly.m @@ -0,0 +1,127 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKAssembly () +@property (nonatomic, readwrite, retain) NSString *defaultDelimiter; +@end + +@implementation PKCharacterAssembly + +- (id)init { + return [self initWithString:nil]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.defaultDelimiter = @""; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + PKCharacterAssembly *a = (PKCharacterAssembly *)[super copyWithZone:zone]; + return a; +} + + +- (id)peek { + if (index >= [string length]) { + return nil; + } + PKUniChar c = [string characterAtIndex:index]; + return [NSNumber numberWithInt:c]; +} + + +- (id)next { + id obj = [self peek]; + if (obj) { + index++; + } + return obj; +} + + +- (BOOL)hasMore { + return (index < [string length]); +} + + +- (NSUInteger)length { + return [string length]; +} + + +- (NSUInteger)objectsConsumed { + return index; +} + + +- (NSUInteger)objectsRemaining { + return ([string length] - index); +} + + +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter { + NSParameterAssert(delimiter); + return [string substringToIndex:self.objectsConsumed]; +} + + +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter { + NSParameterAssert(delimiter); + return [string substringFromIndex:self.objectsConsumed]; +} + + +// overriding simply to print NSNumber objects as their unichar values +- (NSString *)description { + NSMutableString *s = [NSMutableString string]; + [s appendString:@"["]; + + NSUInteger i = 0; + NSUInteger len = [stack count]; + + for (id obj in self.stack) { + if ([obj isKindOfClass:[NSNumber class]]) { // ***this is needed for Char Assemblies + [s appendFormat:@"%C", [obj integerValue]]; + } else { + [s appendString:[obj description]]; + } + if (len - 1 != i++) { + [s appendString:@", "]; + } + } + + [s appendString:@"]"]; + + [s appendString:[self consumedObjectsJoinedByString:self.defaultDelimiter]]; + [s appendString:@"^"]; + [s appendString:[self remainingObjectsJoinedByString:self.defaultDelimiter]]; + + return [[s copy] autorelease]; +} + +@end diff --git a/src/PKCollectionParser.m b/src/PKCollectionParser.m new file mode 100644 index 0000000..d949474 --- /dev/null +++ b/src/PKCollectionParser.m @@ -0,0 +1,104 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface PKCollectionParser () ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest; + +@property (nonatomic, readwrite, retain) NSMutableArray *subparsers; +@end + +@implementation PKCollectionParser + ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest { + PKCollectionParser *cp = [[[self alloc] init] autorelease]; + + if (p1) { + [cp add:p1]; + + PKParser *p = nil; + while (p = va_arg(rest, PKParser *)) { + [cp add:p]; + } + } + + return cp; +} + + +- (id)init { + return [self initWithSubparsers:nil]; +} + + +- (id)initWithSubparsers:(PKParser *)p1, ... { + if (self = [super init]) { + self.subparsers = [NSMutableArray array]; + + if (p1) { + [subparsers addObject:p1]; + + va_list vargs; + va_start(vargs, p1); + + PKParser *p = nil; + while (p = va_arg(vargs, PKParser *)) { + [subparsers addObject:p]; + } + + va_end(vargs); + } + } + return self; +} + + +- (void)dealloc { + self.subparsers = nil; + [super dealloc]; +} + + +- (void)add:(PKParser *)p { + if (![p isKindOfClass:[PKParser class]]) { + NSLog(@"p: %@", p); + } + NSParameterAssert([p isKindOfClass:[PKParser class]]); + [subparsers addObject:p]; +} + + +- (PKParser *)parserNamed:(NSString *)s { + if ([name isEqualToString:s]) { + return self; + } else { + // do bredth-first search + for (PKParser *p in subparsers) { + if ([p.name isEqualToString:s]) { + return p; + } + } + for (PKParser *p in subparsers) { + PKParser *sub = [p parserNamed:s]; + if (sub) { + return sub; + } + } + } + return nil; +} + +@synthesize subparsers; +@end diff --git a/src/PKComment.m b/src/PKComment.m new file mode 100644 index 0000000..fc6165b --- /dev/null +++ b/src/PKComment.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKComment + ++ (id)comment { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isComment; +} + +@end \ No newline at end of file diff --git a/src/PKCommentState.m b/src/PKCommentState.m new file mode 100644 index 0000000..a320bdb --- /dev/null +++ b/src/PKCommentState.m @@ -0,0 +1,147 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t; +@end + +@interface PKCommentState () +@property (nonatomic, retain) PKSymbolRootNode *rootNode; +@property (nonatomic, retain) PKSingleLineCommentState *singleLineState; +@property (nonatomic, retain) PKMultiLineCommentState *multiLineState; +@end + +@interface PKSingleLineCommentState () +- (void)addStartMarker:(NSString *)start; +- (void)removeStartMarker:(NSString *)start; +@property (nonatomic, retain) NSMutableArray *startMarkers; +@property (nonatomic, retain) NSString *currentStartMarker; +@end + +@interface PKMultiLineCommentState () +- (void)addStartMarker:(NSString *)start endMarker:(NSString *)end; +- (void)removeStartMarker:(NSString *)start; +@property (nonatomic, retain) NSMutableArray *startMarkers; +@property (nonatomic, retain) NSMutableArray *endMarkers; +@property (nonatomic, copy) NSString *currentStartMarker; +@end + +@implementation PKCommentState + +- (id)init { + if (self = [super init]) { + self.rootNode = [[[PKSymbolRootNode alloc] init] autorelease]; + self.singleLineState = [[[PKSingleLineCommentState alloc] init] autorelease]; + self.multiLineState = [[[PKMultiLineCommentState alloc] init] autorelease]; + } + return self; +} + + +- (void)dealloc { + self.rootNode = nil; + self.singleLineState = nil; + self.multiLineState = nil; + [super dealloc]; +} + + +- (void)addSingleLineStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [rootNode add:start]; + [singleLineState addStartMarker:start]; +} + + +- (void)removeSingleLineStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [rootNode remove:start]; + [singleLineState removeStartMarker:start]; +} + + +- (void)addMultiLineStartMarker:(NSString *)start endMarker:(NSString *)end { + NSParameterAssert([start length]); + NSParameterAssert([end length]); + [rootNode add:start]; + [rootNode add:end]; + [multiLineState addStartMarker:start endMarker:end]; +} + + +- (void)removeMultiLineStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [rootNode remove:start]; + [multiLineState removeStartMarker:start]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + [self resetWithReader:r]; + + NSString *symbol = [rootNode nextSymbol:r startingWith:cin]; + PKToken *tok = nil; + + while ([symbol length]) { + if ([multiLineState.startMarkers containsObject:symbol]) { + multiLineState.currentStartMarker = symbol; + tok = [multiLineState nextTokenFromReader:r startingWith:cin tokenizer:t]; + if (tok.isComment) { + tok.offset = offset; + } + } else if ([singleLineState.startMarkers containsObject:symbol]) { + singleLineState.currentStartMarker = symbol; + tok = [singleLineState nextTokenFromReader:r startingWith:cin tokenizer:t]; + if (tok.isComment) { + tok.offset = offset; + } + } + + if (tok) { + return tok; + } else { + if ([symbol length] > 1) { + symbol = [symbol substringToIndex:[symbol length] -1]; + } else { + break; + } + [r unread:1]; + } + } + + return [[self nextTokenizerStateFor:cin tokenizer:t] nextTokenFromReader:r startingWith:cin tokenizer:t]; +} + +@synthesize rootNode; +@synthesize singleLineState; +@synthesize multiLineState; +@synthesize reportsCommentTokens; +@synthesize balancesEOFTerminatedComments; +@end diff --git a/src/PKDelimitState.m b/src/PKDelimitState.m new file mode 100644 index 0000000..0e1003c --- /dev/null +++ b/src/PKDelimitState.m @@ -0,0 +1,214 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (void)appendString:(NSString *)s; +- (NSString *)bufferedString; +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t; +@end + +@interface PKDelimitState () +- (NSString *)endMarkerForStartMarker:(NSString *)startMarker; +- (NSCharacterSet *)allowedCharacterSetForStartMarker:(NSString *)startMarker; +@property (nonatomic, retain) PKSymbolRootNode *rootNode; +@property (nonatomic, retain) NSMutableArray *startMarkers; +@property (nonatomic, retain) NSMutableArray *endMarkers; +@property (nonatomic, retain) NSMutableArray *characterSets; +@end + +@implementation PKDelimitState + +- (id)init { + if (self = [super init]) { + self.rootNode = [[[PKSymbolRootNode alloc] init] autorelease]; + self.startMarkers = [NSMutableArray array]; + self.endMarkers = [NSMutableArray array]; + self.characterSets = [NSMutableArray array]; + } + return self; +} + + +- (void)dealloc { + self.rootNode = nil; + self.startMarkers = nil; + self.endMarkers = nil; + self.characterSets = nil; + [super dealloc]; +} + + +- (void)addStartMarker:(NSString *)start endMarker:(NSString *)end allowedCharacterSet:(NSCharacterSet *)set { + NSParameterAssert([start length]); + [rootNode add:start]; + [startMarkers addObject:start]; + + if ([end length]) { + [rootNode add:end]; + [endMarkers addObject:end]; + } else { + [endMarkers addObject:[NSNull null]]; + } + + if (set) { + [characterSets addObject:set]; + } else { + [characterSets addObject:[NSNull null]]; + } +} + + +- (void)removeStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [rootNode remove:start]; + NSUInteger i = [startMarkers indexOfObject:start]; + if (NSNotFound != i) { + [startMarkers removeObject:start]; + [characterSets removeObjectAtIndex:i]; + + id endOrNull = [endMarkers objectAtIndex:i]; + if ([NSNull null] != endOrNull) { + [rootNode remove:endOrNull]; + } + [endMarkers removeObjectAtIndex:i]; // this should always be in range. + } +} + + +- (NSString *)endMarkerForStartMarker:(NSString *)startMarker { + NSParameterAssert([startMarkers containsObject:startMarker]); + NSUInteger i = [startMarkers indexOfObject:startMarker]; + return [endMarkers objectAtIndex:i]; +} + + +- (NSCharacterSet *)allowedCharacterSetForStartMarker:(NSString *)startMarker { + NSParameterAssert([startMarkers containsObject:startMarker]); + NSCharacterSet *characterSet = nil; + NSUInteger i = [startMarkers indexOfObject:startMarker]; + id csOrNull = [characterSets objectAtIndex:i]; + if ([NSNull null] != csOrNull) { + characterSet = csOrNull; + } + return characterSet; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + NSString *startMarker = [rootNode nextSymbol:r startingWith:cin]; + + if (![startMarker length] || ![startMarkers containsObject:startMarker]) { + [r unread:[startMarker length] - 1]; + return [[self nextTokenizerStateFor:cin tokenizer:t] nextTokenFromReader:r startingWith:cin tokenizer:t]; + } + + [self resetWithReader:r]; + [self appendString:startMarker]; + + id endMarkerOrNull = [self endMarkerForStartMarker:startMarker]; + NSString *endMarker = nil; + NSCharacterSet *characterSet = [self allowedCharacterSetForStartMarker:startMarker]; + + PKUniChar c, e; + if ([NSNull null] == endMarkerOrNull) { + e = PKEOF; + } else { + endMarker = endMarkerOrNull; + e = [endMarker characterAtIndex:0]; + } + while (1) { + c = [r read]; + if (PKEOF == c) { + if (balancesEOFTerminatedStrings && endMarker) { + [self appendString:endMarker]; + } else if (endMarker && !allowsUnbalancedStrings) { + [r unread:[[self bufferedString] length] - 1]; + return [[self nextTokenizerStateFor:cin tokenizer:t] nextTokenFromReader:r startingWith:cin tokenizer:t]; + } + break; + } + + if (!endMarker && [t.whitespaceState isWhitespaceChar:c]) { + // if only the start marker was matched, dont return delimited string token. instead, defer tokenization + if ([startMarker isEqualToString:[self bufferedString]]) { + [r unread:[startMarker length] - 1]; + return [[self nextTokenizerStateFor:cin tokenizer:t] nextTokenFromReader:r startingWith:cin tokenizer:t]; + } + // else, return delimited string tok + break; + } + + if (e == c) { + NSString *peek = [rootNode nextSymbol:r startingWith:e]; + if (endMarker && [endMarker isEqualToString:peek]) { + [self appendString:endMarker]; + c = [r read]; + break; + } else { + [r unread:[peek length] - 1]; + if (e != [peek characterAtIndex:0]) { + [self append:c]; + c = [r read]; + } + } + } + + + // check if char is not in allowed character set (if given) + if (characterSet && ![characterSet characterIsMember:c]) { + if (allowsUnbalancedStrings) { + break; + } else { + // if not, unwind and return a symbol tok for cin + [r unread:[[self bufferedString] length]]; + return [[self nextTokenizerStateFor:cin tokenizer:t] nextTokenFromReader:r startingWith:cin tokenizer:t]; + } + } + + [self append:c]; + } + + if (PKEOF != c) { + [r unread]; + } + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeDelimitedString stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; +} + +@synthesize rootNode; +@synthesize balancesEOFTerminatedStrings; +@synthesize allowsUnbalancedStrings; +@synthesize startMarkers; +@synthesize endMarkers; +@synthesize characterSets; +@end diff --git a/src/PKDelimitedString.m b/src/PKDelimitedString.m new file mode 100644 index 0000000..2c2b847 --- /dev/null +++ b/src/PKDelimitedString.m @@ -0,0 +1,64 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKDelimitedString () +@property (nonatomic, retain) NSString *startMarker; +@property (nonatomic, retain) NSString *endMarker; +@end + +@implementation PKDelimitedString + ++ (id)delimitedString { + return [self delimitedStringWithStartMarker:nil]; +} + + ++ (id)delimitedStringWithStartMarker:(NSString *)start { + return [self delimitedStringWithStartMarker:start endMarker:nil]; +} + + ++ (id)delimitedStringWithStartMarker:(NSString *)start endMarker:(NSString *)end { + PKDelimitedString *ds = [[[self alloc] initWithString:nil] autorelease]; + ds.startMarker = start; + ds.endMarker = end; + return ds; +} + + +- (void)dealloc { + self.startMarker = nil; + self.endMarker = nil; + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + BOOL result = tok.isDelimitedString; + if (result && [startMarker length]) { + result = [tok.stringValue hasPrefix:startMarker]; + if (result && [endMarker length]) { + result = [tok.stringValue hasSuffix:endMarker]; + } + } + return result; +} + +@synthesize startMarker; +@synthesize endMarker; +@end \ No newline at end of file diff --git a/src/PKDifference.m b/src/PKDifference.m new file mode 100644 index 0000000..ca4dc39 --- /dev/null +++ b/src/PKDifference.m @@ -0,0 +1,104 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKDifference.h" + +@interface NSMutableSet (PKDifferenceAdditions) +- (void)minusSetTestingEquality:(NSSet *)s; +@end + +@implementation NSMutableSet (PKDifferenceAdditions) + +- (void)minusSetTestingEquality:(NSSet *)s { + for (id a1 in self) { + for (id a2 in s) { + if ([a1 isEqual:a2]) { + [self removeObject:a1]; + } + } + } +} + +@end + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@interface PKDifference () +@property (nonatomic, retain, readwrite) PKParser *subparser; +@property (nonatomic, retain, readwrite) PKParser *minus; +@end + +@implementation PKDifference + ++ (id)differenceWithSubparser:(PKParser *)s minus:(PKParser *)m { + return [[[self alloc] initWithSubparser:s minus:m] autorelease]; +} + + +- (id)initWithSubparser:(PKParser *)s minus:(PKParser *)m { + if (self = [super init]) { + self.subparser = s; + self.minus = m; + } + return self; +} + + +- (void)dealloc { + self.subparser = nil; + self.minus = nil; + [super dealloc]; +} + + +- (PKParser *)parserNamed:(NSString *)s { + if ([name isEqualToString:s]) { + return self; + } else { + // do bredth-first search + if ([subparser.name isEqualToString:s]) { + return subparser; + } + if ([minus.name isEqualToString:s]) { + return minus; + } + + PKParser *sub = [subparser parserNamed:s]; + if (sub) { + return sub; + } + sub = [minus parserNamed:s]; + if (sub) { + return sub; + } + } + return nil; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + + NSMutableSet *outAssemblies = [[[subparser matchAndAssemble:inAssemblies] mutableCopy] autorelease]; + [outAssemblies minusSetTestingEquality:[minus allMatchesFor:inAssemblies]]; + + return outAssemblies; +} + +@synthesize subparser; +@synthesize minus; +@end diff --git a/src/PKDigit.m b/src/PKDigit.m new file mode 100644 index 0000000..448b91e --- /dev/null +++ b/src/PKDigit.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKDigit + ++ (id)digit { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKUniChar c = [obj intValue]; + return isdigit(c); +} + +@end diff --git a/src/PKEmpty.m b/src/PKEmpty.m new file mode 100644 index 0000000..6d16c3f --- /dev/null +++ b/src/PKEmpty.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@implementation PKEmpty + ++ (id)empty { + return [[[self alloc] init] autorelease]; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + //return [[[NSSet alloc] initWithSet:inAssemblies copyItems:YES] autorelease]; + return inAssemblies; +} + +@end diff --git a/src/PKGrammarParser.h b/src/PKGrammarParser.h new file mode 100644 index 0000000..e15e733 --- /dev/null +++ b/src/PKGrammarParser.h @@ -0,0 +1,83 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface PKGrammarParser : NSObject { + id assembler; + PKCollectionParser *statementParser; + PKCollectionParser *declarationParser; + PKCollectionParser *callbackParser; + PKCollectionParser *selectorParser; + PKCollectionParser *exprParser; + PKCollectionParser *termParser; + PKCollectionParser *orTermParser; + PKCollectionParser *factorParser; + PKCollectionParser *nextFactorParser; + PKCollectionParser *phraseParser; + PKCollectionParser *phraseStarParser; + PKCollectionParser *phrasePlusParser; + PKCollectionParser *phraseQuestionParser; + PKCollectionParser *phraseCardinalityParser; + PKCollectionParser *cardinalityParser; + PKCollectionParser *primaryExprParser; + PKCollectionParser *negatedPrimaryExprParser; + PKCollectionParser *barePrimaryExprParser; + PKCollectionParser *predicateParser; + PKCollectionParser *intersectionParser; + PKCollectionParser *differenceParser; + PKCollectionParser *atomicValueParser; + PKCollectionParser *parserParser; + PKCollectionParser *discardParser; + PKCollectionParser *patternParser; + PKCollectionParser *delimitedStringParser; + PKParser *literalParser; + PKParser *variableParser; + PKParser *constantParser; +} + +- (id)initWithAssembler:(id)a; + +@property (nonatomic, retain) PKCollectionParser *statementParser; +@property (nonatomic, retain) PKCollectionParser *declarationParser; +@property (nonatomic, retain) PKCollectionParser *callbackParser; +@property (nonatomic, retain) PKCollectionParser *selectorParser; +@property (nonatomic, retain) PKCollectionParser *exprParser; +@property (nonatomic, retain) PKCollectionParser *termParser; +@property (nonatomic, retain) PKCollectionParser *orTermParser; +@property (nonatomic, retain) PKCollectionParser *factorParser; +@property (nonatomic, retain) PKCollectionParser *nextFactorParser; +@property (nonatomic, retain) PKCollectionParser *phraseParser; +@property (nonatomic, retain) PKCollectionParser *phraseStarParser; +@property (nonatomic, retain) PKCollectionParser *phrasePlusParser; +@property (nonatomic, retain) PKCollectionParser *phraseQuestionParser; +@property (nonatomic, retain) PKCollectionParser *phraseCardinalityParser; +@property (nonatomic, retain) PKCollectionParser *cardinalityParser; +@property (nonatomic, retain) PKCollectionParser *primaryExprParser; +@property (nonatomic, retain) PKCollectionParser *negatedPrimaryExprParser; +@property (nonatomic, retain) PKCollectionParser *barePrimaryExprParser; +@property (nonatomic, retain) PKCollectionParser *predicateParser; +@property (nonatomic, retain) PKCollectionParser *intersectionParser; +@property (nonatomic, retain) PKCollectionParser *differenceParser; +@property (nonatomic, retain) PKCollectionParser *atomicValueParser; +@property (nonatomic, retain) PKCollectionParser *parserParser; +@property (nonatomic, retain) PKCollectionParser *discardParser; +@property (nonatomic, retain) PKCollectionParser *patternParser; +@property (nonatomic, retain) PKCollectionParser *delimitedStringParser; +@property (nonatomic, retain) PKParser *literalParser; +@property (nonatomic, retain) PKParser *variableParser; +@property (nonatomic, retain) PKParser *constantParser; +@property (nonatomic, retain, readonly) PKParser *whitespaceParser; +@property (nonatomic, retain, readonly) PKCollectionParser *optionalWhitespaceParser; +@end diff --git a/src/PKGrammarParser.m b/src/PKGrammarParser.m new file mode 100644 index 0000000..e07292a --- /dev/null +++ b/src/PKGrammarParser.m @@ -0,0 +1,646 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKGrammarParser.h" +#import + +@interface NSObject (PKGrammarParserAdditions) +- (void)didMatchStatement:(PKAssembly *)a; +- (void)didMatchCallback:(PKAssembly *)a; +- (void)didMatchExpression:(PKAssembly *)a; +- (void)didMatchAnd:(PKAssembly *)a; +- (void)didMatchIntersection:(PKAssembly *)a; +- (void)didMatchDifference:(PKAssembly *)a; +- (void)didMatchPatternOptions:(PKAssembly *)a; +- (void)didMatchPattern:(PKAssembly *)a; +- (void)didMatchDiscard:(PKAssembly *)a; +- (void)didMatchLiteral:(PKAssembly *)a; +- (void)didMatchVariable:(PKAssembly *)a; +- (void)didMatchConstant:(PKAssembly *)a; +- (void)didMatchDelimitedString:(PKAssembly *)a; +- (void)didMatchNum:(PKAssembly *)a; +- (void)didMatchStar:(PKAssembly *)a; +- (void)didMatchPlus:(PKAssembly *)a; +- (void)didMatchQuestion:(PKAssembly *)a; +- (void)didMatchPhraseCardinality:(PKAssembly *)a; +- (void)didMatchCardinality:(PKAssembly *)a; +- (void)didMatchOr:(PKAssembly *)a; +- (void)didMatchNegation:(PKAssembly *)a; +@end + +@interface PKGrammarParser () +- (PKAlternation *)zeroOrOne:(PKParser *)p; +- (PKSequence *)oneOrMore:(PKParser *)p; +@end + +@implementation PKGrammarParser + +- (id)initWithAssembler:(id)a { + if (self = [super init]) { + assembler = a; + } + return self; +} + + +- (void)dealloc { + assembler = nil; // appease clang static analyzer + + PKReleaseSubparserTree(statementParser); + PKReleaseSubparserTree(exprParser); + + self.statementParser = nil; + self.declarationParser = nil; + self.callbackParser = nil; + self.selectorParser = nil; + self.exprParser = nil; + self.termParser = nil; + self.orTermParser = nil; + self.factorParser = nil; + self.nextFactorParser = nil; + self.phraseParser = nil; + self.phraseStarParser = nil; + self.phrasePlusParser = nil; + self.phraseQuestionParser = nil; + self.phraseCardinalityParser = nil; + self.cardinalityParser = nil; + self.primaryExprParser = nil; + self.negatedPrimaryExprParser = nil; + self.barePrimaryExprParser = nil; + self.predicateParser = nil; + self.intersectionParser = nil; + self.differenceParser = nil; + self.atomicValueParser = nil; + self.parserParser = nil; + self.discardParser = nil; + self.patternParser = nil; + self.delimitedStringParser = nil; + self.literalParser = nil; + self.variableParser = nil; + self.constantParser = nil; + [super dealloc]; +} + + +- (PKAlternation *)zeroOrOne:(PKParser *)p { + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:p]; + return a; +} + + +- (PKSequence *)oneOrMore:(PKParser *)p { + PKSequence *s = [PKSequence sequence]; + [s add:p]; + [s add:[PKRepetition repetitionWithSubparser:p]]; + return s; +} + + +// @start = statement*; +// satement = S* declaration S* '=' expr; +// callback = S* '(' S* selector S* ')'; +// selector = Word ':'; +// expr = S* term orTerm* S*; +// term = factor nextFactor*; +// orTerm = S* '|' S* term; +// factor = phrase | phraseStar | phrasePlus | phraseQuestion | phraseCardinality; +// nextFactor = S factor; + +// phrase = primaryExpr predicate*; +// phraseStar = phrase S* '*'; +// phrasePlus = phrase S* '+'; +// phraseQuestion = phrase S* '?'; +// phraseCardinality = phrase S* cardinality; +// cardinality = '{' S* Number (S* ',' S* Number)? S* '}'; + +// predicate = S* (intersection | difference); +// intersection = '&' S* primaryExpr; +// difference = '-' S* primaryExpr; + +// primaryExpr = negatedPrimaryExpr | barePrimaryExpr; +// negatedPrimaryExpr = '~' barePrimaryExpr; +// barePrimaryExpr = atomicValue | '(' expr ')'; +// atomicValue = parser discard?; +// parser = pattern | literal | variable | constant | delimitedString; +// discard = S* '!'; +// pattern = DelimitedString('/', '/') (Word & /[imxsw]+/)?; +// delimitedString = 'DelimitedString' S* '(' S* QuotedString (S* ',' QuotedString)? S* ')'; +// literal = QuotedString; +// variable = LowercaseWord; +// constant = UppercaseWord; + + +// satement = S* declaration S* '=' expr; +- (PKCollectionParser *)statementParser { + if (!statementParser) { + self.statementParser = [PKSequence sequence]; + statementParser.name = @"statement"; + [statementParser add:self.optionalWhitespaceParser]; + + PKTrack *tr = [PKTrack track]; + [tr add:self.declarationParser]; + [tr add:self.optionalWhitespaceParser]; + [tr add:[PKSymbol symbolWithString:@"="]]; + + // accept any tokens in the parser expr the first time around. just gather tokens for later + [tr add:[self oneOrMore:[PKAny any]]]; + + [statementParser add:tr]; + [statementParser setAssembler:assembler selector:@selector(didMatchStatement:)]; + } + return statementParser; +} + + +// declaration = Word callback?; +- (PKCollectionParser *)declarationParser { + if (!declarationParser) { + self.declarationParser = [PKSequence sequence]; + declarationParser.name = @"declaration"; + [declarationParser add:[PKWord word]]; + [declarationParser add:[self zeroOrOne:self.callbackParser]]; + } + return declarationParser; +} + + +// callback = S* '(' S* selector S* ')'; +- (PKCollectionParser *)callbackParser { + if (!callbackParser) { + self.callbackParser = [PKSequence sequence]; + callbackParser.name = @"callback"; + [callbackParser add:self.optionalWhitespaceParser]; + + PKTrack *tr = [PKTrack track]; + [tr add:[[PKSymbol symbolWithString:@"("] discard]]; + [tr add:self.optionalWhitespaceParser]; + [tr add:self.selectorParser]; + [tr add:self.optionalWhitespaceParser]; + [tr add:[[PKSymbol symbolWithString:@")"] discard]]; + + [callbackParser add:tr]; + [callbackParser setAssembler:assembler selector:@selector(didMatchCallback:)]; + } + return callbackParser; +} + + +// selector = Word ':'; +- (PKCollectionParser *)selectorParser { + if (!selectorParser) { + self.selectorParser = [PKTrack track]; + selectorParser.name = @"selector"; + [selectorParser add:[PKLowercaseWord word]]; + [selectorParser add:[[PKSymbol symbolWithString:@":"] discard]]; + } + return selectorParser; +} + + +// expr = S* term orTerm* S*; +- (PKCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [PKSequence sequence]; + exprParser.name = @"expr"; + [exprParser add:self.optionalWhitespaceParser]; + [exprParser add:self.termParser]; + [exprParser add:[PKRepetition repetitionWithSubparser:self.orTermParser]]; + [exprParser add:self.optionalWhitespaceParser]; + [exprParser setAssembler:assembler selector:@selector(didMatchExpression:)]; + } + return exprParser; +} + + +// term = factor nextFactor*; +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + termParser.name = @"term"; + [termParser add:self.factorParser]; + [termParser add:[PKRepetition repetitionWithSubparser:self.nextFactorParser]]; + [termParser setAssembler:assembler selector:@selector(didMatchAnd:)]; + } + return termParser; +} + + +// orTerm = S* '|' S* term; +- (PKCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [PKSequence sequence]; + orTermParser.name = @"orTerm"; + [orTermParser add:self.optionalWhitespaceParser]; + + PKTrack *tr = [PKTrack track]; + [tr add:[PKSymbol symbolWithString:@"|"]]; // preserve as fence + [tr add:self.optionalWhitespaceParser]; + [tr add:self.termParser]; + + [orTermParser add:tr]; + [orTermParser setAssembler:assembler selector:@selector(didMatchOr:)]; + } + return orTermParser; +} + + +// factor = phrase | phraseStar | phrasePlus | phraseQuestion | phraseCardinality; +- (PKCollectionParser *)factorParser { + if (!factorParser) { + self.factorParser = [PKAlternation alternation]; + factorParser.name = @"factor"; + [factorParser add:self.phraseParser]; + [factorParser add:self.phraseStarParser]; + [factorParser add:self.phrasePlusParser]; + [factorParser add:self.phraseQuestionParser]; + [factorParser add:self.phraseCardinalityParser]; + } + return factorParser; +} + + +// nextFactor = S factor; +- (PKCollectionParser *)nextFactorParser { + if (!nextFactorParser) { + self.nextFactorParser = [PKSequence sequence]; + nextFactorParser.name = @"nextFactor"; + [nextFactorParser add:self.whitespaceParser]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:self.phraseParser]; + [a add:self.phraseStarParser]; + [a add:self.phrasePlusParser]; + [a add:self.phraseQuestionParser]; + [a add:self.phraseCardinalityParser]; + + [nextFactorParser add:a]; + } + return nextFactorParser; +} + + +// phrase = primaryExpr predicate*; +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + self.phraseParser = [PKSequence sequence]; + phraseParser.name = @"phrase"; + [phraseParser add:self.primaryExprParser]; + [phraseParser add:[PKRepetition repetitionWithSubparser:self.predicateParser]]; + } + return phraseParser; +} + + +// primaryExpr = negatedPrimaryExpr | barePrimaryExpr; +- (PKCollectionParser *)primaryExprParser { + if (!primaryExprParser) { + self.primaryExprParser = [PKAlternation alternation]; + primaryExprParser.name = @"primaryExpr"; + [primaryExprParser add:self.negatedPrimaryExprParser]; + [primaryExprParser add:self.barePrimaryExprParser]; + } + return primaryExprParser; +} + + +// negatedPrimaryExpr = '~' barePrimaryExpr; +- (PKCollectionParser *)negatedPrimaryExprParser { + if (!negatedPrimaryExprParser) { + self.negatedPrimaryExprParser = [PKSequence sequence]; + negatedPrimaryExprParser.name = @"negatedPrimaryExpr"; + [negatedPrimaryExprParser add:[[PKLiteral literalWithString:@"~"] discard]]; + [negatedPrimaryExprParser add:self.barePrimaryExprParser]; + [negatedPrimaryExprParser setAssembler:assembler selector:@selector(didMatchNegation:)]; + } + return negatedPrimaryExprParser; +} + + +// barePrimaryExpr = atomicValue | '(' expr ')'; +- (PKCollectionParser *)barePrimaryExprParser { + if (!barePrimaryExprParser) { + self.barePrimaryExprParser = [PKAlternation alternation]; + barePrimaryExprParser.name = @"barePrimaryExpr"; + [barePrimaryExprParser add:self.atomicValueParser]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:self.exprParser]; + [s add:[[PKSymbol symbolWithString:@")"] discard]]; + + [barePrimaryExprParser add:s]; + } + return barePrimaryExprParser; +} + + +// predicate = S* (intersection | difference); +- (PKCollectionParser *)predicateParser { + if (!predicateParser) { + self.predicateParser = [PKSequence sequence]; + predicateParser.name = @"predicate"; + [predicateParser add:self.optionalWhitespaceParser]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:self.intersectionParser]; + [a add:self.differenceParser]; + + [predicateParser add:a]; + } + return predicateParser; +} + + +// intersection = '&' S* primaryExpr; +- (PKCollectionParser *)intersectionParser { + if (!intersectionParser) { + self.intersectionParser = [PKTrack track]; + intersectionParser.name = @"intersection"; + + PKTrack *tr = [PKTrack track]; + [tr add:[[PKSymbol symbolWithString:@"&"] discard]]; + [tr add:self.optionalWhitespaceParser]; + [tr add:self.primaryExprParser]; + + [intersectionParser add:tr]; + [intersectionParser setAssembler:assembler selector:@selector(didMatchIntersection:)]; + } + return intersectionParser; +} + + +// difference = '-' S* primaryExpr; +- (PKCollectionParser *)differenceParser { + if (!differenceParser) { + self.differenceParser = [PKTrack track]; + differenceParser.name = @"difference"; + + PKTrack *tr = [PKTrack track]; + [tr add:[[PKSymbol symbolWithString:@"-"] discard]]; + [tr add:self.optionalWhitespaceParser]; + [tr add:self.primaryExprParser]; + + [differenceParser add:tr]; + [differenceParser setAssembler:assembler selector:@selector(didMatchDifference:)]; + } + return differenceParser; +} + + +// phraseStar = phrase S* '*'; +- (PKCollectionParser *)phraseStarParser { + if (!phraseStarParser) { + self.phraseStarParser = [PKSequence sequence]; + phraseStarParser.name = @"phraseStar"; + [phraseStarParser add:self.phraseParser]; + [phraseStarParser add:self.optionalWhitespaceParser]; + [phraseStarParser add:[[PKSymbol symbolWithString:@"*"] discard]]; + [phraseStarParser setAssembler:assembler selector:@selector(didMatchStar:)]; + } + return phraseStarParser; +} + + +// phrasePlus = phrase S* '+'; +- (PKCollectionParser *)phrasePlusParser { + if (!phrasePlusParser) { + self.phrasePlusParser = [PKSequence sequence]; + phrasePlusParser.name = @"phrasePlus"; + [phrasePlusParser add:self.phraseParser]; + [phrasePlusParser add:self.optionalWhitespaceParser]; + [phrasePlusParser add:[[PKSymbol symbolWithString:@"+"] discard]]; + [phrasePlusParser setAssembler:assembler selector:@selector(didMatchPlus:)]; + } + return phrasePlusParser; +} + + +// phraseQuestion = phrase S* '?'; +- (PKCollectionParser *)phraseQuestionParser { + if (!phraseQuestionParser) { + self.phraseQuestionParser = [PKSequence sequence]; + phraseQuestionParser.name = @"phraseQuestion"; + [phraseQuestionParser add:self.phraseParser]; + [phraseQuestionParser add:self.optionalWhitespaceParser]; + [phraseQuestionParser add:[[PKSymbol symbolWithString:@"?"] discard]]; + [phraseQuestionParser setAssembler:assembler selector:@selector(didMatchQuestion:)]; + } + return phraseQuestionParser; +} + + +// phraseCardinality = phrase S* cardinality; +- (PKCollectionParser *)phraseCardinalityParser { + if (!phraseCardinalityParser) { + self.phraseCardinalityParser = [PKSequence sequence]; + phraseCardinalityParser.name = @"phraseCardinality"; + [phraseCardinalityParser add:self.phraseParser]; + [phraseCardinalityParser add:self.optionalWhitespaceParser]; + [phraseCardinalityParser add:self.cardinalityParser]; + [phraseCardinalityParser setAssembler:assembler selector:@selector(didMatchPhraseCardinality:)]; + } + return phraseCardinalityParser; +} + + +// cardinality = '{' S* Number (S* ',' S* Number)? S* '}'; +- (PKCollectionParser *)cardinalityParser { + if (!cardinalityParser) { + self.cardinalityParser = [PKSequence sequence]; + cardinalityParser.name = @"cardinality"; + + PKTrack *commaNum = [PKSequence sequence]; + [commaNum add:self.optionalWhitespaceParser]; + [commaNum add:[[PKSymbol symbolWithString:@","] discard]]; + [commaNum add:self.optionalWhitespaceParser]; + [commaNum add:[PKNumber number]]; + + PKTrack *tr = [PKTrack track]; + [tr add:[PKSymbol symbolWithString:@"{"]]; // serves as fence. dont discard + [tr add:self.optionalWhitespaceParser]; + [tr add:[PKNumber number]]; + [tr add:[self zeroOrOne:commaNum]]; + [tr add:self.optionalWhitespaceParser]; + [tr add:[[PKSymbol symbolWithString:@"}"] discard]]; + + [cardinalityParser add:tr]; + [cardinalityParser setAssembler:assembler selector:@selector(didMatchCardinality:)]; + } + return cardinalityParser; +} + + +// atomicValue = parser discard?; +- (PKCollectionParser *)atomicValueParser { + if (!atomicValueParser) { + self.atomicValueParser = [PKSequence sequence]; + atomicValueParser.name = @"atomicValue"; + [atomicValueParser add:self.parserParser]; + [atomicValueParser add:[self zeroOrOne:self.discardParser]]; + } + return atomicValueParser; +} + + +// parser = pattern | literal | variable | constant | delimitedString; +- (PKCollectionParser *)parserParser { + if (!parserParser) { + self.parserParser = [PKAlternation alternation]; + parserParser.name = @"parser"; + [parserParser add:self.patternParser]; + [parserParser add:self.literalParser]; + [parserParser add:self.variableParser]; + [parserParser add:self.constantParser]; + [parserParser add:self.delimitedStringParser]; + } + return parserParser; +} + + +// discard = S* '!'; +- (PKCollectionParser *)discardParser { + if (!discardParser) { + self.discardParser = [PKSequence sequence]; + discardParser.name = @"discard"; + [discardParser add:self.optionalWhitespaceParser]; + [discardParser add:[[PKSymbol symbolWithString:@"!"] discard]]; + [discardParser setAssembler:assembler selector:@selector(didMatchDiscard:)]; + } + return discardParser; +} + + +// pattern = DelimitedString('/', '/') (Word & /[imxsw]+/)?; +- (PKCollectionParser *)patternParser { + if (!patternParser) { + patternParser.name = @"pattern"; + self.patternParser = [PKSequence sequence]; + [patternParser add:[PKDelimitedString delimitedStringWithStartMarker:@"/" endMarker:@"/"]]; + + PKParser *opts = [PKPattern patternWithString:@"[imxsw]+" options:PKPatternOptionsNone]; + PKIntersection *inter = [PKIntersection intersection]; + [inter add:[PKWord word]]; + [inter add:opts]; + [inter setAssembler:assembler selector:@selector(didMatchPatternOptions:)]; + + [patternParser add:[self zeroOrOne:inter]]; + [patternParser setAssembler:assembler selector:@selector(didMatchPattern:)]; + } + return patternParser; +} + + +// delimitedString = 'DelimitedString' S* '(' S* QuotedString (S* ',' QuotedString)? S* ')'; +- (PKCollectionParser *)delimitedStringParser { + if (!delimitedStringParser) { + self.delimitedStringParser = [PKTrack track]; + delimitedStringParser.name = @"delimitedString"; + + PKSequence *secondArg = [PKSequence sequence]; + [secondArg add:self.optionalWhitespaceParser]; + + PKTrack *tr = [PKTrack track]; + [tr add:[[PKSymbol symbolWithString:@","] discard]]; + [tr add:self.optionalWhitespaceParser]; + [tr add:[PKQuotedString quotedString]]; // endMarker + [secondArg add:tr]; + + [delimitedStringParser add:[[PKLiteral literalWithString:@"DelimitedString"] discard]]; + [delimitedStringParser add:self.optionalWhitespaceParser]; + [delimitedStringParser add:[PKSymbol symbolWithString:@"("]]; // preserve as fence + [delimitedStringParser add:self.optionalWhitespaceParser]; + [delimitedStringParser add:[PKQuotedString quotedString]]; // startMarker + [delimitedStringParser add:[self zeroOrOne:secondArg]]; + [delimitedStringParser add:self.optionalWhitespaceParser]; + [delimitedStringParser add:[[PKSymbol symbolWithString:@")"] discard]]; + + [delimitedStringParser setAssembler:assembler selector:@selector(didMatchDelimitedString:)]; + } + return delimitedStringParser; +} + + +// literal = QuotedString; +- (PKParser *)literalParser { + if (!literalParser) { + self.literalParser = [PKQuotedString quotedString]; + [literalParser setAssembler:assembler selector:@selector(didMatchLiteral:)]; + } + return literalParser; +} + + +// variable = LowercaseWord; +- (PKParser *)variableParser { + if (!variableParser) { + self.variableParser = [PKLowercaseWord word]; + variableParser.name = @"variable"; + [variableParser setAssembler:assembler selector:@selector(didMatchVariable:)]; + } + return variableParser; +} + + +// constant = UppercaseWord; +- (PKParser *)constantParser { + if (!constantParser) { + self.constantParser = [PKUppercaseWord word]; + constantParser.name = @"constant"; + [constantParser setAssembler:assembler selector:@selector(didMatchConstant:)]; + } + return constantParser; +} + + +- (PKParser *)whitespaceParser { + return [[PKWhitespace whitespace] discard]; +} + + +- (PKCollectionParser *)optionalWhitespaceParser { + return [PKRepetition repetitionWithSubparser:self.whitespaceParser]; +} + +@synthesize statementParser; +@synthesize declarationParser; +@synthesize callbackParser; +@synthesize selectorParser; +@synthesize exprParser; +@synthesize termParser; +@synthesize orTermParser; +@synthesize factorParser; +@synthesize nextFactorParser; +@synthesize phraseParser; +@synthesize phraseStarParser; +@synthesize phrasePlusParser; +@synthesize phraseQuestionParser; +@synthesize phraseCardinalityParser; +@synthesize cardinalityParser; +@synthesize primaryExprParser; +@synthesize negatedPrimaryExprParser; +@synthesize barePrimaryExprParser; +@synthesize predicateParser; +@synthesize intersectionParser; +@synthesize differenceParser; +@synthesize atomicValueParser; +@synthesize parserParser; +@synthesize discardParser; +@synthesize patternParser; +@synthesize delimitedStringParser; +@synthesize literalParser; +@synthesize variableParser; +@synthesize constantParser; +@end diff --git a/src/PKIntersection.m b/src/PKIntersection.m new file mode 100644 index 0000000..08e9b8a --- /dev/null +++ b/src/PKIntersection.m @@ -0,0 +1,82 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKIntersection.h" +#import + +@interface NSMutableSet (PKIntersectionAdditions) +- (void)intersectSetTestingEquality:(NSSet *)s; +@end + +@implementation NSMutableSet (PKIntersectionAdditions) + +- (void)intersectSetTestingEquality:(NSSet *)s { + for (id a1 in self) { + BOOL found = NO; + for (id a2 in s) { + if ([a1 isEqual:a2]) { + found = YES; + break; + } + } + if (!found) { + [self removeObject:a1]; + } + } +} + +@end + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@interface PKCollectionParser () ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest; +@end + +@implementation PKIntersection + ++ (id)intersection { + return [self intersectionWithSubparsers:nil]; +} + + ++ (id)intersectionWithSubparsers:(PKParser *)p1, ... { + va_list vargs; + va_start(vargs, p1); + PKIntersection *inter = [self collectionParserWithFirst:p1 rest:vargs]; + va_end(vargs); + return inter; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + NSMutableSet *outAssemblies = [NSMutableSet set]; + + NSInteger i = 0; + for (PKParser *p in subparsers) { + if (0 == i++) { + outAssemblies = [[[p matchAndAssemble:inAssemblies] mutableCopy] autorelease]; + } else { + [outAssemblies intersectSetTestingEquality:[p allMatchesFor:inAssemblies]]; + } + } + + return outAssemblies; +} + +@end diff --git a/src/PKLetter.m b/src/PKLetter.m new file mode 100644 index 0000000..6aab51b --- /dev/null +++ b/src/PKLetter.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKLetter + ++ (id)letter { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKUniChar c = [obj intValue]; + return isalpha(c); +} + +@end diff --git a/src/PKLiteral.m b/src/PKLiteral.m new file mode 100644 index 0000000..e502bc1 --- /dev/null +++ b/src/PKLiteral.m @@ -0,0 +1,61 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKLiteral () +@property (nonatomic, retain) PKToken *literal; +@end + +@implementation PKLiteral + ++ (id)literalWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + //NSParameterAssert(s); + self = [super initWithString:s]; + if (self) { + self.literal = [PKToken tokenWithTokenType:PKTokenTypeWord stringValue:s floatValue:0.0]; + } + return self; +} + + +- (void)dealloc { + self.literal = nil; + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + return [literal.stringValue isEqualToString:[obj stringValue]]; + //return [literal isEqual:obj]; +} + + +- (NSString *)description { + NSString *className = [NSStringFromClass([self class]) substringFromIndex:2]; + if ([name length]) { + return [NSString stringWithFormat:@"%@ (%@) %@", className, name, literal.stringValue]; + } else { + return [NSString stringWithFormat:@"%@ %@", className, literal.stringValue]; + } +} + +@synthesize literal; +@end diff --git a/src/PKLowercaseWord.m b/src/PKLowercaseWord.m new file mode 100644 index 0000000..ddb49d1 --- /dev/null +++ b/src/PKLowercaseWord.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKLowercaseWord + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + if (!tok.isWord) { + return NO; + } + + NSString *s = tok.stringValue; + return [s length] && islower([s characterAtIndex:0]); +} + +@end diff --git a/src/PKMultiLineCommentState.m b/src/PKMultiLineCommentState.m new file mode 100644 index 0000000..87e2ec9 --- /dev/null +++ b/src/PKMultiLineCommentState.m @@ -0,0 +1,152 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (void)appendString:(NSString *)s; +- (NSString *)bufferedString; +@end + +@interface PKCommentState () +@property (nonatomic, retain) PKSymbolRootNode *rootNode; +@end + +@interface PKMultiLineCommentState () +- (void)addStartMarker:(NSString *)start endMarker:(NSString *)end; +- (void)removeStartMarker:(NSString *)start; +@property (nonatomic, retain) NSMutableArray *startMarkers; +@property (nonatomic, retain) NSMutableArray *endMarkers; +@property (nonatomic, copy) NSString *currentStartMarker; +@end + +@implementation PKMultiLineCommentState + +- (id)init { + if (self = [super init]) { + self.startMarkers = [NSMutableArray array]; + self.endMarkers = [NSMutableArray array]; + } + return self; +} + + +- (void)dealloc { + self.startMarkers = nil; + self.endMarkers = nil; + self.currentStartMarker = nil; + [super dealloc]; +} + + +- (void)addStartMarker:(NSString *)start endMarker:(NSString *)end { + NSParameterAssert([start length]); + NSParameterAssert([end length]); + [startMarkers addObject:start]; + [endMarkers addObject:end]; +} + + +- (void)removeStartMarker:(NSString *)start { + NSParameterAssert([start length]); + NSUInteger i = [startMarkers indexOfObject:start]; + if (NSNotFound != i) { + [startMarkers removeObject:start]; + [endMarkers removeObjectAtIndex:i]; // this should always be in range. + } +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + BOOL balanceEOF = t.commentState.balancesEOFTerminatedComments; + BOOL reportTokens = t.commentState.reportsCommentTokens; + if (reportTokens) { + [self resetWithReader:r]; + [self appendString:currentStartMarker]; + } + + NSUInteger i = [startMarkers indexOfObject:currentStartMarker]; + NSString *currentEndSymbol = [endMarkers objectAtIndex:i]; + PKUniChar e = [currentEndSymbol characterAtIndex:0]; + + // get the definitions of all multi-char comment start and end symbols from the commentState + PKSymbolRootNode *rootNode = t.commentState.rootNode; + + PKUniChar c; + while (1) { + c = [r read]; + if (PKEOF == c) { + if (balanceEOF) { + [self appendString:currentEndSymbol]; + } + break; + } + + if (e == c) { + NSString *peek = [rootNode nextSymbol:r startingWith:e]; + if ([currentEndSymbol isEqualToString:peek]) { + if (reportTokens) { + [self appendString:currentEndSymbol]; + } + c = [r read]; + break; + } else { + [r unread:[peek length] - 1]; + if (e != [peek characterAtIndex:0]) { + if (reportTokens) { + [self append:c]; + } + c = [r read]; + } + } + } + if (reportTokens) { + [self append:c]; + } + } + + if (PKEOF != c) { + [r unread]; + } + + self.currentStartMarker = nil; + + if (reportTokens) { + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeComment stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; + } else { + return [t nextToken]; + } +} + +@synthesize startMarkers; +@synthesize endMarkers; +@synthesize currentStartMarker; +@end diff --git a/src/PKNegation.m b/src/PKNegation.m new file mode 100644 index 0000000..1f68afe --- /dev/null +++ b/src/PKNegation.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKNegation.h" +#import +#import + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@interface PKNegation () +@property (nonatomic, retain, readwrite) PKParser *subparser; +@property (nonatomic, retain) PKParser *difference; +@end + +@implementation PKNegation + ++ (id)negationWithSubparser:(PKParser *)s { + return [[[self alloc] initWithSubparser:s] autorelease]; +} + + +- (id)initWithSubparser:(PKParser *)s { + if (self = [super init]) { + self.subparser = s; + self.difference = [PKDifference differenceWithSubparser:[PKAny any] minus:subparser]; + } + return self; +} + + +- (void)dealloc { + self.subparser = nil; + self.difference = nil; + [super dealloc]; +} + + +- (PKParser *)parserNamed:(NSString *)s { + if ([name isEqualToString:s]) { + return self; + } else { + return [subparser parserNamed:s]; + } +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + + return [difference allMatchesFor:inAssemblies]; +} + +@synthesize subparser; +@synthesize difference; +@end diff --git a/src/PKNumber.m b/src/PKNumber.m new file mode 100644 index 0000000..82b8a63 --- /dev/null +++ b/src/PKNumber.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKNumber + ++ (id)number { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isNumber; +} + +@end \ No newline at end of file diff --git a/src/PKNumberState.m b/src/PKNumberState.m new file mode 100644 index 0000000..f941f12 --- /dev/null +++ b/src/PKNumberState.m @@ -0,0 +1,264 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface PKNumberState () +- (CGFloat)absorbDigitsFromReader:(PKReader *)r; +- (CGFloat)value; +- (void)parseLeftSideFromReader:(PKReader *)r; +- (void)parseRightSideFromReader:(PKReader *)r; +- (void)parseExponentFromReader:(PKReader *)r; +- (void)reset:(PKUniChar)cin; +- (void)checkForHex:(PKReader *)r; +- (void)checkForOctal; +@end + +@implementation PKNumberState + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + [self resetWithReader:r]; + isNegative = NO; + originalCin = cin; + + if ('-' == cin) { + isNegative = YES; + cin = [r read]; + [self append:'-']; + } else if ('+' == cin) { + cin = [r read]; + [self append:'+']; + } + + [self reset:cin]; + if ('.' == c) { + [self parseRightSideFromReader:r]; + } else { + [self parseLeftSideFromReader:r]; + if (isDecimal) { + [self parseRightSideFromReader:r]; + } + } + + // erroneous ., +, -, or 0x + if (!gotADigit) { + if (isHex) { + [r unread]; + return [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:@"0" floatValue:0.0]; + } else { + if (isNegative && PKEOF != c) { // ?? + [r unread]; + } + return [t.symbolState nextTokenFromReader:r startingWith:originalCin tokenizer:t]; + } + } + + if (PKEOF != c) { + [r unread]; + } + + if (isNegative) { + floatValue = -floatValue; + } + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:[self bufferedString] floatValue:[self value]]; + tok.offset = offset; + return tok; +} + + +- (CGFloat)value { + CGFloat result = (CGFloat)floatValue; + + NSUInteger i = 0; + for ( ; i < exp; i++) { + if (isNegativeExp) { + result /= (CGFloat)10.0; + } else { + result *= (CGFloat)10.0; + } + } + + return (CGFloat)result; +} + + +- (CGFloat)absorbDigitsFromReader:(PKReader *)r { + CGFloat divideBy = 1.0; + CGFloat v = 0.0; + BOOL isHexAlpha = NO; + + while (1) { + isHexAlpha = NO; + if (allowsHexadecimalNotation) { + [self checkForHex:r]; + if (c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F') { + isHexAlpha = YES; + } + } + + if (isdigit(c) || isHexAlpha) { + [self append:c]; + len++; + gotADigit = YES; + + if (allowsOctalNotation) { + [self checkForOctal]; + } + + if (isHexAlpha) { + if (c >= 'a' && c <= 'f') { + c = toupper(c); + } + c -= 7; + } + v = v * base + (c - '0'); + c = [r read]; + if (isFraction) { + divideBy *= base; + } + } else { + break; + } + } + + if (isFraction) { + v = v / divideBy; + } + + return (CGFloat)v; +} + + +- (void)parseLeftSideFromReader:(PKReader *)r { + isFraction = NO; + floatValue = [self absorbDigitsFromReader:r]; +} + + +- (void)parseRightSideFromReader:(PKReader *)r { + if ('.' == c) { + PKUniChar n = [r read]; + BOOL nextIsDigit = isdigit(n); + if (PKEOF != n) { + [r unread]; + } + + if (nextIsDigit || allowsTrailingDot) { + [self append:'.']; + if (nextIsDigit) { + c = [r read]; + isFraction = YES; + floatValue += [self absorbDigitsFromReader:r]; + } + } + } + + if (allowsScientificNotation) { + [self parseExponentFromReader:r]; + } +} + + +- (void)parseExponentFromReader:(PKReader *)r { + NSParameterAssert(r); + if ('e' == c || 'E' == c) { + PKUniChar e = c; + c = [r read]; + + BOOL hasExp = isdigit(c); + isNegativeExp = ('-' == c); + BOOL positiveExp = ('+' == c); + + if (!hasExp && (isNegativeExp || positiveExp)) { + c = [r read]; + hasExp = isdigit(c); + } + if (PKEOF != c) { + [r unread]; + } + if (hasExp) { + [self append:e]; + if (isNegativeExp) { + [self append:'-']; + } else if (positiveExp) { + [self append:'+']; + } + c = [r read]; + isFraction = NO; + exp = [self absorbDigitsFromReader:r]; + } + } +} + + +- (void)reset:(PKUniChar)cin { + c = cin; + firstNum = cin; + gotADigit = NO; + isFraction = NO; + isDecimal = YES; + isHex = NO; + len = 0; + base = (CGFloat)10.0; + floatValue = (CGFloat)0.0; + exp = (CGFloat)0.0; + isNegativeExp = NO; +} + + +- (void)checkForHex:(PKReader *)r { + if ('x' == c && '0' == firstNum && !isFraction && 1 == len) { + [self append:c]; + len++; + c = [r read]; + isDecimal = NO; + base = (CGFloat)16.0; + isHex = YES; + gotADigit = NO; + } +} + + +- (void)checkForOctal { + if ('0' == firstNum && !isFraction && isDecimal && 2 == len) { + isDecimal = NO; + base = (CGFloat)8.0; + } +} + +@synthesize allowsTrailingDot; +@synthesize allowsScientificNotation; +@synthesize allowsOctalNotation; +@synthesize allowsHexadecimalNotation; +@end diff --git a/src/PKParser.m b/src/PKParser.m new file mode 100644 index 0000000..a3add8f --- /dev/null +++ b/src/PKParser.m @@ -0,0 +1,203 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import + +@interface PKAssembly () +- (BOOL)hasMore; +@property (nonatomic, readonly) NSUInteger objectsConsumed; +@end + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (PKAssembly *)best:(NSSet *)inAssemblies; +@end + +@interface PKParser (PKParserFactoryAdditionsFriend) +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@implementation PKParser + ++ (id)parser { + return [[[self alloc] init] autorelease]; +} + + +- (void)dealloc { +#ifdef TARGET_OS_SNOW_LEOPARD + self.assemblerBlock = nil; + self.preassemblerBlock = nil; +#endif + self.assembler = nil; + self.assemblerSelector = nil; + self.preassembler = nil; + self.preassemblerSelector = nil; + self.name = nil; + self.tokenizer = nil; + [super dealloc]; +} + + +- (void)setAssembler:(id)a selector:(SEL)sel { + self.assembler = a; + self.assemblerSelector = sel; +} + + +- (void)setPreassembler:(id)a selector:(SEL)sel { + self.preassembler = a; + self.preassemblerSelector = sel; +} + + +- (PKParser *)parserNamed:(NSString *)s { + if ([name isEqualToString:s]) { + return self; + } + return nil; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSAssert1(0, @"-[PKParser %s] must be overriden", _cmd); + return nil; +} + + +- (PKAssembly *)bestMatchFor:(PKAssembly *)a { + NSParameterAssert(a); + NSSet *initialState = [NSSet setWithObject:a]; + NSSet *finalState = [self matchAndAssemble:initialState]; + return [self best:finalState]; +} + + +- (PKAssembly *)completeMatchFor:(PKAssembly *)a { + NSParameterAssert(a); + PKAssembly *best = [self bestMatchFor:a]; + if (best && ![best hasMore]) { + return best; + } + return nil; +} + + +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + +#ifdef TARGET_OS_SNOW_LEOPARD + if (preassemblerBlock) { + for (PKAssembly *a in inAssemblies) { + preassemblerBlock(a); + } + } else +#endif + if (preassembler) { + NSAssert2([preassembler respondsToSelector:preassemblerSelector], @"provided preassembler %@ should respond to %s", preassembler, preassemblerSelector); + for (PKAssembly *a in inAssemblies) { + [preassembler performSelector:preassemblerSelector withObject:a]; + } + } + + NSSet *outAssemblies = [self allMatchesFor:inAssemblies]; + +#ifdef TARGET_OS_SNOW_LEOPARD + if (assemblerBlock) { + for (PKAssembly *a in outAssemblies) { + assemblerBlock(a); + } + } else +#endif + if (assembler) { + NSAssert2([assembler respondsToSelector:assemblerSelector], @"provided assembler %@ should respond to %s", assembler, assemblerSelector); + for (PKAssembly *a in outAssemblies) { + [assembler performSelector:assemblerSelector withObject:a]; + } + } + return outAssemblies; +} + + +- (PKAssembly *)best:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + PKAssembly *best = nil; + + for (PKAssembly *a in inAssemblies) { + if (![a hasMore]) { + best = a; + break; + } + if (!best || a.objectsConsumed > best.objectsConsumed) { + best = a; + } + } + + return best; +} + + +- (NSString *)description { + NSString *className = [NSStringFromClass([self class]) substringFromIndex:2]; + if ([name length]) { + return [NSString stringWithFormat:@"%@ (%@)", className, name]; + } else { + return [NSString stringWithFormat:@"%@", className]; + } +} + +#ifdef TARGET_OS_SNOW_LEOPARD +@synthesize assemblerBlock; +@synthesize preassemblerBlock; +#endif +@synthesize assembler; +@synthesize assemblerSelector; +@synthesize preassembler; +@synthesize preassemblerSelector; +@synthesize name; +@end + +@implementation PKParser (PKParserFactoryAdditions) + +- (id)parse:(NSString *)s { + PKTokenizer *t = self.tokenizer; + if (!t) { + t = [PKTokenizer tokenizer]; + } + t.string = s; + PKAssembly *a = [self completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + if (a.target) { + return a.target; + } else { + return [a pop]; + } +} + + +- (PKTokenizer *)tokenizer { + return [[tokenizer retain] autorelease]; +} + + +- (void)setTokenizer:(PKTokenizer *)t { + if (tokenizer != t) { + [tokenizer autorelease]; + tokenizer = [t retain]; + } +} + +@end diff --git a/src/PKParserFactory.m b/src/PKParserFactory.m new file mode 100644 index 0000000..4f16b59 --- /dev/null +++ b/src/PKParserFactory.m @@ -0,0 +1,979 @@ +// +// PKParserFactory.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2009 Todd Ditchendorf All rights reserved. +// + +#import "PKParserFactory.h" +#import +#import "PKGrammarParser.h" +#import "NSString+ParseKitAdditions.h" +#import "NSArray+ParseKitAdditions.h" + +@interface PKParser (PKParserFactoryAdditionsFriend) +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@interface PKCollectionParser () +@property (nonatomic, readwrite, retain) NSMutableArray *subparsers; +@end + +@interface PKRepetition () +@property (nonatomic, readwrite, retain) PKParser *subparser; +@end + +@interface PKNegation () +@property (nonatomic, readwrite, retain) PKParser *subparser; +@end + +@interface PKDifference () +@property (nonatomic, readwrite, retain) PKParser *subparser; +@property (nonatomic, readwrite, retain) PKParser *minus; +@end + +@interface PKPattern () +@property (nonatomic, assign) PKTokenType tokenType; +@end + +void PKReleaseSubparserTree(PKParser *p) { + if ([p isKindOfClass:[PKCollectionParser class]]) { + PKCollectionParser *c = (PKCollectionParser *)p; + NSArray *subs = c.subparsers; + if (subs) { + [subs retain]; + c.subparsers = nil; + for (PKParser *s in subs) { + PKReleaseSubparserTree(s); + } + [subs release]; + } + } else if ([p isMemberOfClass:[PKRepetition class]]) { + PKRepetition *r = (PKRepetition *)p; + PKParser *sub = r.subparser; + if (sub) { + [sub retain]; + r.subparser = nil; + PKReleaseSubparserTree(sub); + [sub release]; + } + } else if ([p isMemberOfClass:[PKNegation class]]) { + PKNegation *n = (PKNegation *)p; + PKParser *sub = n.subparser; + if (sub) { + [sub retain]; + n.subparser = nil; + PKReleaseSubparserTree(sub); + [sub release]; + } + } else if ([p isMemberOfClass:[PKDifference class]]) { + PKDifference *d = (PKDifference *)p; + PKParser *sub = d.subparser; + if (sub) { + [sub retain]; + d.subparser = nil; + PKReleaseSubparserTree(sub); + [sub release]; + } + PKParser *m = d.minus; + if (m) { + [m retain]; + d.minus = nil; + PKReleaseSubparserTree(m); + [m release]; + } + } +} + +@interface PKParserFactory () +- (PKTokenizer *)tokenizerForParsingGrammar; +- (BOOL)isAllWhitespace:(NSArray *)toks; +- (id)parserTokensTableFromParsingStatementsInString:(NSString *)s; +- (void)gatherParserClassNamesFromTokens; +- (NSString *)parserClassNameFromTokenArray:(NSArray *)toks; + +- (PKTokenizer *)tokenizerFromGrammarSettings; +- (BOOL)boolForTokenForKey:(NSString *)key; +- (void)setTokenizerState:(PKTokenizerState *)state onTokenizer:(PKTokenizer *)t forTokensForKey:(NSString *)key; +- (void)setFallbackStateOn:(PKTokenizerState *)state withTokenizer:(PKTokenizer *)t forTokensForKey:(NSString *)key; + +- (id)expandParser:(PKParser *)p fromTokenArray:(NSArray *)toks; +- (PKParser *)expandedParserForName:(NSString *)parserName; +- (void)setAssemblerForParser:(PKParser *)p; +- (NSArray *)tokens:(NSArray *)toks byRemovingTokensOfType:(PKTokenType)tt; +- (NSString *)defaultAssemblerSelectorNameForParserName:(NSString *)parserName; +- (NSString *)defaultPreassemblerSelectorNameForParserName:(NSString *)parserName; + +// this is only for unit tests? can it go away? +- (PKSequence *)parserFromExpression:(NSString *)s; + +- (PKAlternation *)zeroOrOne:(PKParser *)p; +- (PKSequence *)oneOrMore:(PKParser *)p; + +- (void)didMatchStatement:(PKAssembly *)a; +- (void)didMatchCallback:(PKAssembly *)a; +- (void)didMatchExpression:(PKAssembly *)a; +- (void)didMatchAnd:(PKAssembly *)a; +- (void)didMatchIntersection:(PKAssembly *)a; +- (void)didMatchDifference:(PKAssembly *)a; +- (void)didMatchPatternOptions:(PKAssembly *)a; +- (void)didMatchPattern:(PKAssembly *)a; +- (void)didMatchDiscard:(PKAssembly *)a; +- (void)didMatchLiteral:(PKAssembly *)a; +- (void)didMatchVariable:(PKAssembly *)a; +- (void)didMatchConstant:(PKAssembly *)a; +- (void)didMatchDelimitedString:(PKAssembly *)a; +- (void)didMatchNum:(PKAssembly *)a; +- (void)didMatchStar:(PKAssembly *)a; +- (void)didMatchPlus:(PKAssembly *)a; +- (void)didMatchQuestion:(PKAssembly *)a; +- (void)didMatchPhraseCardinality:(PKAssembly *)a; +- (void)didMatchCardinality:(PKAssembly *)a; +- (void)didMatchOr:(PKAssembly *)a; +- (void)didMatchNegation:(PKAssembly *)a; + +@property (nonatomic, retain) PKGrammarParser *grammarParser; +@property (nonatomic, assign) id assembler; +@property (nonatomic, assign) id preassembler; +@property (nonatomic, retain) NSMutableDictionary *parserTokensTable; +@property (nonatomic, retain) NSMutableDictionary *parserClassTable; +@property (nonatomic, retain) NSMutableDictionary *selectorTable; +@property (nonatomic, retain) PKToken *equals; +@property (nonatomic, retain) PKToken *curly; +@property (nonatomic, retain) PKToken *paren; +@end + +@implementation PKParserFactory + ++ (id)factory { + return [[[PKParserFactory alloc] init] autorelease]; +} + + +- (id)init { + if (self = [super init]) { + self.grammarParser = [[[PKGrammarParser alloc] initWithAssembler:self] autorelease]; + self.equals = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"=" floatValue:0.0]; + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0.0]; + self.paren = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"(" floatValue:0.0]; + self.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnAll; + } + return self; +} + + +- (void)dealloc { + self.grammarParser = nil; + self.assembler = nil; + self.preassembler = nil; + self.parserTokensTable = nil; + self.parserClassTable = nil; + self.selectorTable = nil; + self.equals = nil; + self.curly = nil; + self.paren = nil; + [super dealloc]; +} + + +- (PKCollectionParser *)exprParser { + return grammarParser.exprParser; +} + + +- (PKParser *)parserFromGrammar:(NSString *)s assembler:(id)a { + return [self parserFromGrammar:s assembler:a preassembler:nil]; +} + + +- (PKParser *)parserFromGrammar:(NSString *)s assembler:(id)a preassembler:(id)pa { + self.assembler = a; + self.preassembler = pa; + self.selectorTable = [NSMutableDictionary dictionary]; + self.parserClassTable = [NSMutableDictionary dictionary]; + self.parserTokensTable = [self parserTokensTableFromParsingStatementsInString:s]; + + PKTokenizer *t = [self tokenizerFromGrammarSettings]; + + [self gatherParserClassNamesFromTokens]; + + PKParser *start = [self expandedParserForName:@"@start"]; + + assembler = nil; + self.selectorTable = nil; + self.parserClassTable = nil; + self.parserTokensTable = nil; + + if (start && [start isKindOfClass:[PKParser class]]) { + start.tokenizer = t; + return start; + } else { + [NSException raise:@"GrammarException" format:@"The provided language grammar was invalid"]; + return nil; + } +} + + +- (PKTokenizer *)tokenizerForParsingGrammar { + PKTokenizer *t = [PKTokenizer tokenizer]; + + t.whitespaceState.reportsWhitespaceTokens = YES; + + // customize tokenizer to find tokenizer customization directives + [t setTokenizerState:t.wordState from:'@' to:'@']; + + // add support for tokenizer directives like @commentState.fallbackState + [t.wordState setWordChars:YES from:'.' to:'.']; + [t.wordState setWordChars:NO from:'-' to:'-']; + + // setup comments + [t setTokenizerState:t.commentState from:'/' to:'/']; + [t.commentState addSingleLineStartMarker:@"//"]; + [t.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + // comment state should fallback to delimit state to match regex delimited strings + t.commentState.fallbackState = t.delimitState; + + // regex delimited strings + [t.delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:[[NSCharacterSet whitespaceCharacterSet] invertedSet]]; + + return t; +} + + +- (BOOL)isAllWhitespace:(NSArray *)toks { + for (PKToken *tok in toks) { + if (PKTokenTypeWhitespace != tok.tokenType) { + return NO; + } + } + return YES; +} + + +- (id)parserTokensTableFromParsingStatementsInString:(NSString *)s { + PKTokenizer *t = [self tokenizerForParsingGrammar]; + t.string = s; + + PKTokenArraySource *src = [[PKTokenArraySource alloc] initWithTokenizer:t delimiter:@";"]; + id target = [NSMutableDictionary dictionary]; // setup the variable lookup table + + while ([src hasMore]) { + NSArray *toks = [src nextTokenArray]; + if (![self isAllWhitespace:toks]) { + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenArray:toks]; + //a.preservesWhitespaceTokens = YES; + a.target = target; + PKAssembly *res = [grammarParser.statementParser completeMatchFor:a]; + target = res.target; + } + } + + [src release]; + + return target; +} + + +- (void)gatherParserClassNamesFromTokens { + isGatheringClasses = YES; + // discover the actual parser class types + for (NSString *parserName in parserTokensTable) { + NSString *className = [self parserClassNameFromTokenArray:[parserTokensTable objectForKey:parserName]]; + NSAssert1([className length], @"Could not build ClassName from token array for parserName: %@", parserName); + [parserClassTable setObject:className forKey:parserName]; + } + isGatheringClasses = NO; +} + + +- (NSString *)parserClassNameFromTokenArray:(NSArray *)toks { + PKAssembly *a = [PKTokenAssembly assemblyWithTokenArray:toks]; + a.target = parserTokensTable; + a = [grammarParser.exprParser completeMatchFor:a]; + PKParser *res = [a pop]; + a.target = nil; + return NSStringFromClass([res class]); +} + + +- (PKTokenizer *)tokenizerFromGrammarSettings { + PKTokenizer *t = [PKTokenizer tokenizer]; + [t.commentState removeSingleLineStartMarker:@"//"]; + [t.commentState removeMultiLineStartMarker:@"/*"]; + + t.whitespaceState.reportsWhitespaceTokens = [self boolForTokenForKey:@"@reportsWhitespaceTokens"]; + t.commentState.reportsCommentTokens = [self boolForTokenForKey:@"@reportsCommentTokens"]; + t.commentState.balancesEOFTerminatedComments = [self boolForTokenForKey:@"balancesEOFTerminatedComments"]; + t.quoteState.balancesEOFTerminatedQuotes = [self boolForTokenForKey:@"@balancesEOFTerminatedQuotes"]; + t.delimitState.balancesEOFTerminatedStrings = [self boolForTokenForKey:@"@balancesEOFTerminatedStrings"]; + t.numberState.allowsTrailingDot = [self boolForTokenForKey:@"@allowsTrailingDot"]; + t.numberState.allowsScientificNotation = [self boolForTokenForKey:@"@allowsScientificNotation"]; + t.numberState.allowsOctalNotation = [self boolForTokenForKey:@"@allowsOctalNotation"]; + t.numberState.allowsHexadecimalNotation = [self boolForTokenForKey:@"@allowsHexadecimalNotation"]; + + [self setTokenizerState:t.wordState onTokenizer:t forTokensForKey:@"@wordState"]; + [self setTokenizerState:t.numberState onTokenizer:t forTokensForKey:@"@numberState"]; + [self setTokenizerState:t.quoteState onTokenizer:t forTokensForKey:@"@quoteState"]; + [self setTokenizerState:t.delimitState onTokenizer:t forTokensForKey:@"@delimitState"]; + [self setTokenizerState:t.symbolState onTokenizer:t forTokensForKey:@"@symbolState"]; + [self setTokenizerState:t.commentState onTokenizer:t forTokensForKey:@"@commentState"]; + [self setTokenizerState:t.whitespaceState onTokenizer:t forTokensForKey:@"@whitespaceState"]; + + [self setFallbackStateOn:t.commentState withTokenizer:t forTokensForKey:@"@commentState.fallbackState"]; + [self setFallbackStateOn:t.delimitState withTokenizer:t forTokensForKey:@"@delimitState.fallbackState"]; + + NSArray *toks = nil; + + // muli-char symbols + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@symbol"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@symbols"]]; + [parserTokensTable removeObjectForKey:@"@symbol"]; + [parserTokensTable removeObjectForKey:@"@symbols"]; + for (PKToken *tok in toks) { + if (tok.isQuotedString) { + [t.symbolState add:[tok.stringValue stringByTrimmingQuotes]]; + } + } + + // wordChars + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@wordChar"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@wordChars"]]; + [parserTokensTable removeObjectForKey:@"@wordChar"]; + [parserTokensTable removeObjectForKey:@"@wordChars"]; + for (PKToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + if ([s length]) { + NSInteger c = [s characterAtIndex:0]; + [t.wordState setWordChars:YES from:c to:c]; + } + } + } + + // whitespaceChars + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@whitespaceChar"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@whitespaceChars"]]; + [parserTokensTable removeObjectForKey:@"@whitespaceChar"]; + [parserTokensTable removeObjectForKey:@"@whitespaceChars"]; + for (PKToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + if ([s length]) { + NSInteger c = 0; + if ([s hasPrefix:@"#x"]) { + c = [s integerValue]; + } else { + c = [s characterAtIndex:0]; + } + [t.whitespaceState setWhitespaceChars:YES from:c to:c]; + } + } + } + + // single-line comments + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@singleLineComment"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@singleLineComments"]]; + [parserTokensTable removeObjectForKey:@"@singleLineComment"]; + [parserTokensTable removeObjectForKey:@"@singleLineComments"]; + for (PKToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + [t.commentState addSingleLineStartMarker:s]; + } + } + + // multi-line comments + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@multiLineComment"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@multiLineComments"]]; + NSAssert(0 == [toks count] % 2, @"@multiLineComments must be specified as quoted strings in multiples of 2"); + [parserTokensTable removeObjectForKey:@"@multiLineComment"]; + [parserTokensTable removeObjectForKey:@"@multiLineComments"]; + if ([toks count] > 1) { + NSInteger i = 0; + for ( ; i < [toks count] - 1; i++) { + PKToken *startTok = [toks objectAtIndex:i]; + PKToken *endTok = [toks objectAtIndex:++i]; + if (startTok.isQuotedString && endTok.isQuotedString) { + NSString *start = [startTok.stringValue stringByTrimmingQuotes]; + NSString *end = [endTok.stringValue stringByTrimmingQuotes]; + [t.commentState addMultiLineStartMarker:start endMarker:end]; + } + } + } + + // delimited strings + toks = [NSArray arrayWithArray:[parserTokensTable objectForKey:@"@delimitedString"]]; + toks = [toks arrayByAddingObjectsFromArray:[parserTokensTable objectForKey:@"@delimitedStrings"]]; + NSAssert(0 == [toks count] % 3, @"@delimitedString must be specified as quoted strings in multiples of 3"); + [parserTokensTable removeObjectForKey:@"@delimitedString"]; + [parserTokensTable removeObjectForKey:@"@delimitedStrings"]; + if ([toks count] > 1) { + NSInteger i = 0; + for ( ; i < [toks count] - 2; i++) { + PKToken *startTok = [toks objectAtIndex:i]; + PKToken *endTok = [toks objectAtIndex:++i]; + PKToken *charSetTok = [toks objectAtIndex:++i]; + if (startTok.isQuotedString && endTok.isQuotedString) { + NSString *start = [startTok.stringValue stringByTrimmingQuotes]; + NSString *end = [endTok.stringValue stringByTrimmingQuotes]; + NSCharacterSet *charSet = nil; + if (charSetTok.isQuotedString) { + charSet = [NSCharacterSet characterSetWithCharactersInString:[charSetTok.stringValue stringByTrimmingQuotes]]; + } + [t.delimitState addStartMarker:start endMarker:end allowedCharacterSet:charSet]; + } + } + } + + return t; +} + + +- (BOOL)boolForTokenForKey:(NSString *)key { + BOOL result = NO; + NSArray *toks = [parserTokensTable objectForKey:key]; + if ([toks count]) { + PKToken *tok = [toks objectAtIndex:0]; + if (tok.isWord && [tok.stringValue isEqualToString:@"YES"]) { + result = YES; + } + } + [parserTokensTable removeObjectForKey:key]; + return result; +} + + +- (void)setTokenizerState:(PKTokenizerState *)state onTokenizer:(PKTokenizer *)t forTokensForKey:(NSString *)key { + NSArray *toks = [parserTokensTable objectForKey:key]; + for (PKToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + if (1 == [s length]) { + NSInteger c = [s characterAtIndex:0]; + [t setTokenizerState:state from:c to:c]; + } + } + } + [parserTokensTable removeObjectForKey:key]; +} + + +- (void)setFallbackStateOn:(PKTokenizerState *)state withTokenizer:(PKTokenizer *)t forTokensForKey:(NSString *)key { + NSArray *toks = [parserTokensTable objectForKey:key]; + if ([toks count]) { + PKToken *tok = [toks objectAtIndex:0]; + if (tok.isWord) { + PKTokenizerState *fallbackState = [t valueForKey:tok.stringValue]; + if (state != fallbackState) { + state.fallbackState = fallbackState; + } + } + } + [parserTokensTable removeObjectForKey:key]; +} + + +- (PKParser *)expandedParserForName:(NSString *)parserName { + id obj = [parserTokensTable objectForKey:parserName]; + if ([obj isKindOfClass:[PKParser class]]) { + return obj; + } else { + // prevent infinite loops by creating a parser of the correct type first, and putting it in the table + NSString *className = [parserClassTable objectForKey:parserName]; + + PKParser *p = [[NSClassFromString(className) alloc] init]; + [parserTokensTable setObject:p forKey:parserName]; + [p release]; + + p = [self expandParser:p fromTokenArray:obj]; + p.name = parserName; + + [self setAssemblerForParser:p]; + + [parserTokensTable setObject:p forKey:parserName]; + return p; + } +} + + +- (void)setAssemblerForParser:(PKParser *)p { + NSString *parserName = p.name; + NSString *selName = [selectorTable objectForKey:parserName]; + + BOOL setOnAll = (assemblerSettingBehavior & PKParserFactoryAssemblerSettingBehaviorOnAll); + + if (setOnAll) { + // continue + } else { + BOOL setOnExplicit = (assemblerSettingBehavior & PKParserFactoryAssemblerSettingBehaviorOnExplicit); + if (setOnExplicit && selName) { + // continue + } else { + BOOL isTerminal = [p isKindOfClass:[PKTerminal class]]; + if (!isTerminal && !setOnExplicit) return; + + BOOL setOnTerminals = (assemblerSettingBehavior & PKParserFactoryAssemblerSettingBehaviorOnTerminals); + if (setOnTerminals && isTerminal) { + // continue + } else { + return; + } + } + } + + if (!selName) { + selName = [self defaultAssemblerSelectorNameForParserName:parserName]; + } + + if (selName) { + SEL sel = NSSelectorFromString(selName); + if (assembler && [assembler respondsToSelector:sel]) { + [p setAssembler:assembler selector:sel]; + } + if (preassembler && [preassembler respondsToSelector:sel]) { + NSString *selName = [self defaultPreassemblerSelectorNameForParserName:parserName]; + [p setPreassembler:preassembler selector:NSSelectorFromString(selName)]; + } + } +} + + +- (id)expandParser:(PKParser *)p fromTokenArray:(NSArray *)toks { + PKAssembly *a = [PKTokenAssembly assemblyWithTokenArray:toks]; + a.target = parserTokensTable; + a = [grammarParser.exprParser completeMatchFor:a]; + PKParser *res = [a pop]; + if ([p isKindOfClass:[PKCollectionParser class]]) { + PKCollectionParser *cp = (PKCollectionParser *)p; + [cp add:res]; + return cp; + } else { + return res; + } +} + + +// this is just a utility for unit-testing +- (PKSequence *)parserFromExpression:(NSString *)s { + PKTokenizer *t = [self tokenizerForParsingGrammar]; + t.string = s; + PKAssembly *a = [PKTokenAssembly assemblyWithTokenizer:t]; + a.target = [NSMutableDictionary dictionary]; // setup the variable lookup table + a = [grammarParser.exprParser completeMatchFor:a]; + return [a pop]; +} + + +- (PKAlternation *)zeroOrOne:(PKParser *)p { + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:p]; + return a; +} + + +- (PKSequence *)oneOrMore:(PKParser *)p { + PKSequence *s = [PKSequence sequence]; + [s add:p]; + [s add:[PKRepetition repetitionWithSubparser:p]]; + return s; +} + + +- (void)didMatchStatement:(PKAssembly *)a { + NSArray *toks = [[a objectsAbove:equals] reversedArray]; + [a pop]; // discard '=' tok + + NSString *parserName = nil; + NSString *selName = nil; + id obj = [a pop]; + if ([obj isKindOfClass:[NSString class]]) { // a callback was provided + selName = obj; + parserName = [[a pop] stringValue]; + } else { + parserName = [obj stringValue]; + } + + if (selName) { + NSAssert([selName length], @""); + [selectorTable setObject:selName forKey:parserName]; + } + NSMutableDictionary *d = a.target; + //NSLog(@"parserName: %@", parserName); + NSAssert([toks count], @""); + + // support for multiple @delimitedString = ... tokenizer directives + if ([parserName hasPrefix:@"@"]) { + // remove whitespace toks from tokenizer directives + if (![parserName isEqualToString:@"@start"]) { + toks = [self tokens:toks byRemovingTokensOfType:PKTokenTypeWhitespace]; + } + + NSArray *existingToks = [d objectForKey:parserName]; + if ([existingToks count]) { + toks = [toks arrayByAddingObjectsFromArray:existingToks]; + } + } + + [d setObject:toks forKey:parserName]; +} + + +- (NSArray *)tokens:(NSArray *)toks byRemovingTokensOfType:(PKTokenType)tt { + NSMutableArray *res = [NSMutableArray array]; + for (PKToken *tok in toks) { + if (PKTokenTypeWhitespace != tok.tokenType) { + [res addObject:tok]; + } + } + return res; +} + + +- (NSString *)defaultAssemblerSelectorNameForParserName:(NSString *)parserName { + NSString *prefix = nil; + if ([parserName hasPrefix:@"@"]) { + // parserName = [parserName substringFromIndex:1]; + // prefix = @"didMatch_"; + return nil; + } else { + prefix = @"didMatch"; + } + NSString *s = [NSString stringWithFormat:@"%@%@", [[parserName substringToIndex:1] uppercaseString], [parserName substringFromIndex:1]]; + return [NSString stringWithFormat:@"%@%@:", prefix, s]; +} + + +- (NSString *)defaultPreassemblerSelectorNameForParserName:(NSString *)parserName { + NSString *prefix = nil; + if ([parserName hasPrefix:@"@"]) { + return nil; + } else { + prefix = @"willMatch"; + } + NSString *s = [NSString stringWithFormat:@"%@%@", [[parserName substringToIndex:1] uppercaseString], [parserName substringFromIndex:1]]; + return [NSString stringWithFormat:@"%@%@:", prefix, s]; +} + + +- (void)didMatchCallback:(PKAssembly *)a { + PKToken *selNameTok = [a pop]; + NSString *selName = [NSString stringWithFormat:@"%@:", selNameTok.stringValue]; + [a push:selName]; +} + + +- (void)didMatchExpression:(PKAssembly *)a { + NSArray *objs = [a objectsAbove:paren]; + NSAssert([objs count], @""); + [a pop]; // pop '(' + + if ([objs count] > 1) { + PKSequence *seq = [PKSequence sequence]; + for (id obj in [objs reverseObjectEnumerator]) { + [seq add:obj]; + } + [a push:seq]; + } else if ([objs count]) { + [a push:[objs objectAtIndex:0]]; + } +} + + +- (void)didMatchDifference:(PKAssembly *)a { + PKParser *minus = [a pop]; + PKParser *sub = [a pop]; + NSAssert([minus isKindOfClass:[PKParser class]], @""); + NSAssert([sub isKindOfClass:[PKParser class]], @""); + + [a push:[PKDifference differenceWithSubparser:sub minus:minus]]; +} + + +- (void)didMatchIntersection:(PKAssembly *)a { + PKParser *predicate = [a pop]; + PKParser *sub = [a pop]; + NSAssert([predicate isKindOfClass:[PKParser class]], @""); + NSAssert([sub isKindOfClass:[PKParser class]], @""); + + PKIntersection *inter = [PKIntersection intersection]; + [inter add:sub]; + [inter add:predicate]; + + [a push:inter]; +} + + +- (void)didMatchPatternOptions:(PKAssembly *)a { + PKToken *tok = [a pop]; + NSAssert(tok.isWord, @""); + + NSString *s = tok.stringValue; + NSAssert([s length] > 0, @""); + + PKPatternOptions opts = PKPatternOptionsNone; + if (NSNotFound != [s rangeOfString:@"i"].location) { + opts |= PKPatternOptionsIgnoreCase; + } + if (NSNotFound != [s rangeOfString:@"m"].location) { + opts |= PKPatternOptionsMultiline; + } + if (NSNotFound != [s rangeOfString:@"x"].location) { + opts |= PKPatternOptionsComments; + } + if (NSNotFound != [s rangeOfString:@"s"].location) { + opts |= PKPatternOptionsDotAll; + } + if (NSNotFound != [s rangeOfString:@"w"].location) { + opts |= PKPatternOptionsUnicodeWordBoundaries; + } + + [a push:[NSNumber numberWithInteger:opts]]; +} + + +- (void)didMatchPattern:(PKAssembly *)a { + id obj = [a pop]; // opts (as Number*) or DelimitedString('/', '/') + + PKPatternOptions opts = PKPatternOptionsNone; + if ([obj isKindOfClass:[NSNumber class]]) { + opts = [obj integerValue]; + obj = [a pop]; + } + + NSAssert([obj isMemberOfClass:[PKToken class]], @""); + PKToken *tok = (PKToken *)obj; + NSAssert(tok.isDelimitedString, @""); + + NSString *s = tok.stringValue; + NSAssert([s length] > 2, @""); + + NSAssert([s hasPrefix:@"/"], @""); + NSAssert([s hasSuffix:@"/"], @""); + + NSString *re = [s stringByTrimmingQuotes]; + + PKTerminal *t = [PKPattern patternWithString:re options:opts]; + + [a push:t]; +} + + +- (void)didMatchDiscard:(PKAssembly *)a { + id obj = [a pop]; + if ([obj isKindOfClass:[PKTerminal class]]) { + PKTerminal *t = (PKTerminal *)obj; + [t discard]; + } + [a push:obj]; +} + + +- (void)didMatchLiteral:(PKAssembly *)a { + PKToken *tok = [a pop]; + + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + PKTerminal *t = [PKCaseInsensitiveLiteral literalWithString:s]; + + [a push:t]; +} + + +- (void)didMatchVariable:(PKAssembly *)a { + PKToken *tok = [a pop]; + NSString *parserName = tok.stringValue; + PKParser *p = nil; + if (isGatheringClasses) { + // lookup the actual possible parser. + // if its not there, or still a token array, just spoof it with a sequence + NSMutableDictionary *d = a.target; + p = [d objectForKey:parserName]; + if (![p isKindOfClass:[PKParser parser]]) { + p = [PKSequence sequence]; + } + } else { + if ([parserTokensTable objectForKey:parserName]) { + p = [self expandedParserForName:parserName]; + } + } + [a push:p]; +} + + +- (void)didMatchConstant:(PKAssembly *)a { + PKToken *tok = [a pop]; + NSString *s = tok.stringValue; + id p = nil; + if ([s isEqualToString:@"Word"]) { + p = [PKWord word]; + } else if ([s isEqualToString:@"LowercaseWord"]) { + p = [PKLowercaseWord word]; + } else if ([s isEqualToString:@"UppercaseWord"]) { + p = [PKUppercaseWord word]; + } else if ([s isEqualToString:@"Number"]) { + p = [PKNumber number]; + } else if ([s isEqualToString:@"S"]) { + p = [PKWhitespace whitespace]; + } else if ([s isEqualToString:@"QuotedString"]) { + p = [PKQuotedString quotedString]; + } else if ([s isEqualToString:@"Symbol"]) { + p = [PKSymbol symbol]; + } else if ([s isEqualToString:@"Comment"]) { + p = [PKComment comment]; + } else if ([s isEqualToString:@"Any"]) { + p = [PKAny any]; + } else if ([s isEqualToString:@"Empty"]) { + p = [PKEmpty empty]; + } else if ([s isEqualToString:@"Pattern"]) { + p = tok; + } else if ([s isEqualToString:@"DelimitedString"]) { + p = tok; + } else if ([s isEqualToString:@"YES"] || [s isEqualToString:@"NO"]) { + p = tok; + } else { + [NSException raise:@"Grammar Exception" format: + @"User Grammar referenced a constant parser name (uppercase word) which is not supported: %@. Must be one of: Word, LowercaseWord, UppercaseWord, QuotedString, Number, Symbol, Empty.", s]; + } + + [a push:p]; +} + + +- (void)didMatchDelimitedString:(PKAssembly *)a { + NSArray *toks = [a objectsAbove:paren]; + [a pop]; // discard '(' fence + + NSAssert([toks count] > 0 && [toks count] < 3, @""); + NSString *start = [[[toks lastObject] stringValue] stringByTrimmingQuotes]; + NSString *end = nil; + if ([toks count] > 1) { + end = [[[toks objectAtIndex:0] stringValue] stringByTrimmingQuotes]; + } + + PKTerminal *t = [PKDelimitedString delimitedStringWithStartMarker:start endMarker:end]; + + [a push:t]; +} + + +- (void)didMatchNum:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)didMatchStar:(PKAssembly *)a { + id top = [a pop]; + PKRepetition *rep = [PKRepetition repetitionWithSubparser:top]; + [a push:rep]; +} + + +- (void)didMatchPlus:(PKAssembly *)a { + id top = [a pop]; + [a push:[self oneOrMore:top]]; +} + + +- (void)didMatchQuestion:(PKAssembly *)a { + id top = [a pop]; + [a push:[self zeroOrOne:top]]; +} + + +- (void)didMatchPhraseCardinality:(PKAssembly *)a { + NSRange r = [[a pop] rangeValue]; + PKParser *p = [a pop]; + PKSequence *s = [PKSequence sequence]; + + NSInteger start = r.location; + NSInteger end = r.length; + + NSInteger i = 0; + for ( ; i < start; i++) { + [s add:p]; + } + + for ( ; i < end; i++) { + [s add:[self zeroOrOne:p]]; + } + + [a push:s]; +} + + +- (void)didMatchCardinality:(PKAssembly *)a { + NSArray *toks = [a objectsAbove:self.curly]; + [a pop]; // discard '{' tok + + NSAssert([toks count] > 0, @""); + + PKToken *tok = [toks lastObject]; + CGFloat start = tok.floatValue; + CGFloat end = start; + if ([toks count] > 1) { + tok = [toks objectAtIndex:0]; + end = tok.floatValue; + } + + NSAssert(start <= end, @""); + + NSRange r = NSMakeRange(start, end); + [a push:[NSValue valueWithRange:r]]; +} + + +- (void)didMatchOr:(PKAssembly *)a { + id second = [a pop]; + [a pop]; // pop '|' + id first = [a pop]; + PKAlternation *p = [PKAlternation alternation]; + [p add:first]; + [p add:second]; + [a push:p]; +} + + +- (void)didMatchAnd:(PKAssembly *)a { + NSMutableArray *parsers = [NSMutableArray array]; + while (![a isStackEmpty]) { + id obj = [a pop]; + if ([obj isKindOfClass:[PKParser class]]) { + [parsers addObject:obj]; + } else { + [a push:obj]; + break; + } + } + + if ([parsers count] > 1) { + PKSequence *seq = [PKSequence sequence]; + for (PKParser *p in [parsers reverseObjectEnumerator]) { + [seq add:p]; + } + + [a push:seq]; + } else if (1 == [parsers count]) { + [a push:[parsers objectAtIndex:0]]; + } +} + + +- (void)didMatchNegation:(PKAssembly *)a { + PKParser *p = [a pop]; + [a push:[PKNegation negationWithSubparser:p]]; +} + +@synthesize grammarParser; +@synthesize assembler; +@synthesize preassembler; +@synthesize parserTokensTable; +@synthesize parserClassTable; +@synthesize selectorTable; +@synthesize equals; +@synthesize curly; +@synthesize paren; +@synthesize assemblerSettingBehavior; +@end diff --git a/src/PKPattern.m b/src/PKPattern.m new file mode 100644 index 0000000..e2632c7 --- /dev/null +++ b/src/PKPattern.m @@ -0,0 +1,51 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import "RegexKitLite.h" + +@implementation PKPattern + ++ (id)patternWithString:(NSString *)s { + return [self patternWithString:s options:PKPatternOptionsNone]; +} + + ++ (id)patternWithString:(NSString *)s options:(PKPatternOptions)opts { + return [[[self alloc] initWithString:s options:opts] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + return [self initWithString:s options:PKPatternOptionsNone]; +} + + +- (id)initWithString:(NSString *)s options:(PKPatternOptions)opts { + if (self = [super initWithString:s]) { + options = opts; + } + return self; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + + NSRange r = NSMakeRange(0, [tok.stringValue length]); + + return NSEqualRanges(r, [tok.stringValue rangeOfRegex:self.string options:(uint32_t)options inRange:r capture:0 error:nil]); +} + +@end diff --git a/src/PKQuoteState.m b/src/PKQuoteState.m new file mode 100644 index 0000000..3bb8427 --- /dev/null +++ b/src/PKQuoteState.m @@ -0,0 +1,62 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@implementation PKQuoteState + +- (void)dealloc { + [super dealloc]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + [self resetWithReader:r]; + + [self append:cin]; + PKUniChar c; + do { + c = [r read]; + if (PKEOF == c) { + c = cin; + if (balancesEOFTerminatedQuotes) { + [self append:c]; + } + } else { + [self append:c]; + } + + } while (c != cin); + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeQuotedString stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; +} + +@synthesize balancesEOFTerminatedQuotes; +@end diff --git a/src/PKQuotedString.m b/src/PKQuotedString.m new file mode 100644 index 0000000..13ab559 --- /dev/null +++ b/src/PKQuotedString.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKQuotedString + ++ (id)quotedString { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isQuotedString; +} + +@end diff --git a/src/PKReader.m b/src/PKReader.m new file mode 100644 index 0000000..75b83c7 --- /dev/null +++ b/src/PKReader.m @@ -0,0 +1,75 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@implementation PKReader + +- (id)init { + return [self initWithString:nil]; +} + + +- (id)initWithString:(NSString *)s { + if (self = [super init]) { + self.string = s; + } + return self; +} + + +- (void)dealloc { + self.string = nil; + [super dealloc]; +} + + +- (NSString *)string { + return [[string retain] autorelease]; +} + + +- (void)setString:(NSString *)s { + if (string != s) { + [string autorelease]; + string = [s copy]; + length = [string length]; + } + // reset cursor + offset = 0; +} + + +- (PKUniChar)read { + if (0 == length || offset > length - 1) { + return PKEOF; + } + return [string characterAtIndex:offset++]; +} + + +- (void)unread { + offset = (0 == offset) ? 0 : offset - 1; +} + + +- (void)unread:(NSUInteger)count { + NSUInteger i = 0; + for ( ; i < count; i++) { + [self unread]; + } +} + +@synthesize offset; +@end diff --git a/src/PKRepetition.m b/src/PKRepetition.m new file mode 100644 index 0000000..d4e8fba --- /dev/null +++ b/src/PKRepetition.m @@ -0,0 +1,77 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +@end + +@interface PKRepetition () +@property (nonatomic, readwrite, retain) PKParser *subparser; +@end + +@implementation PKRepetition + ++ (id)repetitionWithSubparser:(PKParser *)p { + return [[[self alloc] initWithSubparser:p] autorelease]; +} + + +- (id)init { + return [self initWithSubparser:nil]; +} + + +- (id)initWithSubparser:(PKParser *)p { + //NSParameterAssert(p); + if (self = [super init]) { + self.subparser = p; + } + return self; +} + + +- (void)dealloc { + self.subparser = nil; + [super dealloc]; +} + + +- (PKParser *)parserNamed:(NSString *)s { + if ([name isEqualToString:s]) { + return self; + } else { + return [subparser parserNamed:s]; + } +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + //NSMutableSet *outAssemblies = [[[NSMutableSet alloc] initWithSet:inAssemblies copyItems:YES] autorelease]; + NSMutableSet *outAssemblies = [[inAssemblies mutableCopy] autorelease]; + + NSSet *s = inAssemblies; + while ([s count]) { + s = [subparser matchAndAssemble:s]; + [outAssemblies unionSet:s]; + } + + return outAssemblies; +} + +@synthesize subparser; +@end diff --git a/src/PKSequence.m b/src/PKSequence.m new file mode 100644 index 0000000..7ac6c1e --- /dev/null +++ b/src/PKSequence.m @@ -0,0 +1,56 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +@end + +@interface PKCollectionParser () ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest; +@end + +@implementation PKSequence + ++ (id)sequence { + return [self sequenceWithSubparsers:nil]; +} + + ++ (id)sequenceWithSubparsers:(PKParser *)p1, ... { + va_list vargs; + va_start(vargs, p1); + PKSequence *seq = [self collectionParserWithFirst:p1 rest:vargs]; + va_end(vargs); + return seq; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + NSSet *outAssemblies = inAssemblies; + + for (PKParser *p in subparsers) { + outAssemblies = [p matchAndAssemble:outAssemblies]; + if (![outAssemblies count]) { + break; + } + } + + return outAssemblies; +} + +@end diff --git a/src/PKSingleLineCommentState.m b/src/PKSingleLineCommentState.m new file mode 100644 index 0000000..73fc32e --- /dev/null +++ b/src/PKSingleLineCommentState.m @@ -0,0 +1,107 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (void)appendString:(NSString *)s; +- (NSString *)bufferedString; +@end + +@interface PKSingleLineCommentState () +- (void)addStartMarker:(NSString *)start; +- (void)removeStartMarker:(NSString *)start; +@property (nonatomic, retain) NSMutableArray *startMarkers; +@property (nonatomic, retain) NSString *currentStartMarker; +@end + +@implementation PKSingleLineCommentState + +- (id)init { + if (self = [super init]) { + self.startMarkers = [NSMutableArray array]; + } + return self; +} + + +- (void)dealloc { + self.startMarkers = nil; + self.currentStartMarker = nil; + [super dealloc]; +} + + +- (void)addStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [startMarkers addObject:start]; +} + + +- (void)removeStartMarker:(NSString *)start { + NSParameterAssert([start length]); + [startMarkers removeObject:start]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + BOOL reportTokens = t.commentState.reportsCommentTokens; + if (reportTokens) { + [self resetWithReader:r]; + [self appendString:currentStartMarker]; + } + + PKUniChar c; + while (1) { + c = [r read]; + if ('\n' == c || '\r' == c || PKEOF == c) { + break; + } + if (reportTokens) { + [self append:c]; + } + } + + if (PKEOF != c) { + [r unread]; + } + + self.currentStartMarker = nil; + + if (reportTokens) { + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeComment stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; + } else { + return [t nextToken]; + } +} + +@synthesize startMarkers; +@synthesize currentStartMarker; +@end diff --git a/src/PKSpecificChar.m b/src/PKSpecificChar.m new file mode 100644 index 0000000..c4baa94 --- /dev/null +++ b/src/PKSpecificChar.m @@ -0,0 +1,38 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKSpecificChar + ++ (id)specificCharWithChar:(PKUniChar)c { + return [[[self alloc] initWithSpecificChar:c] autorelease]; +} + + +- (id)initWithSpecificChar:(PKUniChar)c { + self = [super initWithString:[NSString stringWithFormat:@"%C", c]]; + if (self) { + } + return self; +} + + +- (BOOL)qualifies:(id)obj { + PKUniChar c = [obj intValue]; + return c == [string characterAtIndex:0]; +} + +@end diff --git a/src/PKSymbol.m b/src/PKSymbol.m new file mode 100644 index 0000000..acd340f --- /dev/null +++ b/src/PKSymbol.m @@ -0,0 +1,79 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKSymbol () +@property (nonatomic, retain) PKToken *symbol; +@end + +@implementation PKSymbol + ++ (id)symbol { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)symbolWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + if ([s length]) { + self.symbol = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:s floatValue:0.0]; + } + } + return self; +} + + +- (void)dealloc { + self.symbol = nil; + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + if (symbol) { + return [symbol isEqual:obj]; + } else { + PKToken *tok = (PKToken *)obj; + return tok.isSymbol; + } +} + + +- (NSString *)description { + NSString *className = [NSStringFromClass([self class]) substringFromIndex:2]; + if ([name length]) { + if (symbol) { + return [NSString stringWithFormat:@"%@ (%@) %@", className, name, symbol.stringValue]; + } else { + return [NSString stringWithFormat:@"%@ (%@)", className, name]; + } + } else { + if (symbol) { + return [NSString stringWithFormat:@"%@ %@", className, symbol.stringValue]; + } else { + return [NSString stringWithFormat:@"%@", className]; + } + } +} + +@synthesize symbol; +@end diff --git a/src/PKSymbolNode.m b/src/PKSymbolNode.m new file mode 100644 index 0000000..a3d897a --- /dev/null +++ b/src/PKSymbolNode.m @@ -0,0 +1,82 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKSymbolNode () +@property (nonatomic, readwrite, retain) NSString *ancestry; +@property (nonatomic, assign) PKSymbolNode *parent; // this must be 'assign' to avoid retain loop leak +@property (nonatomic, retain) NSMutableDictionary *children; +@property (nonatomic) PKUniChar character; +@property (nonatomic, retain) NSString *string; + +- (void)determineAncestry; +@end + +@implementation PKSymbolNode + +- (id)initWithParent:(PKSymbolNode *)p character:(PKUniChar)c { + if (self = [super init]) { + self.parent = p; + self.character = c; + self.children = [NSMutableDictionary dictionary]; + + // this private property is an optimization. + // cache the NSString for the char to prevent it being constantly recreated in -determinAncestry + self.string = [NSString stringWithFormat:@"%C", character]; + + [self determineAncestry]; + } + return self; +} + + +- (void)dealloc { + parent = nil; // makes clang static analyzer happy + self.ancestry = nil; + self.string = nil; + self.children = nil; + [super dealloc]; +} + + +- (void)determineAncestry { + if (PKEOF == parent.character) { // optimization for sinlge-char symbol (parent is symbol root node) + self.ancestry = string; + } else { + NSMutableString *result = [NSMutableString string]; + + PKSymbolNode *n = self; + while (PKEOF != n.character) { + [result insertString:n.string atIndex:0]; + n = n.parent; + } + + //self.ancestry = [[result copy] autorelease]; // assign an immutable copy + self.ancestry = result; // optimization + } +} + + +- (NSString *)description { + return [NSString stringWithFormat:@"", self.ancestry]; +} + +@synthesize ancestry; +@synthesize parent; +@synthesize character; +@synthesize string; +@synthesize children; +@end diff --git a/src/PKSymbolRootNode.m b/src/PKSymbolRootNode.m new file mode 100644 index 0000000..ac361c5 --- /dev/null +++ b/src/PKSymbolRootNode.m @@ -0,0 +1,153 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKSymbolNode () +@property (nonatomic, retain) NSMutableDictionary *children; +@end + +@interface PKSymbolRootNode () +- (void)addWithFirst:(PKUniChar)c rest:(NSString *)s parent:(PKSymbolNode *)p; +- (void)removeWithFirst:(PKUniChar)c rest:(NSString *)s parent:(PKSymbolNode *)p; +- (NSString *)nextWithFirst:(PKUniChar)c rest:(PKReader *)r parent:(PKSymbolNode *)p; +@end + +@implementation PKSymbolRootNode + +- (id)init { + self = [super initWithParent:nil character:PKEOF]; + if (self) { + + } + return self; +} + + +- (void)add:(NSString *)s { + NSParameterAssert(s); + if ([s length] < 2) return; + + [self addWithFirst:[s characterAtIndex:0] rest:[s substringFromIndex:1] parent:self]; +} + + +- (void)remove:(NSString *)s { + NSParameterAssert(s); + if ([s length] < 2) return; + + [self removeWithFirst:[s characterAtIndex:0] rest:[s substringFromIndex:1] parent:self]; +} + + +- (void)addWithFirst:(PKUniChar)c rest:(NSString *)s parent:(PKSymbolNode *)p { + NSParameterAssert(p); + NSNumber *key = [NSNumber numberWithInteger:c]; + PKSymbolNode *child = [p.children objectForKey:key]; + if (!child) { + child = [[PKSymbolNode alloc] initWithParent:p character:c]; + [p.children setObject:child forKey:key]; + [child release]; + } + + NSString *rest = nil; + + if (0 == [s length]) { + return; + } else if ([s length] > 1) { + rest = [s substringFromIndex:1]; + } + + [self addWithFirst:[s characterAtIndex:0] rest:rest parent:child]; +} + + +- (void)removeWithFirst:(PKUniChar)c rest:(NSString *)s parent:(PKSymbolNode *)p { + NSParameterAssert(p); + NSNumber *key = [NSNumber numberWithInteger:c]; + PKSymbolNode *child = [p.children objectForKey:key]; + if (child) { + NSString *rest = nil; + + if (0 == [s length]) { + return; + } else if ([s length] > 1) { + rest = [s substringFromIndex:1]; + [self removeWithFirst:[s characterAtIndex:0] rest:rest parent:child]; + } + + [p.children removeObjectForKey:key]; + } +} + + +- (NSString *)nextSymbol:(PKReader *)r startingWith:(PKUniChar)cin { + NSParameterAssert(r); + return [self nextWithFirst:cin rest:r parent:self]; +} + + +- (NSString *)nextWithFirst:(PKUniChar)c rest:(PKReader *)r parent:(PKSymbolNode *)p { + NSParameterAssert(p); + NSString *result = [NSString stringWithFormat:@"%C", c]; + + // this also works. +// NSString *result = [[[NSString alloc] initWithCharacters:(const unichar *)&c length:1] autorelease]; + + // none of these work. + //NSString *result = [[[NSString alloc] initWithBytes:&c length:1 encoding:NSUTF8StringEncoding] autorelease]; + +// NSLog(@"c: %d", c); +// NSLog(@"string for c: %@", result); +// NSString *chars = [[[NSString alloc] initWithCharacters:(const unichar *)&c length:1] autorelease]; +// NSString *utfs = [[[NSString alloc] initWithUTF8String:(const char *)&c] autorelease]; +// NSString *utf8 = [[[NSString alloc] initWithBytes:&c length:1 encoding:NSUTF8StringEncoding] autorelease]; +// NSString *utf16 = [[[NSString alloc] initWithBytes:&c length:1 encoding:NSUTF16StringEncoding] autorelease]; +// NSString *ascii = [[[NSString alloc] initWithBytes:&c length:1 encoding:NSASCIIStringEncoding] autorelease]; +// NSString *iso = [[[NSString alloc] initWithBytes:&c length:1 encoding:NSISOLatin1StringEncoding] autorelease]; +// +// NSLog(@"chars: '%@'", chars); +// NSLog(@"utfs: '%@'", utfs); +// NSLog(@"utf8: '%@'", utf8); +// NSLog(@"utf16: '%@'", utf16); +// NSLog(@"ascii: '%@'", ascii); +// NSLog(@"iso: '%@'", iso); + + NSNumber *key = [NSNumber numberWithInteger:c]; + PKSymbolNode *child = [p.children objectForKey:key]; + + if (!child) { + if (p == self) { + return result; + } else { + [r unread]; + return @""; + } + } + + c = [r read]; + if (PKEOF == c) { + return result; + } + + return [result stringByAppendingString:[self nextWithFirst:c rest:r parent:child]]; +} + + +- (NSString *)description { + return @""; +} + +@end diff --git a/src/PKSymbolState.m b/src/PKSymbolState.m new file mode 100644 index 0000000..dfe75d4 --- /dev/null +++ b/src/PKSymbolState.m @@ -0,0 +1,113 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t; +@end + +@interface PKSymbolState () +- (PKToken *)symbolTokenWith:(PKUniChar)cin; +- (PKToken *)symbolTokenWithSymbol:(NSString *)s; + +@property (nonatomic, retain) PKSymbolRootNode *rootNode; +@property (nonatomic, retain) NSMutableArray *addedSymbols; +@end + +@implementation PKSymbolState + +- (id)init { + if (self = [super init]) { + self.rootNode = [[[PKSymbolRootNode alloc] init] autorelease]; + self.addedSymbols = [NSMutableArray array]; + } + return self; +} + + +- (void)dealloc { + self.rootNode = nil; + self.addedSymbols = nil; + [super dealloc]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + [self resetWithReader:r]; + + NSString *symbol = [rootNode nextSymbol:r startingWith:cin]; + NSUInteger len = [symbol length]; + + while (len > 1) { + if ([addedSymbols containsObject:symbol]) { + return [self symbolTokenWithSymbol:symbol]; + } + + symbol = [symbol substringToIndex:[symbol length] - 1]; + len = [symbol length]; + [r unread:1]; + } + + if (1 == len) { + return [self symbolTokenWith:cin]; + } else { + PKTokenizerState *state = [self nextTokenizerStateFor:cin tokenizer:t]; + if (!state || state == self) { + return [self symbolTokenWith:cin]; + } else { + return [state nextTokenFromReader:r startingWith:cin tokenizer:t]; + } + } +} + + +- (void)add:(NSString *)s { + NSParameterAssert(s); + [rootNode add:s]; + [addedSymbols addObject:s]; +} + + +- (void)remove:(NSString *)s { + NSParameterAssert(s); + [rootNode remove:s]; + [addedSymbols removeObject:s]; +} + + +- (PKToken *)symbolTokenWith:(PKUniChar)cin { + return [self symbolTokenWithSymbol:[NSString stringWithFormat:@"%C", cin]]; +} + + +- (PKToken *)symbolTokenWithSymbol:(NSString *)s { + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:s floatValue:0.0]; + tok.offset = offset; + return tok; +} + +@synthesize rootNode; +@synthesize addedSymbols; +@end diff --git a/src/PKTerminal.m b/src/PKTerminal.m new file mode 100644 index 0000000..f214521 --- /dev/null +++ b/src/PKTerminal.m @@ -0,0 +1,101 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import + +@interface PKAssembly () +- (id)peek; +- (id)next; +- (BOOL)hasMore; +@property (nonatomic, readonly) NSUInteger objectsConsumed; +@end + +@interface PKTerminal () +- (PKAssembly *)matchOneAssembly:(PKAssembly *)inAssembly; +- (BOOL)qualifies:(id)obj; + +@property (nonatomic, readwrite, copy) NSString *string; +@end + +@implementation PKTerminal + +- (id)init { + return [self initWithString:nil]; +} + + +- (id)initWithString:(NSString *)s { + if (self = [super init]) { + self.string = s; + } + return self; +} + + +- (void)dealloc { + self.string = nil; + [super dealloc]; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + NSMutableSet *outAssemblies = [NSMutableSet set]; + + for (PKAssembly *a in inAssemblies) { + PKAssembly *b = [self matchOneAssembly:a]; + if (b) { + [outAssemblies addObject:b]; + } + } + + return outAssemblies; +} + + +- (PKAssembly *)matchOneAssembly:(PKAssembly *)inAssembly { + NSParameterAssert(inAssembly); + if (![inAssembly hasMore]) { + return nil; + } + + PKAssembly *outAssembly = nil; + + if ([self qualifies:[inAssembly peek]]) { + outAssembly = [[inAssembly copy] autorelease]; + id obj = [outAssembly next]; + if (!discardFlag) { + [outAssembly push:obj]; + } + } + + return outAssembly; +} + + +- (BOOL)qualifies:(id)obj { + NSAssert1(0, @"-[PKTerminal %s] must be overriden", _cmd); + return NO; +} + + +- (PKTerminal *)discard { + discardFlag = YES; + return self; +} + +@synthesize string; +@end diff --git a/src/PKToken.m b/src/PKToken.m new file mode 100644 index 0000000..69662be --- /dev/null +++ b/src/PKToken.m @@ -0,0 +1,239 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface PKTokenEOF : PKToken {} ++ (PKTokenEOF *)instance; +@end + +@implementation PKTokenEOF + +static PKTokenEOF *EOFToken = nil; + ++ (PKTokenEOF *)instance { + @synchronized(self) { + if (!EOFToken) { + [[self alloc] init]; // assignment not done here + } + } + return EOFToken; +} + + ++ (id)allocWithZone:(NSZone *)zone { + @synchronized(self) { + if (!EOFToken) { + EOFToken = [super allocWithZone:zone]; + return EOFToken; // assignment and return on first allocation + } + } + return nil; //on subsequent allocation attempts return nil +} + + +- (id)copyWithZone:(NSZone *)zone { + return self; +} + + +- (id)retain { + return self; +} + + +- (void)release { + // do nothing +} + + +- (id)autorelease { + return self; +} + + +- (NSUInteger)retainCount { + return UINT_MAX; // denotes an object that cannot be released +} + + +- (NSString *)description { + return [NSString stringWithFormat:@"", self]; +} + + +- (NSString *)debugDescription { + return [self description]; +} + + +- (NSUInteger)offset { + return -1; +} + +@end + +@interface PKToken () +- (BOOL)isEqual:(id)obj ignoringCase:(BOOL)ignoringCase; + +@property (nonatomic, readwrite, getter=isNumber) BOOL number; +@property (nonatomic, readwrite, getter=isQuotedString) BOOL quotedString; +@property (nonatomic, readwrite, getter=isSymbol) BOOL symbol; +@property (nonatomic, readwrite, getter=isWord) BOOL word; +@property (nonatomic, readwrite, getter=isWhitespace) BOOL whitespace; +@property (nonatomic, readwrite, getter=isComment) BOOL comment; +@property (nonatomic, readwrite, getter=isDelimitedString) BOOL delimitedString; + +@property (nonatomic, readwrite) CGFloat floatValue; +@property (nonatomic, readwrite, copy) NSString *stringValue; +@property (nonatomic, readwrite) PKTokenType tokenType; +@property (nonatomic, readwrite, copy) id value; + +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@implementation PKToken + ++ (PKToken *)EOFToken { + return [PKTokenEOF instance]; +} + + ++ (id)tokenWithTokenType:(PKTokenType)t stringValue:(NSString *)s floatValue:(CGFloat)n { + return [[[self alloc] initWithTokenType:t stringValue:s floatValue:n] autorelease]; +} + + +// designated initializer +- (id)initWithTokenType:(PKTokenType)t stringValue:(NSString *)s floatValue:(CGFloat)n { + //NSParameterAssert(s); + if (self = [super init]) { + self.tokenType = t; + self.stringValue = s; + self.floatValue = n; + + self.number = (PKTokenTypeNumber == t); + self.quotedString = (PKTokenTypeQuotedString == t); + self.symbol = (PKTokenTypeSymbol == t); + self.word = (PKTokenTypeWord == t); + self.whitespace = (PKTokenTypeWhitespace == t); + self.comment = (PKTokenTypeComment == t); + self.delimitedString = (PKTokenTypeDelimitedString == t); + } + return self; +} + + +- (void)dealloc { + self.stringValue = nil; + self.value = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + return [self retain]; // tokens are immutable +} + + +- (NSUInteger)hash { + return [stringValue hash]; +} + + +- (BOOL)isEqual:(id)obj { + return [self isEqual:obj ignoringCase:NO]; +} + + +- (BOOL)isEqualIgnoringCase:(id)obj { + return [self isEqual:obj ignoringCase:YES]; +} + + +- (BOOL)isEqual:(id)obj ignoringCase:(BOOL)ignoringCase { + if (![obj isMemberOfClass:[PKToken class]]) { + return NO; + } + + PKToken *tok = (PKToken *)obj; + if (tokenType != tok.tokenType) { + return NO; + } + + if (self.isNumber) { + return floatValue == tok.floatValue; + } else { + if (ignoringCase) { + return (NSOrderedSame == [stringValue caseInsensitiveCompare:tok.stringValue]); + } else { + return [stringValue isEqualToString:tok.stringValue]; + } + } +} + + +- (id)value { + if (!value) { + id v = nil; + if (self.isNumber) { + v = [NSNumber numberWithFloat:floatValue]; + } else { + v = stringValue; + } + self.value = v; + } + return value; +} + + +- (NSString *)debugDescription { + NSString *typeString = nil; + if (self.isNumber) { + typeString = @"Number"; + } else if (self.isQuotedString) { + typeString = @"Quoted String"; + } else if (self.isSymbol) { + typeString = @"Symbol"; + } else if (self.isWord) { + typeString = @"Word"; + } else if (self.isWhitespace) { + typeString = @"Whitespace"; + } else if (self.isComment) { + typeString = @"Comment"; + } else if (self.isDelimitedString) { + typeString = @"Delimited String"; + } + return [NSString stringWithFormat:@"<%@ %C%@%C>", typeString, 0x00AB, self.value, 0x00BB]; +} + + +- (NSString *)description { + return stringValue; +} + +@synthesize number; +@synthesize quotedString; +@synthesize symbol; +@synthesize word; +@synthesize whitespace; +@synthesize comment; +@synthesize delimitedString; +@synthesize floatValue; +@synthesize stringValue; +@synthesize tokenType; +@synthesize value; +@synthesize offset; +@end diff --git a/src/PKTokenArraySource.m b/src/PKTokenArraySource.m new file mode 100644 index 0000000..20e1603 --- /dev/null +++ b/src/PKTokenArraySource.m @@ -0,0 +1,85 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import + +@interface PKTokenArraySource () +@property (nonatomic, retain) PKTokenizer *tokenizer; +@property (nonatomic, retain) NSString *delimiter; +@property (nonatomic, retain) PKToken *nextToken; +@end + +@implementation PKTokenArraySource + +- (id)init { + return [self initWithTokenizer:nil delimiter:nil]; +} + + +- (id)initWithTokenizer:(PKTokenizer *)t delimiter:(NSString *)s { + NSParameterAssert(t); + NSParameterAssert(s); + if (self = [super init]) { + self.tokenizer = t; + self.delimiter = s; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.delimiter = nil; + self.nextToken = nil; + [super dealloc]; +} + + +- (BOOL)hasMore { + if (!nextToken) { + self.nextToken = [tokenizer nextToken]; + } + + return ([PKToken EOFToken] != nextToken); +} + + +- (NSArray *)nextTokenArray { + if (![self hasMore]) { + return nil; + } + + NSMutableArray *res = [NSMutableArray arrayWithObject:nextToken]; + self.nextToken = nil; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + while ((tok = [tokenizer nextToken]) != eof) { + if ([tok.stringValue isEqualToString:delimiter]) { + break; // discard delimiter tok + } + [res addObject:tok]; + } + + //return [[res copy] autorelease]; + return res; // optimization +} + +@synthesize tokenizer; +@synthesize delimiter; +@synthesize nextToken; +@end diff --git a/src/PKTokenAssembly.m b/src/PKTokenAssembly.m new file mode 100644 index 0000000..70185c7 --- /dev/null +++ b/src/PKTokenAssembly.m @@ -0,0 +1,204 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import + +@interface PKTokenAssembly () +- (id)initWithString:(NSString *)s tokenzier:(PKTokenizer *)t tokenArray:(NSArray *)a; +- (void)tokenize; +- (NSString *)objectsFrom:(PKUniChar)start to:(PKUniChar)end separatedBy:(NSString *)delimiter; + +@property (nonatomic, retain) PKTokenizer *tokenizer; +@property (nonatomic, copy) NSArray *tokens; +@end + +@implementation PKTokenAssembly + ++ (id)assemblyWithTokenizer:(PKTokenizer *)t { + return [[[self alloc] initWithTokenzier:t] autorelease]; +} + + +- (id)initWithTokenzier:(PKTokenizer *)t { + return [self initWithString:t.string tokenzier:t tokenArray:nil]; +} + + ++ (id)assemblyWithTokenArray:(NSArray *)a { + return [[[self alloc] initWithTokenArray:a] autorelease]; +} + + +- (id)initWithTokenArray:(NSArray *)a { + return [self initWithString:[a componentsJoinedByString:@""] tokenzier:nil tokenArray:a]; +} + + +- (id)initWithString:(NSString *)s { + return [self initWithTokenzier:[[[PKTokenizer alloc] initWithString:s] autorelease]]; +} + + +// designated initializer. this method is private and should not be called from other classes +- (id)initWithString:(NSString *)s tokenzier:(PKTokenizer *)t tokenArray:(NSArray *)a { + self = [super initWithString:s]; + if (self) { + if (t) { + self.tokenizer = t; + } else { + self.tokens = a; + } + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.tokens = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + PKTokenAssembly *a = (PKTokenAssembly *)[super copyWithZone:zone]; + a->tokenizer = nil; // optimization + if (tokens) { + a->tokens = [tokens copyWithZone:zone]; + } else { + a->tokens = nil; + } + + a->preservesWhitespaceTokens = preservesWhitespaceTokens; + return a; +} + + +- (NSArray *)tokens { + if (!tokens) { + [self tokenize]; + } + return tokens; +} + + +- (id)peek { + PKToken *tok = nil; + NSArray *toks = self.tokens; + + while (1) { + if (index >= [toks count]) { + tok = nil; + break; + } + + tok = [toks objectAtIndex:index]; + if (!preservesWhitespaceTokens) { + break; + } + if (PKTokenTypeWhitespace == tok.tokenType) { + [self push:tok]; + index++; + } else { + break; + } + } + + return tok; +} + + +- (id)next { + id tok = [self peek]; + if (tok) { + index++; + } + return tok; +} + + +- (BOOL)hasMore { + return (index < [self.tokens count]); +} + + +- (NSUInteger)length { + return [self.tokens count]; +} + + +- (NSUInteger)objectsConsumed { + return index; +} + + +- (NSUInteger)objectsRemaining { + return ([self.tokens count] - index); +} + + +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter { + NSParameterAssert(delimiter); + return [self objectsFrom:0 to:self.objectsConsumed separatedBy:delimiter]; +} + + +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter { + NSParameterAssert(delimiter); + return [self objectsFrom:self.objectsConsumed to:[self length] separatedBy:delimiter]; +} + + +#pragma mark - +#pragma mark Private + +- (void)tokenize { + if (!tokenizer) { + self.tokenizer = [PKTokenizer tokenizerWithString:string]; + } + + NSMutableArray *a = [NSMutableArray array]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + while ((tok = [tokenizer nextToken]) != eof) { + [a addObject:tok]; + } + + self.tokens = a; +} + + +- (NSString *)objectsFrom:(PKUniChar)start to:(PKUniChar)end separatedBy:(NSString *)delimiter { + NSMutableString *s = [NSMutableString string]; + NSArray *toks = self.tokens; + + NSInteger i = start; + for ( ; i < end; i++) { + PKToken *tok = [toks objectAtIndex:i]; + [s appendString:tok.stringValue]; + if (end - 1 != i) { + [s appendString:delimiter]; + } + } + + return [[s copy] autorelease]; +} + +@synthesize tokenizer; +@synthesize tokens; +@synthesize preservesWhitespaceTokens; +@end diff --git a/src/PKTokenizer.m b/src/PKTokenizer.m new file mode 100644 index 0000000..a24722c --- /dev/null +++ b/src/PKTokenizer.m @@ -0,0 +1,239 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +#define STATE_COUNT 256 + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizer () +- (PKTokenizerState *)tokenizerStateFor:(PKUniChar)c; +- (PKTokenizerState *)defaultTokenizerStateFor:(PKUniChar)c; +@property (nonatomic, retain) PKReader *reader; +@property (nonatomic, retain) NSMutableArray *tokenizerStates; +@end + +@implementation PKTokenizer + ++ (id)tokenizer { + return [self tokenizerWithString:nil]; +} + + ++ (id)tokenizerWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)init { + return [self initWithString:nil]; +} + + +- (id)initWithString:(NSString *)s { + if (self = [super init]) { + self.string = s; + self.reader = [[[PKReader alloc] init] autorelease]; + + self.numberState = [[[PKNumberState alloc] init] autorelease]; + self.quoteState = [[[PKQuoteState alloc] init] autorelease]; + self.commentState = [[[PKCommentState alloc] init] autorelease]; + self.symbolState = [[[PKSymbolState alloc] init] autorelease]; + self.whitespaceState = [[[PKWhitespaceState alloc] init] autorelease]; + self.wordState = [[[PKWordState alloc] init] autorelease]; + self.delimitState = [[[PKDelimitState alloc] init] autorelease]; + + self.tokenizerStates = [NSMutableArray arrayWithCapacity:STATE_COUNT]; + + NSInteger i = 0; + for ( ; i < STATE_COUNT; i++) { + [tokenizerStates addObject:[self defaultTokenizerStateFor:i]]; + } + + [symbolState add:@"<="]; + [symbolState add:@">="]; + [symbolState add:@"!="]; + [symbolState add:@"=="]; + + [commentState addSingleLineStartMarker:@"//"]; + [commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + [self setTokenizerState:commentState from:'/' to:'/']; + } + return self; +} + + +- (void)dealloc { + self.string = nil; + self.reader = nil; + self.tokenizerStates = nil; + self.numberState = nil; + self.quoteState = nil; + self.commentState = nil; + self.symbolState = nil; + self.whitespaceState = nil; + self.wordState = nil; + self.delimitState = nil; + [super dealloc]; +} + + +- (PKToken *)nextToken { + PKUniChar c = [reader read]; + + PKToken *result = nil; + + if (PKEOF == c) { + result = [PKToken EOFToken]; + } else { + PKTokenizerState *state = [self tokenizerStateFor:c]; + if (state) { + result = [state nextTokenFromReader:reader startingWith:c tokenizer:self]; + } else { + result = [PKToken EOFToken]; + } + } + + return result; +} + + +#ifdef TARGET_OS_SNOW_LEOPARD +- (void)enumerateTokensUsingBlock:(void (^)(PKToken *tok, BOOL *stop))block { + PKToken *eof = [PKToken EOFToken]; + + PKToken *tok = nil; + BOOL stop = NO; + + while ((tok = [self nextToken]) != eof) { + block(tok, &stop); + if (stop) break; + } +} +#endif + + +- (void)setTokenizerState:(PKTokenizerState *)state from:(PKUniChar)start to:(PKUniChar)end { + NSParameterAssert(state); + + NSInteger i = start; + for ( ; i <= end; i++) { + [tokenizerStates replaceObjectAtIndex:i withObject:state]; + } +} + + +- (void)setReader:(PKReader *)r { + if (reader != r) { + [reader release]; + reader = [r retain]; + reader.string = string; + } +} + + +- (void)setString:(NSString *)s { + if (string != s) { + [string release]; + string = [s retain]; + } + reader.string = string; +} + + +#pragma mark - + +- (PKTokenizerState *)tokenizerStateFor:(PKUniChar)c { + if (c < 0 || c > 255) { + // customization above 255 is not supported, so fetch default. + return [self defaultTokenizerStateFor:c]; + } else { + // customization below 255 is supported, so be sure to get the (possibly) customized state from `tokenizerStates` + return [tokenizerStates objectAtIndex:c]; + } +} + +- (PKTokenizerState *)defaultTokenizerStateFor:(PKUniChar)c { + if (c >= 0 && c <= ' ') { // From: 0 to: 32 From:0x00 to:0x20 + return whitespaceState; + } else if (c == 33) { + return symbolState; + } else if (c == '"') { // From: 34 to: 34 From:0x22 to:0x22 + return quoteState; + } else if (c >= 35 && c <= 38) { + return symbolState; + } else if (c == '\'') { // From: 39 to: 39 From:0x27 to:0x27 + return quoteState; + } else if (c >= 40 && c <= 42) { + return symbolState; + } else if (c == '+') { // From: 43 to: 43 From:0x2B to:0x2B + return symbolState; + } else if (c == 44) { + return symbolState; + } else if (c == '-') { // From: 45 to: 45 From:0x2D to:0x2D + return numberState; + } else if (c == '.') { // From: 46 to: 46 From:0x2E to:0x2E + return numberState; + } else if (c == '/') { // From: 47 to: 47 From:0x2F to:0x2F + return symbolState; + } else if (c >= '0' && c <= '9') { // From: 48 to: 57 From:0x30 to:0x39 + return numberState; + } else if (c >= 58 && c <= 64) { + return symbolState; + } else if (c >= 'A' && c <= 'Z') { // From: 65 to: 90 From:0x41 to:0x5A + return wordState; + } else if (c >= 91 && c <= 96) { + return symbolState; + } else if (c >= 'a' && c <= 'z') { // From: 97 to:122 From:0x61 to:0x7A + return wordState; + } else if (c >= 123 && c <= 191) { + return symbolState; + } else if (c >= 0xC0 && c <= 0xFF) { // From:192 to:255 From:0xC0 to:0xFF + return wordState; + } else if (c >= 0x19E0 && c <= 0x19FF) { // khmer symbols + return symbolState; + } else if (c >= 0x2000 && c <= 0x2BFF) { // various symbols + return symbolState; + } else if (c >= 0x2E00 && c <= 0x2E7F) { // supplemental punctuation + return symbolState; + } else if (c >= 0x3000 && c <= 0x303F) { // cjk symbols & punctuation + return symbolState; + } else if (c >= 0x3200 && c <= 0x33FF) { // enclosed cjk letters and months, cjk compatibility + return symbolState; + } else if (c >= 0x4DC0 && c <= 0x4DFF) { // yijing hexagram symbols + return symbolState; + } else if (c >= 0xFE30 && c <= 0xFE6F) { // cjk compatibility forms, small form variants + return symbolState; + } else if (c >= 0xFF00 && c <= 0xFFFF) { // hiragana & katakana halfwitdh & fullwidth forms, Specials + return symbolState; + } else { + return wordState; + } +} + +@synthesize numberState; +@synthesize quoteState; +@synthesize commentState; +@synthesize symbolState; +@synthesize whitespaceState; +@synthesize wordState; +@synthesize delimitState; +@synthesize string; +@synthesize reader; +@synthesize tokenizerStates; +@end diff --git a/src/PKTokenizerState.m b/src/PKTokenizerState.m new file mode 100644 index 0000000..c217737 --- /dev/null +++ b/src/PKTokenizerState.m @@ -0,0 +1,119 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import + +#define STATE_COUNT 256 + +@interface PKTokenizer () +- (PKTokenizerState *)defaultTokenizerStateFor:(PKUniChar)c; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (void)appendString:(NSString *)s; +- (NSString *)bufferedString; +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t; + +@property (nonatomic, retain) NSMutableString *stringbuf; +@property (nonatomic) NSUInteger offset; +@property (nonatomic, retain) NSMutableArray *fallbackStates; +@end + +@implementation PKTokenizerState + +- (void)dealloc { + self.stringbuf = nil; + self.fallbackState = nil; + self.fallbackStates = nil; + [super dealloc]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSAssert1(0, @"PKTokenizerState is an abstract classs. %s must be overriden", _cmd); + return nil; +} + + +- (void)setFallbackState:(PKTokenizerState *)state from:(PKUniChar)start to:(PKUniChar)end { + NSParameterAssert(start >= 0 && start < STATE_COUNT); + NSParameterAssert(end >= 0 && end < STATE_COUNT); + + if (!fallbackStates) { + self.fallbackStates = [NSMutableArray arrayWithCapacity:STATE_COUNT]; + + NSInteger i = 0; + for ( ; i < STATE_COUNT; i++) { + [fallbackStates addObject:[NSNull null]]; + } + + } + + NSInteger i = start; + for ( ; i <= end; i++) { + [fallbackStates replaceObjectAtIndex:i withObject:state]; + } +} + + +- (void)resetWithReader:(PKReader *)r { + self.stringbuf = [NSMutableString string]; + self.offset = r.offset - 1; +} + + +- (void)append:(PKUniChar)c { + NSParameterAssert(c > -1); + [stringbuf appendFormat:@"%C", c]; +} + + +- (void)appendString:(NSString *)s { + NSParameterAssert(s); + [stringbuf appendString:s]; +} + + +- (NSString *)bufferedString { + return [[stringbuf copy] autorelease]; +} + + +- (PKTokenizerState *)nextTokenizerStateFor:(PKUniChar)c tokenizer:(PKTokenizer *)t { + NSParameterAssert(c < STATE_COUNT); + + if (fallbackStates) { + id obj = [fallbackStates objectAtIndex:c]; + if ([NSNull null] != obj) { + return obj; + } + } + + if (fallbackState) { + return fallbackState; + } else { + return [t defaultTokenizerStateFor:c]; + } +} + +@synthesize stringbuf; +@synthesize offset; +@synthesize fallbackState; +@synthesize fallbackStates; +@end diff --git a/src/PKTrack.m b/src/PKTrack.m new file mode 100644 index 0000000..4c8fd43 --- /dev/null +++ b/src/PKTrack.m @@ -0,0 +1,97 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import + +@interface PKAssembly () +- (id)peek; +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter; +@end + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (PKAssembly *)best:(NSSet *)inAssemblies; +@end + +@interface PKTrack () +- (void)throwTrackExceptionWithPreviousState:(NSSet *)inAssemblies parser:(PKParser *)p; +@end + +@interface PKCollectionParser () ++ (id)collectionParserWithFirst:(PKParser *)p1 rest:(va_list)rest; +@end + +@implementation PKTrack + ++ (id)track { + return [self trackWithSubparsers:nil]; +} + + ++ (id)trackWithSubparsers:(PKParser *)p1, ... { + va_list vargs; + va_start(vargs, p1); + PKTrack *tr = [self collectionParserWithFirst:p1 rest:vargs]; + va_end(vargs); + return tr; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + BOOL inTrack = NO; + NSSet *lastAssemblies = inAssemblies; + NSSet *outAssemblies = inAssemblies; + + for (PKParser *p in subparsers) { + outAssemblies = [p matchAndAssemble:outAssemblies]; + if (![outAssemblies count]) { + if (inTrack) { + [self throwTrackExceptionWithPreviousState:lastAssemblies parser:p]; + } + break; + } + inTrack = YES; + lastAssemblies = outAssemblies; + } + + return outAssemblies; +} + + +- (void)throwTrackExceptionWithPreviousState:(NSSet *)inAssemblies parser:(PKParser *)p { + PKAssembly *best = [self best:inAssemblies]; + + NSString *after = [best consumedObjectsJoinedByString:@" "]; + if (![after length]) { + after = @"-nothing-"; + } + + NSString *expected = [p description]; + + id next = [best peek]; + NSString *found = next ? [next description] : @"-nothing-"; + + NSString *reason = [NSString stringWithFormat:@"\n\nAfter : %@\nExpected : %@\nFound : %@\n\n", after, expected, found]; + NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys: + after, @"after", + expected, @"expected", + found, @"found", + nil]; + [[PKTrackException exceptionWithName:PKTrackExceptionName reason:reason userInfo:userInfo] raise]; +} + +@end diff --git a/src/PKTrackException.m b/src/PKTrackException.m new file mode 100644 index 0000000..a12d077 --- /dev/null +++ b/src/PKTrackException.m @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKTrackException.h" + +NSString * const PKTrackExceptionName = @"Track Exception"; + +@implementation PKTrackException + +@end diff --git a/src/PKUppercaseWord.m b/src/PKUppercaseWord.m new file mode 100644 index 0000000..5bf8549 --- /dev/null +++ b/src/PKUppercaseWord.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKUppercaseWord + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + if (!tok.isWord) { + return NO; + } + + NSString *s = tok.stringValue; + return [s length] && isupper([s characterAtIndex:0]); +} + +@end diff --git a/src/PKWhitespace.m b/src/PKWhitespace.m new file mode 100644 index 0000000..2473407 --- /dev/null +++ b/src/PKWhitespace.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKWhitespace.h" +#import + +@implementation PKWhitespace + ++ (id)whitespace { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isWhitespace; +} + +@end \ No newline at end of file diff --git a/src/PKWhitespaceState.m b/src/PKWhitespaceState.m new file mode 100644 index 0000000..53a3ef1 --- /dev/null +++ b/src/PKWhitespaceState.m @@ -0,0 +1,112 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import + +#define PKTRUE (id)kCFBooleanTrue +#define PKFALSE (id)kCFBooleanFalse + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface PKWhitespaceState () +@property (nonatomic, retain) NSMutableArray *whitespaceChars; +@end + +@implementation PKWhitespaceState + +- (id)init { + if (self = [super init]) { + const NSUInteger len = 255; + self.whitespaceChars = [NSMutableArray arrayWithCapacity:len]; + NSUInteger i = 0; + for ( ; i <= len; i++) { + [whitespaceChars addObject:PKFALSE]; + } + + [self setWhitespaceChars:YES from:0 to:' ']; + } + return self; +} + + +- (void)dealloc { + self.whitespaceChars = nil; + [super dealloc]; +} + + +- (void)setWhitespaceChars:(BOOL)yn from:(PKUniChar)start to:(PKUniChar)end { + NSUInteger len = [whitespaceChars count]; + if (start > len || end > len || start < 0 || end < 0) { + [NSException raise:@"PKWhitespaceStateNotSupportedException" format:@"PKWhitespaceState only supports setting word chars for chars in the latin1 set (under 256)"]; + } + + id obj = yn ? PKTRUE : PKFALSE; + NSUInteger i = start; + for ( ; i <= end; i++) { + [whitespaceChars replaceObjectAtIndex:i withObject:obj]; + } +} + + +- (BOOL)isWhitespaceChar:(PKUniChar)cin { + if (cin < 0 || cin > [whitespaceChars count] - 1) { + return NO; + } + return PKTRUE == [whitespaceChars objectAtIndex:cin]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + if (reportsWhitespaceTokens) { + [self resetWithReader:r]; + } + + PKUniChar c = cin; + while ([self isWhitespaceChar:c]) { + if (reportsWhitespaceTokens) { + [self append:c]; + } + c = [r read]; + } + if (PKEOF != c) { + [r unread]; + } + + if (reportsWhitespaceTokens) { + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeWhitespace stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; + } else { + return [t nextToken]; + } +} + +@synthesize whitespaceChars; +@synthesize reportsWhitespaceTokens; +@end + diff --git a/src/PKWord.m b/src/PKWord.m new file mode 100644 index 0000000..992871e --- /dev/null +++ b/src/PKWord.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@implementation PKWord + ++ (id)word { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isWord; +} + +@end diff --git a/src/PKWordState.m b/src/PKWordState.m new file mode 100644 index 0000000..c6a727a --- /dev/null +++ b/src/PKWordState.m @@ -0,0 +1,126 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import + +#define PKTRUE (id)kCFBooleanTrue +#define PKFALSE (id)kCFBooleanFalse + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface PKWordState () +- (BOOL)isWordChar:(PKUniChar)c; + +@property (nonatomic, retain) NSMutableArray *wordChars; +@end + +@implementation PKWordState + +- (id)init { + if (self = [super init]) { + self.wordChars = [NSMutableArray arrayWithCapacity:256]; + NSInteger i = 0; + for ( ; i < 256; i++) { + [wordChars addObject:PKFALSE]; + } + + [self setWordChars:YES from: 'a' to: 'z']; + [self setWordChars:YES from: 'A' to: 'Z']; + [self setWordChars:YES from: '0' to: '9']; + [self setWordChars:YES from: '-' to: '-']; + [self setWordChars:YES from: '_' to: '_']; + [self setWordChars:YES from:'\'' to:'\'']; + [self setWordChars:YES from:0xC0 to:0xFF]; + } + return self; +} + + +- (void)dealloc { + self.wordChars = nil; + [super dealloc]; +} + + +- (void)setWordChars:(BOOL)yn from:(PKUniChar)start to:(PKUniChar)end { + NSUInteger len = [wordChars count]; + if (start > len || end > len || start < 0 || end < 0) { + [NSException raise:@"PKWordStateNotSupportedException" format:@"PKWordState only supports setting word chars for chars in the latin1 set (under 256)"]; + } + + id obj = yn ? PKTRUE : PKFALSE; + NSInteger i = start; + for ( ; i <= end; i++) { + [wordChars replaceObjectAtIndex:i withObject:obj]; + } +} + + +- (BOOL)isWordChar:(PKUniChar)c { + if (c > PKEOF && c < [wordChars count] - 1) { + return (PKTRUE == [wordChars objectAtIndex:c]); + } + + if (c >= 0x2000 && c <= 0x2BFF) { // various symbols + return NO; + } else if (c >= 0xFE30 && c <= 0xFE6F) { // general punctuation + return NO; + } else if (c >= 0xFE30 && c <= 0xFE6F) { // western musical symbols + return NO; + } else if (c >= 0xFF00 && c <= 0xFF65) { // symbols within Hiragana & Katakana + return NO; + } else if (c >= 0xFFF0 && c <= 0xFFFF) { // specials + return NO; + } else if (c < 0) { + return NO; + } else { + return YES; + } +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + [self resetWithReader:r]; + + PKUniChar c = cin; + do { + [self append:c]; + c = [r read]; + } while ([self isWordChar:c]); + + if (PKEOF != c) { + [r unread]; + } + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeWord stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; +} + + +@synthesize wordChars; +@end diff --git a/src/RegexKitLite.h b/src/RegexKitLite.h new file mode 100644 index 0000000..0161a71 --- /dev/null +++ b/src/RegexKitLite.h @@ -0,0 +1,220 @@ +// +// RegexKitLite.h +// http://regexkit.sourceforge.net/ +// Licensed under the terms of the BSD License, as specified below. +// + +/* + Copyright (c) 2008-2009, John Engelhart + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the Zang Industries nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifdef __OBJC__ +#import +#import +#import +#import +#import +#endif // __OBJC__ + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef REGEXKITLITE_VERSION_DEFINED +#define REGEXKITLITE_VERSION_DEFINED + +#define _RKL__STRINGIFY(b) #b +#define _RKL_STRINGIFY(a) _RKL__STRINGIFY(a) +#define _RKL_JOIN_VERSION(a,b) _RKL_STRINGIFY(a##.##b) +#define _RKL_VERSION_STRING(a,b) _RKL_JOIN_VERSION(a,b) + +#define REGEXKITLITE_VERSION_MAJOR 3 +#define REGEXKITLITE_VERSION_MINOR 0 + +#define REGEXKITLITE_VERSION_CSTRING _RKL_VERSION_STRING(REGEXKITLITE_VERSION_MAJOR, REGEXKITLITE_VERSION_MINOR) +#define REGEXKITLITE_VERSION_NSSTRING @REGEXKITLITE_VERSION_CSTRING + +#endif // REGEXKITLITE_VERSION_DEFINED + +// For Mac OS X < 10.5. +#ifndef NSINTEGER_DEFINED +#define NSINTEGER_DEFINED +#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) +typedef long NSInteger; +typedef unsigned long NSUInteger; +#define NSIntegerMin LONG_MIN +#define NSIntegerMax LONG_MAX +#define NSUIntegerMax ULONG_MAX +#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) +typedef int NSInteger; +typedef unsigned int NSUInteger; +#define NSIntegerMin INT_MIN +#define NSIntegerMax INT_MAX +#define NSUIntegerMax UINT_MAX +#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64) +#endif // NSINTEGER_DEFINED + +#ifndef RKLREGEXOPTIONS_DEFINED +#define RKLREGEXOPTIONS_DEFINED + +// These must be idential to their ICU regex counterparts. See http://www.icu-project.org/userguide/regexp.html +enum { + RKLNoOptions = 0, + RKLCaseless = 2, + RKLComments = 4, + RKLDotAll = 32, + RKLMultiline = 8, + RKLUnicodeWordBoundaries = 256 +}; +typedef uint32_t RKLRegexOptions; // This must be identical to the ICU 'flags' argument type. + +#endif // RKLREGEXOPTIONS_DEFINED + +#ifndef _REGEXKITLITE_H_ +#define _REGEXKITLITE_H_ + +#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465) +#define RKL_DEPRECATED_ATTRIBUTE __attribute__((deprecated)) +#else +#define RKL_DEPRECATED_ATTRIBUTE +#endif + +// This requires a few levels of rewriting to get the desired results. +#define _RKL_CONCAT_2(c,d) c ## d +#define _RKL_CONCAT(a,b) _RKL_CONCAT_2(a,b) + +#ifdef RKL_PREPEND_TO_METHODS +#define RKL_METHOD_PREPEND(x) _RKL_CONCAT(RKL_PREPEND_TO_METHODS, x) +#else // RKL_PREPEND_TO_METHODS +#define RKL_METHOD_PREPEND(x) x +#endif // RKL_PREPEND_TO_METHODS + +// If it looks like low memory notifications might be available, add code to register and respond to them. +// This is (should be) harmless if it turns out that this isn't the case, since the notification that we register for, +// UIApplicationDidReceiveMemoryWarningNotification, is dynamically looked up via dlsym(). +#if ((defined(TARGET_OS_EMBEDDED) && (TARGET_OS_EMBEDDED != 0)) || (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0))) && (!defined(RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS) || (RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS != 0)) +#define RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS 1 +#endif + +#ifdef __OBJC__ + +// NSException exception name. +extern NSString * const RKLICURegexException; + +// NSError error domains and user info keys. +extern NSString * const RKLICURegexErrorDomain; + +extern NSString * const RKLICURegexErrorCodeErrorKey; +extern NSString * const RKLICURegexErrorNameErrorKey; +extern NSString * const RKLICURegexLineErrorKey; +extern NSString * const RKLICURegexOffsetErrorKey; +extern NSString * const RKLICURegexPreContextErrorKey; +extern NSString * const RKLICURegexPostContextErrorKey; +extern NSString * const RKLICURegexRegexErrorKey; +extern NSString * const RKLICURegexRegexOptionsErrorKey; + +@interface NSString (RegexKitLiteAdditions) + ++ (void)RKL_METHOD_PREPEND(clearStringCache); + +// Although these are marked as deprecated, a bug in GCC prevents a warning from being issues for + class methods. Filed bug with Apple, #6736857. ++ (NSInteger)RKL_METHOD_PREPEND(captureCountForRegex):(NSString *)regex RKL_DEPRECATED_ATTRIBUTE; ++ (NSInteger)RKL_METHOD_PREPEND(captureCountForRegex):(NSString *)regex options:(RKLRegexOptions)options error:(NSError **)error RKL_DEPRECATED_ATTRIBUTE; + +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex; +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex range:(NSRange)range; +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error; + +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex; +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex inRange:(NSRange)range; +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range error:(NSError **)error; + +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex; +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex capture:(NSInteger)capture; +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex inRange:(NSRange)range; +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error; + +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex; +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex capture:(NSInteger)capture; +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex inRange:(NSRange)range; +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error; + +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement; +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement range:(NSRange)searchRange; +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement options:(RKLRegexOptions)options range:(NSRange)searchRange error:(NSError **)error; + + //// + +- (NSInteger)RKL_METHOD_PREPEND(captureCount); +- (NSInteger)RKL_METHOD_PREPEND(captureCountWithOptions):(RKLRegexOptions)options error:(NSError **)error; + +- (BOOL)RKL_METHOD_PREPEND(isRegexValid); +- (BOOL)RKL_METHOD_PREPEND(isRegexValidWithOptions):(RKLRegexOptions)options error:(NSError **)error; + +- (void)RKL_METHOD_PREPEND(flushCachedRegexData); + +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex; +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex capture:(NSInteger)capture; +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex range:(NSRange)range; +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range capture:(NSInteger)capture error:(NSError **)error; + + +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex; +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex range:(NSRange)range; +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error; + +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex; +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex range:(NSRange)range; +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error; + +@end + +@interface NSMutableString (RegexKitLiteAdditions) + +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement; +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement range:(NSRange)searchRange; +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement options:(RKLRegexOptions)options range:(NSRange)searchRange error:(NSError **)error; + +@end + +#endif // __OBJC__ + +#endif // _REGEXKITLITE_H_ + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/src/RegexKitLite.m b/src/RegexKitLite.m new file mode 100644 index 0000000..de1eca4 --- /dev/null +++ b/src/RegexKitLite.m @@ -0,0 +1,1634 @@ +// +// RegexKitLite.m +// http://regexkit.sourceforge.net/ +// Licensed under the terms of the BSD License, as specified below. +// + +/* + Copyright (c) 2008-2009, John Engelhart + + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the Zang Industries nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#include +#include +#include +#import +#import +#import +#import +#import +#import +#ifdef __OBJC_GC__ +#import +#define RKL_STRONG_REF __strong +#else // __OBJC_GC__ +#define RKL_STRONG_REF +#endif // __OBJC_GC__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#import "RegexKitLite.h" + +// If the gcc flag -mmacosx-version-min is used with, for example, '=10.2', give a warning that the libicucore.dylib is only available on >= 10.3. +// If you are reading this comment because of this warning, this is to let you know that linking to /usr/lib/libicucore.dylib will cause your executable to fail on < 10.3. +// You will need to build your own version of the ICU library and link to that in order for RegexKitLite to work successfully on < 10.3. This is not simple. + +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1030 +#warning The ICU dynamic shared library, /usr/lib/libicucore.dylib, is only available on Mac OS X 10.3 and later. +#warning You will need to supply a version of the ICU library to use RegexKitLite on Mac OS X 10.2 and earlier. +#endif + +//////////// +#pragma mark Compile time tuneables + +#ifndef RKL_CACHE_SIZE +#define RKL_CACHE_SIZE (23UL) +#endif + +#ifndef RKL_FIXED_LENGTH +#define RKL_FIXED_LENGTH (2048UL) +#endif + +#ifndef RKL_STACK_LIMIT +#define RKL_STACK_LIMIT (128UL * 1024UL) +#endif + +#ifdef RKL_APPEND_TO_ICU_FUNCTIONS +#define RKL_ICU_FUNCTION_APPEND(x) _RKL_CONCAT(x, RKL_APPEND_TO_ICU_FUNCTIONS) +#else // RKL_APPEND_TO_ICU_FUNCTIONS +#define RKL_ICU_FUNCTION_APPEND(x) x +#endif // RKL_APPEND_TO_ICU_FUNCTIONS + +#if defined(RKL_DTRACE) && (RKL_DTRACE != 0) +#define _RKL_DTRACE_ENABLED +#endif // defined(RKL_DTRACE) && (RKL_DTRACE != 0) + +// These are internal, non-public tuneables. +#define RKL_SCRATCH_BUFFERS (4UL) +#define RKL_CACHE_LINE_SIZE (64UL) +#define RKL_DTRACE_REGEXUTF8_SIZE (64UL) + +////////////// +#pragma mark - +#pragma mark GCC / Compiler macros + +#if defined (__GNUC__) && (__GNUC__ >= 4) +#define RKL_ATTRIBUTES(attr, ...) __attribute__((attr, ##__VA_ARGS__)) +#define RKL_EXPECTED(cond, expect) __builtin_expect((long)(cond), (expect)) +#define RKL_PREFETCH(ptr) __builtin_prefetch(ptr) +#define RKL_PREFETCH_UNICHAR(ptr, off) { const char *p = ((const char *)(ptr)) + ((off) * sizeof(UniChar)) + RKL_CACHE_LINE_SIZE; RKL_PREFETCH(p); RKL_PREFETCH(p + RKL_CACHE_LINE_SIZE); } +#define RKL_HAVE_CLEANUP +#define RKL_CLEANUP(func) __attribute__((cleanup(func))) +#else // defined (__GNUC__) && (__GNUC__ >= 4) +#define RKL_ATTRIBUTES(attr, ...) +#define RKL_EXPECTED(cond, expect) cond +#define RKL_PREFETCH(ptr) +#define RKL_PREFETCH_UNICHAR(ptr, off) +#define RKL_CLEANUP(func) +#endif // defined (__GNUC__) && (__GNUC__ >= 4) + +#define RKL_STATIC_INLINE static __inline__ RKL_ATTRIBUTES(always_inline) +#define RKL_UNUSED_ARG RKL_ATTRIBUTES(unused) +#define RKL_NONNULL_ARGS(arg, ...) RKL_ATTRIBUTES(nonnull(arg, ##__VA_ARGS__)) +#define RKL_NONNULL_ARGS_WARN_UNUSED(arg, ...) RKL_ATTRIBUTES(warn_unused_result, nonnull(arg, ##__VA_ARGS__)) + +#if defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) +#define RKL_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(as, nn, ...) RKL_ATTRIBUTES(warn_unused_result, nonnull(nn, ##__VA_ARGS__), alloc_size(as)) +#else // defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) +#define RKL_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(as, nn, ...) RKL_ATTRIBUTES(warn_unused_result, nonnull(nn, ##__VA_ARGS__)) +#endif // defined (__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) + + +//////////// +#pragma mark - +#pragma mark Assertion macros + +// These macros are nearly identical to their NSCParameterAssert siblings. +// This is required because nearly everything is done while cacheSpinLock is locked. +// We need to safely unlock before throwing any of these exceptions. +// @try {} @finally {} significantly slows things down so it's not used. + +#define RKLCAssertDictionary(d, ...) rkl_makeAssertDictionary(__PRETTY_FUNCTION__, __FILE__, __LINE__, (d), ##__VA_ARGS__) +#define RKLCDelayedHardAssert(c, e, g) do { id *_e=(e); int _c=(c); if(RKL_EXPECTED(_e == NULL, 0L) || RKL_EXPECTED(*_e != NULL, 0L)) { goto g; } if(RKL_EXPECTED(!_c, 0L)) { *_e = RKLCAssertDictionary(@"Invalid parameter not satisfying: %s", #c); goto g; } } while(0) + +#ifdef NS_BLOCK_ASSERTIONS +#define RKLCDelayedAssert(c, e, g) +#define RKL_UNUSED_ASSERTION_ARG RKL_ATTRIBUTES(unused) +#else // NS_BLOCK_ASSERTIONS +#define RKLCDelayedAssert(c, e, g) RKLCDelayedHardAssert(c, e, g) +#define RKL_UNUSED_ASSERTION_ARG +#endif // NS_BLOCK_ASSERTIONS + +#define RKL_EXCEPTION(e, f, ...) [NSException exceptionWithName:(e) reason:rkl_stringFromClassAndMethod((self), (_cmd), (f), ##__VA_ARGS__) userInfo:NULL] +#define RKL_RAISE_EXCEPTION(e, f, ...) [RKL_EXCEPTION(e, f, ##__VA_ARGS__) raise] + +//////////// +#pragma mark - +#pragma mark Utility functions and macros + +RKL_STATIC_INLINE BOOL NSRangeInsideRange(NSRange cin, NSRange win) RKL_ATTRIBUTES(warn_unused_result); +RKL_STATIC_INLINE BOOL NSRangeInsideRange(NSRange cin, NSRange win) { return((((cin.location - win.location) <= win.length) && ((NSMaxRange(cin) - win.location) <= win.length)) ? YES : NO); } + +#define NSMakeRange(loc, len) ((NSRange){.location=(NSUInteger)(loc), .length=(NSUInteger)(len)}) +#define CFMakeRange(loc, len) ((CFRange){.location= (CFIndex)(loc), .length= (CFIndex)(len)}) +#define NSNotFoundRange ((NSRange){.location= NSNotFound, .length= 0UL}) +#define NSMaxiumRange ((NSRange){.location= 0UL, .length= NSUIntegerMax}) + +//////////// +#pragma mark - +#pragma mark Exported NSString symbols for exception names, error domains, error keys, etc + +NSString * const RKLICURegexException = @"RKLICURegexException"; + +NSString * const RKLICURegexErrorDomain = @"RKLICURegexErrorDomain"; + +NSString * const RKLICURegexErrorCodeErrorKey = @"RKLICURegexErrorCode"; +NSString * const RKLICURegexErrorNameErrorKey = @"RKLICURegexErrorName"; +NSString * const RKLICURegexLineErrorKey = @"RKLICURegexLine"; +NSString * const RKLICURegexOffsetErrorKey = @"RKLICURegexOffset"; +NSString * const RKLICURegexPreContextErrorKey = @"RKLICURegexPreContext"; +NSString * const RKLICURegexPostContextErrorKey = @"RKLICURegexPostContext"; +NSString * const RKLICURegexRegexErrorKey = @"RKLICURegexRegex"; +NSString * const RKLICURegexRegexOptionsErrorKey = @"RKLICURegexRegexOptions"; + +//////////// +#pragma mark - +#pragma mark Type / struct definitions + +// In general, the ICU bits and pieces here must exactly match the definition in the ICU sources. + +#define U_ZERO_ERROR 0 +#define U_INDEX_OUTOFBOUNDS_ERROR 8 +#define U_BUFFER_OVERFLOW_ERROR 15 + +#define U_PARSE_CONTEXT_LEN 16 + +typedef struct uregex uregex; // Opaque ICU regex type. + +typedef struct UParseError { // This must be exactly the same as the 'real' ICU declaration. + int32_t line; + int32_t offset; + UniChar preContext[U_PARSE_CONTEXT_LEN]; + UniChar postContext[U_PARSE_CONTEXT_LEN]; +} UParseError; + +// For use with GCC's cleanup() __attribute__. +#define RKLLockedCacheSpinLock ((NSUInteger)(1UL<<0)) +#define RKLUnlockedCacheSpinLock ((NSUInteger)(1UL<<1)) + +enum { + RKLSplitOp = 1, + RKLReplaceOp = 2, + RKLRangeOp = 3, + RKLArrayOfStringsOp = 4, + RKLArrayOfCapturesOp = 5, + RKLCapturesArrayOp = 6, + RKLMaskOp = 0xf, + RKLReplaceMutable = 1 << 4, + RKLSubcapturesArray = 1 << 5, +}; +typedef NSUInteger RKLRegexOp; + +typedef struct { + NSRange *ranges, findInRange; + NSInteger capacity, found, findUpTo, capture; + size_t size, stackUsed; + void **rangesScratchBuffer; + RKL_STRONG_REF void **stringsScratchBuffer; + RKL_STRONG_REF void **arraysScratchBuffer; +} RKLFindAll; + +typedef struct { + CFStringRef string; + CFHashCode hash; + CFIndex length; + RKL_STRONG_REF UniChar *uniChar; +} RKLBuffer; + +typedef struct { + CFStringRef regexString; + RKLRegexOptions options; + uregex *icu_regex; + NSInteger captureCount; + + CFStringRef setToString; + CFHashCode setToHash; + CFIndex setToLength; + NSUInteger setToIsImmutable:1; + NSUInteger setToNeedsConversion:1; + const UniChar *setToUniChar; + NSRange setToRange, lastFindRange, lastMatchRange; +#ifndef __LP64__ + NSUInteger pad[1]; // For 32 bits, this makes the struct 64 bytes exactly, which is good for cache line alignment. +#endif // __LP64__ +} RKLCacheSlot; + +//////////// +#pragma mark - +#pragma mark Translation unit scope global variables + +static UniChar fixedUniChar[(RKL_FIXED_LENGTH)]; // This is the fixed sized UTF-16 conversion buffer. +static RKLCacheSlot rkl_cacheSlots[(RKL_CACHE_SIZE)], *lastCacheSlot; +static OSSpinLock cacheSpinLock = OS_SPINLOCK_INIT; +static RKLBuffer dynamicBuffer, fixedBuffer = {NULL, 0UL, 0L, &fixedUniChar[0]}; +static const UniChar emptyUniCharString[1]; // For safety, icu_regexes are 'set' to this when the string they were searched is cleared. +static RKL_STRONG_REF void *scratchBuffer[(RKL_SCRATCH_BUFFERS)]; // Used to hold temporary allocations that are allocated via reallocf(). + +//////////// +#pragma mark - +#pragma mark CFArray call backs + +// These are used when running under manual memory management for the array that rkl_splitArray creates. +// The split strings are created, but not autoreleased. The (immutable) array is created using these callbacks, which skips the CFRetain() call, effectively transferring ownership to the CFArray object. +// For each split string this saves the overhead of an autorelease, then an array retain, then an NSAutoreleasePool release. This is good for a ~30% speed increase. + +static void RKLCFArrayRelease (CFAllocatorRef allocator RKL_UNUSED_ARG, const void *ptr) { CFRelease((CFTypeRef)ptr); } +static CFArrayCallBacks transferOwnershipArrayCallBacks = { (CFIndex)0L, NULL, RKLCFArrayRelease, CFCopyDescription, CFEqual }; + +#if defined(__OBJC_GC__) || defined(RKL_FORCE_GC) +//////////// +#pragma mark - +#pragma mark Low-level Garbage Collection aware memory/resource allocation utilities +// If compiled with Garbage Collection, we need to be able to do a few things slightly differently. +// The basic premiss is that under GC we use a trampoline function pointer which is set to a _start function to catch the first invocation. +// The _start function checks if GC is running and then overwrites the function pointer with the appropriate routine. Think of it as 'lazy linking'. + +enum { RKLScannedOption = NSScannedOption }; + +// rkl_collectingEnabled uses objc_getClass() to get the NSGarbageCollector class, which doesn't exist on earlier systems. +// This allows for graceful failure should we find ourselves running on an earlier version of the OS without NSGarbageCollector. +static BOOL rkl_collectingEnabled_first (void); +static BOOL rkl_collectingEnabled_yes (void) { return(YES); } +static BOOL rkl_collectingEnabled_no (void) { return(NO); } +static BOOL(*rkl_collectingEnabled) (void) = rkl_collectingEnabled_first; +static BOOL rkl_collectingEnabled_first (void) { + BOOL gcEnabled = ([objc_getClass("NSGarbageCollector") defaultCollector] != NULL) ? YES : NO; + if(gcEnabled == YES) { + // This section of code is required due to what I consider to be a fundamental design flaw in Cocoas GC system. + // Earlier versions of "Garbage Collection Programming Guide" stated that (paraphrased) "all globals are automatically roots". + // Current versions of the guide now include the following warning: + // "You may pass addresses of strong globals or statics into routines expecting pointers to object pointers (such as id* or NSError**) + // only if they have first been assigned to directly, rather than through a pointer dereference." + // This is a surprisingly non-trivial condition to actually meet in practice and is a recipe for impossible to debug race condition bugs. + // We just happen to be very, very, very lucky in the fact that we can initilize our root set before the first use. + int x; + for(x = 0; x < (int)(RKL_SCRATCH_BUFFERS); x++) { scratchBuffer[x] = NSAllocateCollectable(16UL, 0UL); scratchBuffer[x] = NULL; } + dynamicBuffer.uniChar = (RKL_STRONG_REF UniChar *)NSAllocateCollectable(16UL, 0UL); dynamicBuffer.uniChar = NULL; + } + return((rkl_collectingEnabled = (gcEnabled == YES) ? rkl_collectingEnabled_yes : rkl_collectingEnabled_no)()); +} + +// rkl_realloc() +static void *rkl_realloc_first (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags); +static void *rkl_realloc_std (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags RKL_UNUSED_ARG) { return((*ptr = reallocf(*ptr, size))); } +static void *rkl_realloc_gc (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags) { return((*ptr = NSReallocateCollectable(*ptr, (NSUInteger)size, flags))); } +static void *(*rkl_realloc) (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags) RKL_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(2,1) = rkl_realloc_first; +static void *rkl_realloc_first (RKL_STRONG_REF void **ptr, size_t size, NSUInteger flags) { return((rkl_realloc = (rkl_collectingEnabled()==YES) ? rkl_realloc_gc : rkl_realloc_std)(ptr, size, flags)); } + +// rkl_free() +static void * rkl_free_first (RKL_STRONG_REF void **ptr); +static void * rkl_free_std (RKL_STRONG_REF void **ptr) { if(*ptr != NULL) { free(*ptr); *ptr = NULL; } return(NULL); } +static void * rkl_free_gc (RKL_STRONG_REF void **ptr) { if(*ptr != NULL) { *ptr = NULL; } return(NULL); } +static void *(*rkl_free) (RKL_STRONG_REF void **ptr) RKL_NONNULL_ARGS(1) = rkl_free_first; +static void * rkl_free_first (RKL_STRONG_REF void **ptr) { return((rkl_free = (rkl_collectingEnabled()==YES) ? rkl_free_gc : rkl_free_std)(ptr)); } + +// rkl_CFAutorelease() +static id rkl_CFAutorelease_first (CFTypeRef obj); +static id rkl_CFAutorelease_std (CFTypeRef obj) { return([(id)obj autorelease]); } +static id rkl_CFAutorelease_gc (CFTypeRef obj) { return(NSMakeCollectable(obj)); } +static id(*rkl_CFAutorelease) (CFTypeRef obj) = rkl_CFAutorelease_first; +static id rkl_CFAutorelease_first (CFTypeRef obj) { return((rkl_CFAutorelease = (rkl_collectingEnabled()==YES) ? rkl_CFAutorelease_gc : rkl_CFAutorelease_std)(obj)); } + +// rkl_CreateStringWithSubstring() +static id rkl_CreateStringWithSubstring_first (id string, NSRange range); +static id rkl_CreateStringWithSubstring_std (id string, NSRange range) { return((id)CFStringCreateWithSubstring(NULL, (CFStringRef)string, CFMakeRange((CFIndex)range.location, (CFIndex)range.length))); } +static id rkl_CreateStringWithSubstring_gc (id string, NSRange range) { return([string substringWithRange:range]); } +static id(*rkl_CreateStringWithSubstring) (id string, NSRange range) RKL_NONNULL_ARGS_WARN_UNUSED(1) = rkl_CreateStringWithSubstring_first; +static id rkl_CreateStringWithSubstring_first (id string, NSRange range) { return((rkl_CreateStringWithSubstring = (rkl_collectingEnabled()==YES) ? rkl_CreateStringWithSubstring_gc : rkl_CreateStringWithSubstring_std)(string, range)); } + +// rkl_ReleaseObject() +static id rkl_ReleaseObject_first (id obj); +static id rkl_ReleaseObject_std (id obj) { CFRelease((CFTypeRef)obj); return(NULL); } +static id rkl_ReleaseObject_gc (id obj RKL_UNUSED_ARG) { return(NULL); } +static id (*rkl_ReleaseObject) (id obj) RKL_NONNULL_ARGS(1) = rkl_ReleaseObject_first; +static id rkl_ReleaseObject_first (id obj) { return((rkl_ReleaseObject = (rkl_collectingEnabled()==YES) ? rkl_ReleaseObject_gc : rkl_ReleaseObject_std)(obj)); } + +// rkl_CreateArrayWithObjects() +static id rkl_CreateArrayWithObjects_first (void **objects, NSUInteger count); +static id rkl_CreateArrayWithObjects_std (void **objects, NSUInteger count) { return((id)CFArrayCreate(NULL, (const void **)objects, (CFIndex)count, &transferOwnershipArrayCallBacks)); } +static id rkl_CreateArrayWithObjects_gc (void **objects, NSUInteger count) { return([NSArray arrayWithObjects:(const id *)objects count:count]); } +static id(*rkl_CreateArrayWithObjects) (void **objects, NSUInteger count) RKL_NONNULL_ARGS_WARN_UNUSED(1) = rkl_CreateArrayWithObjects_first; +static id rkl_CreateArrayWithObjects_first (void **objects, NSUInteger count) { return((rkl_CreateArrayWithObjects = (rkl_collectingEnabled()==YES) ? rkl_CreateArrayWithObjects_gc : rkl_CreateArrayWithObjects_std)(objects, count)); } + +// rkl_CreateAutoreleasedArray() +static id rkl_CreateAutoreleasedArray_first (void **objects, NSUInteger count); +static id rkl_CreateAutoreleasedArray_std (void **objects, NSUInteger count) { return((id)rkl_CFAutorelease(rkl_CreateArrayWithObjects(objects, count))); } +static id rkl_CreateAutoreleasedArray_gc (void **objects, NSUInteger count) { return(rkl_CreateArrayWithObjects(objects, count)); } +static id(*rkl_CreateAutoreleasedArray) (void **objects, NSUInteger count) RKL_NONNULL_ARGS_WARN_UNUSED(1) = rkl_CreateAutoreleasedArray_first; +static id rkl_CreateAutoreleasedArray_first (void **objects, NSUInteger count) { return((rkl_CreateAutoreleasedArray = (rkl_collectingEnabled()==YES) ? rkl_CreateAutoreleasedArray_gc : rkl_CreateAutoreleasedArray_std)(objects, count)); } + +#else // __OBJC_GC__ not defined +//////////// +#pragma mark - +#pragma mark Low-level explicit memory/resource allocation utilities + +enum { RKLScannedOption = 0 }; + +#define rkl_collectingEnabled() (NO) + +RKL_STATIC_INLINE void *rkl_realloc (void **ptr, size_t size, NSUInteger flags) RKL_ALLOC_SIZE_NON_NULL_ARGS_WARN_UNUSED(2,1); +RKL_STATIC_INLINE void *rkl_free (void **ptr) RKL_NONNULL_ARGS(1); +RKL_STATIC_INLINE id rkl_CFAutorelease (CFTypeRef obj); +RKL_STATIC_INLINE id rkl_CreateAutoreleasedArray (void **objects, NSUInteger count) RKL_NONNULL_ARGS_WARN_UNUSED(1); +RKL_STATIC_INLINE id rkl_CreateArrayWithObjects (void **objects, NSUInteger count) RKL_NONNULL_ARGS_WARN_UNUSED(1); +RKL_STATIC_INLINE id rkl_CreateStringWithSubstring (id string, NSRange range) RKL_NONNULL_ARGS_WARN_UNUSED(1); +RKL_STATIC_INLINE id rkl_ReleaseObject (id obj) RKL_NONNULL_ARGS(1); + +RKL_STATIC_INLINE void *rkl_realloc (void **ptr, size_t size, NSUInteger flags RKL_UNUSED_ARG) { return((*ptr = reallocf(*ptr, size))); } +RKL_STATIC_INLINE void *rkl_free (void **ptr) { if(*ptr != NULL) { free(*ptr); *ptr = NULL; } return(NULL); } +RKL_STATIC_INLINE id rkl_CFAutorelease (CFTypeRef obj) { return([(id)obj autorelease]); } +RKL_STATIC_INLINE id rkl_CreateArrayWithObjects (void **objects, NSUInteger count) { return((id)CFArrayCreate(NULL, (const void **)objects, (CFIndex)count, &transferOwnershipArrayCallBacks)); } +RKL_STATIC_INLINE id rkl_CreateAutoreleasedArray (void **objects, NSUInteger count) { return(rkl_CFAutorelease(rkl_CreateArrayWithObjects(objects, count))); } +RKL_STATIC_INLINE id rkl_CreateStringWithSubstring (id string, NSRange range) { return((id)CFStringCreateWithSubstring(NULL, (CFStringRef)string, CFMakeRange((CFIndex)range.location, (CFIndex)[range length]))); } +RKL_STATIC_INLINE id rkl_ReleaseObject (id obj) { CFRelease((CFTypeRef)obj); return(NULL); } + +#endif // __OBJC_GC__ + +//////////// +#pragma mark - +#pragma mark ICU function prototypes + +// ICU functions. See http://www.icu-project.org/apiref/icu4c/uregex_8h.html Tweaked slightly from the originals, but functionally identical. +const char *RKL_ICU_FUNCTION_APPEND(u_errorName) (int32_t status) RKL_ATTRIBUTES(pure); +int32_t RKL_ICU_FUNCTION_APPEND(u_strlen) (const UniChar *s) RKL_ATTRIBUTES(nonnull(1), pure); +int32_t RKL_ICU_FUNCTION_APPEND(uregex_appendReplacement) (uregex *regexp, const UniChar *replacementText, int32_t replacementLength, UniChar **destBuf, int32_t *destCapacity, int32_t *status) RKL_NONNULL_ARGS(1,2,4,5,6); +int32_t RKL_ICU_FUNCTION_APPEND(uregex_appendTail) (uregex *regexp, UniChar **destBuf, int32_t *destCapacity, int32_t *status) RKL_NONNULL_ARGS(1,2,3,4); +void RKL_ICU_FUNCTION_APPEND(uregex_close) (uregex *regexp) RKL_NONNULL_ARGS(1); +int32_t RKL_ICU_FUNCTION_APPEND(uregex_end) (uregex *regexp, int32_t groupNum, int32_t *status) RKL_NONNULL_ARGS(1,3); +BOOL RKL_ICU_FUNCTION_APPEND(uregex_find) (uregex *regexp, int32_t location, int32_t *status) RKL_NONNULL_ARGS(1,3); +BOOL RKL_ICU_FUNCTION_APPEND(uregex_findNext) (uregex *regexp, int32_t *status) RKL_NONNULL_ARGS(1,2); +int32_t RKL_ICU_FUNCTION_APPEND(uregex_groupCount) (uregex *regexp, int32_t *status) RKL_NONNULL_ARGS(1,2); +uregex *RKL_ICU_FUNCTION_APPEND(uregex_open) (const UniChar *pattern, int32_t patternLength, RKLRegexOptions flags, UParseError *parseError, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,4,5); +void RKL_ICU_FUNCTION_APPEND(uregex_reset) (uregex *regexp, int32_t newIndex, int32_t *status) RKL_NONNULL_ARGS(1,3); +void RKL_ICU_FUNCTION_APPEND(uregex_setText) (uregex *regexp, const UniChar *text, int32_t textLength, int32_t *status) RKL_NONNULL_ARGS(1,2,4); +int32_t RKL_ICU_FUNCTION_APPEND(uregex_start) (uregex *regexp, int32_t groupNum, int32_t *status) RKL_NONNULL_ARGS(1,3); + +//////////// +#pragma mark - +#pragma mark RegexKitLite internal, private function prototypes + +static RKLCacheSlot *rkl_getCachedRegex (NSString *regexString, RKLRegexOptions options, NSError **error, id *exception) RKL_NONNULL_ARGS_WARN_UNUSED(1,4); +static NSUInteger rkl_setCacheSlotToString (RKLCacheSlot *cacheSlot, const NSRange *range, int32_t *status, id *exception RKL_UNUSED_ASSERTION_ARG) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,3,4); +static RKLCacheSlot *rkl_getCachedRegexSetToString (NSString *regexString, RKLRegexOptions options, NSString *matchString, NSUInteger *matchLengthPtr, NSRange *matchRange, NSError **error, id *exception, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,3,4,5,7,8); +static id rkl_performRegexOp (id self, SEL _cmd, RKLRegexOp regexOp, NSString *regexString, RKLRegexOptions options, NSInteger capture, id matchString, NSRange *matchRange, NSString *replacementString, NSError **error, void *result) RKL_NONNULL_ARGS(1,2); +static void rkl_handleDelayedAssert (id self, SEL _cmd, id exception) RKL_NONNULL_ARGS(1,2,3); + +static NSUInteger rkl_search (RKLCacheSlot *cacheSlot, NSRange *searchRange, NSUInteger updateSearchRange, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4,5); + +static BOOL rkl_findRanges (RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindAll *findAll, id *exception, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,3,4,5); +static NSUInteger rkl_growFindRanges (RKLCacheSlot *cacheSlot, NSUInteger lastLocation, RKLFindAll *findAll, id *exception RKL_UNUSED_ASSERTION_ARG) RKL_NONNULL_ARGS_WARN_UNUSED(1,3,4); +static NSArray *rkl_makeArray (RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindAll *findAll, id *exception RKL_UNUSED_ASSERTION_ARG) RKL_NONNULL_ARGS_WARN_UNUSED(1,3,4); + +static NSString *rkl_replaceString (RKLCacheSlot *cacheSlot, id searchString, NSUInteger searchU16Length, NSString *replacementString, NSUInteger replacementU16Length, NSUInteger *replacedCount, NSUInteger replaceMutable, id *exception, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4,8,9); +static int32_t rkl_replaceAll (RKLCacheSlot *cacheSlot, const UniChar *replacementUniChar, int32_t replacementU16Length, UniChar *replacedUniChar, int32_t replacedU16Capacity, NSUInteger *replacedCount, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4,7,8); + +static NSUInteger rkl_isRegexValid (id self, SEL _cmd, NSString *regex, RKLRegexOptions options, NSInteger *captureCountPtr, NSError **error) RKL_NONNULL_ARGS(1,2); + +static void rkl_clearStringCache (void); +static void rkl_clearBuffer (RKLBuffer *buffer, NSUInteger freeDynamicBuffer) RKL_NONNULL_ARGS(1); +static void rkl_clearCacheSlotRegex (RKLCacheSlot *cacheSlot) RKL_NONNULL_ARGS(1); +static void rkl_clearCacheSlotSetTo (RKLCacheSlot *cacheSlot) RKL_NONNULL_ARGS(1); + +static NSDictionary *rkl_userInfoDictionary (NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status, ...) RKL_ATTRIBUTES(sentinel, nonnull(1), warn_unused_result); +static NSError *rkl_NSErrorForRegex (NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status) RKL_NONNULL_ARGS_WARN_UNUSED(1); +static NSException *rkl_NSExceptionForRegex (NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status) RKL_NONNULL_ARGS_WARN_UNUSED(1); +static NSDictionary *rkl_makeAssertDictionary (const char *function, const char *file, int line, NSString *format, ...) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4); +static NSString *rkl_stringFromClassAndMethod (id object, SEL selector, NSString *format, ...) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,3); + +RKL_STATIC_INLINE int32_t rkl_getRangeForCapture(RKLCacheSlot *cs, int32_t *s, int32_t c, NSRange *r) RKL_NONNULL_ARGS_WARN_UNUSED(1,2,4); +RKL_STATIC_INLINE int32_t rkl_getRangeForCapture(RKLCacheSlot *cs, int32_t *s, int32_t c, NSRange *r) { uregex *re = cs->icu_regex; int32_t start = RKL_ICU_FUNCTION_APPEND(uregex_start)(re, c, s); if(RKL_EXPECTED((*s > U_ZERO_ERROR), 0L) || (start == -1)) { *r = NSNotFoundRange; } else { r->location = (NSUInteger)start; r->length = (NSUInteger)RKL_ICU_FUNCTION_APPEND(uregex_end)(re, c, s) - r->location; r->location += cs->setToRange.location; } return(*s); } + +RKL_STATIC_INLINE RKLFindAll rkl_makeFindAll(NSRange *r, NSRange fir, NSInteger c, size_t s, size_t su, void **rsb, RKL_STRONG_REF void **ssb, RKL_STRONG_REF void **asb, NSInteger f, NSInteger cap, NSInteger fut) RKL_ATTRIBUTES(warn_unused_result); +RKL_STATIC_INLINE RKLFindAll rkl_makeFindAll(NSRange *r, NSRange fir, NSInteger c, size_t s, size_t su, void **rsb, RKL_STRONG_REF void **ssb, RKL_STRONG_REF void **asb, NSInteger f, NSInteger cap, NSInteger fut) { return(((RKLFindAll){ .ranges=r, .findInRange=fir, .capacity=c, .found=f, .findUpTo=fut, .capture=cap, .size=s, .stackUsed=su, .rangesScratchBuffer=rsb, .stringsScratchBuffer=ssb, .arraysScratchBuffer=asb})); } + +//////////// +#pragma mark - +#pragma mark RKL_FAST_MUTABLE_CHECK implementation + +#ifdef RKL_FAST_MUTABLE_CHECK +// We use a trampoline function pointer to check at run time if the function __CFStringIsMutable is available. +// If it is, the trampoline function pointer is replaced with the address of that function. +// Otherwise, we assume the worst case that every string is mutable. +// This hopefully helps to protect us since we're using an undocumented, non-public API call. +// We will keep on working if it ever does go away, just with a bit less performance due to the overhead of mutable checks. + +static BOOL rkl_CFStringIsMutable_first (CFStringRef str); +static BOOL rkl_CFStringIsMutable_yes (CFStringRef str RKL_UNUSED_ARG) { return(YES); } +static BOOL(*rkl_CFStringIsMutable) (CFStringRef str) = rkl_CFStringIsMutable_first; +static BOOL rkl_CFStringIsMutable_first (CFStringRef str) { if((rkl_CFStringIsMutable = (BOOL(*)(CFStringRef))dlsym(RTLD_DEFAULT, "__CFStringIsMutable")) == NULL) { rkl_CFStringIsMutable = rkl_CFStringIsMutable_yes; } return(rkl_CFStringIsMutable(str)); } +#else // RKL_FAST_MUTABLE_CHECK is not defined. Assume that all strings are potentially mutable. +#define rkl_CFStringIsMutable(s) (YES) +#endif // RKL_FAST_MUTABLE_CHECK + + +//////////// +#pragma mark - +#pragma mark iPhone / iPod touch low memory notification handler + +#if defined(RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS) && (RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS == 1) + +// The next few lines are specifically for the iPhone to catch low memory conditions. +// The basic idea is that rkl_RegisterForLowMemoryNotifications() is set to be run once by the linker at load time via __attribute((constructor)). +// rkl_RegisterForLowMemoryNotifications() tries to find the iPhone low memory notification symbol. If it can find it, +// it registers with the default NSNotificationCenter to call the RKLLowMemoryWarningObserver class method +lowMemoryWarning:. +// rkl_RegisterForLowMemoryNotifications() uses an atomic compare and swap to guarantee that it initalizes exactly once. +// +lowMemoryWarning tries to acquire the cache lock. If it gets the lock, it clears the cache. If it can't, it calls performSelector: +// with a delay of half a second to try again. This will hopefully prevent any deadlocks, such as a RegexKitLite request for +// memory triggering a notifcation while the lock is held. + +static void rkl_RegisterForLowMemoryNotifications(void) RKL_ATTRIBUTES(used); + +@interface RKLLowMemoryWarningObserver : NSObject +(void)lowMemoryWarning:(id)notification; @end +@implementation RKLLowMemoryWarningObserver ++(void)lowMemoryWarning:(id)notification { + if(OSSpinLockTry(&cacheSpinLock)) { rkl_clearStringCache(); OSSpinLockUnlock(&cacheSpinLock); } + else { [[RKLLowMemoryWarningObserver class] performSelector:@selector(lowMemoryWarning:) withObject:NULL afterDelay:(NSTimeInterval)0.1]; } +} +@end + +static int rkl_HaveRegisteredForLowMemoryNotifications = 0; + +__attribute__((constructor)) static void rkl_RegisterForLowMemoryNotifications(void) { + void **memoryWarningNotification = NULL; + + if(OSAtomicCompareAndSwapIntBarrier(0, 1, &rkl_HaveRegisteredForLowMemoryNotifications)) { + if((memoryWarningNotification = (void **)dlsym(RTLD_DEFAULT, "UIApplicationDidReceiveMemoryWarningNotification")) != NULL) { + [[NSNotificationCenter defaultCenter] addObserver:[RKLLowMemoryWarningObserver class] selector:@selector(lowMemoryWarning:) name:(NSString *)*memoryWarningNotification object:NULL]; + } + } +} + +#endif // defined(RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS) && (RKL_REGISTER_FOR_IPHONE_LOWMEM_NOTIFICATIONS == 1) + +#ifdef _RKL_DTRACE_ENABLED + +// compiledRegexCache(unsigned long eventID, const char *regexUTF8, int options, int captures, int hitMiss, int icuStatusCode, const char *icuErrorMessage, double *hitRate); +// utf16ConversionCache(unsigned long eventID, unsigned int lookupResultFlags, double *hitRate, const void *string, unsigned long NSRange.location, unsigned long [NSRange length], long length); + +/* +provider RegexKitLite { + probe compiledRegexCache(unsigned long, const char *, unsigned int, int, int, int, const char *, double *); + probe utf16ConversionCache(unsigned long, unsigned int, double *, const void *, unsigned long, unsigned long, long); +}; + +#pragma D attributes Unstable/Unstable/Common provider RegexKitLite provider +#pragma D attributes Private/Private/Common provider RegexKitLite module +#pragma D attributes Private/Private/Common provider RegexKitLite function +#pragma D attributes Unstable/Unstable/Common provider RegexKitLite name +#pragma D attributes Unstable/Unstable/Common provider RegexKitLite args +*/ + +#define REGEXKITLITE_STABILITY "___dtrace_stability$RegexKitLite$v1$4_4_5_1_1_5_1_1_5_4_4_5_4_4_5" +#define REGEXKITLITE_TYPEDEFS "___dtrace_typedefs$RegexKitLite$v1" +#define REGEXKITLITE_COMPILEDREGEXCACHE(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { __asm__ volatile(".reference " REGEXKITLITE_TYPEDEFS); __dtrace_probe$RegexKitLite$compiledRegexCache$v1$756e7369676e6564206c6f6e67$63686172202a$756e7369676e656420696e74$696e74$696e74$696e74$63686172202a$646f75626c65202a(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); __asm__ volatile(".reference " REGEXKITLITE_STABILITY); } +#define REGEXKITLITE_COMPILEDREGEXCACHE_ENABLED() __dtrace_isenabled$RegexKitLite$compiledRegexCache$v1() +#define REGEXKITLITE_CONVERTEDSTRINGU16CACHE(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { __asm__ volatile(".reference " REGEXKITLITE_TYPEDEFS); __dtrace_probe$RegexKitLite$utf16ConversionCache$v1$756e7369676e6564206c6f6e67$756e7369676e656420696e74$646f75626c65202a$766f6964202a$756e7369676e6564206c6f6e67$756e7369676e6564206c6f6e67$6c6f6e67(arg0, arg1, arg2, arg3, arg4, arg5, arg6); __asm__ volatile(".reference " REGEXKITLITE_STABILITY); } +#define REGEXKITLITE_CONVERTEDSTRINGU16CACHE_ENABLED() __dtrace_isenabled$RegexKitLite$utf16ConversionCache$v1() + +extern void __dtrace_probe$RegexKitLite$compiledRegexCache$v1$756e7369676e6564206c6f6e67$63686172202a$756e7369676e656420696e74$696e74$696e74$696e74$63686172202a$646f75626c65202a(unsigned long, const char *, unsigned int, int, int, int, const char *, double *); +extern int __dtrace_isenabled$RegexKitLite$compiledRegexCache$v1(void); +extern void __dtrace_probe$RegexKitLite$utf16ConversionCache$v1$756e7369676e6564206c6f6e67$756e7369676e656420696e74$646f75626c65202a$766f6964202a$756e7369676e6564206c6f6e67$756e7369676e6564206c6f6e67$6c6f6e67(unsigned long, unsigned int, double *, const void *, unsigned long, unsigned long, long); +extern int __dtrace_isenabled$RegexKitLite$utf16ConversionCache$v1(void); + +//////////////////////////// + +enum { + RKLCacheHitLookupFlag = 1 << 0, + RKLConversionRequiredLookupFlag = 1 << 1, + RKLSetTextLookupFlag = 1 << 2, + RKLDynamicBufferLookupFlag = 1 << 3, + RKLErrorLookupFlag = 1 << 4, +}; + +#define rkl_dtrace_addLookupFlag(a,b) do { a |= (unsigned int)(b); } while(0) + +static char rkl_dtrace_regexUTF8[(RKL_CACHE_SIZE) + 1][(RKL_DTRACE_REGEXUTF8_SIZE)]; +static NSUInteger rkl_dtrace_eventID, rkl_dtrace_compiledCacheLookups, rkl_dtrace_compiledCacheHits, rkl_dtrace_conversionBufferLookups, rkl_dtrace_conversionBufferHits; + +#define rkl_dtrace_incrementEventID() do { rkl_dtrace_eventID++; } while(0) +#define rkl_dtrace_compiledRegexCache(a0, a1, a2, a3, a4, a5) do { int _a3 = (a3); rkl_dtrace_compiledCacheLookups++; if(_a3 == 1) { rkl_dtrace_compiledCacheHits++; } if(RKL_EXPECTED(REGEXKITLITE_COMPILEDREGEXCACHE_ENABLED(), 0L)) { double hitRate = 0.0; if(rkl_dtrace_compiledCacheLookups > 0UL) { hitRate = ((double)rkl_dtrace_compiledCacheHits / (double)rkl_dtrace_compiledCacheLookups) * 100.0; } REGEXKITLITE_COMPILEDREGEXCACHE(rkl_dtrace_eventID, a0, a1, a2, _a3, a4, a5, &hitRate); } } while(0) +#define rkl_dtrace_utf16ConversionCache(a0, a1, a2, a3, a4) do { unsigned int _a0 = (a0); if((_a0 & RKLConversionRequiredLookupFlag) != 0U) { rkl_dtrace_conversionBufferLookups++; if((_a0 & RKLCacheHitLookupFlag) != 0U) { rkl_dtrace_conversionBufferHits++; } } if(RKL_EXPECTED(REGEXKITLITE_CONVERTEDSTRINGU16CACHE_ENABLED(), 0L)) { double hitRate = 0.0; if(rkl_dtrace_conversionBufferLookups > 0UL) { hitRate = ((double)rkl_dtrace_conversionBufferHits / (double)rkl_dtrace_conversionBufferLookups) * 100.0; } REGEXKITLITE_CONVERTEDSTRINGU16CACHE(rkl_dtrace_eventID, _a0, &hitRate, a1, a2, a3, a4); } } while(0) + + +// \342\200\246 == UTF8 for HORIZONTAL ELLIPSIS, aka triple dots '...' +#define RKL_UTF8_ELLIPSE "\342\200\246" + +// rkl_dtrace_getRegexUTF8 will copy the str argument to utf8Buffer using UTF8 as the string encoding. +// If the utf8 encoding would take up more bytes than the utf8Buffers length, then the unicode character 'HORIZONTAL ELLIPSIS' ('...') is appened to indicate truncation occured. +static void rkl_dtrace_getRegexUTF8(CFStringRef str, char *utf8Buffer) RKL_NONNULL_ARGS(2); +static void rkl_dtrace_getRegexUTF8(CFStringRef str, char *utf8Buffer) { + if((str == NULL) || (utf8Buffer == NULL)) { return; } + CFIndex maxLength = ((CFIndex)(RKL_DTRACE_REGEXUTF8_SIZE) - 2L), maxBytes = (maxLength - (CFIndex)sizeof(RKL_UTF8_ELLIPSE) - 1L), stringU16Length = CFStringGetLength(str), usedBytes = 0L; + CFStringGetBytes(str, CFMakeRange(0L, ((stringU16Length < maxLength) ? stringU16Length : maxLength)), kCFStringEncodingUTF8, (UInt8)'?', (Boolean)0, (UInt8 *)utf8Buffer, maxBytes, &usedBytes); + if(usedBytes == maxBytes) { strncpy(utf8Buffer + usedBytes, RKL_UTF8_ELLIPSE, ((size_t)(RKL_DTRACE_REGEXUTF8_SIZE) - (size_t)usedBytes) - 2UL); } else { utf8Buffer[usedBytes] = (char)0; } +} + +#else // _RKL_DTRACE_ENABLED + +#define rkl_dtrace_incrementEventID() +#define rkl_dtrace_compiledRegexCache(a0, a1, a2, a3, a4, a5) +#define rkl_dtrace_utf16ConversionCache(a0, a1, a2, a3, a4) +#define rkl_dtrace_getRegexUTF8(str, buf) +#define rkl_dtrace_addLookupFlag(a,b) + +#endif // _RKL_DTRACE_ENABLED + +//////////// +#pragma mark - +#pragma mark RegexKitLite low-level internal functions + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called with cacheSpinLock already locked! +// ---------- + +static RKLCacheSlot *rkl_getCachedRegex(NSString *regexString, RKLRegexOptions options, NSError **error, id *exception) { + RKLCacheSlot *cacheSlot = NULL; + CFHashCode regexHash = 0UL; + int32_t status = 0; + + RKLCDelayedAssert((cacheSpinLock != 0) && (regexString != NULL), exception, exitNow); + + // Fast path the common case where this regex is exactly the same one used last time. + // The pointer equality test is valid under these circumstances since the cacheSlot->regexString is an immutable copy. + // If the regexString argument is mutable, this test will fail, and we'll use the the slow path cache check below. + if(RKL_EXPECTED(lastCacheSlot != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->options == options, 1L) && RKL_EXPECTED(lastCacheSlot->icu_regex != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->regexString != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->regexString == (CFStringRef)regexString, 1L)) { + rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(lastCacheSlot - &rkl_cacheSlots[0])][0], lastCacheSlot->options, (int)lastCacheSlot->captureCount, 1, 0, NULL); + return(lastCacheSlot); + } + + lastCacheSlot = NULL; + regexHash = CFHash((CFTypeRef)regexString); + cacheSlot = &rkl_cacheSlots[(regexHash % (CFHashCode)(RKL_CACHE_SIZE))]; // Retrieve the cache slot for this regex. + + // Return the cached entry if it's a match, otherwise clear the slot and create a new ICU regex in its place. + // If regexString is mutable, the pointer equality test will fail, and CFEqual() is used to determine true + // equality with the immutable cacheSlot copy. CFEqual() performs a slow character by character check. + if(RKL_EXPECTED(cacheSlot->options == options, 1L) && RKL_EXPECTED(cacheSlot->icu_regex != NULL, 1L) && RKL_EXPECTED(cacheSlot->regexString != NULL, 1L) && (RKL_EXPECTED(cacheSlot->regexString == (CFStringRef)regexString, 1L) || RKL_EXPECTED(CFEqual((CFTypeRef)regexString, (CFTypeRef)cacheSlot->regexString) == YES, 1L))) { + lastCacheSlot = cacheSlot; + rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(lastCacheSlot - &rkl_cacheSlots[0])][0], lastCacheSlot->options, (int)lastCacheSlot->captureCount, 1, 0, NULL); + return(cacheSlot); + } + + rkl_clearCacheSlotRegex(cacheSlot); + + if(RKL_EXPECTED((cacheSlot->regexString = CFStringCreateCopy(NULL, (CFStringRef)regexString)) == NULL, 0L)) { goto exitNow; } ; // Get a cheap immutable copy. + rkl_dtrace_getRegexUTF8(cacheSlot->regexString, &rkl_dtrace_regexUTF8[(cacheSlot - &rkl_cacheSlots[0])][0]); + cacheSlot->options = options; + + CFIndex regexStringU16Length = CFStringGetLength(cacheSlot->regexString); // In UTF16 code units. + UParseError parseError = (UParseError){-1, -1, {0}, {0}}; + const UniChar *regexUniChar = NULL; + + if(RKL_EXPECTED(regexStringU16Length >= (CFIndex)INT_MAX, 0L)) { *exception = [NSException exceptionWithName:NSRangeException reason:@"Regex string length exceeds INT_MAX" userInfo:NULL]; goto exitNow; } + + // Try to quickly obtain regexString in UTF16 format. + if((regexUniChar = CFStringGetCharactersPtr(cacheSlot->regexString)) == NULL) { // We didn't get the UTF16 pointer quickly and need to perform a full conversion in a temp buffer. + UniChar *uniCharBuffer = NULL; + if(((size_t)regexStringU16Length * sizeof(UniChar)) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((uniCharBuffer = (UniChar *)alloca( (size_t)regexStringU16Length * sizeof(UniChar) )) == NULL, 0L)) { goto exitNow; } } // Try to use the stack. + else { if(RKL_EXPECTED((uniCharBuffer = (UniChar *)rkl_realloc(&scratchBuffer[0], (size_t)regexStringU16Length * sizeof(UniChar), 0UL)) == NULL, 0L)) { goto exitNow; } } // Otherwise use the heap. + CFStringGetCharacters(cacheSlot->regexString, CFMakeRange(0L, regexStringU16Length), uniCharBuffer); // Convert regexString to UTF16. + regexUniChar = uniCharBuffer; + } + + // Create the ICU regex. + if(RKL_EXPECTED((cacheSlot->icu_regex = RKL_ICU_FUNCTION_APPEND(uregex_open)(regexUniChar, (int32_t)regexStringU16Length, options, &parseError, &status)) == NULL, 0L)) { goto exitNow; } + if(RKL_EXPECTED(status <= U_ZERO_ERROR, 1L)) { cacheSlot->captureCount = (NSInteger)RKL_ICU_FUNCTION_APPEND(uregex_groupCount)(cacheSlot->icu_regex, &status); } + if(RKL_EXPECTED(status <= U_ZERO_ERROR, 1L)) { lastCacheSlot = cacheSlot; } + +exitNow: + if(RKL_EXPECTED(scratchBuffer[0] != NULL, 0L)) { scratchBuffer[0] = rkl_free(&scratchBuffer[0]); } + if(RKL_EXPECTED(status > U_ZERO_ERROR, 0L)) { rkl_clearCacheSlotRegex(cacheSlot); cacheSlot = NULL; if(error != NULL) { *error = rkl_NSErrorForRegex(regexString, options, &parseError, status); } } + +#ifdef _RKL_DTRACE_ENABLED + if(RKL_EXPECTED(cacheSlot != NULL, 1L)) { rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(cacheSlot - &rkl_cacheSlots[0])][0], cacheSlot->options, (int)cacheSlot->captureCount, 0, status, NULL); } + else { char regexUTF8[(RKL_DTRACE_REGEXUTF8_SIZE)]; const char *err = NULL; if(status != U_ZERO_ERROR) { err = RKL_ICU_FUNCTION_APPEND(u_errorName)(status); } rkl_dtrace_getRegexUTF8((CFStringRef)regexString, regexUTF8); rkl_dtrace_compiledRegexCache(regexUTF8, options, -1, -1, status, err); } +#endif // _RKL_DTRACE_ENABLED + + return(cacheSlot); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called with cacheSpinLock already locked! +// ---------- + +static NSUInteger rkl_setCacheSlotToString(RKLCacheSlot *cacheSlot, const NSRange *range, int32_t *status, id *exception RKL_UNUSED_ASSERTION_ARG) { + RKLCDelayedAssert((cacheSlot != NULL) && (cacheSlot->setToString != NULL) && ((range != NULL) && (NSEqualRanges(*range, NSNotFoundRange) == NO)) && (status != NULL), exception, exitNow); + const UniChar *stringUniChar = NULL; +#ifdef _RKL_DTRACE_ENABLED + unsigned int lookupResultFlags = 0U; +#endif + + if(cacheSlot->setToNeedsConversion == 0U) { + if(RKL_EXPECTED((stringUniChar = CFStringGetCharactersPtr(cacheSlot->setToString)) == NULL, 0L)) { cacheSlot->setToNeedsConversion = 1U; } + else { if(RKL_EXPECTED(cacheSlot->setToUniChar != stringUniChar, 0L)) { cacheSlot->setToRange = NSNotFoundRange; cacheSlot->setToUniChar = stringUniChar; } goto setRegexText; } + } + rkl_dtrace_addLookupFlag(lookupResultFlags, RKLConversionRequiredLookupFlag); + + NSUInteger useFixedBuffer = (cacheSlot->setToLength < (CFIndex)(RKL_FIXED_LENGTH)) ? 1UL : 0UL; + RKLBuffer *buffer = useFixedBuffer ? &fixedBuffer : &dynamicBuffer; + rkl_dtrace_addLookupFlag(lookupResultFlags, (useFixedBuffer ? 0U : RKLDynamicBufferLookupFlag)); + + if((cacheSlot->setToUniChar != NULL) && ((cacheSlot->setToString == buffer->string) || ((cacheSlot->setToLength == buffer->length) && (cacheSlot->setToHash == buffer->hash)))) { rkl_dtrace_addLookupFlag(lookupResultFlags, RKLCacheHitLookupFlag); goto setRegexText; } + + if(RKL_EXPECTED((stringUniChar = CFStringGetCharactersPtr(cacheSlot->setToString)) != NULL, 0L)) { cacheSlot->setToNeedsConversion = 0U; cacheSlot->setToRange = NSNotFoundRange; cacheSlot->setToUniChar = stringUniChar; goto setRegexText; } + + rkl_clearBuffer(buffer, 0UL); + + if(useFixedBuffer == 0U) { + RKLCDelayedAssert(buffer == &dynamicBuffer, exception, exitNow); + RKL_STRONG_REF void *p = (RKL_STRONG_REF void *)dynamicBuffer.uniChar; + if(RKL_EXPECTED((dynamicBuffer.uniChar = (RKL_STRONG_REF UniChar *)rkl_realloc(&p, ((size_t)cacheSlot->setToLength * sizeof(UniChar)), 0UL)) == NULL, 0L)) { goto exitNow; } // Resize the buffer. + } + + RKLCDelayedAssert(buffer->uniChar != NULL, exception, exitNow); + CFStringGetCharacters(cacheSlot->setToString, CFMakeRange(0L, cacheSlot->setToLength), (UniChar *)buffer->uniChar); // Convert to a UTF16 string. + + RKLCDelayedAssert(buffer->string == NULL, exception, exitNow); + if(RKL_EXPECTED((buffer->string = (CFStringRef)CFRetain((CFTypeRef)cacheSlot->setToString)) == NULL, 0L)) { goto exitNow; } + buffer->hash = cacheSlot->setToHash; + buffer->length = cacheSlot->setToLength; + + cacheSlot->setToUniChar = buffer->uniChar; + cacheSlot->setToRange = NSNotFoundRange; + +setRegexText: + if(NSEqualRanges(cacheSlot->setToRange, *range) == NO) { + RKLCDelayedAssert((cacheSlot->icu_regex != NULL) && (cacheSlot->setToUniChar != NULL) && (NSMaxRange(*range) <= (NSUInteger)cacheSlot->setToLength) && (cacheSlot->setToRange.length <= INT_MAX), exception, exitNow); + cacheSlot->lastFindRange = cacheSlot->lastMatchRange = NSNotFoundRange; + cacheSlot->setToRange = *range; + RKL_ICU_FUNCTION_APPEND(uregex_setText)(cacheSlot->icu_regex, cacheSlot->setToUniChar + cacheSlot->setToRange.location, (int32_t)cacheSlot->setToRange.length, status); + rkl_dtrace_addLookupFlag(lookupResultFlags, RKLSetTextLookupFlag); + if(RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto exitNow; } + } + + rkl_dtrace_utf16ConversionCache(lookupResultFlags, cacheSlot->setToString, cacheSlot->setToRange.location, cacheSlot->setToRange.length, cacheSlot->setToLength); + return(1UL); + +exitNow: + return(0UL); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called with cacheSpinLock already locked! +// ---------- + +static RKLCacheSlot *rkl_getCachedRegexSetToString(NSString *regexString, RKLRegexOptions options, NSString *matchString, NSUInteger *matchLengthPtr, NSRange *matchRange, NSError **error, id *exception, int32_t *status) { + RKLCacheSlot *cacheSlot = NULL; + RKLCDelayedAssert((regexString != NULL) && (exception != NULL) && (status != NULL) && (matchLengthPtr != NULL), exception, exitNow); + + // Fast path the common case where this regex is exactly the same one used last time. + if(RKL_EXPECTED(lastCacheSlot != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->icu_regex != NULL, 1L) && RKL_EXPECTED(lastCacheSlot->regexString == (CFStringRef)regexString, 1L) && RKL_EXPECTED(lastCacheSlot->options == options, 1L)) { cacheSlot = lastCacheSlot; rkl_dtrace_compiledRegexCache(&rkl_dtrace_regexUTF8[(cacheSlot - &rkl_cacheSlots[0])][0], cacheSlot->options, (int)cacheSlot->captureCount, 1, 0, NULL); } + else { lastCacheSlot = NULL; if(RKL_EXPECTED((cacheSlot = rkl_getCachedRegex(regexString, options, error, exception)) == NULL, 0L)) { goto exitNow; } } + RKLCDelayedAssert((cacheSlot != NULL) && (cacheSlot->icu_regex != NULL) && (cacheSlot->regexString != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot == lastCacheSlot), exception, exitNow); + + // Optimize the case where the string to search (matchString) is immutable and the setToString immutable copy is the same string with its reference count incremented. + NSUInteger isSetTo = ((cacheSlot->setToString != NULL) && (cacheSlot->setToString == (CFStringRef)matchString)) ? 1UL : 0UL; + CFIndex matchLength = ((isSetTo == 1UL) && (cacheSlot->setToIsImmutable == 1U)) ? cacheSlot->setToLength : CFStringGetLength((CFStringRef)matchString); + + *matchLengthPtr = (NSUInteger)matchLength; + if(matchRange->length == NSUIntegerMax) { matchRange->length = (NSUInteger)matchLength; } // For convenience, allow NSUIntegerMax == string length. + + if(RKL_EXPECTED((NSUInteger)matchLength < NSMaxRange(*matchRange), 0L)) { goto exitNow; } // The match range is out of bounds for the string. performRegexOp will catch and report the problem. + + if((cacheSlot->setToIsImmutable == 0U) && (cacheSlot->setToString != NULL) && ((cacheSlot->setToLength != CFStringGetLength(cacheSlot->setToString)) || (cacheSlot->setToHash != CFHash((CFTypeRef)cacheSlot->setToString)))) { isSetTo = 0UL; } + else { // If the first pointer equality check failed, check the hash and length. + if(((isSetTo == 0UL) || (cacheSlot->setToIsImmutable == 0U)) && (cacheSlot->setToString != NULL)) { isSetTo = ((cacheSlot->setToLength == matchLength) && (cacheSlot->setToHash == CFHash((CFTypeRef)matchString))) ? 1UL : 0UL; } + + if(isSetTo == 1UL) { if(RKL_EXPECTED(rkl_setCacheSlotToString(cacheSlot, matchRange, status, exception) == 0UL, 0L)) { cacheSlot = NULL; if(*exception == NULL) { *exception = (id)RKLCAssertDictionary(@"Failed to set up UTF16 buffer."); } } goto exitNow; } + } + + // Sometimes the range that the regex is set to isn't right, in which case we don't want to clear the cache slot. Otherwise, flush it out. + if((cacheSlot->setToString != NULL) && (isSetTo == 0UL)) { rkl_clearCacheSlotSetTo(cacheSlot); } + + if(cacheSlot->setToString == NULL) { + cacheSlot->setToString = (CFStringRef)CFRetain((CFTypeRef)matchString); + RKLCDelayedAssert(cacheSlot->setToString != NULL, exception, exitNow); + cacheSlot->setToUniChar = CFStringGetCharactersPtr(cacheSlot->setToString); + cacheSlot->setToNeedsConversion = (cacheSlot->setToUniChar == NULL) ? 1U : 0U; + cacheSlot->setToIsImmutable = (rkl_CFStringIsMutable(cacheSlot->setToString) == YES) ? 0U : 1U; // If RKL_FAST_MUTABLE_CHECK is not defined then setToIsImmutable will always be set to '0', or in other words mutable.. + cacheSlot->setToHash = CFHash((CFTypeRef)cacheSlot->setToString); + cacheSlot->setToRange = NSNotFoundRange; + cacheSlot->setToLength = matchLength; + } + + if(RKL_EXPECTED(rkl_setCacheSlotToString(cacheSlot, matchRange, status, exception) == 0UL, 0L)) { cacheSlot = NULL; if(*exception == NULL) { *exception = (id)RKLCAssertDictionary(@"Failed to set up UTF16 buffer."); } goto exitNow; } + +exitNow: + return(cacheSlot); +} + +#ifdef RKL_HAVE_CLEANUP + +// rkl_cleanup_cacheSpinLockStatus takes advantage of GCC's 'cleanup' variable attribute. When an 'auto' variable with the 'cleanup' attribute goes out of scope, +// GCC arranges to have the designated function called. In this case, we make sure that if rkl_cacheSpinLock was locked that it was also unlocked. +// If rkl_cacheSpinLock was locked, but the cacheSpinLockStatus unlocked flag was not set, we force cacheSpinLock unlocked with a call to OSSpinLockUnlock. +// This is not a panacea for preventing mutex usage errors. Old style ObjC exceptions will bypass the cleanup call, but newer C++ style ObjC exceptions should cause the cleanup function to be called during the stack unwind. + +// We do not depend on this cleanup function being called. It is used only as an extra safety net. It is probably a bug in RegexKitLite if it is ever invoked and forced to take some kind of protective action. + +volatile NSUInteger rkl_debugCacheSpinLockCount = 0UL; + +void rkl_debugCacheSpinLock (void) RKL_ATTRIBUTES(used, noinline, visibility("default")); +static void rkl_cleanup_cacheSpinLockStatus (volatile NSUInteger *cacheSpinLockStatusPtr) RKL_ATTRIBUTES(used); + +void rkl_debugCacheSpinLock(void) { + rkl_debugCacheSpinLockCount++; // This is here primarily to prevent the optimizer from optimizing away the function. +} + +static void rkl_cleanup_cacheSpinLockStatus(volatile NSUInteger *cacheSpinLockStatusPtr) { + static NSUInteger didPrintForcedUnlockWarning = 0UL, didPrintNotLockedWarning = 0UL; + NSUInteger cacheSpinLockStatus = *cacheSpinLockStatusPtr; + + if(RKL_EXPECTED((cacheSpinLockStatus & RKLUnlockedCacheSpinLock) == 0UL, 0L) && RKL_EXPECTED((cacheSpinLockStatus & RKLLockedCacheSpinLock) != 0UL, 1L)) { + if(cacheSpinLock != 0) { + if(didPrintForcedUnlockWarning == 0UL) { didPrintForcedUnlockWarning = 1UL; NSLog(@"[RegexKitLite] Unusual condition detected: Recorded that cacheSpinLock was locked, but for some reason it was not unlocked. Forcibly unlocking cacheSpinLock. Set a breakpoint at rkl_debugCacheSpinLock to debug. This warning is only printed once."); } + rkl_debugCacheSpinLock(); // Since this is an unusual condition, offer an attempt to catch it before we unlock. + OSSpinLockUnlock(&cacheSpinLock); + } else { + if(didPrintNotLockedWarning == 0UL) { didPrintNotLockedWarning = 1UL; NSLog(@"[RegexKitLite] Unusual condition detected: Recorded that cacheSpinLock was locked, but for some reason it was not unlocked, yet cacheSpinLock is currently not locked? Set a breakpoint at rkl_debugCacheSpinLock to debug. This warning is only printed once."); } + rkl_debugCacheSpinLock(); + } + } +} + +#endif // RKL_HAVE_CLEANUP + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// ---------- + +static id rkl_performRegexOp(id self, SEL _cmd, RKLRegexOp regexOp, NSString *regexString, RKLRegexOptions options, NSInteger capture, id matchString, NSRange *matchRange, NSString *replacementString, NSError **error, void *result) { + volatile NSUInteger RKL_CLEANUP(rkl_cleanup_cacheSpinLockStatus) cacheSpinLockStatus = 0UL; + + NSUInteger replaceMutable = 0UL; + RKLRegexOp maskedRegexOp = (regexOp & RKLMaskOp); + + if((error != NULL) && (*error != NULL)) { *error = NULL; } + + if(RKL_EXPECTED(regexString == NULL, 0L)) { RKL_RAISE_EXCEPTION(NSInvalidArgumentException, @"The regular expression argument is NULL."); } + if(RKL_EXPECTED(matchString == NULL, 0L)) { RKL_RAISE_EXCEPTION(NSInternalInconsistencyException, @"The match string argument is NULL."); } + if((maskedRegexOp == RKLReplaceOp) && (replacementString == NULL)) { RKL_RAISE_EXCEPTION(NSInvalidArgumentException, @"The replacement string argument is NULL."); } + + id resultObject = NULL, exception = NULL; + int32_t status = U_ZERO_ERROR; + RKLCacheSlot *cacheSlot = NULL; + NSUInteger stringU16Length = 0UL; + NSRange stackRanges[2048]; + RKLFindAll findAll; + + + // IMPORTANT! Once we have obtained the lock, code MUST exit via 'goto exitNow;' to unlock the lock! NO EXCEPTIONS! + // ---------- + OSSpinLockLock(&cacheSpinLock); // Grab the lock and get cache entry. + cacheSpinLockStatus |= RKLLockedCacheSpinLock; + rkl_dtrace_incrementEventID(); + + if(RKL_EXPECTED((cacheSlot = rkl_getCachedRegexSetToString(regexString, options, matchString, &stringU16Length, matchRange, error, &exception, &status)) == NULL, 0L)) { stringU16Length = (NSUInteger)CFStringGetLength((CFStringRef)matchString); } + if(RKL_EXPECTED(matchRange->length == NSUIntegerMax, 1L)) { matchRange->length = stringU16Length; } // For convenience. + if(RKL_EXPECTED(stringU16Length < NSMaxRange(*matchRange), 0L) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSRangeException, @"Range or index out of bounds"); goto exitNow; } + if(RKL_EXPECTED(stringU16Length >= (NSUInteger)INT_MAX, 0L) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSRangeException, @"String length exceeds INT_MAX"); goto exitNow; } + if(((maskedRegexOp == RKLRangeOp) || (maskedRegexOp == RKLArrayOfStringsOp)) && RKL_EXPECTED(cacheSlot != NULL, 1L) && (RKL_EXPECTED(capture < 0L, 0L) || RKL_EXPECTED(capture > cacheSlot->captureCount, 0L)) && RKL_EXPECTED(exception == NULL, 1L)) { exception = (id)RKL_EXCEPTION(NSInvalidArgumentException, @"The capture argument is not valid."); goto exitNow; } + if(RKL_EXPECTED(cacheSlot == NULL, 0L) || RKL_EXPECTED(status > U_ZERO_ERROR, 0L) || RKL_EXPECTED(exception != NULL, 0L)) { goto exitNow; } + + RKLCDelayedAssert((cacheSlot != NULL) && (cacheSlot->icu_regex != NULL) && (cacheSlot->regexString != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot->setToString != NULL) && (cacheSlot->setToLength >= 0L) && (cacheSlot->setToUniChar != NULL) && ((CFIndex)NSMaxRange(cacheSlot->setToRange) <= cacheSlot->setToLength), &exception, exitNow); + +#ifndef NS_BLOCK_ASSERTIONS + if(cacheSlot->setToNeedsConversion == 0U) { RKLCDelayedAssert((cacheSlot->setToUniChar == CFStringGetCharactersPtr(cacheSlot->setToString)), &exception, exitNow); } + else { + RKLBuffer *buffer = (cacheSlot->setToLength < (CFIndex)(RKL_FIXED_LENGTH)) ? &fixedBuffer : &dynamicBuffer; + RKLCDelayedAssert((cacheSlot->setToHash == buffer->hash) && (cacheSlot->setToLength == buffer->length) && (cacheSlot->setToUniChar == buffer->uniChar), &exception, exitNow); + } +#endif + + switch(maskedRegexOp) { + case RKLRangeOp: + if((rkl_search(cacheSlot, matchRange, 0UL, &exception, &status) == NO) || (RKL_EXPECTED(status > U_ZERO_ERROR, 0L))) { *(NSRange *)result = NSNotFoundRange; goto exitNow; } + if(RKL_EXPECTED(capture == 0L, 1L)) { *(NSRange *)result = cacheSlot->lastMatchRange; } else { if(RKL_EXPECTED(rkl_getRangeForCapture(cacheSlot, &status, (int32_t)capture, (NSRange *)result) > U_ZERO_ERROR, 0L)) { goto exitNow; } } + break; + + case RKLSplitOp: // Fall-thru... + case RKLArrayOfStringsOp: // Fall-thru... + case RKLCapturesArrayOp: // Fall-thru... + case RKLArrayOfCapturesOp: + findAll = rkl_makeFindAll(stackRanges, *matchRange, 2048L, (2048UL * sizeof(NSRange)), 0UL, (void **)&scratchBuffer[0], &scratchBuffer[1], &scratchBuffer[2], 0L, capture, ((maskedRegexOp == RKLCapturesArrayOp) ? 1L : NSIntegerMax)); + + if(RKL_EXPECTED(rkl_findRanges(cacheSlot, regexOp, &findAll, &exception, &status) == NO, 1L)) { + if(RKL_EXPECTED(findAll.found == 0L, 0L)) { resultObject = [NSArray array]; } else { resultObject = rkl_makeArray(cacheSlot, regexOp, &findAll, &exception); } + } + + if(RKL_EXPECTED(scratchBuffer[0] != NULL, 0L)) { scratchBuffer[0] = rkl_free(&scratchBuffer[0]); } + if(RKL_EXPECTED(scratchBuffer[1] != NULL, 0L)) { scratchBuffer[1] = rkl_free(&scratchBuffer[1]); } + if(RKL_EXPECTED(scratchBuffer[2] != NULL, 0L)) { scratchBuffer[2] = rkl_free(&scratchBuffer[2]); } + + break; + + case RKLReplaceOp: resultObject = rkl_replaceString(cacheSlot, matchString, stringU16Length, replacementString, (NSUInteger)CFStringGetLength((CFStringRef)replacementString), (NSUInteger *)result, (replaceMutable = (((regexOp & RKLReplaceMutable) != 0) ? 1UL : 0UL)), &exception, &status); break; + default: exception = RKLCAssertDictionary(@"Unknown regexOp code."); break; + } + +exitNow: + OSSpinLockUnlock(&cacheSpinLock); + cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; + + if(RKL_EXPECTED(status > U_ZERO_ERROR, 0L) && RKL_EXPECTED(exception == NULL, 0L)) { exception = rkl_NSExceptionForRegex(regexString, options, NULL, status); } // If we had a problem, prepare an exception to be thrown. + if(RKL_EXPECTED(exception != NULL, 0L)) { rkl_handleDelayedAssert(self, _cmd, exception); } // If there is an exception, throw it at this point. + // If we're working on a mutable string and there were successful matches/replacements, then we still have work to do. + // This is done outside the cache lock and with the objc replaceCharactersInRange:withString: method because Core Foundation + // does not assert that the string we are attempting to update is actually a mutable string, whereas Foundation ensures + // the object receiving the message is a mutable string and throws an exception if we're attempting to modify an immutable string. + if(RKL_EXPECTED(replaceMutable == 1UL, 0L) && RKL_EXPECTED(*((NSUInteger *)result) > 0UL, 1L)) { NSCParameterAssert(resultObject != NULL); [matchString replaceCharactersInRange:*matchRange withString:resultObject]; } + + return(resultObject); +} + +static void rkl_handleDelayedAssert(id self, SEL _cmd, id exception) { + if(RKL_EXPECTED(exception != NULL, 0L)) { + if([exception isKindOfClass:[NSException class]]) { [[NSException exceptionWithName:[exception name] reason:rkl_stringFromClassAndMethod(self, _cmd, [exception reason]) userInfo:[exception userInfo]] raise]; } + else { + id functionString = [exception objectForKey:@"function"], fileString = [exception objectForKey:@"file"], descriptionString = [exception objectForKey:@"description"], lineNumber = [exception objectForKey:@"line"]; + NSCParameterAssert((functionString != NULL) && (fileString != NULL) && (descriptionString != NULL) && (lineNumber != NULL)); + [[NSAssertionHandler currentHandler] handleFailureInFunction:functionString file:fileString lineNumber:(NSInteger)[lineNumber longValue] description:descriptionString]; + } + } +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called from rkl_performRegexOp() or rkl_findRanges(). +// ---------- + +static NSUInteger rkl_search(RKLCacheSlot *cacheSlot, NSRange *searchRange, NSUInteger updateSearchRange, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) { + NSUInteger foundMatch = 0UL, searchEqualsEndOfRange = (RKL_EXPECTED(NSEqualRanges(*searchRange, NSMakeRange(NSMaxRange(cacheSlot->setToRange), 0UL)) == YES, 0L) ? 1UL : 0UL); + + if((NSEqualRanges(*searchRange, cacheSlot->lastFindRange) == YES) || (searchEqualsEndOfRange == 1UL)) { foundMatch = (((cacheSlot->lastMatchRange.location == NSNotFound) || (searchEqualsEndOfRange == 1UL)) ? 0UL : 1UL);} + else { // Only perform an expensive 'find' operation iff the current find range is different than the last find range. + NSUInteger findLocation = (searchRange->location - cacheSlot->setToRange.location); + RKLCDelayedAssert(((searchRange->location >= cacheSlot->setToRange.location)) && (NSRangeInsideRange(*searchRange, cacheSlot->setToRange) == YES) && (findLocation < INT_MAX) && (findLocation <= cacheSlot->setToRange.length), exception, exitNow); + + RKL_PREFETCH_UNICHAR(cacheSlot->setToUniChar, searchRange->location); // Spool up the CPU caches. + + // Using uregex_findNext can be a slight performance win. + NSUInteger useFindNext = ((searchRange->location == (NSMaxRange(cacheSlot->lastMatchRange) + (((cacheSlot->lastMatchRange.length == 0UL) && (cacheSlot->lastMatchRange.location < NSMaxRange(cacheSlot->setToRange))) ? 1UL : 0UL))) ? 1UL : 0UL); + + cacheSlot->lastFindRange = *searchRange; + if(RKL_EXPECTED(useFindNext == 0UL, 0L)) { if(RKL_EXPECTED((RKL_ICU_FUNCTION_APPEND(uregex_find) (cacheSlot->icu_regex, (int32_t)findLocation, status) == NO), 0L) || RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto finishedFind; } } + else { if(RKL_EXPECTED((RKL_ICU_FUNCTION_APPEND(uregex_findNext)(cacheSlot->icu_regex, status) == NO), 0L) || RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto finishedFind; } } + foundMatch = 1UL; + + if(RKL_EXPECTED(rkl_getRangeForCapture(cacheSlot, status, 0, &cacheSlot->lastMatchRange) > U_ZERO_ERROR, 0L)) { goto finishedFind; } + RKLCDelayedAssert(NSRangeInsideRange(cacheSlot->lastMatchRange, *searchRange) == YES, exception, exitNow); + } + +finishedFind: + if(RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { foundMatch = 0UL; cacheSlot->lastFindRange = NSNotFoundRange; } + + if(foundMatch == 0UL) { cacheSlot->lastMatchRange = NSNotFoundRange; if(updateSearchRange == 1UL) { *searchRange = NSMakeRange(NSMaxRange(*searchRange), 0UL); } } + else { + RKLCDelayedAssert(NSRangeInsideRange(cacheSlot->lastMatchRange, *searchRange) == YES, exception, exitNow); + if(updateSearchRange == 1UL) { + NSUInteger nextLocation = (NSMaxRange(cacheSlot->lastMatchRange) + (((cacheSlot->lastMatchRange.length == 0UL) && (cacheSlot->lastMatchRange.location < NSMaxRange(cacheSlot->setToRange))) ? 1UL : 0UL)), locationDiff = nextLocation - searchRange->location; + RKLCDelayedAssert((((locationDiff > 0UL) || ((locationDiff == 0UL) && (cacheSlot->lastMatchRange.location == NSMaxRange(cacheSlot->setToRange)))) && (locationDiff <= searchRange->length)), exception, exitNow); + searchRange->location = nextLocation; + searchRange->length -= locationDiff; + } + } + +#ifndef NS_BLOCK_ASSERTIONS +exitNow: +#endif + return(foundMatch); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called from rkl_doFindOp(). +// ---------- + +static BOOL rkl_findRanges(RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindAll *findAll, id *exception, int32_t *status) { + BOOL returnWithError = YES; + RKLCDelayedAssert((((cacheSlot != NULL) && (cacheSlot->icu_regex != NULL) && (cacheSlot->setToUniChar != NULL) && (cacheSlot->captureCount >= 0L) && (cacheSlot->setToRange.location != NSNotFound)) && (status != NULL) && ((findAll != NULL) && (findAll->found == 0L) && ((findAll->capacity >= 0L) && (((findAll->capacity > 0L) || (findAll->size > 0UL)) ? ((findAll->ranges != NULL) && (findAll->capacity > 0L) && (findAll->size > 0UL)) : 1)) && (findAll->rangesScratchBuffer != NULL) && ((findAll->capture >= 0L) && (findAll->capture <= cacheSlot->captureCount)))), exception, exitNow); + + if(RKL_EXPECTED(cacheSlot->setToLength == 0L, 0L) || RKL_EXPECTED(cacheSlot->setToRange.length == 0UL, 0L)) { returnWithError = NO; goto exitNow; } + + NSInteger captureCount = cacheSlot->captureCount; + RKLRegexOp maskedRegexOp = (regexOp & RKLMaskOp); + NSUInteger lastLocation = findAll->findInRange.location; + NSRange searchRange = findAll->findInRange; + + for(findAll->found = 0L; (findAll->found < findAll->findUpTo) && ((findAll->found < findAll->capacity) || (findAll->found == 0L)); findAll->found++) { + NSInteger loopCapture, shouldBreak = 0L; + + if(RKL_EXPECTED(findAll->found >= ((findAll->capacity - ((captureCount + 2L) * 4L)) - 4L), 0L)) { if(RKL_EXPECTED(rkl_growFindRanges(cacheSlot, lastLocation, findAll, exception) == 0UL, 0L)) { goto exitNow; } } + + RKLCDelayedAssert((searchRange.location != NSNotFound) && (NSRangeInsideRange(searchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(findAll->findInRange, cacheSlot->setToRange) == YES), exception, exitNow); + + // This fixes a 'bug' that is also present in ICU's uregex_split(). 'Bug', in this case, means that the results of a split operation can differ from those that perl's split() creates for the same input. + // "I|at|ice I eat rice" split using the regex "\b\s*" demonstrates the problem. ICU bug http://bugs.icu-project.org/trac/ticket/6826 + // ICU : "", "I", "|", "at", "|", "ice", "", "I", "", "eat", "", "rice" <- Results that RegexKitLite used to produce. + // PERL: "I", "|", "at", "|", "ice", "I", "eat", "rice" <- Results that RegexKitLite now produces. + do { if((rkl_search(cacheSlot, &searchRange, 1UL, exception, status) == NO) || (RKL_EXPECTED(*status > U_ZERO_ERROR, 0L))) { shouldBreak = 1L; } } + while((maskedRegexOp == RKLSplitOp) && RKL_EXPECTED(shouldBreak == 0L, 1L) && RKL_EXPECTED(cacheSlot->lastMatchRange.length == 0UL, 0L) && RKL_EXPECTED((cacheSlot->lastMatchRange.location - lastLocation) == 0UL, 0L)); + if(RKL_EXPECTED(shouldBreak == 1L, 0L)) { break; } + + RKLCDelayedAssert((searchRange.location != NSNotFound) && (NSRangeInsideRange(searchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(findAll->findInRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(searchRange, findAll->findInRange) == YES), exception, exitNow); + RKLCDelayedAssert((NSRangeInsideRange(cacheSlot->lastFindRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(cacheSlot->lastMatchRange, cacheSlot->setToRange) == YES) && (NSRangeInsideRange(cacheSlot->lastMatchRange, findAll->findInRange) == YES), exception, exitNow); + RKLCDelayedAssert((findAll->ranges != NULL) && (findAll->found >= 0L) && (findAll->capacity >= 0L) && ((findAll->found + (captureCount + 3L) + 1L) < (findAll->capacity - 2L)), exception, exitNow); + + switch(maskedRegexOp) { + case RKLArrayOfStringsOp: + if(findAll->capture == 0L) { findAll->ranges[findAll->found] = cacheSlot->lastMatchRange; } else { if(RKL_EXPECTED(rkl_getRangeForCapture(cacheSlot, status, (int32_t)findAll->capture, &findAll->ranges[findAll->found]) > U_ZERO_ERROR, 0L)) { goto exitNow; } } + break; + + case RKLSplitOp: // Fall-thru... + case RKLCapturesArrayOp: // Fall-thru... + case RKLArrayOfCapturesOp: + findAll->ranges[findAll->found] = ((maskedRegexOp == RKLSplitOp) ? NSMakeRange(lastLocation, cacheSlot->lastMatchRange.location - lastLocation) : cacheSlot->lastMatchRange); + + for(loopCapture = 1L; loopCapture <= captureCount; loopCapture++) { + RKLCDelayedAssert((findAll->found >= 0L) && (findAll->found < (findAll->capacity - 2L)) && (loopCapture < INT_MAX), exception, exitNow); + if(RKL_EXPECTED(rkl_getRangeForCapture(cacheSlot, status, (int32_t)loopCapture, &findAll->ranges[++findAll->found]) > U_ZERO_ERROR, 0L)) { goto exitNow; } + } + break; + + default: if(*exception != NULL) { *exception = RKLCAssertDictionary(@"Unknown regexOp."); } goto exitNow; break; + } + + lastLocation = NSMaxRange(cacheSlot->lastMatchRange); + } + + if(RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto exitNow; } + + RKLCDelayedAssert((findAll->ranges != NULL) && (findAll->found >= 0L) && (findAll->found < (findAll->capacity - 2L)), exception, exitNow); + if((maskedRegexOp == RKLSplitOp) && (lastLocation != NSMaxRange(findAll->findInRange))) { findAll->ranges[findAll->found++] = NSMakeRange(lastLocation, NSMaxRange(findAll->findInRange) - lastLocation); } + + RKLCDelayedAssert((findAll->ranges != NULL) && (findAll->found >= 0L) && (findAll->found < (findAll->capacity - 2L)), exception, exitNow); + returnWithError = NO; + +exitNow: + return(returnWithError); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called from rkl_findRanges(). +// ---------- + +static NSUInteger rkl_growFindRanges(RKLCacheSlot *cacheSlot, NSUInteger lastLocation, RKLFindAll *findAll, id *exception RKL_UNUSED_ASSERTION_ARG) { + NSUInteger didGrowRanges = 0UL; + RKLCDelayedAssert((((cacheSlot != NULL) && (cacheSlot->captureCount >= 0L)) && ((findAll != NULL) && (findAll->capacity >= 0L) && (findAll->rangesScratchBuffer != NULL) && (findAll->found >= 0L) && (((findAll->capacity > 0L) || (findAll->size > 0UL) || (findAll->ranges != NULL)) ? ((findAll->capacity > 0L) && (findAll->size > 0UL) && (findAll->ranges != NULL) && (((size_t)findAll->capacity * sizeof(NSRange)) == findAll->size)) : 1))), exception, exitNow); + + // Attempt to guesstimate the required capacity based on: the total length needed to search / (length we've searched so far / ranges found so far). + NSInteger newCapacity = (findAll->capacity + (findAll->capacity / 2L)), estimate = (NSInteger)((float)cacheSlot->setToLength / (((float)lastLocation + 1.0f) / ((float)findAll->found + 1.0f))); + newCapacity = (((newCapacity + ((estimate > newCapacity) ? estimate : newCapacity)) / 2L) + ((cacheSlot->captureCount + 2L) * 4L) + 4L); + + NSUInteger needToCopy = ((findAll->ranges != NULL) && (*findAll->rangesScratchBuffer != findAll->ranges)) ? 1UL : 0UL; // If findAll->ranges is set to a stack allocation then we need to manually copy the data from the stack to the new heap allocation. + size_t newSize = ((size_t)newCapacity * sizeof(NSRange)); + NSRange *newRanges = NULL; + + if(RKL_EXPECTED((newRanges = (NSRange *)rkl_realloc((RKL_STRONG_REF void **)findAll->rangesScratchBuffer, newSize, 0UL)) == NULL, 0L)) { findAll->capacity = 0L; findAll->size = 0UL; findAll->ranges = NULL; *findAll->rangesScratchBuffer = rkl_free((RKL_STRONG_REF void **)findAll->rangesScratchBuffer); goto exitNow; } else { didGrowRanges = 1UL; } + if(needToCopy == 1UL) { memcpy(newRanges, findAll->ranges, findAll->size); } // If necessary, copy the existing data to the new heap allocation. + + findAll->capacity = newCapacity; + findAll->size = newSize; + findAll->ranges = newRanges; + +exitNow: + return(didGrowRanges); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called from rkl_doFindOp(). +// ---------- + +static NSArray *rkl_makeArray(RKLCacheSlot *cacheSlot, RKLRegexOp regexOp, RKLFindAll *findAll, id *exception RKL_UNUSED_ASSERTION_ARG) { + NSUInteger createdStringsCount = 0UL, createdArraysCount = 0UL, transferedStringsCount = 0UL; + id *matchedStrings = NULL, *subcaptureArrays = NULL, emptyString = @""; + NSArray *resultArray = NULL; + + RKLCDelayedAssert((cacheSlot != NULL) && ((findAll != NULL) && (findAll->found >= 0L) && (findAll->stringsScratchBuffer != NULL) && (findAll->arraysScratchBuffer != NULL)), exception, exitNow); + + size_t matchedStringsSize = ((size_t)findAll->found * sizeof(id)); + CFStringRef setToString = cacheSlot->setToString; + + if((findAll->stackUsed + matchedStringsSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((matchedStrings = (id *)alloca(matchedStringsSize)) == NULL, 0L)) { goto exitNow; } findAll->stackUsed += matchedStringsSize; } + else { if(RKL_EXPECTED((matchedStrings = (id *)rkl_realloc(findAll->stringsScratchBuffer, matchedStringsSize, (NSUInteger)RKLScannedOption)) == NULL, 0L)) { goto exitNow; } } + + { // This sub-block (and its local variables) is here for the benefit of the optimizer. + NSUInteger found = (NSUInteger)findAll->found; + const NSRange *rangePtr = findAll->ranges; + id *matchedStringsPtr = matchedStrings; + + for(createdStringsCount = 0UL; createdStringsCount < found; createdStringsCount++) { + NSRange range = *rangePtr++; + if(RKL_EXPECTED(((*matchedStringsPtr++ = RKL_EXPECTED(range.length == 0UL, 0L) ? emptyString : rkl_CreateStringWithSubstring((id)setToString, range)) == NULL), 0L)) { goto exitNow; } + } + } + + NSUInteger arrayCount = createdStringsCount; + id *arrayObjects = matchedStrings; + + if((regexOp & RKLSubcapturesArray) != 0UL) { + RKLCDelayedAssert(((createdStringsCount % ((NSUInteger)cacheSlot->captureCount + 1UL)) == 0UL) && (createdArraysCount == 0UL), exception, exitNow); + + NSUInteger captureCount = ((NSUInteger)cacheSlot->captureCount + 1UL); + NSUInteger subcaptureArraysCount = (createdStringsCount / captureCount); + size_t subcaptureArraysSize = ((size_t)subcaptureArraysCount * sizeof(id)); + + if((findAll->stackUsed + subcaptureArraysSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((subcaptureArrays = (id *)alloca(subcaptureArraysSize)) == NULL, 0L)) { goto exitNow; } findAll->stackUsed += subcaptureArraysSize; } + else { if(RKL_EXPECTED((subcaptureArrays = (id *)rkl_realloc(findAll->arraysScratchBuffer, subcaptureArraysSize, (NSUInteger)RKLScannedOption)) == NULL, 0L)) { goto exitNow; } } + + { // This sub-block (and its local variables) is here for the benefit of the optimizer. + id *subcaptureArraysPtr = subcaptureArrays; + id *matchedStringsPtr = matchedStrings; + + for(createdArraysCount = 0UL; createdArraysCount < subcaptureArraysCount; createdArraysCount++) { + if(RKL_EXPECTED((*subcaptureArraysPtr++ = rkl_CreateArrayWithObjects((void **)matchedStringsPtr, captureCount)) == NULL, 0L)) { goto exitNow; } + matchedStringsPtr += captureCount; + transferedStringsCount += captureCount; + } + } + + RKLCDelayedAssert((transferedStringsCount == createdStringsCount), exception, exitNow); + arrayCount = createdArraysCount; + arrayObjects = subcaptureArrays; + } + + RKLCDelayedAssert((arrayObjects != NULL), exception, exitNow); + resultArray = rkl_CreateAutoreleasedArray((void **)arrayObjects, (NSUInteger)arrayCount); + +exitNow: + if(RKL_EXPECTED(resultArray == NULL, 0L) && (rkl_collectingEnabled() == NO)) { // If we did not create an array then we need to make sure that we release any objects we created. + NSUInteger x; + if(matchedStrings != NULL) { for(x = transferedStringsCount; x < createdStringsCount; x++) { if((matchedStrings[x] != NULL) && (matchedStrings[x] != emptyString)) { matchedStrings[x] = rkl_ReleaseObject(matchedStrings[x]); } } } + if(subcaptureArrays != NULL) { for(x = 0UL; x < createdArraysCount; x++) { if(subcaptureArrays[x] != NULL) { subcaptureArrays[x] = rkl_ReleaseObject(subcaptureArrays[x]); } } } + } + + return(resultArray); +} + +// IMPORTANT! This code is critical path code. Because of this, it has been written for speed, not clarity. +// IMPORTANT! Should only be called from rkl_performRegexOp(). +// ---------- + +static NSString *rkl_replaceString(RKLCacheSlot *cacheSlot, id searchString, NSUInteger searchU16Length, NSString *replacementString, NSUInteger replacementU16Length, NSUInteger *replacedCountPtr, NSUInteger replaceMutable, id *exception, int32_t *status) { + uint64_t searchU16Length64 = (uint64_t)searchU16Length, replacementU16Length64 = (uint64_t)replacementU16Length; + int32_t resultU16Length = 0, tempUniCharBufferU16Capacity = 0; + UniChar *tempUniCharBuffer = NULL; + const UniChar *replacementUniChar = NULL; + id resultObject = NULL; + NSUInteger replacedCount = 0UL; + + if((RKL_EXPECTED(replacementU16Length64 >= (uint64_t)INT_MAX, 0L) || RKL_EXPECTED(((searchU16Length64 / 2ULL) + (replacementU16Length64 * 2ULL)) >= (uint64_t)INT_MAX, 0L))) { *exception = [NSException exceptionWithName:NSRangeException reason:@"Replacement string length exceeds INT_MAX" userInfo:NULL]; goto exitNow; } + + RKLCDelayedAssert((searchU16Length64 < (uint64_t)INT_MAX) && (replacementU16Length64 < (uint64_t)INT_MAX) && (((searchU16Length64 / 2ULL) + (replacementU16Length64 * 2ULL)) < (uint64_t)INT_MAX), exception, exitNow); + + // Zero order approximation of the buffer sizes for holding the replaced string or split strings and split strings pointer offsets. As UTF16 code units. + tempUniCharBufferU16Capacity = (int32_t)(16UL + (searchU16Length + (searchU16Length / 2UL)) + (replacementU16Length * 2UL)); + + // Buffer sizes converted from native units to bytes. + size_t stackSize = 0UL, replacementSize = ((size_t)replacementU16Length * sizeof(UniChar)), tempUniCharBufferSize = ((size_t)tempUniCharBufferU16Capacity * sizeof(UniChar)); + + // For the various buffers we require, we first try to allocate from the stack if we're not over the RKL_STACK_LIMIT. If we are, switch to using the heap for the buffer. + if((stackSize + tempUniCharBufferSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)alloca(tempUniCharBufferSize)) == NULL, 0L)) { goto exitNow; } stackSize += tempUniCharBufferSize; } + else { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)rkl_realloc(&scratchBuffer[0], tempUniCharBufferSize, 0UL)) == NULL, 0L)) { goto exitNow; } } + + // Try to get the pointer to the replacement strings UTF16 data. If we can't, allocate some buffer space, then covert to UTF16. + if((replacementUniChar = CFStringGetCharactersPtr((CFStringRef)replacementString)) == NULL) { + UniChar *uniCharBuffer = NULL; + if((stackSize + replacementSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((uniCharBuffer = (UniChar *)alloca(replacementSize)) == NULL, 0L)) { goto exitNow; } stackSize += replacementSize; } + else { if(RKL_EXPECTED((uniCharBuffer = (UniChar *)rkl_realloc(&scratchBuffer[1], replacementSize, 0UL)) == NULL, 0L)) { goto exitNow; } } + CFStringGetCharacters((CFStringRef)replacementString, CFMakeRange(0L, replacementU16Length), uniCharBuffer); // Convert to a UTF16 string. + replacementUniChar = uniCharBuffer; + } + + resultU16Length = rkl_replaceAll(cacheSlot, replacementUniChar, (int32_t)replacementU16Length, tempUniCharBuffer, tempUniCharBufferU16Capacity, &replacedCount, exception, status); + + if(RKL_EXPECTED(*status == U_BUFFER_OVERFLOW_ERROR, 0L)) { // Our buffer guess(es) were too small. Resize the buffers and try again. + tempUniCharBufferSize = ((size_t)(tempUniCharBufferU16Capacity = resultU16Length + 4) * sizeof(UniChar)); + if((stackSize + tempUniCharBufferSize) < (size_t)(RKL_STACK_LIMIT)) { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)alloca(tempUniCharBufferSize)) == NULL, 0L)) { goto exitNow; } stackSize += tempUniCharBufferSize; } + else { if(RKL_EXPECTED((tempUniCharBuffer = (UniChar *)rkl_realloc(&scratchBuffer[0], tempUniCharBufferSize, 0UL)) == NULL, 0L)) { goto exitNow; } } + + *status = U_ZERO_ERROR; // Make sure the status var is cleared and try again. + resultU16Length = rkl_replaceAll(cacheSlot, replacementUniChar, (int32_t)replacementU16Length, tempUniCharBuffer, tempUniCharBufferU16Capacity, &replacedCount, exception, status); + } + + if(RKL_EXPECTED(*status > U_ZERO_ERROR, 0L)) { goto exitNow; } // Something went wrong. + + if(resultU16Length == 0) { resultObject = @""; } // Optimize the case where the replaced text length == 0 with a @"" string. + else if(((NSUInteger)resultU16Length == searchU16Length) && (replacedCount == 0UL)) { // Optimize the case where the replacement == original by creating a copy. Very fast if self is immutable. + if(replaceMutable == 0UL) { resultObject = rkl_CFAutorelease(CFStringCreateCopy(NULL, (CFStringRef)searchString)); } // .. but only if this is not replacing a mutable self. + } else { resultObject = rkl_CFAutorelease(CFStringCreateWithCharacters(NULL, tempUniCharBuffer, (CFIndex)resultU16Length)); } // otherwise, create a new string. + + // If replaceMutable == 1UL, we don't do the replacement here. We wait until after we return and unlock the cache lock. + // This is because we may be trying to mutate an immutable string object. + if((replacedCount > 0UL) && (replaceMutable == 1UL)) { // We're working on a mutable string and there were successfull matches with replaced text, so there's work to do. + rkl_clearBuffer((cacheSlot->setToLength < (CFIndex)(RKL_FIXED_LENGTH)) ? &fixedBuffer : &dynamicBuffer, 0UL); + rkl_clearCacheSlotSetTo(cacheSlot); // Flush any cached information about this string since it will mutate. + } + +exitNow: + if(scratchBuffer[0] != NULL) { scratchBuffer[0] = rkl_free(&scratchBuffer[0]); } + if(scratchBuffer[1] != NULL) { scratchBuffer[1] = rkl_free(&scratchBuffer[1]); } + if(replacedCountPtr != NULL) { *replacedCountPtr = replacedCount; } + return(resultObject); +} + +// IMPORTANT! Should only be called from rkl_replaceString(). +// ---------- +// Modified version of the ICU libraries uregex_replaceAll() that keeps count of the number of replacements made. + +static int32_t rkl_replaceAll(RKLCacheSlot *cacheSlot, const UniChar *replacementUniChar, int32_t replacementU16Length, UniChar *replacedUniChar, int32_t replacedU16Capacity, NSUInteger *replacedCount, id *exception RKL_UNUSED_ASSERTION_ARG, int32_t *status) { + NSUInteger replaced = 0UL, bufferOverflowed = 0UL; + int32_t u16Length = 0; + RKLCDelayedAssert((cacheSlot != NULL) && (replacementUniChar != NULL) && (replacedUniChar != NULL) && (status != NULL) && (replacementU16Length >= 0) && (replacedU16Capacity >= 0), exception, exitNow); + + cacheSlot->lastFindRange = cacheSlot->lastMatchRange = NSNotFoundRange; // Clear the cached find information for this regex so a subsequent find works correctly. + RKL_ICU_FUNCTION_APPEND(uregex_reset)(cacheSlot->icu_regex, 0, status); + + // Work around for ICU uregex_reset() bug, see http://bugs.icu-project.org/trac/ticket/6545 + // http://sourceforge.net/tracker/index.php?func=detail&aid=2105213&group_id=204582&atid=990188 + if(RKL_EXPECTED(cacheSlot->setToRange.length == 0L, 0L) && (*status == U_INDEX_OUTOFBOUNDS_ERROR)) { *status = U_ZERO_ERROR; } + + // This loop originally came from ICU source/i18n/uregex.cpp, uregex_replaceAll. + // There is a bug in that code which causes the size of the buffer required for the replaced text to not be calculated correctly. + // This contains a work around using the variable bufferOverflowed. + // ICU bug: http://bugs.icu-project.org/trac/ticket/6656 + // http://sourceforge.net/tracker/index.php?func=detail&aid=2408447&group_id=204582&atid=990188 + while(RKL_ICU_FUNCTION_APPEND(uregex_findNext)(cacheSlot->icu_regex, status)) { + replaced++; + u16Length += RKL_ICU_FUNCTION_APPEND(uregex_appendReplacement)(cacheSlot->icu_regex, replacementUniChar, replacementU16Length, &replacedUniChar, &replacedU16Capacity, status); + if(RKL_EXPECTED(*status == U_BUFFER_OVERFLOW_ERROR, 0L)) { bufferOverflowed = 1UL; *status = U_ZERO_ERROR; } + } + if(RKL_EXPECTED(*status == U_BUFFER_OVERFLOW_ERROR, 0L)) { bufferOverflowed = 1UL; *status = U_ZERO_ERROR; } + u16Length += RKL_ICU_FUNCTION_APPEND(uregex_appendTail)(cacheSlot->icu_regex, &replacedUniChar, &replacedU16Capacity, status); + + if(RKL_EXPECTED(*status == U_ZERO_ERROR, 1L) && RKL_EXPECTED(bufferOverflowed == 1UL, 0L)) { *status = U_BUFFER_OVERFLOW_ERROR; } + if(replacedCount != NULL) { *replacedCount = replaced; } + +#ifndef NS_BLOCK_ASSERTIONS +exitNow: +#endif + return(u16Length); +} + +static NSUInteger rkl_isRegexValid(id self, SEL _cmd, NSString *regex, RKLRegexOptions options, NSInteger *captureCountPtr, NSError **error) { + volatile NSUInteger RKL_CLEANUP(rkl_cleanup_cacheSpinLockStatus) cacheSpinLockStatus = 0UL; + + RKLCacheSlot *cacheSlot = NULL; + NSUInteger gotCacheSlot = 0UL; + NSInteger captureCount = -1L; + id exception = NULL; + + if((error != NULL) && (*error != NULL)) { *error = NULL; } + if(regex == NULL) { RKL_RAISE_EXCEPTION(NSInvalidArgumentException, @"The regular expression argument is NULL."); } + + OSSpinLockLock(&cacheSpinLock); + cacheSpinLockStatus |= RKLLockedCacheSpinLock; + rkl_dtrace_incrementEventID(); + if((cacheSlot = rkl_getCachedRegex(regex, options, error, &exception)) != NULL) { gotCacheSlot = 1UL; captureCount = cacheSlot->captureCount; } + cacheSlot = NULL; + OSSpinLockUnlock(&cacheSpinLock); + cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; + + if(captureCountPtr != NULL) { *captureCountPtr = captureCount; } + if(RKL_EXPECTED(exception != NULL, 0L)) { rkl_handleDelayedAssert(self, _cmd, exception); } + return(gotCacheSlot); +} + +static void rkl_clearStringCache(void) { + NSCParameterAssert(cacheSpinLock != 0); + lastCacheSlot = NULL; + NSUInteger x = 0UL; + for(x = 0UL; x < (NSUInteger)(RKL_SCRATCH_BUFFERS); x++) { if(scratchBuffer[x] != NULL) { scratchBuffer[x] = rkl_free(&scratchBuffer[x]); } } + for(x = 0UL; x < (NSUInteger)(RKL_CACHE_SIZE); x++) { rkl_clearCacheSlotRegex(&rkl_cacheSlots[x]); } + rkl_clearBuffer(&fixedBuffer, 0UL); + rkl_clearBuffer(&dynamicBuffer, 1UL); +} + +static void rkl_clearBuffer(RKLBuffer *buffer, NSUInteger freeDynamicBuffer) { + if(buffer == NULL) { return; } + if((freeDynamicBuffer == 1UL) && (buffer->uniChar != NULL) && (buffer == &dynamicBuffer)) { RKL_STRONG_REF void *p = (RKL_STRONG_REF void *)dynamicBuffer.uniChar; dynamicBuffer.uniChar = (RKL_STRONG_REF UniChar *)rkl_free(&p); } + if(buffer->string != NULL) { CFRelease((CFTypeRef)buffer->string); buffer->string = NULL; } + buffer->length = 0L; + buffer->hash = 0UL; +} + +static void rkl_clearCacheSlotRegex(RKLCacheSlot *cacheSlot) { + if(cacheSlot == NULL) { return; } + if(cacheSlot->setToString != NULL) { rkl_clearCacheSlotSetTo(cacheSlot); } + if(cacheSlot->icu_regex != NULL) { RKL_ICU_FUNCTION_APPEND(uregex_close)(cacheSlot->icu_regex); cacheSlot->icu_regex = NULL; cacheSlot->captureCount = -1L; } + if(cacheSlot->regexString != NULL) { CFRelease((CFTypeRef)cacheSlot->regexString); cacheSlot->regexString = NULL; cacheSlot->options = 0U; } +} + +static void rkl_clearCacheSlotSetTo(RKLCacheSlot *cacheSlot) { + if(cacheSlot == NULL) { return; } + if(cacheSlot->icu_regex != NULL) { int32_t status = 0; RKL_ICU_FUNCTION_APPEND(uregex_setText)(cacheSlot->icu_regex, &emptyUniCharString[0], 0, &status); } + if(cacheSlot->setToString != NULL) { CFRelease((CFTypeRef)cacheSlot->setToString); cacheSlot->setToString = NULL; } + cacheSlot->lastFindRange = cacheSlot->lastMatchRange = cacheSlot->setToRange = NSNotFoundRange; + cacheSlot->setToIsImmutable = cacheSlot->setToNeedsConversion = 0U; + cacheSlot->setToUniChar = NULL; + cacheSlot->setToHash = 0UL; + cacheSlot->setToLength = 0L; +} + +// Helps to keep things tidy. +#define addKeyAndObject(objs, keys, i, k, o) ({id _o=(o), _k=(k); if((_o != NULL) && (_k != NULL)) { objs[i] = _o; keys[i] = _k; i++; } }) + +static NSDictionary *rkl_userInfoDictionary(NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status, ...) { + va_list varArgsList; + va_start(varArgsList, status); + if(regexString == NULL) { va_end(varArgsList); return(NULL); } + + id objects[64], keys[64]; + NSUInteger count = 0UL; + + NSString *errorNameString = [NSString stringWithUTF8String:RKL_ICU_FUNCTION_APPEND(u_errorName)(status)]; + + addKeyAndObject(objects, keys, count, RKLICURegexRegexErrorKey, regexString); + addKeyAndObject(objects, keys, count, RKLICURegexRegexOptionsErrorKey, [NSNumber numberWithUnsignedInt:options]); + addKeyAndObject(objects, keys, count, RKLICURegexErrorCodeErrorKey, [NSNumber numberWithInt:status]); + addKeyAndObject(objects, keys, count, RKLICURegexErrorNameErrorKey, errorNameString); + + if((parseError != NULL) && (parseError->line != -1)) { + NSString *preContextString = [NSString stringWithCharacters:&parseError->preContext[0] length:(NSUInteger)RKL_ICU_FUNCTION_APPEND(u_strlen)(&parseError->preContext[0])]; + NSString *postContextString = [NSString stringWithCharacters:&parseError->postContext[0] length:(NSUInteger)RKL_ICU_FUNCTION_APPEND(u_strlen)(&parseError->postContext[0])]; + + addKeyAndObject(objects, keys, count, RKLICURegexLineErrorKey, [NSNumber numberWithInt:parseError->line]); + addKeyAndObject(objects, keys, count, RKLICURegexOffsetErrorKey, [NSNumber numberWithInt:parseError->offset]); + addKeyAndObject(objects, keys, count, RKLICURegexPreContextErrorKey, preContextString); + addKeyAndObject(objects, keys, count, RKLICURegexPostContextErrorKey, postContextString); + addKeyAndObject(objects, keys, count, @"NSLocalizedFailureReason", ([NSString stringWithFormat:@"The error %@ occurred at line %d, column %d: %@<>%@", errorNameString, parseError->line, parseError->offset, preContextString, postContextString])); + } else { + addKeyAndObject(objects, keys, count, @"NSLocalizedFailureReason", ([NSString stringWithFormat:@"The error %@ occurred.", errorNameString])); + } + + while(count < 62UL) { id obj = va_arg(varArgsList, id), key = va_arg(varArgsList, id); if((obj != NULL) && (key != NULL)) { addKeyAndObject(objects, keys, count, key, obj); } else { break; } } + va_end(varArgsList); + + return([NSDictionary dictionaryWithObjects:&objects[0] forKeys:&keys[0] count:count]); +} + +static NSError *rkl_NSErrorForRegex(NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status) { + return([NSError errorWithDomain:RKLICURegexErrorDomain code:(NSInteger)status userInfo:rkl_userInfoDictionary(regexString, options, parseError, status, @"There was an error compiling the regular expression.", @"NSLocalizedDescription", NULL)]); +} + +static NSException *rkl_NSExceptionForRegex(NSString *regexString, RKLRegexOptions options, const UParseError *parseError, int32_t status) { + return([NSException exceptionWithName:RKLICURegexException reason:[NSString stringWithFormat:@"ICU regular expression error #%d, %s", status, RKL_ICU_FUNCTION_APPEND(u_errorName)(status)] userInfo:rkl_userInfoDictionary(regexString, options, parseError, status, NULL)]); +} + +static NSDictionary *rkl_makeAssertDictionary(const char *function, const char *file, int line, NSString *format, ...) { + va_list varArgsList; + va_start(varArgsList, format); + NSString *formatString = [[[NSString alloc] initWithFormat:format arguments:varArgsList] autorelease]; + va_end(varArgsList); + NSString *functionString = [NSString stringWithUTF8String:function], *fileString = [NSString stringWithUTF8String:file]; + return([NSDictionary dictionaryWithObjectsAndKeys:formatString, @"description", functionString, @"function", fileString, @"file", [NSNumber numberWithInt:line], @"line", NSInternalInconsistencyException, @"exceptionName", NULL]); +} + +static NSString *rkl_stringFromClassAndMethod(id object, SEL selector, NSString *format, ...) { + va_list varArgsList; + va_start(varArgsList, format); + NSString *formatString = [[[NSString alloc] initWithFormat:format arguments:varArgsList] autorelease]; + va_end(varArgsList); + Class objectsClass = [object class]; + return([NSString stringWithFormat:@"*** %c[%@ %@]: %@", (object == objectsClass) ? '+' : '-', NSStringFromClass(objectsClass), NSStringFromSelector(selector), formatString]); +} + +#pragma mark - +#pragma mark Objective-C Public Interface +#pragma mark - + +@implementation NSString (RegexKitLiteAdditions) + +#pragma mark +clearStringCache + ++ (void)RKL_METHOD_PREPEND(clearStringCache) +{ + volatile NSUInteger RKL_CLEANUP(rkl_cleanup_cacheSpinLockStatus) cacheSpinLockStatus = 0UL; + OSSpinLockLock(&cacheSpinLock); + cacheSpinLockStatus |= RKLLockedCacheSpinLock; + rkl_clearStringCache(); + OSSpinLockUnlock(&cacheSpinLock); + cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; +} + +#pragma mark +captureCountForRegex: + ++ (NSInteger)RKL_METHOD_PREPEND(captureCountForRegex):(NSString *)regex +{ + NSInteger captureCount = -1L; + rkl_isRegexValid(self, _cmd, regex, RKLNoOptions, &captureCount, NULL); + return(captureCount); +} + ++ (NSInteger)RKL_METHOD_PREPEND(captureCountForRegex):(NSString *)regex options:(RKLRegexOptions)options error:(NSError **)error +{ + NSInteger captureCount = -1L; + rkl_isRegexValid(self, _cmd, regex, options, &captureCount, error); + return(captureCount); +} + +#pragma mark -captureCount: + +- (NSInteger)RKL_METHOD_PREPEND(captureCount) +{ + NSInteger captureCount = -1L; + rkl_isRegexValid(self, _cmd, self, RKLNoOptions, &captureCount, NULL); + return(captureCount); +} + +- (NSInteger)RKL_METHOD_PREPEND(captureCountWithOptions):(RKLRegexOptions)options error:(NSError **)error +{ + NSInteger captureCount = -1L; + rkl_isRegexValid(self, _cmd, self, options, &captureCount, error); + return(captureCount); +} + +#pragma mark -componentsSeparatedByRegex: + +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex +{ + NSRange range = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLSplitOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex range:(NSRange)range +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLSplitOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(componentsSeparatedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLSplitOp, regex, options, 0L, self, &range, NULL, error, NULL)); +} + +#pragma mark -isMatchedByRegex: + +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex +{ + NSRange result = NSNotFoundRange, range = NSMaxiumRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &result); + return((result.location == NSNotFound) ? NO : YES); +} + +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex inRange:(NSRange)range +{ + NSRange result = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &result); + return((result.location == NSNotFound) ? NO : YES); +} + +- (BOOL)RKL_METHOD_PREPEND(isMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range error:(NSError **)error +{ + NSRange result = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, options, 0L, self, &range, NULL, error, &result); + return((result.location == NSNotFound) ? NO : YES); +} + +#pragma mark -isRegexValid + +- (BOOL)RKL_METHOD_PREPEND(isRegexValid) +{ + return(rkl_isRegexValid(self, _cmd, self, RKLNoOptions, NULL, NULL) == 1UL ? YES : NO); +} + +- (BOOL)RKL_METHOD_PREPEND(isRegexValidWithOptions):(RKLRegexOptions)options error:(NSError **)error +{ + return(rkl_isRegexValid(self, _cmd, self, options, NULL, error) == 1UL ? YES : NO); +} + +#pragma mark -flushCachedRegexData + +- (void)RKL_METHOD_PREPEND(flushCachedRegexData) +{ + volatile NSUInteger RKL_CLEANUP(rkl_cleanup_cacheSpinLockStatus) cacheSpinLockStatus = 0UL; + + CFIndex selfLength = CFStringGetLength((CFStringRef)self); + CFHashCode selfHash = CFHash((CFTypeRef)self); + + OSSpinLockLock(&cacheSpinLock); + cacheSpinLockStatus |= RKLLockedCacheSpinLock; + rkl_dtrace_incrementEventID(); + + NSUInteger slot; + for(slot = 0UL; slot < (NSUInteger)(RKL_CACHE_SIZE); slot++) { + RKLCacheSlot *cacheSlot = &rkl_cacheSlots[slot]; + if((cacheSlot->setToString != NULL) && ( (cacheSlot->setToString == (CFStringRef)self) || ((cacheSlot->setToLength == selfLength) && (cacheSlot->setToHash == selfHash)) ) ) { rkl_clearCacheSlotSetTo(cacheSlot); } + } + + RKLBuffer *buffer = (selfLength < (CFIndex)(RKL_FIXED_LENGTH)) ? &fixedBuffer : &dynamicBuffer; + if((buffer->string != NULL) && ((buffer->string == (CFStringRef)self) || ((buffer->length == selfLength) && (buffer->hash == selfHash)))) { rkl_clearBuffer(buffer, 0UL); } + + OSSpinLockUnlock(&cacheSpinLock); + cacheSpinLockStatus |= RKLUnlockedCacheSpinLock; +} + +#pragma mark -rangeOfRegex: + +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex +{ + NSRange result = NSNotFoundRange, range = NSMaxiumRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &result); + return(result); +} + +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex capture:(NSInteger)capture +{ + NSRange result = NSNotFoundRange, range = NSMaxiumRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, capture, self, &range, NULL, NULL, &result); + return(result); +} + +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex inRange:(NSRange)range +{ + NSRange result = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &result); + return(result); +} + +- (NSRange)RKL_METHOD_PREPEND(rangeOfRegex):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error +{ + NSRange result = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, options, capture, self, &range, NULL, error, &result); + return(result); +} + +#pragma mark -stringByMatching: + +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex +{ + NSRange matchedRange = NSNotFoundRange, range = NSMaxiumRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &matchedRange); + return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length)))); +} + +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex capture:(NSInteger)capture +{ + NSRange matchedRange = NSNotFoundRange, range = NSMaxiumRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, capture, self, &range, NULL, NULL, &matchedRange); + return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length)))); +} + +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex inRange:(NSRange)range +{ + NSRange matchedRange = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, &matchedRange); + return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length)))); +} + +- (NSString *)RKL_METHOD_PREPEND(stringByMatching):(NSString *)regex options:(RKLRegexOptions)options inRange:(NSRange)range capture:(NSInteger)capture error:(NSError **)error +{ + NSRange matchedRange = NSNotFoundRange; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLRangeOp, regex, options, capture, self, &range, NULL, error, &matchedRange); + return((matchedRange.location == NSNotFound) ? NULL : rkl_CFAutorelease(CFStringCreateWithSubstring(NULL, (CFStringRef)self, CFMakeRange(matchedRange.location, matchedRange.length)))); +} + +#pragma mark -stringByReplacingOccurrencesOfRegex: + +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement +{ + NSRange searchRange = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLReplaceOp, regex, RKLNoOptions, 0L, self, &searchRange, replacement, NULL, NULL)); +} + +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement range:(NSRange)searchRange +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLReplaceOp, regex, RKLNoOptions, 0L, self, &searchRange, replacement, NULL, NULL)); +} + +- (NSString *)RKL_METHOD_PREPEND(stringByReplacingOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement options:(RKLRegexOptions)options range:(NSRange)searchRange error:(NSError **)error +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLReplaceOp, regex, options, 0L, self, &searchRange, replacement, error, NULL)); +} + +#pragma mark -componentsMatchedByRegex: + +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex +{ + NSRange searchRange = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLArrayOfStringsOp, regex, RKLNoOptions, 0L, self, &searchRange, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex capture:(NSInteger)capture +{ + NSRange searchRange = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLArrayOfStringsOp, regex, RKLNoOptions, capture, self, &searchRange, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex range:(NSRange)range +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLArrayOfStringsOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(componentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range capture:(NSInteger)capture error:(NSError **)error +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLArrayOfStringsOp, regex, options, capture, self, &range, NULL, error, NULL)); +} + +#pragma mark -captureComponentsMatchedByRegex: + +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex +{ + NSRange searchRange = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLCapturesArrayOp, regex, RKLNoOptions, 0L, self, &searchRange, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex range:(NSRange)range +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLCapturesArrayOp, regex, RKLNoOptions, 0L, self, &range, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(captureComponentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)RKLCapturesArrayOp, regex, options, 0L, self, &range, NULL, error, NULL)); +} + +#pragma mark -arrayOfCaptureComponentsMatchedByRegex: + +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex +{ + NSRange searchRange = NSMaxiumRange; + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLArrayOfCapturesOp | RKLSubcapturesArray), regex, RKLNoOptions, 0L, self, &searchRange, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex range:(NSRange)range +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLArrayOfCapturesOp | RKLSubcapturesArray), regex, RKLNoOptions, 0L, self, &range, NULL, NULL, NULL)); +} + +- (NSArray *)RKL_METHOD_PREPEND(arrayOfCaptureComponentsMatchedByRegex):(NSString *)regex options:(RKLRegexOptions)options range:(NSRange)range error:(NSError **)error +{ + return(rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLArrayOfCapturesOp | RKLSubcapturesArray), regex, options, 0L, self, &range, NULL, error, NULL)); +} + +@end + + +@implementation NSMutableString (RegexKitLiteAdditions) + +#pragma mark -replaceOccurrencesOfRegex: + +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement +{ + NSRange searchRange = NSMaxiumRange; + NSUInteger replacedCount = 0UL; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLReplaceOp | RKLReplaceMutable), regex, RKLNoOptions, 0L, self, &searchRange, replacement, NULL, (void **)((void *)&replacedCount)); + return(replacedCount); +} + +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement range:(NSRange)searchRange +{ + NSUInteger replacedCount = 0UL; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLReplaceOp | RKLReplaceMutable), regex, RKLNoOptions, 0L, self, &searchRange, replacement, NULL, (void **)((void *)&replacedCount)); + return(replacedCount); +} + +- (NSUInteger)RKL_METHOD_PREPEND(replaceOccurrencesOfRegex):(NSString *)regex withString:(NSString *)replacement options:(RKLRegexOptions)options range:(NSRange)searchRange error:(NSError **)error +{ + NSUInteger replacedCount = 0UL; + rkl_performRegexOp(self, _cmd, (RKLRegexOp)(RKLReplaceOp | RKLReplaceMutable), regex, options, 0L, self, &searchRange, replacement, error, (void **)((void *)&replacedCount)); + return(replacedCount); +} + +@end diff --git a/test/.svn/all-wcprops b/test/.svn/all-wcprops new file mode 100644 index 0000000..9cb0316 --- /dev/null +++ b/test/.svn/all-wcprops @@ -0,0 +1,1619 @@ +K 25 +svn:wc:ra_dav:version-url +V 29 +/svn/!svn/ver/1410/trunk/test +END +TDXmlTokenAssembly.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1171/trunk/test/TDXmlTokenAssembly.h +END +TDXmlNmtokenState.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1404/trunk/test/TDXmlNmtokenState.m +END +TDXmlCdata.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1404/trunk/test/TDXmlCdata.m +END +TDMiniCSSAssembler.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1171/trunk/test/TDMiniCSSAssembler.h +END +TDSymbolStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1171/trunk/test/TDSymbolStateTest.h +END +TDXmlTokenAssembly.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1405/trunk/test/TDXmlTokenAssembly.m +END +TDMiniCSSAssembler.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1405/trunk/test/TDMiniCSSAssembler.m +END +XPathParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1171/trunk/test/XPathParserTest.h +END +TDXmlStartTag.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDXmlStartTag.h +END +TDSymbolStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1410/trunk/test/TDSymbolStateTest.m +END +TDXmlWhitespace.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1171/trunk/test/TDXmlWhitespace.h +END +TDXMLParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1347/trunk/test/TDXMLParserTest.h +END +XPathParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1171/trunk/test/XPathParserTest.m +END +TDXmlStartTag.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1404/trunk/test/TDXmlStartTag.m +END +TDXMLParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1361/trunk/test/TDXMLParserTest.m +END +TDXmlWhitespace.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1404/trunk/test/TDXmlWhitespace.m +END +TDJavaScriptParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1115/trunk/test/TDJavaScriptParserTest.h +END +TDXmlAttribute.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/TDXmlAttribute.h +END +TDJavaScriptParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1115/trunk/test/TDJavaScriptParserTest.m +END +TDXmlAttribute.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1404/trunk/test/TDXmlAttribute.m +END +TDXmlEntityRef.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/TDXmlEntityRef.h +END +TDXmlTokenizer.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/TDXmlTokenizer.h +END +TDXmlEntityRef.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1404/trunk/test/TDXmlEntityRef.m +END +TDXmlTokenizer.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/TDXmlTokenizer.m +END +TDDigitTest.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1171/trunk/test/TDDigitTest.h +END +SRGSParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/SRGSParserTest.h +END +TDSyntaxHighlighter.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1171/trunk/test/TDSyntaxHighlighter.h +END +TDDigitTest.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1403/trunk/test/TDDigitTest.m +END +Tests-Info.plist +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1173/trunk/test/Tests-Info.plist +END +TDNSPredicateBuilderTest.h +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1115/trunk/test/TDNSPredicateBuilderTest.h +END +SRGSParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/SRGSParserTest.m +END +TDGenericAssemblerTest.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1171/trunk/test/TDGenericAssemblerTest.h +END +TDSyntaxHighlighter.m +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1263/trunk/test/TDSyntaxHighlighter.m +END +TDNSPredicateBuilderTest.m +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1115/trunk/test/TDNSPredicateBuilderTest.m +END +TDPatternTest.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1115/trunk/test/TDPatternTest.h +END +TDGenericAssemblerTest.m +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1171/trunk/test/TDGenericAssemblerTest.m +END +ERBTest.h +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/!svn/ver/1260/trunk/test/ERBTest.h +END +TDRepetitionTest.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1171/trunk/test/TDRepetitionTest.h +END +TDPatternTest.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1179/trunk/test/TDPatternTest.m +END +TDPredicateEvaluatorTest.h +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1115/trunk/test/TDPredicateEvaluatorTest.h +END +ERBTest.m +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/!svn/ver/1361/trunk/test/ERBTest.m +END +TDTokenizer+BlobState.h +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1115/trunk/test/TDTokenizer+BlobState.h +END +TDRepetitionTest.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1405/trunk/test/TDRepetitionTest.m +END +TDPredicateEvaluatorTest.m +K 25 +svn:wc:ra_dav:version-url +V 56 +/svn/!svn/ver/1370/trunk/test/TDPredicateEvaluatorTest.m +END +TDTokenizer+BlobState.m +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1115/trunk/test/TDTokenizer+BlobState.m +END +TDTrackTest.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1171/trunk/test/TDTrackTest.h +END +XPathParser.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1171/trunk/test/XPathParser.h +END +TDTrackTest.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1382/trunk/test/TDTrackTest.m +END +TDXMLParser.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1115/trunk/test/TDXMLParser.h +END +TDBlob.h +K 25 +svn:wc:ra_dav:version-url +V 38 +/svn/!svn/ver/1115/trunk/test/TDBlob.h +END +XPathParser.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1276/trunk/test/XPathParser.m +END +PKRuleNode.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1331/trunk/test/PKRuleNode.h +END +TDXMLParser.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1115/trunk/test/TDXMLParser.m +END +TDBlob.m +K 25 +svn:wc:ra_dav:version-url +V 38 +/svn/!svn/ver/1115/trunk/test/TDBlob.m +END +TDNSPredicateEvaluator.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1115/trunk/test/TDNSPredicateEvaluator.h +END +TDParserFactoryTest.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1171/trunk/test/TDParserFactoryTest.h +END +PKRuleNode.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1331/trunk/test/PKRuleNode.m +END +TDDelimitStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1115/trunk/test/TDDelimitStateTest.h +END +PKTokenNode.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1331/trunk/test/PKTokenNode.h +END +TDNSPredicateEvaluator.m +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1405/trunk/test/TDNSPredicateEvaluator.m +END +TDParserFactoryTest.m +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1405/trunk/test/TDParserFactoryTest.m +END +TDParseTreeTest.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1331/trunk/test/TDParseTreeTest.h +END +PKNumberState.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1218/trunk/test/PKNumberState.h +END +TDCharacterAssemblyTest.h +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1171/trunk/test/TDCharacterAssemblyTest.h +END +TDDelimitStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1115/trunk/test/TDDelimitStateTest.m +END +TDXmlEntity.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1171/trunk/test/TDXmlEntity.h +END +PKTokenNode.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1331/trunk/test/PKTokenNode.m +END +TDParseTreeTest.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1315/trunk/test/TDParseTreeTest.m +END +PKNumberState.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1217/trunk/test/PKNumberState.m +END +TDCharacterAssemblyTest.m +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1404/trunk/test/TDCharacterAssemblyTest.m +END +TDXmlToken.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1171/trunk/test/TDXmlToken.h +END +TDXmlEntity.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1404/trunk/test/TDXmlEntity.m +END +TDFastJsonParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1171/trunk/test/TDFastJsonParserTest.h +END +TDXmlToken.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1171/trunk/test/TDXmlToken.m +END +TDFastJsonParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1171/trunk/test/TDFastJsonParserTest.m +END +TDSlashStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1170/trunk/test/TDSlashStateTest.h +END +TDSignificantWhitespaceState.h +K 25 +svn:wc:ra_dav:version-url +V 60 +/svn/!svn/ver/1171/trunk/test/TDSignificantWhitespaceState.h +END +TDWordStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1171/trunk/test/TDWordStateTest.h +END +TDSlashStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1170/trunk/test/TDSlashStateTest.m +END +TDSignificantWhitespaceState.m +K 25 +svn:wc:ra_dav:version-url +V 60 +/svn/!svn/ver/1171/trunk/test/TDSignificantWhitespaceState.m +END +TDWordStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1171/trunk/test/TDWordStateTest.m +END +PKScientificNumberState.h +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1217/trunk/test/PKScientificNumberState.h +END +TDXmlDocument.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDXmlDocument.h +END +PKScientificNumberState.m +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1217/trunk/test/PKScientificNumberState.m +END +TDReaderTest.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/TDReaderTest.h +END +TDXmlDocument.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1404/trunk/test/TDXmlDocument.m +END +TDReaderTest.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/TDReaderTest.m +END +TDLowercaseWordTest.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1171/trunk/test/TDLowercaseWordTest.h +END +TDLowercaseWordTest.m +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1171/trunk/test/TDLowercaseWordTest.m +END +TDXmlDecl.h +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1171/trunk/test/TDXmlDecl.h +END +TDToken+Blob.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1129/trunk/test/TDToken+Blob.h +END +TDScientificNumberStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1218/trunk/test/TDScientificNumberStateTest.h +END +TDParserBlocksTest.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1379/trunk/test/TDParserBlocksTest.h +END +TDXmlSignificantWhitespace.h +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1171/trunk/test/TDXmlSignificantWhitespace.h +END +TDXmlDecl.m +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1404/trunk/test/TDXmlDecl.m +END +TDQuoteStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1171/trunk/test/TDQuoteStateTest.h +END +TDScientificNumberStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 59 +/svn/!svn/ver/1372/trunk/test/TDScientificNumberStateTest.m +END +TDToken+Blob.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1129/trunk/test/TDToken+Blob.m +END +TDParserBlocksTest.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1400/trunk/test/TDParserBlocksTest.m +END +RelaxParser.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1115/trunk/test/RelaxParser.h +END +TDXmlSignificantWhitespace.m +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1404/trunk/test/TDXmlSignificantWhitespace.m +END +TDXmlNameTest.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDXmlNameTest.h +END +TDQuoteStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1171/trunk/test/TDQuoteStateTest.m +END +TDXmlText.h +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1171/trunk/test/TDXmlText.h +END +RelaxParser.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1115/trunk/test/RelaxParser.m +END +TDParserFactoryTest2.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1118/trunk/test/TDParserFactoryTest2.h +END +TDXmlNameTest.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDXmlNameTest.m +END +TDXmlText.m +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1404/trunk/test/TDXmlText.m +END +TDReservedWord.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/TDReservedWord.h +END +TDParserFactoryTest2.m +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1275/trunk/test/TDParserFactoryTest2.m +END +TDWordOrReservedState.h +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1170/trunk/test/TDWordOrReservedState.h +END +TDRegularParser.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1171/trunk/test/TDRegularParser.h +END +TDBlobState.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1115/trunk/test/TDBlobState.h +END +TDReservedWord.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1404/trunk/test/TDReservedWord.m +END +TDWordOrReservedState.m +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1171/trunk/test/TDWordOrReservedState.m +END +TDParserFactoryPatternTest.h +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1118/trunk/test/TDParserFactoryPatternTest.h +END +TDRegularParser.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1405/trunk/test/TDRegularParser.m +END +TDBlobState.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1129/trunk/test/TDBlobState.m +END +TDParserFactoryPatternTest.m +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1118/trunk/test/TDParserFactoryPatternTest.m +END +TDArithmeticAssembler.h +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1399/trunk/test/TDArithmeticAssembler.h +END +XMLReader.h +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1171/trunk/test/XMLReader.h +END +TDXmlTerminal.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDXmlTerminal.h +END +TDArithmeticAssembler.m +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1399/trunk/test/TDArithmeticAssembler.m +END +XMLReader.m +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/735/trunk/test/XMLReader.m +END +TDXmlTerminal.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDXmlTerminal.m +END +TDMiniCSSAssemblerTest.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1171/trunk/test/TDMiniCSSAssemblerTest.h +END +TDSymbolTest.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/TDSymbolTest.h +END +TDMiniCSSAssemblerTest.m +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1171/trunk/test/TDMiniCSSAssemblerTest.m +END +TDSymbolTest.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/TDSymbolTest.m +END +TDXmlEndEntity.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/TDXmlEndEntity.h +END +TDXmlEndEntity.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1404/trunk/test/TDXmlEndEntity.m +END +XPathAssembler.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/XPathAssembler.h +END +TDXmlTokenizerTest.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1171/trunk/test/TDXmlTokenizerTest.h +END +TDLiteralTest.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDLiteralTest.h +END +TDXmlNmtoken.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/TDXmlNmtoken.h +END +XPathAssembler.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1276/trunk/test/XPathAssembler.m +END +EBNFParser.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1368/trunk/test/EBNFParser.h +END +TDXmlTokenizerTest.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1171/trunk/test/TDXmlTokenizerTest.m +END +TDLiteralTest.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1177/trunk/test/TDLiteralTest.m +END +TDXmlName.h +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1171/trunk/test/TDXmlName.h +END +TDXmlNmtoken.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/TDXmlNmtoken.m +END +EBNFParser.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1404/trunk/test/EBNFParser.m +END +TDXmlName.m +K 25 +svn:wc:ra_dav:version-url +V 41 +/svn/!svn/ver/1171/trunk/test/TDXmlName.m +END +TDParserFactoryTest3.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1266/trunk/test/TDParserFactoryTest3.h +END +TDNSPredicateBuilder.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1115/trunk/test/TDNSPredicateBuilder.h +END +TDXmlNotation.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDXmlNotation.h +END +TDParserFactoryTest3.m +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1276/trunk/test/TDParserFactoryTest3.m +END +TDNSPredicateBuilder.m +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1405/trunk/test/TDNSPredicateBuilder.m +END +TDRegularParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1171/trunk/test/TDRegularParserTest.h +END +TDTokenTest.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1171/trunk/test/TDTokenTest.h +END +TDXmlNotation.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1404/trunk/test/TDXmlNotation.m +END +TDRegularParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1405/trunk/test/TDRegularParserTest.m +END +TDUppercaseWordTest.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1171/trunk/test/TDUppercaseWordTest.h +END +TDXmlComment.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/TDXmlComment.h +END +TDTokenTest.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1171/trunk/test/TDTokenTest.m +END +TDUppercaseWordTest.m +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1171/trunk/test/TDUppercaseWordTest.m +END +TDXmlComment.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1404/trunk/test/TDXmlComment.m +END +TDParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/TDParserTest.h +END +TDTokenArraySourceTest.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1171/trunk/test/TDTokenArraySourceTest.h +END +TDParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1379/trunk/test/TDParserTest.m +END +TDTokenArraySourceTest.m +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1405/trunk/test/TDTokenArraySourceTest.m +END +XPathParserGrammarTest.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1115/trunk/test/XPathParserGrammarTest.h +END +XPathParserGrammarTest.m +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1361/trunk/test/XPathParserGrammarTest.m +END +XPathContext.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/XPathContext.h +END +TDXmlNameState.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/TDXmlNameState.h +END +TDFastJsonParser.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1171/trunk/test/TDFastJsonParser.h +END +XPathContext.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/XPathContext.m +END +TDXmlNameState.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/TDXmlNameState.m +END +TDPlistParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1171/trunk/test/TDPlistParserTest.h +END +TDFastJsonParser.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1405/trunk/test/TDFastJsonParser.m +END +TDTokenizerTest.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1374/trunk/test/TDTokenizerTest.h +END +TDPlistParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1382/trunk/test/TDPlistParserTest.m +END +TDTokenizerTest.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1171/trunk/test/TDTokenizerTest.m +END +TDHtmlSyntaxHighlighter.h +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1171/trunk/test/TDHtmlSyntaxHighlighter.h +END +TDHtmlSyntaxHighlighter.m +K 25 +svn:wc:ra_dav:version-url +V 55 +/svn/!svn/ver/1405/trunk/test/TDHtmlSyntaxHighlighter.m +END +TDArithmeticParser.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1372/trunk/test/TDArithmeticParser.h +END +TDTokenizerBlocksTest.h +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1374/trunk/test/TDTokenizerBlocksTest.h +END +TDArithmeticParser.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1372/trunk/test/TDArithmeticParser.m +END +TDTokenizerBlocksTest.m +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1400/trunk/test/TDTokenizerBlocksTest.m +END +TDJavaScriptParser.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1115/trunk/test/TDJavaScriptParser.h +END +TDSpecificCharTest.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1171/trunk/test/TDSpecificCharTest.h +END +TDSpecificCharTest.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1403/trunk/test/TDSpecificCharTest.m +END +TDJavaScriptParser.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1218/trunk/test/TDJavaScriptParser.m +END +PKAST.h +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/!svn/ver/1212/trunk/test/PKAST.h +END +PKAST.m +K 25 +svn:wc:ra_dav:version-url +V 37 +/svn/!svn/ver/1212/trunk/test/PKAST.m +END +TDNCName.h +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1171/trunk/test/TDNCName.h +END +SRGSParser.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1171/trunk/test/SRGSParser.h +END +TDNCName.m +K 25 +svn:wc:ra_dav:version-url +V 40 +/svn/!svn/ver/1171/trunk/test/TDNCName.m +END +TDSequenceTest.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/TDSequenceTest.h +END +SRGSParser.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1276/trunk/test/SRGSParser.m +END +TDReservedWordTest.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1171/trunk/test/TDReservedWordTest.h +END +TDCharTest.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1171/trunk/test/TDCharTest.h +END +TDSequenceTest.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1405/trunk/test/TDSequenceTest.m +END +TDReservedWordTest.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1171/trunk/test/TDReservedWordTest.m +END +TDCharTest.m +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1403/trunk/test/TDCharTest.m +END +TDPredicateEvaluator.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1115/trunk/test/TDPredicateEvaluator.h +END +TDXmlFragment.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDXmlFragment.h +END +TDNonReservedWord.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1171/trunk/test/TDNonReservedWord.h +END +TDPredicateEvaluator.m +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1371/trunk/test/TDPredicateEvaluator.m +END +TDXmlFragment.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1404/trunk/test/TDXmlFragment.m +END +TDDifferenceTest.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1162/trunk/test/TDDifferenceTest.h +END +XMLReaderTest.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/XMLReaderTest.h +END +TDNonReservedWord.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1404/trunk/test/TDNonReservedWord.m +END +PKParseTreeAssembler.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1331/trunk/test/PKParseTreeAssembler.h +END +TDDifferenceTest.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1162/trunk/test/TDDifferenceTest.m +END +XMLReaderTest.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/XMLReaderTest.m +END +PKParseTreeAssembler.m +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1404/trunk/test/PKParseTreeAssembler.m +END +TDArithmeticParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1372/trunk/test/TDArithmeticParserTest.h +END +TDArithmeticParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 54 +/svn/!svn/ver/1372/trunk/test/TDArithmeticParserTest.m +END +TDTokenizerStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1213/trunk/test/TDTokenizerStateTest.h +END +TDTokenAssemblyTest.h +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1171/trunk/test/TDTokenAssemblyTest.h +END +TDTokenizerStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 52 +/svn/!svn/ver/1410/trunk/test/TDTokenizerStateTest.m +END +TDNSPredicateEvaluatorTest.h +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1115/trunk/test/TDNSPredicateEvaluatorTest.h +END +TDTokenAssemblyTest.m +K 25 +svn:wc:ra_dav:version-url +V 51 +/svn/!svn/ver/1404/trunk/test/TDTokenAssemblyTest.m +END +TDNSPredicateEvaluatorTest.m +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1405/trunk/test/TDNSPredicateEvaluatorTest.m +END +TDWhitespaceStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1171/trunk/test/TDWhitespaceStateTest.h +END +EBNFParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/EBNFParserTest.h +END +SAXAssembler.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1347/trunk/test/SAXAssembler.h +END +TDWhitespaceStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 53 +/svn/!svn/ver/1171/trunk/test/TDWhitespaceStateTest.m +END +TDNCNameState.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDNCNameState.h +END +TDCommentStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1171/trunk/test/TDCommentStateTest.h +END +EBNFParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1171/trunk/test/EBNFParserTest.m +END +TDNegationTest.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1162/trunk/test/TDNegationTest.h +END +SAXAssembler.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1354/trunk/test/SAXAssembler.m +END +TDNCNameState.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1171/trunk/test/TDNCNameState.m +END +TDCommentStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1410/trunk/test/TDCommentStateTest.m +END +TDNegationTest.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1162/trunk/test/TDNegationTest.m +END +TDSlashState.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1170/trunk/test/TDSlashState.h +END +TDSignificantWhitespaceStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 64 +/svn/!svn/ver/1171/trunk/test/TDSignificantWhitespaceStateTest.h +END +TDSlashState.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1170/trunk/test/TDSlashState.m +END +TDSignificantWhitespaceStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 64 +/svn/!svn/ver/1170/trunk/test/TDSignificantWhitespaceStateTest.m +END +TDJsonParser.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1367/trunk/test/TDJsonParser.h +END +TDNumberStateTest.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1171/trunk/test/TDNumberStateTest.h +END +TDJsonParser.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1405/trunk/test/TDJsonParser.m +END +PKParseTree.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1331/trunk/test/PKParseTree.h +END +TDNumberStateTest.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1171/trunk/test/TDNumberStateTest.m +END +TDLetterTest.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/TDLetterTest.h +END +PKParseTree.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1331/trunk/test/PKParseTree.m +END +TDLetterTest.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1403/trunk/test/TDLetterTest.m +END +TDSlashStarState.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1170/trunk/test/TDSlashStarState.h +END +TDSlashSlashState.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1170/trunk/test/TDSlashSlashState.h +END +TDSlashStarState.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1170/trunk/test/TDSlashStarState.m +END +TDSlashSlashState.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1170/trunk/test/TDSlashSlashState.m +END +PKExclusion.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1166/trunk/test/PKExclusion.h +END +TDTestScaffold.h +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1375/trunk/test/TDTestScaffold.h +END +PKExclusion.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1168/trunk/test/PKExclusion.m +END +TDTestScaffold.m +K 25 +svn:wc:ra_dav:version-url +V 46 +/svn/!svn/ver/1400/trunk/test/TDTestScaffold.m +END +TDXmlDoctype.h +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1171/trunk/test/TDXmlDoctype.h +END +TDXmlDoctype.m +K 25 +svn:wc:ra_dav:version-url +V 44 +/svn/!svn/ver/1404/trunk/test/TDXmlDoctype.m +END +TDXmlProcessingInstruction.h +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1171/trunk/test/TDXmlProcessingInstruction.h +END +SAXTest.h +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/!svn/ver/1347/trunk/test/SAXTest.h +END +TDXmlProcessingInstruction.m +K 25 +svn:wc:ra_dav:version-url +V 58 +/svn/!svn/ver/1404/trunk/test/TDXmlProcessingInstruction.m +END +TDPlistParser.h +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1367/trunk/test/TDPlistParser.h +END +SAXTest.m +K 25 +svn:wc:ra_dav:version-url +V 39 +/svn/!svn/ver/1361/trunk/test/SAXTest.m +END +TDExclusionTest.h +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1153/trunk/test/TDExclusionTest.h +END +TDGenericAssembler.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1261/trunk/test/TDGenericAssembler.h +END +TDPlistParser.m +K 25 +svn:wc:ra_dav:version-url +V 45 +/svn/!svn/ver/1405/trunk/test/TDPlistParser.m +END +TDExclusionTest.m +K 25 +svn:wc:ra_dav:version-url +V 47 +/svn/!svn/ver/1153/trunk/test/TDExclusionTest.m +END +TDGenericAssembler.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1404/trunk/test/TDGenericAssembler.m +END +TDAlternationTest.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1171/trunk/test/TDAlternationTest.h +END +TDXmlEndTag.h +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1171/trunk/test/TDXmlEndTag.h +END +TDRobotCommandTest.h +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1171/trunk/test/TDRobotCommandTest.h +END +TDAlternationTest.m +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1225/trunk/test/TDAlternationTest.m +END +TDJsonParserTest.h +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1171/trunk/test/TDJsonParserTest.h +END +TDXmlEndTag.m +K 25 +svn:wc:ra_dav:version-url +V 43 +/svn/!svn/ver/1404/trunk/test/TDXmlEndTag.m +END +TDRobotCommandTest.m +K 25 +svn:wc:ra_dav:version-url +V 50 +/svn/!svn/ver/1276/trunk/test/TDRobotCommandTest.m +END +TDJsonParserTest.m +K 25 +svn:wc:ra_dav:version-url +V 48 +/svn/!svn/ver/1405/trunk/test/TDJsonParserTest.m +END +TDXmlNmtokenState.h +K 25 +svn:wc:ra_dav:version-url +V 49 +/svn/!svn/ver/1171/trunk/test/TDXmlNmtokenState.h +END +TDXmlCdata.h +K 25 +svn:wc:ra_dav:version-url +V 42 +/svn/!svn/ver/1171/trunk/test/TDXmlCdata.h +END diff --git a/test/.svn/entries b/test/.svn/entries new file mode 100644 index 0000000..7a66859 --- /dev/null +++ b/test/.svn/entries @@ -0,0 +1,9174 @@ +10 + +dir +1411 +https://todd.ditchendorf@todparsekit.googlecode.com/svn/trunk/test +https://todd.ditchendorf@todparsekit.googlecode.com/svn + + + +2009-11-06T01:42:40.664388Z +1410 +todd.ditchendorf + + + + + + + + + + + + + + +7c5183cd-b054-0410-b1f0-833f5c61cfe1 + +TDXmlTokenAssembly.h +file + + + + +2009-07-03T19:42:55.000000Z +6005e82f2437aeaabefd88a3876b3d6e +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +387 + +TDXmlCdata.m +file + + + + +2009-11-13T07:14:26.000000Z +db2a5628fa3d3464b36fe7f14da85992 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +832 + +TDXmlNmtokenState.m +file + + + + +2009-11-13T07:14:26.000000Z +9dce21433f87112f150c08bebe17b2c5 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1664 + +TDMiniCSSAssembler.h +file + + + + +2009-07-03T19:42:55.000000Z +06b6cb26ca1cdaee73184e4428a48109 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +485 + +TDXmlTokenAssembly.m +file + + + + +2009-11-13T07:14:26.000000Z +0bc3622d591adce015b0f1641453c920 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2843 + +TDSymbolStateTest.h +file + + + + +2009-07-03T19:31:27.000000Z +f8ca217adc51892b82bca91eddb761d5 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +295 + +TDMiniCSSAssembler.m +file + + + + +2009-11-13T07:14:26.000000Z +329c78a2a6d658d0e4f779715d4e62a1 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +5380 + +XPathParserTest.h +file + + + + +2009-07-03T19:31:20.000000Z +79234379e9638c5a36c960793048fbfd +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +331 + +TDXmlStartTag.h +file + + + + +2009-07-03T19:31:22.000000Z +0bb485a40bb38dd7e4aab2265bb4e004 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +279 + +TDSymbolStateTest.m +file + + + + +2009-11-13T07:14:26.000000Z +befb4b7c900af58fa50d20d0cf99c871 +2009-11-06T01:42:40.664388Z +1410 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +15484 + +TDXmlWhitespace.h +file + + + + +2009-07-03T19:31:21.000000Z +4367efb8015bba64dc884c61b07fb1f3 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +287 + +TDXMLParserTest.h +file + + + + +2009-08-17T07:55:20.000000Z +bfa766519c47938c2e3ec1dec89869f6 +2009-08-23T05:03:45.633098Z +1347 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +372 + +XPathParserTest.m +file + + + + +2009-07-03T19:31:20.000000Z +09982e53a108ba5f81a425bc01c0ee95 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +9019 + +TDXmlStartTag.m +file + + + + +2009-11-13T07:14:26.000000Z +d54815dfdf91ad353fc6ea183b792089 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +854 + +TDXMLParserTest.m +file + + + + +2009-08-29T06:09:29.000000Z +10812c40fc8ff8459033fb5d8cd9aff8 +2009-08-29T06:10:20.621428Z +1361 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +18854 + +TDXmlWhitespace.m +file + + + + +2009-11-13T07:14:26.000000Z +5a5540405eedfd508b80c334b866f964 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +867 + +TDJavaScriptParserTest.h +file + + + + +2009-06-30T06:13:13.000000Z +2d0edc3a37e4ceea310aa76b91980547 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +353 + +TDXmlAttribute.h +file + + + + +2009-07-03T19:31:23.000000Z +5baccf29289c34b835529e5815e9eca6 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +283 + +TDJavaScriptParserTest.m +file + + + + +2009-06-30T06:13:13.000000Z +ab543bdd23d646eb7f0bad72bfe32de1 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +26389 + +TDXmlAttribute.m +file + + + + +2009-11-13T07:14:26.000000Z +471d7487fa9420d1a8a096f99a3d2eca +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +860 + +TDXmlEntityRef.h +file + + + + +2009-07-03T19:31:22.000000Z +d77fa2ff7a2b0dc8febe27c093dc4548 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +283 + +TDXmlTokenizer.h +file + + + + +2009-07-03T19:31:24.000000Z +faf31bec1d62b3d43a257d78d0a1637f +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +415 + +TDXmlEntityRef.m +file + + + + +2009-11-13T07:14:26.000000Z +e887c1fba3b8522aea12691967760dc8 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +861 + +TDDigitTest.h +file + + + + +2009-07-03T19:31:26.000000Z +ae18390ea03b47cd889e9791046af4ab +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +304 + +TDXmlTokenizer.m +file + + + + +2009-07-03T19:42:56.000000Z +0548c68530e76e71659b9b2329707c42 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1249 + +SRGSParserTest.h +file + + + + +2009-07-03T19:31:19.000000Z +086682b2b15ace60d726070ee4a60f1f +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +327 + +TDSyntaxHighlighter.h +file + + + + +2009-07-03T19:42:56.000000Z +f159862b35839a7bf5ad3c6e55e4b791 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +766 + +TDDigitTest.m +file + + + + +2009-09-26T05:55:36.000000Z +baefe3dcc0cb55f24645905f34a97aa1 +2009-09-26T19:12:29.746961Z +1403 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1199 + +Tests-Info.plist +file + + + + +2009-07-03T20:35:47.000000Z +f3afee633e814c6e62bbbb24d8f9b171 +2009-07-03T20:39:51.719779Z +1173 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +675 + +TDNSPredicateBuilderTest.h +file + + + + +2009-06-30T06:13:11.000000Z +d50a637c2ecc3c2462c79e41f15dcef4 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +337 + +SRGSParserTest.m +file + + + + +2009-07-12T23:20:48.000000Z +fe8011b0fdd0b0ce84cba5a83b90c869 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +5298 + +TDGenericAssemblerTest.h +file + + + + +2009-07-03T19:31:29.000000Z +7e46bf3272825c70445b50d92c4e7d4c +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +549 + +TDSyntaxHighlighter.m +file + + + + +2009-07-27T05:46:37.000000Z +982c86b655aaa7984e066cecb087732d +2009-07-27T06:00:08.623243Z +1263 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +5574 + +TDNSPredicateBuilderTest.m +file + + + + +2009-06-30T06:13:13.000000Z +a1dd5aab9bcfca9bc53d1fcd241934c2 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +7679 + +TDPatternTest.h +file + + + + +2009-06-30T06:13:10.000000Z +09d53bc2c80fd546f4b8808a4e91ca55 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +323 + +TDGenericAssemblerTest.m +file + + + + +2009-07-03T19:31:29.000000Z +9a202dafb1973ec7a37e7a35e79acc9e +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2136 + +ERBTest.h +file + + + + +2009-07-27T00:55:45.000000Z +687d0bee5481fb427679e3ce8eb0524e +2009-07-27T01:22:37.892748Z +1260 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +399 + +TDRepetitionTest.h +file + + + + +2009-07-03T19:31:29.000000Z +fa666e2c88f5e2ed9196dddfe641f408 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +281 + +TDPatternTest.m +file + + + + +2009-07-03T22:32:10.000000Z +760b64b9fb2b7d9710a4c133c35622d4 +2009-07-03T22:34:56.929029Z +1179 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +6003 + +TDPredicateEvaluatorTest.h +file + + + + +2009-06-30T06:13:11.000000Z +4afd59d8acec27e21a598bcd1d2e6f80 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +406 + +ERBTest.m +file + + + + +2009-08-29T06:09:00.000000Z +102cd88973f3731c728b387ad9ce9cf2 +2009-08-29T06:10:20.621428Z +1361 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1491 + +TDTokenizer+BlobState.h +file + + + + +2009-06-30T06:13:08.000000Z +8584e401bf99714cf58bdf776f4d80b1 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +275 + +TDRepetitionTest.m +file + + + + +2009-11-13T07:14:26.000000Z +9298bff00a6af62f67de3fb1449028ad +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +5566 + +TDPredicateEvaluatorTest.m +file + + + + +2009-09-16T04:29:42.000000Z +d758cff681916f7a583a93c5215cbbe1 +2009-09-16T04:30:31.017239Z +1370 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +10465 + +TDTokenizer+BlobState.m +file + + + + +2009-06-30T06:13:13.000000Z +2fc2b60c289db3b5ffcb2b4310e62f30 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +772 + +TDTrackTest.h +file + + + + +2009-07-03T19:31:28.000000Z +0c8b6ab26ab57631641c6f7af9126c12 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +219 + +TDTrackTest.m +file + + + + +2009-09-17T22:45:56.000000Z +dde3752778bd9b2cfe37b283475fb411 +2009-09-17T22:46:20.790207Z +1382 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +3303 + +XPathParser.h +file + + + + +2009-07-03T19:31:20.000000Z +fafb6a995b117e4b895627b823520983 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3754 + +TDXMLParser.h +file + + + + +2009-06-30T06:13:07.000000Z +45c66e82cca93ba4452401d50e93b8c2 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +219 + +XPathParser.m +file + + + + +2009-08-06T04:01:55.000000Z +a1de989d67997c8ba260440e884edd37 +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +30876 + +TDBlob.h +file + + + + +2009-06-30T06:13:07.000000Z +daa564c42e605e7d6a3c7a1294442ea8 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +265 + +PKRuleNode.h +file + + + + +2009-08-06T04:02:00.000000Z +f359df7dcb42a06d8a2150ee5257ae6c +2009-08-17T01:06:48.172726Z +1331 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +399 + +TDXMLParser.m +file + + + + +2009-06-30T06:13:15.000000Z +874bda7e4245fbc96e52af5d70e5448d +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +204 + +TDBlob.m +file + + + + +2009-06-30T06:13:06.000000Z +fdd1acac7f89f280a5d24ab7fbd4cfff +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +606 + +TDNSPredicateEvaluator.h +file + + + + +2009-07-03T19:42:56.000000Z +92665170c184a4ebe92786bb893ff086 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +616 + +TDParserFactoryTest.h +file + + + + +2009-07-03T19:31:30.000000Z +86b2f9d813c85d1edc17a28839dfcefa +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +437 + +PKRuleNode.m +file + + + + +2009-08-06T04:02:04.000000Z +2ae3d621ca80e6128735bdb0a7ae1e1b +2009-08-17T01:06:48.172726Z +1331 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +834 + +TDDelimitStateTest.h +file + + + + +2009-06-30T06:13:12.000000Z +2856e51c050c626d51c599eab4a597c5 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +321 + +TDParserFactoryTest.m +file + + + + +2009-11-13T07:14:26.000000Z +dee3ccd9bd31a8569f80742c27064708 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +43246 + +TDNSPredicateEvaluator.m +file + + + + +2009-11-13T07:14:26.000000Z +a35eab5be1a276715aae2d265263d04b +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +6270 + +PKTokenNode.h +file + + + + +2009-08-06T04:02:00.000000Z +e32eaa4eaace0be48dc451c2f86b700e +2009-08-17T01:06:48.172726Z +1331 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +425 + +TDParseTreeTest.h +file + + + + +2009-08-17T00:38:47.000000Z +2214b7df31cb49fda613bd1c5d8a4a86 +2009-08-17T01:06:48.172726Z +1331 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +544 + +TDCharacterAssemblyTest.h +file + + + + +2009-07-03T19:31:26.000000Z +ccd79d788278595a9b5465cba2a32892 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +312 + +PKNumberState.h +file + + + + +2009-07-13T03:26:58.000000Z +50beb43f197ef6e29c046eb9b908a40f +2009-07-13T03:32:51.609563Z +1218 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1175 + +TDDelimitStateTest.m +file + + + + +2009-06-30T06:13:12.000000Z +8f60b0f6c1eaefb4edf0a80350ba1a06 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +22429 + +TDXmlEntity.h +file + + + + +2009-07-03T19:31:22.000000Z +7ec9293a5784703899ff3d772e496dec +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +271 + +PKTokenNode.m +file + + + + +2009-08-06T04:02:04.000000Z +c81e1745e228fe99c850eb1f04dd3da2 +2009-08-17T01:06:48.172726Z +1331 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +866 + +TDParseTreeTest.m +file + + + + +2009-09-03T09:44:59.000000Z +528d5063afc7fa787613b053f1cefd81 +2009-08-09T07:09:11.210917Z +1315 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +6176 + +PKNumberState.m +file + + + + +2009-07-13T03:08:53.000000Z +6bd0a4ba6a9136c017995ba3817a3d6e +2009-07-13T03:20:31.678525Z +1217 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3228 + +TDXmlToken.h +file + + + + +2009-07-03T19:42:56.000000Z +28db290808dbd6cc8c03d8501b988ffe +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2870 + +TDCharacterAssemblyTest.m +file + + + + +2009-11-13T07:14:26.000000Z +435820a9e8d9546070830b4a1d529b3f +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1658 + +TDXmlEntity.m +file + + + + +2009-11-13T07:14:26.000000Z +d433a5d36e79c1745b66a3c7c6fc41e0 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +839 + +TDFastJsonParserTest.h +file + + + + +2009-07-03T19:31:24.000000Z +f585d4a89d62e8a844261d0123a68904 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +258 + +TDXmlToken.m +file + + + + +2009-07-03T19:42:56.000000Z +e7ce5f08c2d3753d4adf670e96de062e +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +6165 + +TDFastJsonParserTest.m +file + + + + +2009-07-03T19:31:24.000000Z +719ee766544dc11a6b0f1bad0af86e5c +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +878 + +TDSlashStateTest.h +file + + + + +2009-07-03T19:31:12.000000Z +72dc9b88e54423461e92cb23d6d3a5f7 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +311 + +TDWordStateTest.h +file + + + + +2009-07-03T19:31:26.000000Z +83b28411693b315662eb7d2024406858 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +286 + +TDSignificantWhitespaceState.h +file + + + + +2009-07-03T19:42:56.000000Z +6251bd525f89984968ec53abcf2146c9 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +642 + +TDSlashStateTest.m +file + + + + +2009-07-03T19:31:12.000000Z +6ddc3ccfe9f54ab0c8c0c775122d0b40 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +10130 + +TDSignificantWhitespaceState.m +file + + + + +2009-07-03T19:31:17.000000Z +b6e7c89a0f801eacd94e0f2ba8690542 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1646 + +TDWordStateTest.m +file + + + + +2009-07-03T19:31:26.000000Z +ac15d7d14d38386c61a8a9bcfa1e76b9 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2838 + +PKScientificNumberState.h +file + + + + +2009-07-13T03:08:11.000000Z +b010b09325e0a6d87be48c192f971d4b +2009-07-13T03:20:31.678525Z +1217 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +854 + +TDXmlDocument.h +file + + + + +2009-07-03T19:31:23.000000Z +05b57655d074cf6a6b607aba78e72ad4 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +279 + +TDReaderTest.h +file + + + + +2009-07-03T19:31:27.000000Z +f8b956ca1ad8d38f07b8245c36457f55 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +264 + +PKScientificNumberState.m +file + + + + +2009-07-13T03:12:24.000000Z +ca59be76eed203c886f01609fc121991 +2009-07-13T03:20:31.678525Z +1217 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1989 + +TDXmlDocument.m +file + + + + +2009-11-13T07:14:26.000000Z +6c61875dbfb84506f1805618e9afa7d3 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +853 + +TDReaderTest.m +file + + + + +2009-07-03T19:31:27.000000Z +3b966234eb89657042bbfc0e9a817a1b +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1333 + +TDLowercaseWordTest.h +file + + + + +2009-07-03T19:31:28.000000Z +418e19d6135a35033b817b17823d4e2b +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +243 + +TDLowercaseWordTest.m +file + + + + +2009-07-03T19:31:27.000000Z +8c85ab03002a0f852f45219fd0be6681 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1228 + +TDXmlDecl.h +file + + + + +2009-07-03T19:31:23.000000Z +f77594af484397d5d483f571bd810e11 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +269 + +TDToken+Blob.h +file + + + + +2009-06-30T08:18:50.000000Z +e1262dd321dcacf5ba8c0df6bd747aee +2009-06-30T08:19:25.121159Z +1129 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +262 + +TDScientificNumberStateTest.h +file + + + + +2009-07-13T03:29:09.000000Z +a48641e6b4a2d3d01a08bd7cd0fd85dc +2009-07-13T03:32:51.609563Z +1218 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +336 + +TDParserBlocksTest.h +file + + + + +2009-09-17T21:57:35.000000Z +d2b3ad50f0f4c03a8073a00705ab5f88 +2009-09-17T22:12:38.271967Z +1379 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +289 + +TDXmlSignificantWhitespace.h +file + + + + +2009-07-03T19:31:22.000000Z +7699650f1e76a1285986a3f4301b9e25 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +331 + +TDXmlDecl.m +file + + + + +2009-11-13T07:14:26.000000Z +2a7675b8c8dd56d041597ec444b6d8d2 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +838 + +TDQuoteStateTest.h +file + + + + +2009-07-03T19:31:27.000000Z +03fc05c174c124190fef838a032f0db1 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +290 + +TDToken+Blob.m +file + + + + +2009-06-30T08:18:50.000000Z +5d920a189643a5088030911ce4ee3549 +2009-06-30T08:19:25.121159Z +1129 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +313 + +TDScientificNumberStateTest.m +file + + + + +2009-09-16T05:24:42.000000Z +679a0b3be12a28d04c15fc0f5d12ea53 +2009-09-16T05:35:05.447616Z +1372 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +31145 + +TDParserBlocksTest.m +file + + + + +2009-09-26T03:40:29.000000Z +9d957ce254ad706c5ccbf171714c202e +2009-09-26T03:50:36.795525Z +1400 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2041 + +RelaxParser.h +file + + + + +2009-06-30T06:13:08.000000Z +664a5c37dbdf3a200b311a8feaec61bd +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +245 + +TDXmlNameTest.h +file + + + + +2009-07-03T19:31:21.000000Z +77b539123e5ab66d54ea0320017fda7d +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +226 + +TDXmlSignificantWhitespace.m +file + + + + +2009-11-13T07:14:26.000000Z +ff062f7211e90f9ff82da56d972de9a7 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +945 + +TDQuoteStateTest.m +file + + + + +2009-07-03T19:31:27.000000Z +84ff5d2f3966f0ed0d959abe2bf23788 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2581 + +RelaxParser.m +file + + + + +2009-06-30T06:13:11.000000Z +c0d3411bd025690770b0537d22b6425d +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +16676 + +TDXmlText.h +file + + + + +2009-07-03T19:31:21.000000Z +a8dc1f21bdcfaedd8a6e0cf896f5ae18 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +263 + +TDParserFactoryTest2.h +file + + + + +2009-06-30T06:34:51.000000Z +66946bf761bf41130167c12cbd3dc131 +2009-06-30T06:36:18.475282Z +1118 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +448 + +TDXmlNameTest.m +file + + + + +2009-07-03T19:31:21.000000Z +446b505b44562be0e8dcd3cd190c68b1 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1633 + +TDXmlText.m +file + + + + +2009-11-13T07:14:26.000000Z +5059f622c836021286ad97b16c837744 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +944 + +TDReservedWord.h +file + + + + +2009-07-03T19:31:18.000000Z +cdb2d33524ddd80d048e8190713a3d33 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +300 + +TDParserFactoryTest2.m +file + + + + +2009-08-06T04:01:55.000000Z +5b39e03a01a2e8dcb7745533bf40eb17 +2009-08-02T22:59:20.682429Z +1275 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +20855 + +TDWordOrReservedState.h +file + + + + +2009-07-03T19:31:13.000000Z +be13fbe5e3a2f6db7a277de438382bd2 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +629 + +TDRegularParser.h +file + + + + +2009-07-03T19:31:25.000000Z +4667eb4c2b9687934f9b4b3273337b03 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1235 + +TDBlobState.h +file + + + + +2009-06-30T06:13:07.000000Z +093552caf9b4fc3cdfd0f9113c80e14b +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +234 + +TDReservedWord.m +file + + + + +2009-11-13T07:14:26.000000Z +33533fc49425600b3310c77c163e8bc8 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +846 + +TDWordOrReservedState.m +file + + + + +2009-07-03T19:42:56.000000Z +e797b724e1fe0d5503c0b37d000dcfa4 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +788 + +TDParserFactoryPatternTest.h +file + + + + +2009-06-30T06:34:51.000000Z +cd16e2ccd67fd02611938a65f7b5e164 +2009-06-30T06:36:18.475282Z +1118 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +441 + +TDRegularParser.m +file + + + + +2009-11-13T07:14:26.000000Z +85b83d00fa06a4b9ad7d8f1bb5e719fb +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +9360 + +TDBlobState.m +file + + + + +2009-07-03T19:42:56.000000Z +44ea12dc013d3ac6d36d673549470ae7 +2009-06-30T08:19:25.121159Z +1129 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1001 + +TDParserFactoryPatternTest.m +file + + + + +2009-06-30T06:34:51.000000Z +17de374ccea0cc8b5dab1c9a770083e1 +2009-06-30T06:36:18.475282Z +1118 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +2105 + +TDArithmeticAssembler.h +file + + + + +2009-09-26T03:08:41.000000Z +95a31ebd216abcecd97969a85a570a60 +2009-09-25T23:53:58.853281Z +1399 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +242 + +XMLReader.h +file + + + + +2009-07-03T19:42:56.000000Z +30998420c4287cce7b665ed40462c5a2 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +8430 + +TDXmlTerminal.h +file + + + + +2009-07-03T19:42:56.000000Z +3fe0ef2cb69b3767dd2abe9637247eb0 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +313 + +TDArithmeticAssembler.m +file + + + + +2009-09-26T03:08:41.000000Z +297330071ef00157a26e7cc3db1ce7bf +2009-09-25T23:53:58.853281Z +1399 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1297 + +XMLReader.m +file + + + + +2009-07-03T19:42:56.000000Z +c7b17c21b53cdb7df6e66386d8399ce2 +2009-03-23T17:04:23.554366Z +735 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +10486 + +TDXmlTerminal.m +file + + + + +2009-07-03T19:31:22.000000Z +85419e37f3606f19bce7ec07dca9b8bf +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +310 + +TDMiniCSSAssemblerTest.h +file + + + + +2009-07-03T19:31:30.000000Z +34f7fc1cd5bffcb9333989dcd9a5c063 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +462 + +TDSymbolTest.h +file + + + + +2009-07-03T19:31:28.000000Z +b4236151fca74a1c7c3dcb8f9e77c874 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +273 + +TDMiniCSSAssemblerTest.m +file + + + + +2009-07-03T19:31:30.000000Z +bccf786c6acb333e3d680a2c44dd70ee +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +8971 + +TDSymbolTest.m +file + + + + +2009-07-03T19:31:28.000000Z +321a7a19127503861d8e5e988e712901 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1215 + +TDXmlEndEntity.h +file + + + + +2009-07-03T19:31:23.000000Z +b5347cb75fa3b98b1194cab62cbb7325 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +283 + +TDXmlEndEntity.m +file + + + + +2009-11-13T07:14:26.000000Z +5c1be2469636eac5763a84cf5a1dc55e +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +861 + +XPathAssembler.h +file + + + + +2009-07-03T19:31:20.000000Z +ab4415a3c1f621cb8d46159284dfb1e5 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +374 + +TDXmlTokenizerTest.h +file + + + + +2009-07-03T19:31:24.000000Z +0f298ccac1944a8d1bcaff1f0d5c9bd5 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +283 + +TDLiteralTest.h +file + + + + +2009-07-03T19:31:29.000000Z +4b7af10932f4c5a8a61b856aeec147bf +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +275 + +TDXmlNmtoken.h +file + + + + +2009-07-03T19:31:20.000000Z +21cf1a4df1a2be20df6b05938c8538f4 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +230 + +XPathAssembler.m +file + + + + +2009-08-06T04:01:56.000000Z +5e22aef57355dd4d3e4ba77055122429 +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1067 + +EBNFParser.h +file + + + + +2009-09-16T04:24:50.000000Z +fa2ef0354692dec27f130d1b78ce4a64 +2009-09-16T04:25:37.006705Z +1368 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1879 + +TDXmlTokenizerTest.m +file + + + + +2009-07-03T19:31:24.000000Z +fb3b90c01e4dc0a635744b245a61cebd +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1442 + +TDXmlNmtoken.m +file + + + + +2009-07-03T19:31:20.000000Z +3c5813da1de14017329ec971247379a0 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +414 + +TDLiteralTest.m +file + + + + +2009-07-03T22:05:22.000000Z +fa90bdb119cdcca675c64ce59288e60a +2009-07-03T22:22:49.496142Z +1177 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2244 + +TDXmlName.h +file + + + + +2009-07-03T19:31:21.000000Z +ab5360c9d48c35d4c7e21306cba21b19 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +221 + +EBNFParser.m +file + + + + +2009-11-13T07:14:26.000000Z +64bbcf3e8d8d57b739ec8e9229c151de +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +12648 + +TDXmlName.m +file + + + + +2009-07-03T19:31:21.000000Z +1a0c6457b1b39218538cfd8c500f7254 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +500 + +TDParserFactoryTest3.h +file + + + + +2009-08-06T04:01:56.000000Z +af3a61afd61aadc27d797a11b1a5565e +2009-08-02T06:27:39.526860Z +1266 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +420 + +TDNSPredicateBuilder.h +file + + + + +2009-07-03T19:42:56.000000Z +3a627365f34cce304c349137c71ab5f6 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3279 + +TDXmlNotation.h +file + + + + +2009-07-03T19:31:22.000000Z +4ee37d2d5f7ff05e64424d2c65612716 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +279 + +TDParserFactoryTest3.m +file + + + + +2009-08-06T04:01:56.000000Z +f9e2ee6c195f2f1589ad896f196a0c7b +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +4860 + +TDNSPredicateBuilder.m +file + + + + +2009-11-13T07:14:26.000000Z +542ab0f5c01536736a7d1fe99a9615c1 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +18656 + +TDRegularParserTest.h +file + + + + +2009-07-03T19:31:25.000000Z +144d7f063f4c287ac531e9de4ad4c6ad +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +352 + +TDTokenTest.h +file + + + + +2009-07-03T19:31:27.000000Z +d26afeb45e7502a7940e3271a10cc67f +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +236 + +TDXmlNotation.m +file + + + + +2009-11-13T07:14:26.000000Z +52255e8fed41304c3908443177775a1b +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +853 + +TDXmlComment.h +file + + + + +2009-07-03T19:31:23.000000Z +b3605d1112d850f2e3baac0b9c69f082 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +275 + +TDUppercaseWordTest.h +file + + + + +2009-07-03T19:31:28.000000Z +feb6a458245b98546546ae83ffe78427 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +235 + +TDRegularParserTest.m +file + + + + +2009-11-13T07:14:26.000000Z +f02c8c4dbca9cb25bc378874fdb2004c +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +13351 + +TDTokenTest.m +file + + + + +2009-07-03T19:31:27.000000Z +e348223773fe69458889b61bff4a9e06 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1489 + +TDXmlComment.m +file + + + + +2009-11-13T07:14:26.000000Z +b03a45849ce8295e3ece0f1517970ddc +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +846 + +TDUppercaseWordTest.m +file + + + + +2009-07-03T19:31:28.000000Z +050945e5899585fdd70e5e60b731a84a +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1249 + +TDParserTest.h +file + + + + +2009-07-03T19:31:29.000000Z +ea76cf420d46f291c2b7276f2b22bce5 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +273 + +TDTokenArraySourceTest.h +file + + + + +2009-07-03T19:31:27.000000Z +7e19e396803368a2902f5662e849c768 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +324 + +TDParserTest.m +file + + + + +2009-09-17T19:30:36.000000Z +e6ad2b3c78a48d9dceac3aa49006d8c8 +2009-09-17T22:12:38.271967Z +1379 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +4782 + +TDTokenArraySourceTest.m +file + + + + +2009-11-13T07:14:26.000000Z +e6712ed28dd034ac13181dabd4c87ca7 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1476 + +XPathParserGrammarTest.h +file + + + + +2009-06-30T06:13:05.000000Z +9d522d9d9004432f8ae10545fb0cae26 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +352 + +XPathParserGrammarTest.m +file + + + + +2009-08-29T06:08:45.000000Z +a74ff6dbb140d0d93c0206ebafe2b847 +2009-08-29T06:10:20.621428Z +1361 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +9837 + +XPathContext.h +file + + + + +2009-07-03T19:31:20.000000Z +04a4afc62d7703c1c165944438a65203 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +684 + +TDXmlNameState.h +file + + + + +2009-07-03T19:31:21.000000Z +c889bedb1a2769a01d2ba52809c5d96c +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +232 + +TDFastJsonParser.h +file + + + + +2009-07-03T19:31:24.000000Z +3d7457e7330d3dbed06a70d467955c4d +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +392 + +XPathContext.m +file + + + + +2009-07-03T19:31:20.000000Z +5eb5b9a2c025abbf25fa0353dccd4dab +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +618 + +TDXmlNameState.m +file + + + + +2009-07-03T19:31:21.000000Z +9f877f1308ddefb885cff239dd086fb4 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2066 + +TDPlistParserTest.h +file + + + + +2009-07-03T19:31:24.000000Z +ab79893b4ca7efcb2d749f9e490c9dc6 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +340 + +TDFastJsonParser.m +file + + + + +2009-11-13T07:14:26.000000Z +3b635157b15f8a2bc9db3a998860fa5d +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +3802 + +TDTokenizerTest.h +file + + + + +2009-09-17T01:59:11.000000Z +cd4aaf465d59655ee9e975e67908bd8e +2009-09-17T06:13:16.719223Z +1374 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +284 + +TDPlistParserTest.m +file + + + + +2009-09-17T22:35:08.000000Z +fb89622a76377a37a3640f1a40a872e2 +2009-09-17T22:46:20.790207Z +1382 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +13750 + +TDTokenizerTest.m +file + + + + +2009-07-03T19:31:31.000000Z +f6499167b3dd9aea538b2b0cfdc93e81 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +15734 + +TDHtmlSyntaxHighlighter.h +file + + + + +2009-07-03T19:42:56.000000Z +3933998c13f8ebeac05cb66c2089eefd +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1644 + +TDHtmlSyntaxHighlighter.m +file + + + + +2009-11-13T07:14:26.000000Z +978961fdab15faa781801d1e06a281b0 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +21248 + +TDArithmeticParser.h +file + + + + +2009-09-16T05:22:36.000000Z +5effef34f326c175b2a2bc2407a45f94 +2009-09-16T05:35:05.447616Z +1372 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1118 + +TDTokenizerBlocksTest.h +file + + + + +2009-09-17T01:59:26.000000Z +c79054140fbdd7f534af11cca100f1dd +2009-09-17T06:13:16.719223Z +1374 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +296 + +TDArithmeticParser.m +file + + + + +2009-09-16T05:22:44.000000Z +5fa64eb3b89854341cc6e2561e237ab1 +2009-09-16T05:35:05.447616Z +1372 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +6614 + +TDTokenizerBlocksTest.m +file + + + + +2009-09-26T03:40:29.000000Z +a2e7f6a7a3752158bf674ee5a7fcd4c0 +2009-09-26T03:50:36.795525Z +1400 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +740 + +TDSpecificCharTest.h +file + + + + +2009-07-03T19:31:25.000000Z +17e11a0ed2e897eab13f9c65b185fccd +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +317 + +TDJavaScriptParser.h +file + + + + +2009-07-03T19:42:56.000000Z +f1954e123e01347ffda436324f849522 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +15954 + +TDSpecificCharTest.m +file + + + + +2009-09-26T05:55:06.000000Z +f8dc6fdf61e4f62967c5e9ca2a0b44c6 +2009-09-26T19:12:29.746961Z +1403 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1298 + +TDJavaScriptParser.m +file + + + + +2009-07-13T03:30:23.000000Z +a9faf60f13f4082cb58e3aa220d75354 +2009-07-13T03:32:51.609563Z +1218 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +71093 + +PKAST.h +file + + + + +2009-07-12T02:41:15.000000Z +63835387e7736938fbc39e70450e0541 +2009-07-12T02:42:38.222853Z +1212 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +415 + +PKAST.m +file + + + + +2009-07-12T02:48:02.000000Z +5d0ba42d84f9338d83f8db07f89e4813 +2009-07-12T02:42:38.222853Z +1212 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1686 + +TDNCName.h +file + + + + +2009-07-03T19:31:20.000000Z +25287f3be9f9a862cadffc5b6fe922dc +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +378 + +SRGSParser.h +file + + + + +2009-07-03T19:42:56.000000Z +f002acc2a9dec94fd149864f19cc9d25 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3781 + +TDNCName.m +file + + + + +2009-07-03T19:31:20.000000Z +58f93ebd30137558689e40f8525ed2ee +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +524 + +SRGSParser.m +file + + + + +2009-08-06T04:01:55.000000Z +33ce73fbcc6ad51926728b5707db40a1 +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +22158 + +TDSequenceTest.h +file + + + + +2009-07-03T19:31:28.000000Z +fbc3234326f9d0a579cd9c44df49ae17 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +287 + +TDReservedWordTest.h +file + + + + +2009-07-03T19:31:28.000000Z +5e70a5f97bb7c5e6f68a34e29d47c82d +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +233 + +TDSequenceTest.m +file + + + + +2009-11-13T07:14:26.000000Z +776c9a538b97617c228f8853b5851e50 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +6731 + +TDCharTest.h +file + + + + +2009-07-03T19:31:26.000000Z +43eac4a7ea114dd6617f97ff57fb0ff8 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +301 + +TDReservedWordTest.m +file + + + + +2009-07-03T19:31:28.000000Z +80088a99f0ebc9994c8a5ecb6c32bc60 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +955 + +TDCharTest.m +file + + + + +2009-09-26T05:55:45.000000Z +7bd9861340f1feedbbd03dfd67e656c4 +2009-09-26T19:12:29.746961Z +1403 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1225 + +TDPredicateEvaluator.h +file + + + + +2009-07-03T19:42:56.000000Z +1d12f7c42239780f2eafac22455e63c1 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3834 + +TDXmlFragment.h +file + + + + +2009-07-03T19:31:22.000000Z +ebecdfb53ee8eb3f591bb658717872b1 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +277 + +TDNonReservedWord.h +file + + + + +2009-07-03T19:31:17.000000Z +0d4e8ccd56403866f503902f46eb1e17 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +261 + +TDPredicateEvaluator.m +file + + + + +2009-09-16T05:10:03.000000Z +172be784d4601877caae968feb10e264 +2009-09-16T05:10:42.142005Z +1371 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +21739 + +TDXmlFragment.m +file + + + + +2009-11-13T07:14:26.000000Z +6bbcf54bb5bc664801dd5719d679b09b +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +851 + +TDDifferenceTest.h +file + + + + +2009-07-03T18:05:31.000000Z +ff3a97721b0041c259a67e3e54b1d132 +2009-07-03T18:21:46.347810Z +1162 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +346 + +XMLReaderTest.h +file + + + + +2009-07-03T19:31:21.000000Z +cbb518f9547de4bc092f53e08152d961 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +245 + +TDNonReservedWord.m +file + + + + +2009-11-13T07:14:26.000000Z +a1d73198ceb812338cb45c7047dfae6b +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +588 + +PKParseTreeAssembler.h +file + + + + +2009-08-06T04:02:00.000000Z +47d76ad742010dc6d2e4389887965316 +2009-08-17T01:06:48.172726Z +1331 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +363 + +TDDifferenceTest.m +file + + + + +2009-07-03T18:18:30.000000Z +4d073e70fd9eeccc898806e4563878d2 +2009-07-03T18:21:46.347810Z +1162 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +3145 + +PKParseTreeAssembler.m +file + + + + +2009-11-13T07:14:26.000000Z +a8f11e99e5049bdbb81a18683830ba7a +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +5143 + +XMLReaderTest.m +file + + + + +2009-07-03T19:31:21.000000Z +b611a80dbbfe08d4cb90e50dac4fa8f5 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +595 + +TDArithmeticParserTest.h +file + + + + +2009-09-16T05:31:33.000000Z +818a17fc44778357bd4176a9506dace0 +2009-09-16T05:35:05.447616Z +1372 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +334 + +TDArithmeticParserTest.m +file + + + + +2009-09-16T05:23:10.000000Z +940611be4e260bd120fd5dbce85b6aec +2009-09-16T05:35:05.447616Z +1372 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +5815 + +TDTokenizerStateTest.h +file + + + + +2009-07-12T22:33:57.000000Z +51bd5e58be8cc9315eb5896020a817e3 +2009-07-12T23:22:41.730758Z +1213 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +291 + +TDTokenAssemblyTest.h +file + + + + +2009-07-03T19:31:28.000000Z +0cd9c68596ce1767e88ee175329bbaf9 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +287 + +TDTokenizerStateTest.m +file + + + + +2009-11-13T07:14:26.000000Z +1d50bedf4eafd033375841bb0908763e +2009-11-06T01:42:40.664388Z +1410 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +4565 + +TDNSPredicateEvaluatorTest.h +file + + + + +2009-06-30T06:13:11.000000Z +425ab12a70361eda2080b44753db6977 +2009-06-30T06:20:20.789257Z +1115 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +447 + +TDTokenAssemblyTest.m +file + + + + +2009-11-13T07:14:26.000000Z +d4fcc9f9df9e6dbdab888d18cf9b93d3 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +7451 + +TDNSPredicateEvaluatorTest.m +file + + + + +2009-11-13T07:14:27.000000Z +a92552c68e72bc340508329d043a7959 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +8094 + +TDWhitespaceStateTest.h +file + + + + +2009-07-03T19:31:27.000000Z +cfdbb1f7f09e2dd4f94d4cb66e23fabf +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +310 + +EBNFParserTest.h +file + + + + +2009-07-03T19:31:25.000000Z +bfdba8092f6180dd3a236360f2f8d390 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +225 + +SAXAssembler.h +file + + + + +2009-08-17T07:54:31.000000Z +b36099df0481fec8c6c9657655d018e9 +2009-08-23T05:03:45.633098Z +1347 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +225 + +TDWhitespaceStateTest.m +file + + + + +2009-07-03T19:31:26.000000Z +be15d6540c7094521e1bfe5e47001fa1 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +9094 + +TDNCNameState.h +file + + + + +2009-07-03T19:31:20.000000Z +4b3cba4507b59ba90ba318e574fe84e7 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +234 + +TDCommentStateTest.h +file + + + + +2009-07-03T19:31:26.000000Z +cb6bb29e297f7b8525a532021064f435 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +339 + +EBNFParserTest.m +file + + + + +2009-07-03T19:31:25.000000Z +cf74c9841f8278a01f82bea8df5d4b2b +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1083 + +TDNegationTest.h +file + + + + +2009-07-03T18:03:21.000000Z +bac0e787ebbde25223f49b889c545a0f +2009-07-03T18:21:46.347810Z +1162 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +323 + +SAXAssembler.m +file + + + + +2009-08-28T04:17:48.000000Z +19f2a4775362554222e7f1611f21fd26 +2009-08-28T04:20:40.336564Z +1354 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +282 + +TDNCNameState.m +file + + + + +2009-07-03T19:31:20.000000Z +f4ca92db26c2578b85eba25b688560d3 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1978 + +TDCommentStateTest.m +file + + + + +2009-11-13T07:14:27.000000Z +0be9b512c35106002bf2f01492f67c2c +2009-11-06T01:42:40.664388Z +1410 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +13284 + +TDNegationTest.m +file + + + + +2009-07-03T18:14:40.000000Z +a38ddac4edbee2651da520dbc26bc3a7 +2009-07-03T18:21:46.347810Z +1162 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1409 + +TDSlashState.h +file + + + + +2009-07-03T19:42:56.000000Z +4f951e496e8e1daaf3f7ea48f1cabf72 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +656 + +TDSignificantWhitespaceStateTest.h +file + + + + +2009-07-03T19:31:17.000000Z +5ad90845509de2c93214fd4e950489dc +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +392 + +TDSlashState.m +file + + + + +2009-07-03T19:42:56.000000Z +d275b1c1fb78c9ab6592d3195117e6ab +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1546 + +TDSignificantWhitespaceStateTest.m +file + + + + +2009-07-03T19:31:12.000000Z +919789bfd61e64435ab5f97f8a44558b +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +4759 + +TDJsonParser.h +file + + + + +2009-09-16T04:19:54.000000Z +3b9357a548d01ef00a76d28eaad197dc +2009-09-16T04:21:10.758194Z +1367 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1358 + +TDNumberStateTest.h +file + + + + +2009-07-03T19:31:27.000000Z +f57dad10c394d2a1c49f5058afa10592 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +315 + +TDJsonParser.m +file + + + + +2009-11-13T07:14:27.000000Z +d052138524daebc4bc25ea9515858b8b +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +9187 + +PKParseTree.h +file + + + + +2009-08-06T04:02:00.000000Z +e32c2a87f3dfb7c00590171ae5cde1dd +2009-08-17T01:06:48.172726Z +1331 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +765 + +TDNumberStateTest.m +file + + + + +2009-07-03T19:31:27.000000Z +d8e0315300bfb69148c3b9b5a927ad05 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +17066 + +TDLetterTest.h +file + + + + +2009-07-03T19:31:26.000000Z +8016e4fbe99b60741f1ae96542d48c8d +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +305 + +PKParseTree.m +file + + + + +2009-08-06T04:02:04.000000Z +599bb33ef0d8516b8d32b53257f00ded +2009-08-17T01:06:48.172726Z +1331 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1896 + +TDLetterTest.m +file + + + + +2009-09-26T05:55:30.000000Z +59491f269dd6075b788ed58a23fbf093 +2009-09-26T19:12:29.746961Z +1403 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1213 + +TDSlashStarState.h +file + + + + +2009-07-03T19:31:13.000000Z +26be3db72f553c8abe181b398c7719ab +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +455 + +TDSlashSlashState.h +file + + + + +2009-07-03T19:31:13.000000Z +b10796bb184f44d824d2ce1f03e4bf61 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +443 + +TDSlashStarState.m +file + + + + +2009-07-03T19:31:11.000000Z +268d4030d03e0ed4cd6f541f84aae008 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1727 + +TDSlashSlashState.m +file + + + + +2009-07-03T19:31:11.000000Z +0302df5698dd883e969ce7e972f0d656 +2009-07-03T19:33:03.768692Z +1170 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +1241 + +PKExclusion.h +file + + + + +2009-07-03T18:46:13.000000Z +be4957ba710f46ce7e2bcb70f70fccdf +2009-07-03T18:51:49.968882Z +1166 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +259 + +TDTestScaffold.h +file + + + + +2009-09-17T06:15:07.000000Z +546d3561ffbcc6c7e77f46ac94cacf6d +2009-09-17T06:18:52.723802Z +1375 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +545 + +PKExclusion.m +file + + + + +2009-07-03T19:27:30.000000Z +a3b977932d663bd30c7ce3b998e5aaae +2009-07-03T19:28:44.824677Z +1168 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1643 + +TDTestScaffold.m +file + + + + +2009-09-26T03:40:29.000000Z +0985afb1737f71e6640e0319721c0074 +2009-09-26T03:50:36.795525Z +1400 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +5312 + +TDXmlDoctype.h +file + + + + +2009-07-03T19:31:23.000000Z +e3e6e09b0710d12756f8fafdd7aef261 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +275 + +TDXmlDoctype.m +file + + + + +2009-11-13T07:14:27.000000Z +f9ab685c8393df411c2a1fdd2af16a30 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +846 + +TDXmlProcessingInstruction.h +file + + + + +2009-07-03T19:31:22.000000Z +fdb928042131a1c1d9a2028be1d3a8f1 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +331 + +SAXTest.h +file + + + + +2009-08-17T07:56:03.000000Z +ec3072723d435ee83bd561e649d403b1 +2009-08-23T05:03:45.633098Z +1347 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +360 + +TDXmlProcessingInstruction.m +file + + + + +2009-11-13T07:14:27.000000Z +86d832e63afb86ba53afaca84bcdd302 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +945 + +TDPlistParser.h +file + + + + +2009-09-16T04:17:16.000000Z +25e48391eb619790e8860e9704c5d20f +2009-09-16T04:21:10.758194Z +1367 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +1168 + +SAXTest.m +file + + + + +2009-08-29T06:09:13.000000Z +f1a5432770ad7c3c9aa070cc9be7656d +2009-08-29T06:10:20.621428Z +1361 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +591 + +TDExclusionTest.h +file + + + + +2009-07-03T18:51:08.000000Z +379243a38b311998fdca9c6b13f1ef46 +2009-07-03T04:02:20.986832Z +1153 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +306 + +TDGenericAssembler.h +file + + + + +2009-07-27T04:40:05.000000Z +ef2e9f5e9143d0248c139faf474abf9f +2009-07-27T04:54:34.746113Z +1261 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +716 + +TDPlistParser.m +file + + + + +2009-11-13T07:14:27.000000Z +c72e5f1482f70caddfa9fd09db224606 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +9157 + +TDExclusionTest.m +file + + + + +2009-07-03T18:49:23.000000Z +962961c0bfc6952fe69b65fd2f574155 +2009-07-03T04:02:20.986832Z +1153 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +867 + +TDGenericAssembler.m +file + + + + +2009-11-13T07:14:27.000000Z +dcfc32d7f2b8be60e6207e205d0433e4 +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf + + + + + + + + + + + + + + + + + + + + + +5159 + +TDAlternationTest.h +file + + + + +2009-07-03T19:31:29.000000Z +74f99d629dbc7a9ef33dbfd8451c1465 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +293 + +TDXmlEndTag.h +file + + + + +2009-07-03T19:31:23.000000Z +381e060bbf078627d19c5ff8048f7cea +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +271 + +TDRobotCommandTest.h +file + + + + +2009-07-03T19:31:28.000000Z +b0459b610f2fdebeb91a8c1f377ee246 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +233 + +TDAlternationTest.m +file + + + + +2009-07-14T03:29:56.000000Z +254c5e240831086072fccb33c210d463 +2009-07-14T03:32:39.769371Z +1225 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +2535 + +TDJsonParserTest.h +file + + + + +2009-07-03T19:31:24.000000Z +7a18c87249dfd2861886d1b94cfa7107 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +331 + +TDXmlEndTag.m +file + + + + +2009-11-13T07:14:27.000000Z +5d08c90d836effe796a056ac6eb5d83d +2009-10-07T21:46:32.347945Z +1404 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +840 + +TDRobotCommandTest.m +file + + + + +2009-08-06T04:01:56.000000Z +b29759c6fe013de040f65df83508789e +2009-08-03T00:23:08.034904Z +1276 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +4671 + +TDJsonParserTest.m +file + + + + +2009-11-13T07:14:27.000000Z +2052082900ce538058f977a6cad97524 +2009-10-07T23:23:48.841577Z +1405 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +22938 + +TDXmlCdata.h +file + + + + +2009-07-03T19:31:23.000000Z +7e83246098207786b28b7c7d70c10210 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +267 + +TDXmlNmtokenState.h +file + + + + +2009-07-03T19:31:20.000000Z +40cd46893da81bd20c3c29dd6dac77e0 +2009-07-03T19:36:16.806225Z +1171 +todd.ditchendorf +has-props + + + + + + + + + + + + + + + + + + + + +234 + diff --git a/test/.svn/prop-base/TDAlternationTest.h.svn-base b/test/.svn/prop-base/TDAlternationTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDAlternationTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDAlternationTest.m.svn-base b/test/.svn/prop-base/TDAlternationTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDAlternationTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDCharTest.h.svn-base b/test/.svn/prop-base/TDCharTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDCharTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDCharTest.m.svn-base b/test/.svn/prop-base/TDCharTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDCharTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDCharacterAssemblyTest.h.svn-base b/test/.svn/prop-base/TDCharacterAssemblyTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDCharacterAssemblyTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDCharacterAssemblyTest.m.svn-base b/test/.svn/prop-base/TDCharacterAssemblyTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDCharacterAssemblyTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDDigitTest.h.svn-base b/test/.svn/prop-base/TDDigitTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDDigitTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDDigitTest.m.svn-base b/test/.svn/prop-base/TDDigitTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDDigitTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDFastJsonParser.h.svn-base b/test/.svn/prop-base/TDFastJsonParser.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDFastJsonParser.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDFastJsonParser.m.svn-base b/test/.svn/prop-base/TDFastJsonParser.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDFastJsonParser.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDFastJsonParserTest.h.svn-base b/test/.svn/prop-base/TDFastJsonParserTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDFastJsonParserTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDFastJsonParserTest.m.svn-base b/test/.svn/prop-base/TDFastJsonParserTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDFastJsonParserTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDHtmlSyntaxHighlighter.h.svn-base b/test/.svn/prop-base/TDHtmlSyntaxHighlighter.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDHtmlSyntaxHighlighter.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDHtmlSyntaxHighlighter.m.svn-base b/test/.svn/prop-base/TDHtmlSyntaxHighlighter.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDHtmlSyntaxHighlighter.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDJsonParser.h.svn-base b/test/.svn/prop-base/TDJsonParser.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDJsonParser.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDJsonParser.m.svn-base b/test/.svn/prop-base/TDJsonParser.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDJsonParser.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDJsonParserTest.h.svn-base b/test/.svn/prop-base/TDJsonParserTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDJsonParserTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDJsonParserTest.m.svn-base b/test/.svn/prop-base/TDJsonParserTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDJsonParserTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDLetterTest.h.svn-base b/test/.svn/prop-base/TDLetterTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDLetterTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDLetterTest.m.svn-base b/test/.svn/prop-base/TDLetterTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDLetterTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDLiteralTest.h.svn-base b/test/.svn/prop-base/TDLiteralTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDLiteralTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDLiteralTest.m.svn-base b/test/.svn/prop-base/TDLiteralTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDLiteralTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDLowercaseWordTest.h.svn-base b/test/.svn/prop-base/TDLowercaseWordTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDLowercaseWordTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDLowercaseWordTest.m.svn-base b/test/.svn/prop-base/TDLowercaseWordTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDLowercaseWordTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDMiniCSSAssembler.h.svn-base b/test/.svn/prop-base/TDMiniCSSAssembler.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDMiniCSSAssembler.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDMiniCSSAssembler.m.svn-base b/test/.svn/prop-base/TDMiniCSSAssembler.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDMiniCSSAssembler.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDMiniCSSAssemblerTest.h.svn-base b/test/.svn/prop-base/TDMiniCSSAssemblerTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDMiniCSSAssemblerTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDMiniCSSAssemblerTest.m.svn-base b/test/.svn/prop-base/TDMiniCSSAssemblerTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDMiniCSSAssemblerTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDNCName.h.svn-base b/test/.svn/prop-base/TDNCName.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDNCName.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDNCName.m.svn-base b/test/.svn/prop-base/TDNCName.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDNCName.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDNCNameState.h.svn-base b/test/.svn/prop-base/TDNCNameState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDNCNameState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDNCNameState.m.svn-base b/test/.svn/prop-base/TDNCNameState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDNCNameState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDNonReservedWord.h.svn-base b/test/.svn/prop-base/TDNonReservedWord.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDNonReservedWord.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDNonReservedWord.m.svn-base b/test/.svn/prop-base/TDNonReservedWord.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDNonReservedWord.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDNumberStateTest.h.svn-base b/test/.svn/prop-base/TDNumberStateTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDNumberStateTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDNumberStateTest.m.svn-base b/test/.svn/prop-base/TDNumberStateTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDNumberStateTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDParserFactoryTest.h.svn-base b/test/.svn/prop-base/TDParserFactoryTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDParserFactoryTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDParserFactoryTest.m.svn-base b/test/.svn/prop-base/TDParserFactoryTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDParserFactoryTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDParserTest.h.svn-base b/test/.svn/prop-base/TDParserTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDParserTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDParserTest.m.svn-base b/test/.svn/prop-base/TDParserTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDParserTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDQuoteStateTest.h.svn-base b/test/.svn/prop-base/TDQuoteStateTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDQuoteStateTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDQuoteStateTest.m.svn-base b/test/.svn/prop-base/TDQuoteStateTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDQuoteStateTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDReaderTest.h.svn-base b/test/.svn/prop-base/TDReaderTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDReaderTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDReaderTest.m.svn-base b/test/.svn/prop-base/TDReaderTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDReaderTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDRegularParser.h.svn-base b/test/.svn/prop-base/TDRegularParser.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDRegularParser.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDRegularParser.m.svn-base b/test/.svn/prop-base/TDRegularParser.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDRegularParser.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDRegularParserTest.h.svn-base b/test/.svn/prop-base/TDRegularParserTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDRegularParserTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDRegularParserTest.m.svn-base b/test/.svn/prop-base/TDRegularParserTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDRegularParserTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDRepetitionTest.h.svn-base b/test/.svn/prop-base/TDRepetitionTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDRepetitionTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDRepetitionTest.m.svn-base b/test/.svn/prop-base/TDRepetitionTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDRepetitionTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDReservedWord.h.svn-base b/test/.svn/prop-base/TDReservedWord.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDReservedWord.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDReservedWord.m.svn-base b/test/.svn/prop-base/TDReservedWord.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDReservedWord.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDReservedWordTest.h.svn-base b/test/.svn/prop-base/TDReservedWordTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDReservedWordTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDReservedWordTest.m.svn-base b/test/.svn/prop-base/TDReservedWordTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDReservedWordTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDRobotCommandTest.h.svn-base b/test/.svn/prop-base/TDRobotCommandTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDRobotCommandTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDRobotCommandTest.m.svn-base b/test/.svn/prop-base/TDRobotCommandTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDRobotCommandTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSequenceTest.h.svn-base b/test/.svn/prop-base/TDSequenceTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSequenceTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSequenceTest.m.svn-base b/test/.svn/prop-base/TDSequenceTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSequenceTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSignificantWhitespaceState.h.svn-base b/test/.svn/prop-base/TDSignificantWhitespaceState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSignificantWhitespaceState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSignificantWhitespaceState.m.svn-base b/test/.svn/prop-base/TDSignificantWhitespaceState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSignificantWhitespaceState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSignificantWhitespaceStateTest.h.svn-base b/test/.svn/prop-base/TDSignificantWhitespaceStateTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSignificantWhitespaceStateTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSignificantWhitespaceStateTest.m.svn-base b/test/.svn/prop-base/TDSignificantWhitespaceStateTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSignificantWhitespaceStateTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSlashSlashState.h.svn-base b/test/.svn/prop-base/TDSlashSlashState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSlashSlashState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSlashSlashState.m.svn-base b/test/.svn/prop-base/TDSlashSlashState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSlashSlashState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSlashStarState.h.svn-base b/test/.svn/prop-base/TDSlashStarState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSlashStarState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSlashStarState.m.svn-base b/test/.svn/prop-base/TDSlashStarState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSlashStarState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSlashState.h.svn-base b/test/.svn/prop-base/TDSlashState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSlashState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSlashState.m.svn-base b/test/.svn/prop-base/TDSlashState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSlashState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSlashStateTest.h.svn-base b/test/.svn/prop-base/TDSlashStateTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSlashStateTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSlashStateTest.m.svn-base b/test/.svn/prop-base/TDSlashStateTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSlashStateTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSpecificCharTest.h.svn-base b/test/.svn/prop-base/TDSpecificCharTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSpecificCharTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSpecificCharTest.m.svn-base b/test/.svn/prop-base/TDSpecificCharTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSpecificCharTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSymbolStateTest.h.svn-base b/test/.svn/prop-base/TDSymbolStateTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSymbolStateTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSymbolStateTest.m.svn-base b/test/.svn/prop-base/TDSymbolStateTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSymbolStateTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSymbolTest.h.svn-base b/test/.svn/prop-base/TDSymbolTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSymbolTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSymbolTest.m.svn-base b/test/.svn/prop-base/TDSymbolTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSymbolTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSyntaxHighlighter.h.svn-base b/test/.svn/prop-base/TDSyntaxHighlighter.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSyntaxHighlighter.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDSyntaxHighlighter.m.svn-base b/test/.svn/prop-base/TDSyntaxHighlighter.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDSyntaxHighlighter.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDTestScaffold.h.svn-base b/test/.svn/prop-base/TDTestScaffold.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDTestScaffold.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDTestScaffold.m.svn-base b/test/.svn/prop-base/TDTestScaffold.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDTestScaffold.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDTokenArraySourceTest.h.svn-base b/test/.svn/prop-base/TDTokenArraySourceTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDTokenArraySourceTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDTokenArraySourceTest.m.svn-base b/test/.svn/prop-base/TDTokenArraySourceTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDTokenArraySourceTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDTokenAssemblyTest.h.svn-base b/test/.svn/prop-base/TDTokenAssemblyTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDTokenAssemblyTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDTokenAssemblyTest.m.svn-base b/test/.svn/prop-base/TDTokenAssemblyTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDTokenAssemblyTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDTokenizerTest.h.svn-base b/test/.svn/prop-base/TDTokenizerTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDTokenizerTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDTokenizerTest.m.svn-base b/test/.svn/prop-base/TDTokenizerTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDTokenizerTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDTrackTest.h.svn-base b/test/.svn/prop-base/TDTrackTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDTrackTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDTrackTest.m.svn-base b/test/.svn/prop-base/TDTrackTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDTrackTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDUppercaseWordTest.h.svn-base b/test/.svn/prop-base/TDUppercaseWordTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDUppercaseWordTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDUppercaseWordTest.m.svn-base b/test/.svn/prop-base/TDUppercaseWordTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDUppercaseWordTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDWhitespaceStateTest.h.svn-base b/test/.svn/prop-base/TDWhitespaceStateTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDWhitespaceStateTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDWhitespaceStateTest.m.svn-base b/test/.svn/prop-base/TDWhitespaceStateTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDWhitespaceStateTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDWordOrReservedState.h.svn-base b/test/.svn/prop-base/TDWordOrReservedState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDWordOrReservedState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDWordOrReservedState.m.svn-base b/test/.svn/prop-base/TDWordOrReservedState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDWordOrReservedState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDWordStateTest.h.svn-base b/test/.svn/prop-base/TDWordStateTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDWordStateTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDWordStateTest.m.svn-base b/test/.svn/prop-base/TDWordStateTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDWordStateTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlAttribute.h.svn-base b/test/.svn/prop-base/TDXmlAttribute.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlAttribute.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlAttribute.m.svn-base b/test/.svn/prop-base/TDXmlAttribute.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlAttribute.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlCdata.h.svn-base b/test/.svn/prop-base/TDXmlCdata.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlCdata.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlCdata.m.svn-base b/test/.svn/prop-base/TDXmlCdata.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlCdata.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlComment.h.svn-base b/test/.svn/prop-base/TDXmlComment.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlComment.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlComment.m.svn-base b/test/.svn/prop-base/TDXmlComment.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlComment.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlDecl.h.svn-base b/test/.svn/prop-base/TDXmlDecl.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlDecl.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlDecl.m.svn-base b/test/.svn/prop-base/TDXmlDecl.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlDecl.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlDoctype.h.svn-base b/test/.svn/prop-base/TDXmlDoctype.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlDoctype.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlDoctype.m.svn-base b/test/.svn/prop-base/TDXmlDoctype.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlDoctype.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlDocument.h.svn-base b/test/.svn/prop-base/TDXmlDocument.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlDocument.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlDocument.m.svn-base b/test/.svn/prop-base/TDXmlDocument.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlDocument.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlEndEntity.h.svn-base b/test/.svn/prop-base/TDXmlEndEntity.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlEndEntity.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlEndEntity.m.svn-base b/test/.svn/prop-base/TDXmlEndEntity.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlEndEntity.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlEndTag.h.svn-base b/test/.svn/prop-base/TDXmlEndTag.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlEndTag.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlEndTag.m.svn-base b/test/.svn/prop-base/TDXmlEndTag.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlEndTag.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlEntity.h.svn-base b/test/.svn/prop-base/TDXmlEntity.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlEntity.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlEntity.m.svn-base b/test/.svn/prop-base/TDXmlEntity.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlEntity.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlEntityRef.h.svn-base b/test/.svn/prop-base/TDXmlEntityRef.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlEntityRef.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlEntityRef.m.svn-base b/test/.svn/prop-base/TDXmlEntityRef.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlEntityRef.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlFragment.h.svn-base b/test/.svn/prop-base/TDXmlFragment.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlFragment.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlFragment.m.svn-base b/test/.svn/prop-base/TDXmlFragment.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlFragment.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlName.h.svn-base b/test/.svn/prop-base/TDXmlName.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlName.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlName.m.svn-base b/test/.svn/prop-base/TDXmlName.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlName.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlNameState.h.svn-base b/test/.svn/prop-base/TDXmlNameState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlNameState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlNameState.m.svn-base b/test/.svn/prop-base/TDXmlNameState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlNameState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlNameTest.h.svn-base b/test/.svn/prop-base/TDXmlNameTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlNameTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlNameTest.m.svn-base b/test/.svn/prop-base/TDXmlNameTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlNameTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlNmtoken.h.svn-base b/test/.svn/prop-base/TDXmlNmtoken.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlNmtoken.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlNmtoken.m.svn-base b/test/.svn/prop-base/TDXmlNmtoken.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlNmtoken.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlNmtokenState.h.svn-base b/test/.svn/prop-base/TDXmlNmtokenState.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlNmtokenState.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlNmtokenState.m.svn-base b/test/.svn/prop-base/TDXmlNmtokenState.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlNmtokenState.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlNotation.h.svn-base b/test/.svn/prop-base/TDXmlNotation.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlNotation.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlNotation.m.svn-base b/test/.svn/prop-base/TDXmlNotation.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlNotation.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlProcessingInstruction.h.svn-base b/test/.svn/prop-base/TDXmlProcessingInstruction.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlProcessingInstruction.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlProcessingInstruction.m.svn-base b/test/.svn/prop-base/TDXmlProcessingInstruction.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlProcessingInstruction.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlSignificantWhitespace.h.svn-base b/test/.svn/prop-base/TDXmlSignificantWhitespace.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlSignificantWhitespace.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlSignificantWhitespace.m.svn-base b/test/.svn/prop-base/TDXmlSignificantWhitespace.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlSignificantWhitespace.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlStartTag.h.svn-base b/test/.svn/prop-base/TDXmlStartTag.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlStartTag.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlStartTag.m.svn-base b/test/.svn/prop-base/TDXmlStartTag.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlStartTag.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlTerminal.h.svn-base b/test/.svn/prop-base/TDXmlTerminal.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlTerminal.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlTerminal.m.svn-base b/test/.svn/prop-base/TDXmlTerminal.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlTerminal.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlText.h.svn-base b/test/.svn/prop-base/TDXmlText.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlText.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlText.m.svn-base b/test/.svn/prop-base/TDXmlText.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlText.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlToken.h.svn-base b/test/.svn/prop-base/TDXmlToken.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlToken.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlToken.m.svn-base b/test/.svn/prop-base/TDXmlToken.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlToken.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlTokenAssembly.h.svn-base b/test/.svn/prop-base/TDXmlTokenAssembly.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlTokenAssembly.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlTokenAssembly.m.svn-base b/test/.svn/prop-base/TDXmlTokenAssembly.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlTokenAssembly.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlTokenizer.h.svn-base b/test/.svn/prop-base/TDXmlTokenizer.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlTokenizer.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlTokenizer.m.svn-base b/test/.svn/prop-base/TDXmlTokenizer.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlTokenizer.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlTokenizerTest.h.svn-base b/test/.svn/prop-base/TDXmlTokenizerTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlTokenizerTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlTokenizerTest.m.svn-base b/test/.svn/prop-base/TDXmlTokenizerTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlTokenizerTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlWhitespace.h.svn-base b/test/.svn/prop-base/TDXmlWhitespace.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlWhitespace.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/TDXmlWhitespace.m.svn-base b/test/.svn/prop-base/TDXmlWhitespace.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/TDXmlWhitespace.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/XMLReader.h.svn-base b/test/.svn/prop-base/XMLReader.h.svn-base new file mode 100644 index 0000000..8d28d86 --- /dev/null +++ b/test/.svn/prop-base/XMLReader.h.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/XMLReader.m.svn-base b/test/.svn/prop-base/XMLReader.m.svn-base new file mode 100644 index 0000000..8d28d86 --- /dev/null +++ b/test/.svn/prop-base/XMLReader.m.svn-base @@ -0,0 +1,9 @@ +K 14 +svn:executable +V 1 +* +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/XMLReaderTest.h.svn-base b/test/.svn/prop-base/XMLReaderTest.h.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/XMLReaderTest.h.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/prop-base/XMLReaderTest.m.svn-base b/test/.svn/prop-base/XMLReaderTest.m.svn-base new file mode 100644 index 0000000..3160658 --- /dev/null +++ b/test/.svn/prop-base/XMLReaderTest.m.svn-base @@ -0,0 +1,5 @@ +K 13 +svn:mergeinfo +V 0 + +END diff --git a/test/.svn/text-base/EBNFParser.h.svn-base b/test/.svn/text-base/EBNFParser.h.svn-base new file mode 100644 index 0000000..509539c --- /dev/null +++ b/test/.svn/text-base/EBNFParser.h.svn-base @@ -0,0 +1,45 @@ +// +// EBNFParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface EBNFParser : PKRepetition { + PKCollectionParser *statementParser; + PKCollectionParser *exprOrAssignmentParser; + PKCollectionParser *assignmentParser; + PKCollectionParser *declarationParser; + PKCollectionParser *variableParser; + PKCollectionParser *expressionParser; + PKCollectionParser *termParser; + PKCollectionParser *orTermParser; + PKCollectionParser *factorParser; + PKCollectionParser *nextFactorParser; + PKCollectionParser *phraseParser; + PKCollectionParser *phraseStarParser; + PKCollectionParser *phraseQuestionParser; + PKCollectionParser *phrasePlusParser; + PKCollectionParser *atomicValueParser; +} +- (id)parse:(NSString *)s; + +@property (nonatomic, retain) PKCollectionParser *statementParser; +@property (nonatomic, retain) PKCollectionParser *exprOrAssignmentParser; +@property (nonatomic, retain) PKCollectionParser *assignmentParser; +@property (nonatomic, retain) PKCollectionParser *declarationParser; +@property (nonatomic, retain) PKCollectionParser *variableParser; +@property (nonatomic, retain) PKCollectionParser *expressionParser; +@property (nonatomic, retain) PKCollectionParser *termParser; +@property (nonatomic, retain) PKCollectionParser *orTermParser; +@property (nonatomic, retain) PKCollectionParser *factorParser; +@property (nonatomic, retain) PKCollectionParser *nextFactorParser; +@property (nonatomic, retain) PKCollectionParser *phraseParser; +@property (nonatomic, retain) PKCollectionParser *phraseStarParser; +@property (nonatomic, retain) PKCollectionParser *phraseQuestionParser; +@property (nonatomic, retain) PKCollectionParser *phrasePlusParser; +@property (nonatomic, retain) PKCollectionParser *atomicValueParser; +@end diff --git a/test/.svn/text-base/EBNFParser.m.svn-base b/test/.svn/text-base/EBNFParser.m.svn-base new file mode 100644 index 0000000..261e6e5 --- /dev/null +++ b/test/.svn/text-base/EBNFParser.m.svn-base @@ -0,0 +1,427 @@ +// +// EBNFParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "EBNFParser.h" +#import "NSString+ParseKitAdditions.h" + +/* + statement = exprOrAssignment ';' + exprOrAssignment = expression | assigment + assigment = declaration '=' expression + declaration = '$' Word + variable = '$' Word + expression = term orTerm* + term = factor nextFactor* + orTerm = '|' term + factor = phrase | phraseStar | phraseQuestion | phrasePlus + nextFactor = factor + phrase = atomicValue | '(' expression ')' + phraseStar = phrase '*' + phraseQuestion = phrase '?' + phrasePlus = phrase '+' + atomicValue = Word | Number | QuotedString | variable +*/ + +static NSString * const kEBNFEqualsString = @"="; +static NSString * const kEBNFVariablePrefix = @"$"; +static NSString * const kEBNFVariableSuffix = @""; + +@interface PKParser (PKParserFactoryAdditionsFriend) +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@interface EBNFParser () +- (void)addSymbolString:(NSString *)s toTokenizer:(PKTokenizer *)t; + +- (void)didMatchWord:(PKAssembly *)a; +- (void)didMatchNum:(PKAssembly *)a; +- (void)didMatchQuotedString:(PKAssembly *)a; +- (void)didMatchStar:(PKAssembly *)a; +- (void)didMatchQuestion:(PKAssembly *)a; +- (void)didMatchPlus:(PKAssembly *)a; +- (void)didMatchAnd:(PKAssembly *)a; +- (void)didMatchOr:(PKAssembly *)a; +- (void)didMatchAssignment:(PKAssembly *)a; +- (void)didMatchVariable:(PKAssembly *)a; +@end + +@implementation EBNFParser + +- (id)init { + if ([super initWithSubparser:self.statementParser]) { + self.tokenizer = [PKTokenizer tokenizer]; + [self addSymbolString:kEBNFEqualsString toTokenizer:self.tokenizer]; + [self addSymbolString:kEBNFVariablePrefix toTokenizer:self.tokenizer]; + [self addSymbolString:kEBNFVariableSuffix toTokenizer:self.tokenizer]; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.statementParser = nil; + self.exprOrAssignmentParser = nil; + self.assignmentParser = nil; + self.declarationParser = nil; + self.variableParser = nil; + self.expressionParser = nil; + self.termParser = nil; + self.orTermParser = nil; + self.factorParser = nil; + self.nextFactorParser = nil; + self.phraseParser = nil; + self.phraseStarParser = nil; + self.phraseQuestionParser = nil; + self.phrasePlusParser = nil; + self.atomicValueParser = nil; + [super dealloc]; +} + + +- (id)parse:(NSString *)s { + self.tokenizer.string = s; + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:self.tokenizer]; + PKAssembly *result = [self completeMatchFor:a]; + return [result pop]; +} + + +- (void)addSymbolString:(NSString *)s toTokenizer:(PKTokenizer *)t { + if ([s length]) { + NSInteger c = [s characterAtIndex:0]; + [t setTokenizerState:t.symbolState from:c to:c]; + [t.symbolState add:s]; + } +} + + +// statement = exprOrAssignment ';' +- (PKCollectionParser *)statementParser { + if (!statementParser) { + self.statementParser = [PKTrack track]; + [statementParser add:self.exprOrAssignmentParser]; + [statementParser add:[[PKSymbol symbolWithString:@";"] discard]]; + } + return statementParser; +} + + +// exprOrAssignmentParser = expression | assignment +- (PKCollectionParser *)exprOrAssignmentParser { + if (!exprOrAssignmentParser) { + self.exprOrAssignmentParser = [PKAlternation alternation]; + [exprOrAssignmentParser add:self.expressionParser]; + [exprOrAssignmentParser add:self.assignmentParser]; + } + return exprOrAssignmentParser; +} + + +// declaration = variable '=' expression +- (PKCollectionParser *)assignmentParser { + if (!assignmentParser) { + self.assignmentParser = [PKTrack track]; + [assignmentParser add:self.declarationParser]; + [assignmentParser add:[[PKSymbol symbolWithString:kEBNFEqualsString] discard]]; + [assignmentParser add:self.expressionParser]; + [assignmentParser setAssembler:self selector:@selector(didMatchAssignment:)]; + } + return assignmentParser; +} + + +// declaration = '$' Word +- (PKCollectionParser *)declarationParser { + if (!declarationParser) { + self.declarationParser = [PKTrack track]; + [declarationParser add:[[PKSymbol symbolWithString:kEBNFVariablePrefix] discard]]; + [declarationParser add:[PKWord word]]; + if ([kEBNFVariableSuffix length]) { + [declarationParser add:[[PKSymbol symbolWithString:kEBNFVariableSuffix] discard]]; + } + } + return declarationParser; +} + + +// variable = '$' Word +- (PKCollectionParser *)variableParser { + if (!variableParser) { + self.variableParser = [PKTrack track]; + [variableParser add:[[PKSymbol symbolWithString:kEBNFVariablePrefix] discard]]; + [variableParser add:[PKWord word]]; + if ([kEBNFVariableSuffix length]) { + [variableParser add:[[PKSymbol symbolWithString:kEBNFVariableSuffix] discard]]; + } + } + return variableParser; +} + + +// expression = term orTerm* +- (PKCollectionParser *)expressionParser { + if (!expressionParser) { + self.expressionParser = [PKSequence sequence]; + [expressionParser add:self.termParser]; + [expressionParser add:[PKRepetition repetitionWithSubparser:self.orTermParser]]; + } + return expressionParser; +} + + +// term = factor nextFactor* +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + [termParser add:self.factorParser]; + [termParser add:[PKRepetition repetitionWithSubparser:self.nextFactorParser]]; + } + return termParser; +} + + +// orTerm = '|' term +- (PKCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [PKTrack track]; + [orTermParser add:[[PKSymbol symbolWithString:@"|"] discard]]; + [orTermParser add:self.termParser]; + [orTermParser setAssembler:self selector:@selector(didMatchOr:)]; + } + return orTermParser; +} + + +// factor = phrase | phraseStar | phraseQuestion | phrasePlus +- (PKCollectionParser *)factorParser { + if (!factorParser) { + self.factorParser = [PKAlternation alternation]; + [factorParser add:self.phraseParser]; + [factorParser add:self.phraseStarParser]; + [factorParser add:self.phraseQuestionParser]; + [factorParser add:self.phrasePlusParser]; + } + return factorParser; +} + + +// nextFactor = factor +- (PKCollectionParser *)nextFactorParser { + if (!nextFactorParser) { + self.nextFactorParser = [PKAlternation alternation]; + [nextFactorParser add:self.phraseParser]; + [nextFactorParser add:self.phraseStarParser]; + [nextFactorParser add:self.phraseQuestionParser]; + [nextFactorParser add:self.phrasePlusParser]; + [nextFactorParser setAssembler:self selector:@selector(didMatchAnd:)]; + } + return nextFactorParser; +} + + +// phrase = atomicValue | '(' expression ')' +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + PKSequence *s = [PKTrack track]; + [s add:[[PKSymbol symbolWithString:@"("] discard]]; + [s add:self.expressionParser]; + [s add:[[PKSymbol symbolWithString:@")"] discard]]; + + self.phraseParser = [PKAlternation alternation]; + [phraseParser add:self.atomicValueParser]; + [phraseParser add:s]; + } + return phraseParser; +} + + +// phraseStar = phrase '*' +- (PKCollectionParser *)phraseStarParser { + if (!phraseStarParser) { + self.phraseStarParser = [PKSequence sequence]; + [phraseStarParser add:self.phraseParser]; + [phraseStarParser add:[[PKSymbol symbolWithString:@"*"] discard]]; + [phraseStarParser setAssembler:self selector:@selector(didMatchStar:)]; + } + return phraseStarParser; +} + + +// phraseQuestion = phrase '?' +- (PKCollectionParser *)phraseQuestionParser { + if (!phraseQuestionParser) { + self.phraseQuestionParser = [PKSequence sequence]; + [phraseQuestionParser add:self.phraseParser]; + [phraseQuestionParser add:[[PKSymbol symbolWithString:@"?"] discard]]; + [phraseQuestionParser setAssembler:self selector:@selector(didMatchQuestion:)]; + } + return phraseQuestionParser; +} + + +// phrasePlus = phrase '+' +- (PKCollectionParser *)phrasePlusParser { + if (!phrasePlusParser) { + self.phrasePlusParser = [PKSequence sequence]; + [phrasePlusParser add:self.phraseParser]; + [phrasePlusParser add:[[PKSymbol symbolWithString:@"+"] discard]]; + [phrasePlusParser setAssembler:self selector:@selector(didMatchPlus:)]; + } + return phrasePlusParser; +} + + +// atomicValue = Word | Number | QuotedString | Variable +- (PKCollectionParser *)atomicValueParser { + if (!atomicValueParser) { + self.atomicValueParser = [PKAlternation alternation]; + + PKParser *p = [PKWord word]; + [p setAssembler:self selector:@selector(didMatchWord:)]; + [atomicValueParser add:p]; + + p = [PKNumber number]; + [p setAssembler:self selector:@selector(didMatchNum:)]; + [atomicValueParser add:p]; + + p = [PKQuotedString quotedString]; + [p setAssembler:self selector:@selector(didMatchQuotedString:)]; + [atomicValueParser add:p]; + + p = self.variableParser; + [p setAssembler:self selector:@selector(didMatchVariable:)]; + [atomicValueParser add:p]; + } + return atomicValueParser; +} + + +- (void)didMatchWord:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + [a push:[PKLiteral literalWithString:tok.stringValue]]; +} + + +- (void)didMatchNum:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + [a push:[PKLiteral literalWithString:tok.stringValue]]; +} + + +- (void)didMatchQuotedString:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + + PKSequence *p = [PKSequence sequence]; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKToken *eof = [PKToken EOFToken]; + while (eof != (tok = [t nextToken])) { + [p add:[PKLiteral literalWithString:tok.stringValue]]; + } + + [a push:p]; +} + + +- (void)didMatchStar:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + PKRepetition *p = [PKRepetition repetitionWithSubparser:[a pop]]; + [a push:p]; +} + + +- (void)didMatchQuestion:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + PKAlternation *p = [PKAlternation alternation]; + [p add:[a pop]]; + [p add:[PKEmpty empty]]; + [a push:p]; +} + + +- (void)didMatchPlus:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + PKSequence *p = [PKSequence sequence]; + [p add:top]; + [p add:[PKRepetition repetitionWithSubparser:top]]; + [a push:p]; +} + + +- (void)didMatchAnd:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + PKSequence *p = [PKSequence sequence]; + [p add:[a pop]]; + [p add:top]; + [a push:p]; +} + + +- (void)didMatchOr:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + // NSLog(@"top: %@", top); + // NSLog(@"top class: %@", [top class]); + PKAlternation *p = [PKAlternation alternation]; + [p add:[a pop]]; + [p add:top]; + [a push:p]; +} + + +- (void)didMatchAssignment:(PKAssembly *)a { + NSLog(@"%s", _cmd); + NSLog(@"a: %@", a); + id val = [a pop]; + PKToken *keyTok = [a pop]; + NSMutableDictionary *table = [NSMutableDictionary dictionaryWithDictionary:a.target]; + [table setObject:val forKey:keyTok.stringValue]; + a.target = table; +} + + +- (void)didMatchVariable:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKToken *keyTok = [a pop]; + id val = [a.target objectForKey:keyTok.stringValue]; + if (val) { + [a push:val]; + } +} + +@synthesize statementParser; +@synthesize exprOrAssignmentParser; +@synthesize assignmentParser; +@synthesize declarationParser; +@synthesize variableParser; +@synthesize expressionParser; +@synthesize termParser; +@synthesize orTermParser; +@synthesize factorParser; +@synthesize nextFactorParser; +@synthesize phraseParser; +@synthesize phraseStarParser; +@synthesize phraseQuestionParser; +@synthesize phrasePlusParser; +@synthesize atomicValueParser; +@end \ No newline at end of file diff --git a/test/.svn/text-base/EBNFParserTest.h.svn-base b/test/.svn/text-base/EBNFParserTest.h.svn-base new file mode 100644 index 0000000..e62d42b --- /dev/null +++ b/test/.svn/text-base/EBNFParserTest.h.svn-base @@ -0,0 +1,15 @@ +// +// EBNFParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface EBNFParserTest : SenTestCase { + +} + +@end diff --git a/test/.svn/text-base/EBNFParserTest.m.svn-base b/test/.svn/text-base/EBNFParserTest.m.svn-base new file mode 100644 index 0000000..2563d5c --- /dev/null +++ b/test/.svn/text-base/EBNFParserTest.m.svn-base @@ -0,0 +1,37 @@ +// +// EBNFParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "EBNFParserTest.h" +#import "EBNFParser.h" + +@implementation EBNFParserTest + +- (void)test { + //NSString *s = @"foo (bar|baz)*;"; + NSString *s = @"$baz = bar; ($baz|foo)*;"; + //NSString *s = @"foo;"; + EBNFParser *p = [[[EBNFParser alloc] init] autorelease]; + + // PKAssembly *a = [p bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + // NSLog(@"a: %@", a); + // NSLog(@"a.target: %@", a.target); + + PKParser *res = [p parse:s]; + // NSLog(@"res: %@", res); + // NSLog(@"res: %@", res.string); + // NSLog(@"res.subparsers: %@", res.subparsers); + // NSLog(@"res.subparsers 0: %@", [[res.subparsers objectAtIndex:0] string]); + // NSLog(@"res.subparsers 1: %@", [[res.subparsers objectAtIndex:1] string]); + + s = @"bar foo bar foo"; + PKAssembly *a = [res completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + NSLog(@"\n\na: %@\n\n", a); + +} + +@end diff --git a/test/.svn/text-base/ERBTest.h.svn-base b/test/.svn/text-base/ERBTest.h.svn-base new file mode 100644 index 0000000..a997c20 --- /dev/null +++ b/test/.svn/text-base/ERBTest.h.svn-base @@ -0,0 +1,22 @@ +// +// ERBTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/26/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" + +@interface ERBTest : SenTestCase { + NSString *g; + NSString *s; + PKAssembly *res; + PKParser *lp; // language parser + PKTokenizer *t; + PKToken *tok; + PKToken *startPrintMarker; +} + +@end diff --git a/test/.svn/text-base/ERBTest.m.svn-base b/test/.svn/text-base/ERBTest.m.svn-base new file mode 100644 index 0000000..cb82089 --- /dev/null +++ b/test/.svn/text-base/ERBTest.m.svn-base @@ -0,0 +1,66 @@ +// +// ERBTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/26/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "ERBTest.h" + +@interface ERBAssembler : NSObject { + +} + +@end + +@implementation ERBAssembler + +- (id)provideValueForKey:(NSString *)k { + return @"hai"; +} + + +- (void)didMatchEndMarker:(PKAssembly *)a { + [a pop]; // '@>' + NSString *k = [a pop]; + [a pop]; // discard '<@=' + [a push:[self provideValueForKey:k]]; +} + + +- (void)didMatchDotWord:(PKAssembly *)a { + PKToken *lastPart = [a pop]; + [a pop]; // '.' + PKToken *firstPart = [a pop]; + + NSString *keyPath = [NSString stringWithFormat:@"%@.%@", + firstPart, lastPart]; + [a push:keyPath]; + // do something with the keyPath +} + +@end + + +@implementation ERBTest + +- (void)setUp { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"erb" ofType:@"grammar"]; + g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + lp = [[PKParserFactory factory] parserFromGrammar:g assembler:[[[ERBAssembler alloc] init] autorelease]]; + t = lp.tokenizer; +// startPrintMarker = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"<@=" floatValue:0]; +} + + +- (void)testFoo { + t.string = @"oh <@= foo.bar @> !"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; +// TDEqualObjects([res description], @"[oh, hai, !]oh/<@=/foo/./bar/@>/!^"); + +} + +@end + diff --git a/test/.svn/text-base/PKAST.h.svn-base b/test/.svn/text-base/PKAST.h.svn-base new file mode 100644 index 0000000..ace9b02 --- /dev/null +++ b/test/.svn/text-base/PKAST.h.svn-base @@ -0,0 +1,27 @@ +// +// PKAST.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKToken; + +@interface PKAST : NSObject { + PKToken *token; + NSMutableArray *children; +} + ++ (id)ASTWithToken:(PKToken *)tok; + +- (id)initWithToken:(PKToken *)tok; + +- (NSInteger)type; + +- (void)addChild:(PKAST *)c; +- (BOOL)isNil; + +@end diff --git a/test/.svn/text-base/PKAST.m.svn-base b/test/.svn/text-base/PKAST.m.svn-base new file mode 100644 index 0000000..2eeb925 --- /dev/null +++ b/test/.svn/text-base/PKAST.m.svn-base @@ -0,0 +1,96 @@ +// +// PKAST.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKAST.h" + +@interface PKAST () +@property (nonatomic, retain) PKToken *token; +@property (nonatomic, retain) NSMutableArray *children; +@end + +@implementation PKAST + ++ (id)ASTWithToken:(PKToken *)tok { + return [[[self alloc] initWithToken:tok] autorelease]; +} + + +- (id)init { + return [self initWithToken:nil]; +} + + +- (id)initWithToken:(PKToken *)tok { + if (self = [super init]) { + self.token = tok; + } + return self; +} + + +- (void)dealloc { + self.token = nil; + self.children = nil; + [super dealloc]; +} + + +- (NSString *)description { + return [token stringValue]; +} + + +- (NSString *)treeDescription { + if (![children count]) { + return [self description]; + } + + NSMutableString *ms = [NSMutableString string]; + + if (![self isNil]) { + [ms appendFormat:@"(%@ ", [self description]]; + } + + NSInteger i = 0; + for (PKAST *child in children) { + if (i++) { + [ms appendFormat:@" %@", child]; + } else { + [ms appendFormat:@"%@", child]; + } + } + + if (![self isNil]) { + [ms appendString:@")"]; + } + + return [[ms copy] autorelease]; +} + + +- (NSInteger)type { + NSAssert2(0, @"%s is an abastract method. Must be overridden in %@", __PRETTY_FUNCTION__, NSStringFromClass([self class])); + return -1; +} + + +- (void)addChild:(PKAST *)c { + if (!children) { + self.children = [NSMutableArray array]; + } + [children addObject:c]; +} + + +- (BOOL)isNil { + return !token; +} + +@synthesize token; +@synthesize children; +@end diff --git a/test/.svn/text-base/PKExclusion.h.svn-base b/test/.svn/text-base/PKExclusion.h.svn-base new file mode 100644 index 0000000..8e47979 --- /dev/null +++ b/test/.svn/text-base/PKExclusion.h.svn-base @@ -0,0 +1,16 @@ +// +// PKExclusion.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface PKExclusion : PKCollectionParser { + +} + ++ (id)exclusion; +@end diff --git a/test/.svn/text-base/PKExclusion.m.svn-base b/test/.svn/text-base/PKExclusion.m.svn-base new file mode 100644 index 0000000..e5b8e2c --- /dev/null +++ b/test/.svn/text-base/PKExclusion.m.svn-base @@ -0,0 +1,76 @@ +// +// PKExclusion.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKExclusion.h" +#import + +@interface NSMutableSet (PKExclusionAdditions) +- (void)exclusiveSetTestingEquality:(NSSet *)s; +@end + +@implementation NSMutableSet (PKExclusionAdditions) + +- (void)exclusiveSetTestingEquality:(NSSet *)s { + for (id a1 in self) { + BOOL found = NO; + for (id a2 in s) { + if ([a1 isEqual:a2 ]) { + found = YES; + break; + } + } + if (found) { + [self removeObject:a1]; + } + } + + for (id a2 in s) { + BOOL found = NO; + for (id a1 in self) { + if ([a2 isEqual:a1]) { + found = YES; + break; + } + } + if (!found) { + [self addObject:a2]; + } + } +} + +@end + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@implementation PKExclusion + ++ (id)exclusion { + return [[[self alloc] init] autorelease]; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + NSMutableSet *outAssemblies = [NSMutableSet set]; + + NSInteger i = 0; + for (PKParser *p in subparsers) { + if (0 == i++) { + outAssemblies = [[[p matchAndAssemble:inAssemblies] mutableCopy] autorelease]; + } else { + [outAssemblies exclusiveSetTestingEquality:[p allMatchesFor:inAssemblies]]; + } + } + + return outAssemblies; +} + +@end diff --git a/test/.svn/text-base/PKNumberState.h.svn-base b/test/.svn/text-base/PKNumberState.h.svn-base new file mode 100644 index 0000000..734d831 --- /dev/null +++ b/test/.svn/text-base/PKNumberState.h.svn-base @@ -0,0 +1,32 @@ +// +// PKNumberState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class PKNumberState + @brief A number state returns a number from a reader. + @details This state's idea of a number allows an optional, initial minus sign, followed by one or more digits. A decimal point and another string of digits may follow these digits. + If allowsScientificNotation is true (the default) this state allows 'e' or 'E' followed by an (optionally explicityly positive or negative) integer to represent 10 to the indicated power. For example, this state will recognize 1e2 as equaling 100.

+*/ +@interface PKNumberState : PKTokenizerState { + BOOL allowsTrailingDot; + BOOL gotADigit; + BOOL negative; + PKUniChar c; + CGFloat floatValue; +} + +/*! + @property allowsTrailingDot + @brief If true, numbers are allowed to end with a trialing dot, e.g. 42. + @details false by default. +*/ +@property (nonatomic) BOOL allowsTrailingDot; +@end diff --git a/test/.svn/text-base/PKNumberState.m.svn-base b/test/.svn/text-base/PKNumberState.m.svn-base new file mode 100644 index 0000000..055a74d --- /dev/null +++ b/test/.svn/text-base/PKNumberState.m.svn-base @@ -0,0 +1,145 @@ +// +// PKNumberState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface PKNumberState () +- (CGFloat)absorbDigitsFromReader:(PKReader *)r isFraction:(BOOL)fraction; +- (CGFloat)value; +- (void)parseLeftSideFromReader:(PKReader *)r; +- (void)parseRightSideFromReader:(PKReader *)r; +- (void)reset:(PKUniChar)cin; +@end + +@implementation PKNumberState + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + [self resetWithReader:r]; + negative = NO; + PKUniChar originalCin = cin; + + if ('-' == cin) { + negative = YES; + cin = [r read]; + [self append:'-']; + } else if ('+' == cin) { + cin = [r read]; + [self append:'+']; + } + + [self reset:cin]; + if ('.' == c) { + [self parseRightSideFromReader:r]; + } else { + [self parseLeftSideFromReader:r]; + [self parseRightSideFromReader:r]; + } + + // erroneous ., +, or - + if (!gotADigit) { + if (negative && PKEOF != c) { // ?? + [r unread]; + } + return [t.symbolState nextTokenFromReader:r startingWith:originalCin tokenizer:t]; + } + + if (PKEOF != c) { + [r unread]; + } + + if (negative) { + floatValue = -floatValue; + } + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:[self bufferedString] floatValue:[self value]]; + tok.offset = offset; + return tok; +} + + +- (CGFloat)value { + return floatValue; +} + + +- (CGFloat)absorbDigitsFromReader:(PKReader *)r isFraction:(BOOL)isFraction { + CGFloat divideBy = 1.0; + CGFloat v = 0.0; + + while (1) { + if (isdigit(c)) { + [self append:c]; + gotADigit = YES; + v = v * 10.0 + (c - '0'); + c = [r read]; + if (isFraction) { + divideBy *= 10.0; + } + } else { + break; + } + } + + if (isFraction) { + v = v / divideBy; + } + + return (CGFloat)v; +} + + +- (void)parseLeftSideFromReader:(PKReader *)r { + floatValue = [self absorbDigitsFromReader:r isFraction:NO]; +} + + +- (void)parseRightSideFromReader:(PKReader *)r { + if ('.' == c) { + PKUniChar n = [r read]; + BOOL nextIsDigit = isdigit(n); + if (PKEOF != n) { + [r unread]; + } + + if (nextIsDigit || allowsTrailingDot) { + [self append:'.']; + if (nextIsDigit) { + c = [r read]; + floatValue += [self absorbDigitsFromReader:r isFraction:YES]; + } + } + } +} + + +- (void)reset:(PKUniChar)cin { + gotADigit = NO; + floatValue = 0.0; + c = cin; +} + +@synthesize allowsTrailingDot; +@end diff --git a/test/.svn/text-base/PKParseTree.h.svn-base b/test/.svn/text-base/PKParseTree.h.svn-base new file mode 100644 index 0000000..57413b9 --- /dev/null +++ b/test/.svn/text-base/PKParseTree.h.svn-base @@ -0,0 +1,31 @@ +// +// PKParseTree.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKRuleNode; +@class PKTokenNode; +@class PKToken; + +@interface PKParseTree : NSObject { + PKParseTree *parent; + NSMutableArray *children; + id userInfo; + BOOL matched; +} ++ (id)parseTree; + +- (PKRuleNode *)addChildRule:(NSString *)name; +- (PKTokenNode *)addChildToken:(PKToken *)tok; +- (void)addChild:(PKParseTree *)tr; + +@property (nonatomic, assign, readonly) PKParseTree *parent; // weak ref +@property (nonatomic, retain, readonly) NSMutableArray *children; +@property (nonatomic, retain) id userInfo; +@property (nonatomic, getter=isMatched) BOOL matched; +@end diff --git a/test/.svn/text-base/PKParseTree.m.svn-base b/test/.svn/text-base/PKParseTree.m.svn-base new file mode 100644 index 0000000..3ce1d99 --- /dev/null +++ b/test/.svn/text-base/PKParseTree.m.svn-base @@ -0,0 +1,90 @@ +// +// PKParseTree.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKParseTree.h" +#import "PKRuleNode.h" +#import "PKTokenNode.h" + +@interface PKParseTree () +@property (nonatomic, assign, readwrite) PKParseTree *parent; +@property (nonatomic, retain, readwrite) NSMutableArray *children; +@end + +@implementation PKParseTree + ++ (id)parseTree { + return [[[self alloc] init] autorelease]; +} + + +- (void)dealloc { + self.parent = nil; + self.children = nil; + self.userInfo = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + PKParseTree *t = [[[self class] allocWithZone:zone] init]; + + // assign parent + if (parent) { + t->parent = parent; + + // put new copy in new parent's children array + NSInteger i = [[parent children] indexOfObject:self]; + if (NSNotFound != i) { + [[t->parent children] replaceObjectAtIndex:i withObject:t]; + } + } + + // copy children + if (children) { + t->children = [children mutableCopyWithZone:zone]; + } + return t; +} + + +- (PKRuleNode *)addChildRule:(NSString *)name { + NSParameterAssert([name length]); + PKRuleNode *n = [PKRuleNode ruleNodeWithName:name]; + [self addChild:n]; + return n; +} + + +- (PKTokenNode *)addChildToken:(PKToken *)tok { + NSParameterAssert([[tok stringValue] length]); + PKTokenNode *n = [PKTokenNode tokenNodeWithToken:tok]; + [self addChild:n]; + return n; +} + + +- (void)addChild:(PKParseTree *)tr { + NSParameterAssert(tr); + if (!children) { + self.children = [NSMutableArray array]; + } + tr.parent = self; + [children addObject:tr]; +} + + +- (NSString *)description { + return [NSString stringWithFormat:@"", children]; +} + +@synthesize parent; +@synthesize children; +@synthesize userInfo; +@synthesize matched; +@end + diff --git a/test/.svn/text-base/PKParseTreeAssembler.h.svn-base b/test/.svn/text-base/PKParseTreeAssembler.h.svn-base new file mode 100644 index 0000000..5adb2e8 --- /dev/null +++ b/test/.svn/text-base/PKParseTreeAssembler.h.svn-base @@ -0,0 +1,18 @@ +// +// PKParseTreeAssembler.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface PKParseTreeAssembler : NSObject { + NSMutableDictionary *ruleNames; + NSString *preassemblerPrefix; + NSString *assemblerPrefix; + NSString *suffix; +} + +@end diff --git a/test/.svn/text-base/PKParseTreeAssembler.m.svn-base b/test/.svn/text-base/PKParseTreeAssembler.m.svn-base new file mode 100644 index 0000000..15d83d1 --- /dev/null +++ b/test/.svn/text-base/PKParseTreeAssembler.m.svn-base @@ -0,0 +1,175 @@ +// +// PKParseTreeAssembler.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKParseTreeAssembler.h" +#import +#import "PKParseTree.h" +#import "PKRuleNode.h" +#import "PKTokenNode.h" + +@interface PKParseTreeAssembler () +- (NSString *)ruleNameForSelName:(NSString *)selName withPrefix:(NSString *)pre; +- (void)didMatchRuleNamed:(NSString *)name assembly:(PKAssembly *)a; +- (void)willMatchRuleNamed:(NSString *)name assembly:(PKAssembly *)a; +- (void)didMatchToken:(PKAssembly *)a; +- (PKParseTree *)currentFrom:(PKAssembly *)a; +- (void)removeUnmatchedChildrenFrom:(PKParseTree *)n; + +@property (nonatomic, retain) NSMutableDictionary *ruleNames; +@property (nonatomic, copy) NSString *assemblerPrefix; +@property (nonatomic, copy) NSString *preassemblerPrefix; +@property (nonatomic, copy) NSString *suffix; +@end + +@implementation PKParseTreeAssembler + +- (id)init { + if (self = [super init]) { + self.ruleNames = [NSMutableDictionary dictionary]; + self.preassemblerPrefix = @"willMatch"; + self.assemblerPrefix = @"didMatch"; + self.suffix = @":"; + } + return self; +} + + +- (void)dealloc { + self.ruleNames = nil; + self.preassemblerPrefix = nil; + self.assemblerPrefix = nil; + self.suffix = nil; + [super dealloc]; +} + + +- (BOOL)respondsToSelector:(SEL)sel { + return YES; + if ([super respondsToSelector:sel]) { + return YES; + } else { + NSString *selName = NSStringFromSelector(sel); + if ([selName hasPrefix:assemblerPrefix] && [selName hasSuffix:suffix]) { + return YES; + } + } + return NO; +} + + +- (id)performSelector:(SEL)sel withObject:(id)obj { + NSString *selName = NSStringFromSelector(sel); + + if ([selName hasPrefix:assemblerPrefix] && [selName hasSuffix:suffix]) { + [self didMatchRuleNamed:[self ruleNameForSelName:selName withPrefix:assemblerPrefix] assembly:obj]; + } else if ([selName hasPrefix:preassemblerPrefix] && [selName hasSuffix:suffix]) { + [self willMatchRuleNamed:[self ruleNameForSelName:selName withPrefix:preassemblerPrefix] assembly:obj]; + } else if ([super respondsToSelector:sel]) { + return [super performSelector:sel withObject:obj]; + } else { + NSAssert(0, @""); + } + return nil; +} + + +- (NSString *)ruleNameForSelName:(NSString *)selName withPrefix:(NSString *)prefix { + NSString *ruleName = [ruleNames objectForKey:selName]; + + if (!ruleName) { + NSUInteger prefixLen = [prefix length]; + NSInteger c = ((NSInteger)[selName characterAtIndex:prefixLen]) + 32; // lowercase + NSRange r = NSMakeRange(prefixLen + 1, [selName length] - (prefixLen + [suffix length] + 1 /*:*/)); + ruleName = [NSString stringWithFormat:@"%C%@", c, [selName substringWithRange:r]]; + [ruleNames setObject:ruleName forKey:selName]; + } + + return ruleName; +} + + +- (void)willMatchRuleNamed:(NSString *)name assembly:(PKAssembly *)a { + PKParseTree *current = [self currentFrom:a]; + [self didMatchToken:a]; + current = [current addChildRule:name]; + a.target = current; +} + + +- (void)didMatchRuleNamed:(NSString *)name assembly:(PKAssembly *)a { + PKParseTree *current = [self currentFrom:a]; + + NSArray *origChildren = [[[current children] mutableCopy] autorelease]; + + PKParseTree *oldCurrent = nil; + while ([current isKindOfClass:[PKRuleNode class]] && ![[(id)current name] isEqualToString:name]) { + oldCurrent = [[current retain] autorelease]; + a.target = [current parent]; + current = [self currentFrom:a]; + [self didMatchToken:a]; + } + + if (oldCurrent && ![oldCurrent isMatched]) { + [(id)[current children] addObjectsFromArray:origChildren]; + } + + [self didMatchToken:a]; + current = [self currentFrom:a]; + + [self removeUnmatchedChildrenFrom:current]; + [current setMatched:YES]; + a.target = [current parent]; +} + + +- (void)removeUnmatchedChildrenFrom:(PKParseTree *)n { + NSMutableArray *remove = [NSMutableArray array]; + for (id child in [n children]) { + if (![child isMatched]) { + [remove addObject:child]; + } + } + + for (id child in remove) { + [(id)[n children] removeObject:child]; + } +} + + +- (PKParseTree *)currentFrom:(PKAssembly *)a { + PKParseTree *current = a.target; + if (!current) { + current = [PKParseTree parseTree]; + a.target = current; + } + return current; +} + + +- (void)didMatchToken:(PKAssembly *)a { + PKParseTree *current = [self currentFrom:a]; + if ([current isMatched]) return; + + NSMutableArray *toks = [NSMutableArray arrayWithCapacity:[a.stack count]]; + while (![a isStackEmpty]) { + id tok = [a pop]; + NSAssert([tok isKindOfClass:[PKToken class]], @""); + [toks addObject:tok]; + } + + for (id tok in [toks reverseObjectEnumerator]) { + PKTokenNode *n = [current addChildToken:tok]; + [n setMatched:YES]; + } +} + +@synthesize ruleNames; +@synthesize preassemblerPrefix; +@synthesize assemblerPrefix; +@synthesize suffix; +@end diff --git a/test/.svn/text-base/PKRuleNode.h.svn-base b/test/.svn/text-base/PKRuleNode.h.svn-base new file mode 100644 index 0000000..4988d60 --- /dev/null +++ b/test/.svn/text-base/PKRuleNode.h.svn-base @@ -0,0 +1,21 @@ +// +// PKRuleNode.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKParseTree.h" + +@interface PKRuleNode : PKParseTree { + NSString *name; +} + ++ (id)ruleNodeWithName:(NSString *)s; + +// designated initializer +- (id)initWithName:(NSString *)s; + +@property (nonatomic, copy, readonly) NSString *name; +@end diff --git a/test/.svn/text-base/PKRuleNode.m.svn-base b/test/.svn/text-base/PKRuleNode.m.svn-base new file mode 100644 index 0000000..71571ec --- /dev/null +++ b/test/.svn/text-base/PKRuleNode.m.svn-base @@ -0,0 +1,48 @@ +// +// PKRuleNode.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKRuleNode.h" + +@interface PKRuleNode () +@property (nonatomic, copy, readwrite) NSString *name; +@end + +@implementation PKRuleNode + ++ (id)ruleNodeWithName:(NSString *)s { + return [[[self alloc] initWithName:s] autorelease]; +} + + +- (id)initWithName:(NSString *)s { + if (self = [super init]) { + self.name = s; + } + return self; +} + + +- (void)dealloc { + self.name = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + PKRuleNode *n = [super copyWithZone:zone]; + n->name = [name copyWithZone:zone]; + return n; +} + + +- (NSString *)description { + return [NSString stringWithFormat:@"", name, children]; +} + +@synthesize name; +@end diff --git a/test/.svn/text-base/PKScientificNumberState.h.svn-base b/test/.svn/text-base/PKScientificNumberState.h.svn-base new file mode 100644 index 0000000..214b918 --- /dev/null +++ b/test/.svn/text-base/PKScientificNumberState.h.svn-base @@ -0,0 +1,24 @@ +// +// PKScientificNumberState.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +/*! + @class PKScientificNumberState + @brief A PKScientificNumberState object returns a number from a reader. + @details

This state's idea of a number expands on its superclass, allowing an 'e' followed by an integer to represent 10 to the indicated power. For example, this state will recognize 1e2 as equaling 100.

+

This class exists primarily to show how to introduce a new tokenizing state.

+*/ +@interface PKScientificNumberState : PKNumberState { + BOOL allowsScientificNotation; + CGFloat exp; + BOOL negativeExp; +} + +@property (nonatomic) BOOL allowsScientificNotation; +@end diff --git a/test/.svn/text-base/PKScientificNumberState.m.svn-base b/test/.svn/text-base/PKScientificNumberState.m.svn-base new file mode 100644 index 0000000..fc8ed1b --- /dev/null +++ b/test/.svn/text-base/PKScientificNumberState.m.svn-base @@ -0,0 +1,93 @@ +// +// PKScientificNumberState.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKScientificNumberState.h" +#import +#import + +@interface PKTokenizerState () +- (void)append:(PKUniChar)c; +@end + +@interface PKNumberState () +- (CGFloat)absorbDigitsFromReader:(PKReader *)r isFraction:(BOOL)isFraction; +- (void)parseRightSideFromReader:(PKReader *)r; +- (void)reset:(PKUniChar)cin; +- (CGFloat)value; +@end + +@implementation PKScientificNumberState + +- (id)init { + if (self = [super init]) { + self.allowsScientificNotation = YES; + } + return self; +} + + +- (void)parseRightSideFromReader:(PKReader *)r { + NSParameterAssert(r); + [super parseRightSideFromReader:r]; + if (!allowsScientificNotation) { + return; + } + + if ('e' == c || 'E' == c) { + PKUniChar e = c; + c = [r read]; + + BOOL hasExp = isdigit(c); + negativeExp = ('-' == c); + BOOL positiveExp = ('+' == c); + + if (!hasExp && (negativeExp || positiveExp)) { + c = [r read]; + hasExp = isdigit(c); + } + if (PKEOF != c) { + [r unread]; + } + if (hasExp) { + [self append:e]; + if (negativeExp) { + [self append:'-']; + } else if (positiveExp) { + [self append:'+']; + } + c = [r read]; + exp = [super absorbDigitsFromReader:r isFraction:NO]; + } + } +} + + +- (void)reset:(PKUniChar)cin { + [super reset:cin]; + exp = (CGFloat)0.0; + negativeExp = NO; +} + + +- (CGFloat)value { + CGFloat result = (CGFloat)floatValue; + + NSUInteger i = 0; + for ( ; i < exp; i++) { + if (negativeExp) { + result /= (CGFloat)10.0; + } else { + result *= (CGFloat)10.0; + } + } + + return (CGFloat)result; +} + +@synthesize allowsScientificNotation; +@end diff --git a/test/.svn/text-base/PKTokenNode.h.svn-base b/test/.svn/text-base/PKTokenNode.h.svn-base new file mode 100644 index 0000000..fa8790a --- /dev/null +++ b/test/.svn/text-base/PKTokenNode.h.svn-base @@ -0,0 +1,23 @@ +// +// PKTokenNode.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKParseTree.h" + +@class PKToken; + +@interface PKTokenNode : PKParseTree { + PKToken *token; +} + ++ (id)tokenNodeWithToken:(PKToken *)tok; + +// designated initializer +- (id)initWithToken:(PKToken *)tok; + +@property (nonatomic, retain, readonly) PKToken *token; +@end diff --git a/test/.svn/text-base/PKTokenNode.m.svn-base b/test/.svn/text-base/PKTokenNode.m.svn-base new file mode 100644 index 0000000..98979a5 --- /dev/null +++ b/test/.svn/text-base/PKTokenNode.m.svn-base @@ -0,0 +1,49 @@ +// +// PKTokenNode.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKTokenNode.h" +#import + +@interface PKTokenNode () +@property (nonatomic, retain, readwrite) PKToken *token; +@end + +@implementation PKTokenNode + ++ (id)tokenNodeWithToken:(PKToken *)s { + return [[[self alloc] initWithToken:s] autorelease]; +} + + +- (id)initWithToken:(PKToken *)s { + if (self = [super init]) { + self.token = s; + } + return self; +} + + +- (void)dealloc { + self.token = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + PKTokenNode *n = [super copyWithZone:zone]; + n->token = [token copyWithZone:zone]; + return n; +} + + +- (NSString *)description { + return [NSString stringWithFormat:@"", token]; +} + +@synthesize token; +@end diff --git a/test/.svn/text-base/RelaxParser.h.svn-base b/test/.svn/text-base/RelaxParser.h.svn-base new file mode 100644 index 0000000..5f154c6 --- /dev/null +++ b/test/.svn/text-base/RelaxParser.h.svn-base @@ -0,0 +1,15 @@ +// +// RelaxParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/15/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface RelaxParser : PKSequence { + PKTokenizer *tokenizer; +} + +@end diff --git a/test/.svn/text-base/RelaxParser.m.svn-base b/test/.svn/text-base/RelaxParser.m.svn-base new file mode 100644 index 0000000..48f8a6d --- /dev/null +++ b/test/.svn/text-base/RelaxParser.m.svn-base @@ -0,0 +1,618 @@ +// +// RelaxParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/15/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "RelaxParser.h" + +@implementation RelaxParser + +- (PKTokenizer *)tokenizer { + if (!tokenizer) { + self.tokenizer = [PKTokenizer tokenizer]; + [tokenizer.symbolState add:@"|="]; + [tokenizer.symbolState add:@"&="]; + } + return tokenizer; +} + +// topLevel ::= decl* (pattern | grammarContent*) +- (PKCollectionParser *)topLevelParser { + if (!topLevelParser) { + self.topLevelParser = [PKSequence sequence]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.declParser]; + [topLevelParser add:a]; + + a = [PKAlternation alternation]; + [a add:self.patternParser]; + [a add:[PKRepetition repetitionWithSubparser:self.grammarContentParser]]; + [topLevelParser add:a]; + } + return topLevelParser; +} + +// decl ::= "namespace" identifierOrKeyword "=" namespaceURILiteral +// | "default" "namespace" [identifierOrKeyword] "=" namespaceURILiteral +// | "datatypes" identifierOrKeyword "=" literal +- (PKCollectionParser *)declParser { + if (!declParser) { + self.declParser = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"namespace"]]; + [s add:self.identifierOrKeywordParser]; + [s add:[PKSymbol symbolWithString:@"="]]; + [a add:self.namespaceURILiteralParser]; + [declParser add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"default"]]; + [s add:[PKLiteral literalWithString:@"namespace"]]; + [s add:self.identifierOrKeywordParser]; + [s add:[PKSymbol symbolWithString:@"="]]; + [a add:self.namespaceURILiteralParser]; + [declParser add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"datatypes"]]; + [s add:self.identifierOrKeywordParser]; + [s add:[PKSymbol symbolWithString:@"="]]; + [a add:[PKQuotedString quotedString]]; + [declParser add:s]; + } + return declParser; +} + + +- (PKCollectionParser *)atLeastOneOf:(PKParser *)p { + PKSequence *s = [PKSequence sequence]; + [s add:p]; + [s add:[PKRepetition repetitionWithSubparser:p]]; + return s; +} + +// pattern ::= +// elementPattern +// | attributePattern +// | pattern commaPattern+ +// | pattern andPattern+ +// | pattern orPattern+ +// | patternQuestion +// | patternStar +// | patternPlus +// | listPattern +// | mixedPattern +// | identifier +// | parent +// | emptyKeyword +// | textKeyword +// | [datatypeName] datatypeValue +// | datatypeName ["{" param* "}"] [exceptPattern] +// | "notAllowed" +// | "external" anyURILiteral [inherit] +// | "grammar" "{" grammarContent* "}" +// | "(" pattern ")" +- (PKCollectionParser *)patternParser { + if (!patternParser) { + self.patternParser = [PKAlternation alternation]; + [patternParser add:self.elementPatternParser]; + [patternParser add:self.attributePatternParser]; + [patternParser add:[self atLeastOneOf:self.commaPatternParser]]; + [patternParser add:[self atLeastOneOf:self.andPatternParser]]; + [patternParser add:[self atLeastOneOf:self.orPatternParser]]; + [patternParser add:[self atLeastOneOf:self.patternQuestionParser]]; + [patternParser add:[self atLeastOneOf:self.patternStarParser]]; + [patternParser add:[self atLeastOneOf:self.patternPlusParser]]; + [patternParser add:self.listPatternParser]; + [patternParser add:self.mixedPatternParser]; + [patternParser add:self.identifierParser]; + [patternParser add:self.parentParser]; + [patternParser add:self.emptyKeywordParser]; + [patternParser add:self.textKeywordParser]; + + + + + s = [PKSequence sequence]; + [s add:patternParser]; + + } +} + +// elementPattern := "element" nameClass "{" pattern "}" +- (PKCollectionParser *)elementPatternParser { + if (!elementPatternParser) { + self.elementPatternParser = [PKSequence sequence]; + [elementPatternParser add:[PKLiteral literalWithString:@"element"]]; + [elementPatternParser add:self.nameClass]; + [elementPatternParser add:[PKSymbol symbolWithString:@"{"]]; + [elementPatternParser add:patternParser]; + [elementPatternParser add:[PKSymbol symbolWithString:@"}"]]; + } + return elementPatternParser; +} + + +// attributePattern := "attribute" nameClass "{" pattern "}" +- (PKCollectionParser *)attributePatternParser { + if (!attributePatternParser) { + attributePatternParser = [PKSequence sequence]; + [attributePatternParser add:[PKLiteral literalWithString:@"attribute"]]; + [attributePatternParser add:self.nameClass]; + [attributePatternParser add:[PKSymbol symbolWithString:@"{"]]; + [attributePatternParser add:patternParser]; + [attributePatternParser add:[PKSymbol symbolWithString:@"}"]]; + } + return attributePatternParser; +} + + +// commaPattern := "," pattern +- (PKCollectionParser *)commaPatternParser { + if (!commaPatternParser) { + self.commaPatternParser = [PKSequence sequence]; + [commaPatternParser add:[PKSymbol symbolWithString:@","]]; + [commaPatternParser add:self.patternParser]; + } + return commaPatternParser; +} + + +// andPattern := "&" pattern +- (PKCollectionParser *)andPatternParser { + if (!andPatternParser) { + self.andPatternParser = [PKSequence sequence]; + [andPatternParser add:[PKSymbol symbolWithString:@"&"]]; + [andPatternParser add:self.patternParser]; + } + return andPatternParser; +} + + +// orPattern := "|" pattern +- (PKCollectionParser *)orPatternParser { + if (!orPatternParser) { + self.orPatternParser = [PKSequence sequence]; + [orPatternParser add:[PKSymbol symbolWithString:@"|"]]; + [orPatternParser add:self.patternParser]; + } + return orPatternParser; +} + + +// patternQuestion := pattern "?" +- (PKCollectionParser *)patternQuestionParser { + if (!patternQuestionParser) { + self.patternQuestionParser = [PKSequence sequence]; + [patternQuestionParser add:self.patternParser]; + [patternQuestionParser add:[PKSymbol symbolWithString:@"?"]]; + } + return patternQuestionParser; +} + + +// patternQuestion := pattern "*" +- (PKCollectionParser *)patternStarParser { + if (!patternStarParser) { + self.patternStarParser = [PKSequence sequence]; + [patternStarParser add:self.patternParser]; + [patternStarParser add:[PKSymbol symbolWithString:@"*"]]; + } + return patternStarParser; +} + + +// patternQuestion := pattern "+" +- (PKCollectionParser *)patternPlusParser { + if (!patternPlusParser) { + self.patternPlusParser = [PKSequence sequence]; + [patternPlusParser add:self.patternParser]; + [patternPlusParser add:[PKSymbol symbolWithString:@"+"]]; + } + return patternPlusParser; +} + +// | "list" "{" pattern "}" +- (PKCollectionParser *)listPatternParser { + if (!listPatternParser) { + self.listPatternParser = [PKSequence sequence]; + [listPatternParser add:[PKLiteral literalWithString:@"list"]]; + [listPatternParser add:[PKSymbol symbolWithString:@"{"]]; + [listPatternParser add:patternParser]; + [listPatternParser add:[PKSymbol symbolWithString:@"}"]]; + } + return listPatternParser; +} + +// | "mixed" "{" pattern "}" +- (PKCollectionParser *)mixedPatternParser { + if (!mixedPatternParser) { + self.mixedPatternParser = [PKSequence sequence]; + [mixedPatternParser add:[PKLiteral literalWithString:@"mixed"]]; + [mixedPatternParser add:[PKSymbol symbolWithString:@"{"]]; + [mixedPatternParser add:patternParser]; + [mixedPatternParser add:[PKSymbol symbolWithString:@"}"]]; + } + return mixedPatternParser; +} + +// | "parent" identifier +- (PKCollectionParser *)parentParser { + if (!parentParser) { + self.parentParser = [PKSequence sequence]; + [parentParser add:[PKLiteral literalWithString:@"parent"]]; + [parentParser add:self.identifierParser]; + } + return parentParser; +} + + +// param ::= identifierOrKeyword "=" literal +- (PKCollectionParser *)paramParser { + if (!paramParser) { + self.paramParser = [PKSequence sequence]; + [paramParser add:self.identifierOrKeywordParser]; + [paramParser add:[PKSymbol symbolWithString:@"="]]; + [paramParser add:self.literalParser]; + } + return paramParser; +} + +// exceptPattern ::= "-" pattern +- (PKCollectionParser *)exceptPatternParser { + if (!exceptPattern) { + self.exceptPattern = [PKSequence sequence]; + [exceptPattern add:[PKSymbol symbolWithString:@"-"]]; + [exceptPattern add:self.patternParser]; + } + return exceptPattern; +} + + +// grammarContent ::= start | define | "element" "{" grammarContent* "}" | "include" anyURILiteral [inherit] ["{" includeContent* "}"] +// +// includeContent ::= define | start | elementIncludeContent +- (PKCollectionParser *)includeContentParser { + if (!includeContentParser) { + self.includeContentParser = [PKAlternation alternation]; + [includeContentParser add:self.defineParser]; + [includeContentParser add:self.startParser]; + [includeContentParser add:self.elementIncludeContentParser]; + } + return includeContentParser; +} + +// elementIncludeContent ::= "element" "{" includeContent* "}" +- (PKCollectionParser *)elementIncludeContentParser { + if (!elementIncludeContentParser) { + self.elementIncludeContentParser = [PKSequence sequence]; + [s add:self.elementKeywordParser]; + [s add:[PKSymbol symbolWithString:@"{"]]; + [s add:[PKRepetition repetitionWithSubparser:self.includeContentParser]] + [s add:[PKSymbol symbolWithString:@"}"]]; + + [elementIncludeContentParser add:s]; + } + return elementIncludeContentParser; +} + + +// +// start ::= "start" assignMethod pattern +- (PKCollectionParser *)startParser { + if (!startParser) { + self.startParser = [PKSequence sequence]; + [startParser add:self.startKeywordParser]; + [startParser add:self.assignMethodParser]; + [startParser add:self.patternParser]; + } + return startParser; +} + + +// +// define ::= identifier assignMethod pattern +- (PKCollectionParser *)defineParser { + if (!defineParser) { + self.defineParser = [PKSequence sequence]; + [defineParser add:self.identifierParser]; + [defineParser add:self.assignMethodParser]; + [defineParser add:self.patternParser]; + } + return defineParser; +} + + +// +// assignMethod ::= "=" | "|=" | "&=" +- (PKCollectionParser *)assignMethodParser { + if (!assignMethodParser) { + self.assignMethodParser = [PKAlternation alternation]; + [assignMethodParser add:[PKSymbol symbolWithString:@"="]]; + [assignMethodParser add:[PKSymbol symbolWithString:@"|="]]; + [assignMethodParser add:[PKSymbol symbolWithString:@"&="]]; + } + return assignMethodParser; +} + +// +// nameClass ::= name +// | nsName [exceptNameClass] +// | anyName [exceptNameClass] +// | nameClass "|" nameClass +// | "(" nameClass ")" +// +// name ::= identifierOrKeyword | CName +- (PKCollectionParser *)nameParser { + if (!nameParser) { + self.nameParser = [PKAlternation alternation]; + [nameParser add:self.identifierOrKeywordParser]; + [nameParser add:self.CNameParser]; + } + return nameParser; +} + +// +// exceptNameClass ::= "-" nameClass +- (PKCollectionParser *)exceptNameClassParser { + if (!exceptNameClassParser) { + self.exceptNameClassParser = [PKSequence sequence]; + [nameParser add:[PKSymbol symbolWithString:@"-"]]; + [nameParser add:self.nameClassParser]; + } + return nameParser; +} + +// +// datatypeName ::= CName | "string" | "token" +- (PKCollectionParser *)datatypeNameParser { + if (!datatypeNameParser) { + self.datatypeNameParser = [PKAlternation alternation]; + [datatypeNameParser add:self.CNameParser]; + [datatypeNameParser add:self.stringKeywordParser]; + [datatypeNameParser add:self.tokenKeywordParser]; + } + return datatypeNameParser; +} + + +// +// datatypeValue ::= literal +- (PKCollectionParser *)datatypeValueParser { + if (!datatypeValueParser) { + self.datatypeValueParser = self.literalParser; + } + return datatypeValueParser; +} + + +// +// anyURILiteral ::= literal +- (PKCollectionParser *)anyURILiteralParser { + if (!anyURILiteralParser) { + self.anyURILiteralParser = self.literalParser; + } + return anyURILiteralParser; +} + + +// +// namespaceURILiteral ::= literal | "inherit" +// +// inherit ::= "inherit" "=" identifierOrKeyword +// +// identifierOrKeyword ::= identifier | keyword +// +// identifier ::= (NCName - keyword) | quotedIdentifier +// +// quotedIdentifier ::= "\" NCName +// +// CName ::= NCName ":" NCName +// +// nsName ::= NCName ":*" +// +// anyName ::= "*" +// +// literal ::= literalSegment ("~" literalSegment)+ +// +// literalSegment ::= '"' (Char - ('"' | newline))* '"' +// | "'" (Char - ("'" | newline))* "'" +// | '"""' (['"'] ['"'] (Char - '"'))* '"""' +// | "'''" (["'"] ["'"] (Char - "'"))* "'''" + + +// keyword ::= "attribute" +// | "default" +// | "datatypes" +// | "element" +// | "empty" +// | "external" +// | "grammar" +// | "include" +// | "inherit" +// | "list" +// | "mixed" +// | "namespace" +// | "notAllowed" +// | "parent" +// | "start" +// | "string" +// | "text" +// | "token" +// +- (PKParser *)keywordParser { + if (!keywordParser) { + self.keywordParser = [PKAlternation alternation]; + [keywordParser add:self.attributeKeywordParser]; + [keywordParser add:self.defaultKeywordParser]; + [keywordParser add:self.datatypesKeywordParser]; + [keywordParser add:self.elementKeywordParser]; + [keywordParser add:self.emptyKeywordParser]; + [keywordParser add:self.externalKeywordParser]; + [keywordParser add:self.grammarKeywordParser]; + [keywordParser add:self.includeKeywordParser]; + [keywordParser add:self.inheritKeywordParser]; + [keywordParser add:self.listKeywordParser]; + [keywordParser add:self.mixedKeywordParser]; + [keywordParser add:self.namespaceKeywordParser]; + [keywordParser add:self.notAllowedKeywordParser]; + [keywordParser add:self.parentKeywordParser]; + [keywordParser add:self.startKeywordParser]; + [keywordParser add:self.stringKeywordParser]; + [keywordParser add:self.textParser]; + [keywordParser add:self.tokenKeywordParser]; + } + return keywordParser; +} + + +- (PKParser *)attributeKeywordParser { + if (!attributeKeywordParser) { + self.attributeKeywordParser = [PKLiteral literalWithString:@"attribute"]; + } + return attributeKeywordParser; +} + + +- (PKParser *)defaultKeywordParser { + if (!defaultKeywordParser) { + self.defaultKeywordParser = [PKLiteral literalWithString:@"default"]; + } + return defaultKeywordParser; +} + + +- (PKParser *)datatypesKeywordParser { + if (!datatypesKeywordParser) { + self.datatypesKeywordParser = [PKLiteral literalWithString:@"datatypes"]; + } + return datatypesKeywordParser; +} + + +- (PKParser *)elementKeywordParser { + if (!elementKeywordParser) { + self.elementKeywordParser = [PKLiteral literalWithString:@"element"]; + } + return elementKeywordParser; +} + + +- (PKParser *)emptyKeywordParser { + if (!emptyKeywordParser) { + self.emptyKeywordParser = [PKLiteral literalWithString:@"empty"]; + } + return emptyKeywordParser; +} + + +- (PKParser *)externalKeywordParser { + if (!externalKeywordParser) { + self.externalKeywordParser = [PKLiteral literalWithString:@"external"]; + } + return externalKeywordParser; +} + + +- (PKParser *)grammarKeywordParser { + if (!grammarKeywordParser) { + self.grammarKeywordParser = [PKLiteral literalWithString:@"grammar"]; + } + return grammarKeywordParser; +} + + +- (PKParser *)includeKeywordParser { + if (!includeKeywordParser) { + self.includeKeywordParser = [PKLiteral literalWithString:@"include"]; + } + return includeKeywordParser; +} + + +- (PKParser *)inheritKeywordParser { + if (!inheritKeywordParser) { + self.inheritKeywordParser = [PKLiteral literalWithString:@"inherit"]; + } + return inheritKeywordParser; +} + + +- (PKParser *)listKeywordParser { + if (!listKeywordParser) { + self.listKeywordParser = [PKLiteral literalWithString:@"list"]; + } + return listKeywordParser; +} + + +- (PKParser *)mixedKeywordParser { + if (!mixedKeywordParser) { + self.mixedKeywordParser = [PKLiteral literalWithString:@"mixed"]; + } + return mixedKeywordParser; +} + + +- (PKParser *)namespaceKeywordParser { + if (!namespaceKeywordParser) { + self.namespaceKeywordParser = [PKLiteral literalWithString:@"namespace"]; + } + return namespaceKeywordParser; +} + + +- (PKParser *)notAllowedKeywordParser { + if (!notAllowedKeywordParser) { + self.notAllowedKeywordParser = [PKLiteral literalWithString:@"notAllowed"]; + } + return notAllowedKeywordParser; +} + + +- (PKParser *)parentKeywordParser { + if (!parentKeywordParser) { + self.parentKeywordParser = [PKLiteral literalWithString:@"parent"]; + } + return parentKeywordParser; +} + + +- (PKParser *)startKeywordParser { + if (!startKeywordParser) { + self.startKeywordParser = [PKLiteral literalWithString:@"start"]; + } + return startKeywordParser; +} + + +- (PKParser *)stringKeywordParser { + if (!stringKeywordParser) { + self.stringKeywordParser = [PKLiteral literalWithString:@"string"]; + } + return stringKeywordParser; +} + + +- (PKParser *)textKeywordParser { + if (!textKeywordParser) { + self.textKeywordParser = [PKLiteral literalWithString:@"text"]; + } + return textKeywordParser; +} + + +- (PKParser *)tokenKeywordParser { + if (!tokenKeywordParser) { + self.tokenKeywordParser = [PKLiteral literalWithString:@"token"]; + } + return tokenKeywordParser; +} + +@end diff --git a/test/.svn/text-base/SAXAssembler.h.svn-base b/test/.svn/text-base/SAXAssembler.h.svn-base new file mode 100644 index 0000000..02c4661 --- /dev/null +++ b/test/.svn/text-base/SAXAssembler.h.svn-base @@ -0,0 +1,15 @@ +// +// SAXAssembler.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface SAXAssembler : NSObject { + +} + +@end diff --git a/test/.svn/text-base/SAXAssembler.m.svn-base b/test/.svn/text-base/SAXAssembler.m.svn-base new file mode 100644 index 0000000..199ded3 --- /dev/null +++ b/test/.svn/text-base/SAXAssembler.m.svn-base @@ -0,0 +1,18 @@ +// +// SAXAssembler.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "SAXAssembler.h" +#import + +@implementation SAXAssembler + +- (void)didMatchSTag:(PKAssembly *)a { + +} + +@end diff --git a/test/.svn/text-base/SAXTest.h.svn-base b/test/.svn/text-base/SAXTest.h.svn-base new file mode 100644 index 0000000..3ec3640 --- /dev/null +++ b/test/.svn/text-base/SAXTest.h.svn-base @@ -0,0 +1,21 @@ +// +// SAXTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface SAXTest : SenTestCase { + NSString *s; + NSString *g; + PKParserFactory *factory; + PKTokenAssembly *a; + PKAssembly *res; + PKParser *p; + PKTokenizer *t; +} + +@end diff --git a/test/.svn/text-base/SAXTest.m.svn-base b/test/.svn/text-base/SAXTest.m.svn-base new file mode 100644 index 0000000..1b841a7 --- /dev/null +++ b/test/.svn/text-base/SAXTest.m.svn-base @@ -0,0 +1,27 @@ +// +// SAXTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "SAXTest.h" + +@implementation SAXTest + +- (void)setUp { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"xml" ofType:@"grammar"]; + g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + factory = [PKParserFactory factory]; + p = [factory parserFromGrammar:g assembler:self]; + t = p.tokenizer; +} + + +- (void)testSTag { + //PKParser *sTag = [p parserNamed:@"sTag"]; + +} + +@end diff --git a/test/.svn/text-base/SRGSParser.h.svn-base b/test/.svn/text-base/SRGSParser.h.svn-base new file mode 100644 index 0000000..905078b --- /dev/null +++ b/test/.svn/text-base/SRGSParser.h.svn-base @@ -0,0 +1,88 @@ +// +// SRGSParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface SRGSParser : PKSequence { + PKCollectionParser *selfIdentHeader; + PKCollectionParser *ruleName; + PKCollectionParser *tagFormat; + PKCollectionParser *lexiconURI; + PKCollectionParser *weight; + PKCollectionParser *repeat; + PKCollectionParser *probability; + PKCollectionParser *externalRuleRef; + PKCollectionParser *token; + PKCollectionParser *languageAttachment; + PKCollectionParser *tag; + PKCollectionParser *grammar; + PKCollectionParser *declaration; + PKCollectionParser *baseDecl; + PKCollectionParser *languageDecl; + PKCollectionParser *modeDecl; + PKCollectionParser *rootRuleDecl; + PKCollectionParser *tagFormatDecl; + PKCollectionParser *lexiconDecl; + PKCollectionParser *metaDecl; + PKCollectionParser *tagDecl; + PKCollectionParser *ruleDefinition; + PKCollectionParser *scope; + PKCollectionParser *ruleExpansion; + PKCollectionParser *ruleAlternative; + PKCollectionParser *sequenceElement; + PKCollectionParser *subexpansion; + PKCollectionParser *ruleRef; + PKCollectionParser *localRuleRef; + PKCollectionParser *specialRuleRef; + PKCollectionParser *repeatOperator; + + PKCollectionParser *baseURI; + PKCollectionParser *languageCode; + PKCollectionParser *ABNF_URI; + PKCollectionParser *ABNF_URI_with_Media_Type; +} +- (id)parse:(NSString *)s; +- (PKAssembly *)assemblyWithString:(NSString *)s; + +@property (nonatomic, retain) PKCollectionParser *selfIdentHeader; +@property (nonatomic, retain) PKCollectionParser *ruleName; +@property (nonatomic, retain) PKCollectionParser *tagFormat; +@property (nonatomic, retain) PKCollectionParser *lexiconURI; +@property (nonatomic, retain) PKCollectionParser *weight; +@property (nonatomic, retain) PKCollectionParser *repeat; +@property (nonatomic, retain) PKCollectionParser *probability; +@property (nonatomic, retain) PKCollectionParser *externalRuleRef; +@property (nonatomic, retain) PKCollectionParser *token; +@property (nonatomic, retain) PKCollectionParser *languageAttachment; +@property (nonatomic, retain) PKCollectionParser *tag; +@property (nonatomic, retain) PKCollectionParser *grammar; +@property (nonatomic, retain) PKCollectionParser *declaration; +@property (nonatomic, retain) PKCollectionParser *baseDecl; +@property (nonatomic, retain) PKCollectionParser *languageDecl; +@property (nonatomic, retain) PKCollectionParser *modeDecl; +@property (nonatomic, retain) PKCollectionParser *rootRuleDecl; +@property (nonatomic, retain) PKCollectionParser *tagFormatDecl; +@property (nonatomic, retain) PKCollectionParser *lexiconDecl; +@property (nonatomic, retain) PKCollectionParser *metaDecl; +@property (nonatomic, retain) PKCollectionParser *tagDecl; +@property (nonatomic, retain) PKCollectionParser *ruleDefinition; +@property (nonatomic, retain) PKCollectionParser *scope; +@property (nonatomic, retain) PKCollectionParser *ruleExpansion; +@property (nonatomic, retain) PKCollectionParser *ruleAlternative; +@property (nonatomic, retain) PKCollectionParser *sequenceElement; +@property (nonatomic, retain) PKCollectionParser *subexpansion; +@property (nonatomic, retain) PKCollectionParser *ruleRef; +@property (nonatomic, retain) PKCollectionParser *localRuleRef; +@property (nonatomic, retain) PKCollectionParser *specialRuleRef; +@property (nonatomic, retain) PKCollectionParser *repeatOperator; + +@property (nonatomic, retain) PKCollectionParser *baseURI; +@property (nonatomic, retain) PKCollectionParser *languageCode; +@property (nonatomic, retain) PKCollectionParser *ABNF_URI; +@property (nonatomic, retain) PKCollectionParser *ABNF_URI_with_Media_Type; +@end diff --git a/test/.svn/text-base/SRGSParser.m.svn-base b/test/.svn/text-base/SRGSParser.m.svn-base new file mode 100644 index 0000000..a330989 --- /dev/null +++ b/test/.svn/text-base/SRGSParser.m.svn-base @@ -0,0 +1,786 @@ +// +// SRGSParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "SRGSParser.h" +#import "NSString+ParseKitAdditions.h" + +@interface SRGSParser () +- (void)didMatchWord:(PKAssembly *)a; +- (void)didMatchNum:(PKAssembly *)a; +- (void)didMatchQuotedString:(PKAssembly *)a; +- (void)didMatchStar:(PKAssembly *)a; +- (void)didMatchQuestion:(PKAssembly *)a; +- (void)didMatchAnd:(PKAssembly *)a; +- (void)didMatchOr:(PKAssembly *)a; +- (void)didMatchAssignment:(PKAssembly *)a; +- (void)didMatchVariable:(PKAssembly *)a; +@end + +@implementation SRGSParser + +- (id)init { + if (self = [super init]) { + [self add:self.grammar]; + } + return self; +} + + +- (void)dealloc { + self.selfIdentHeader = nil; + self.ruleName = nil; + self.tagFormat = nil; + self.lexiconURI = nil; + self.weight = nil; + self.repeat = nil; + self.probability = nil; + self.externalRuleRef = nil; + self.token = nil; + self.languageAttachment = nil; + self.tag = nil; + self.grammar = nil; + self.declaration = nil; + self.baseDecl = nil; + self.languageDecl = nil; + self.modeDecl = nil; + self.rootRuleDecl = nil; + self.tagFormatDecl = nil; + self.lexiconDecl = nil; + self.metaDecl = nil; + self.tagDecl = nil; + self.ruleDefinition = nil; + self.scope = nil; + self.ruleExpansion = nil; + self.ruleAlternative = nil; + self.sequenceElement = nil; + self.subexpansion = nil; + self.ruleRef = nil; + self.localRuleRef = nil; + self.specialRuleRef = nil; + self.repeatOperator = nil; + + self.baseURI = nil; + self.languageCode = nil; + self.ABNF_URI = nil; + self.ABNF_URI_with_Media_Type = nil; + [super dealloc]; +} + + +- (id)parse:(NSString *)s { + PKAssembly *a = [self assemblyWithString:s]; + a = [self completeMatchFor:a]; + return [a pop]; +} + + +- (PKAssembly *)assemblyWithString:(NSString *)s { + PKTokenizer *t = [[[PKTokenizer alloc] initWithString:s] autorelease]; + [t setTokenizerState:t.symbolState from: '-' to: '-']; + [t setTokenizerState:t.symbolState from: '.' to: '.']; + //[t.wordState setWordChars:YES from:'-' to:'-']; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:t]; + // TDNCNameState *NCNameState = [[[TDNCNameState alloc] init] autorelease]; + return a; +} + + +//selfIdentHeader ::= '#ABNF' #x20 VersionNumber (#x20 CharEncoding)? ';' +//VersionNumber ::= '1.0' +//CharEncoding ::= Nmtoken +- (PKCollectionParser *)selfIdentHeader { + if (!selfIdentHeader) { + self.selfIdentHeader = [PKSequence sequence]; + selfIdentHeader.name = @"selfIdentHeader"; + + [selfIdentHeader add:[PKSymbol symbolWithString:@"#"]]; + [selfIdentHeader add:[PKLiteral literalWithString:@"ABNF"]]; + [selfIdentHeader add:[PKNumber number]]; // VersionNumber + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:[PKWord word]]; // CharEncoding + + [selfIdentHeader add:a]; + [selfIdentHeader add:[PKSymbol symbolWithString:@";"]]; + } + return selfIdentHeader; +} + + +//RuleName ::= '$' ConstrainedName +//ConstrainedName ::= Name - (Char* ('.' | ':' | '-') Char*) +- (PKCollectionParser *)ruleName { + if (!ruleName) { + self.ruleName = [PKSequence sequence]; + [ruleName add:[PKSymbol symbolWithString:@"$"]]; + [ruleName add:[PKWord word]]; // TODO: ConstrainedName + } + return ruleName; +} + +//TagFormat ::= ABNF_URI +- (PKCollectionParser *)tagFormat { + if (!tagFormat) { + self.tagFormat = self.ABNF_URI; + } + return tagFormat; +} + + +//LexiconURI ::= ABNF_URI | ABNF_URI_with_Media_Type +- (PKCollectionParser *)lexiconURI { + if (!lexiconURI) { + self.lexiconURI = [PKAlternation alternation]; + [lexiconURI add:self.ABNF_URI]; + [lexiconURI add:self.ABNF_URI_with_Media_Type]; + } + return lexiconURI; +} + + +//Weight ::= '/' Number '/' +- (PKCollectionParser *)weight { + if (!weight) { + self.weight = [PKSequence sequence]; + [weight add:[PKSymbol symbolWithString:@"/"]]; + [weight add:[PKNumber number]]; + [weight add:[PKSymbol symbolWithString:@"/"]]; + } + return weight; +} + + +//Repeat ::= [0-9]+ ('-' [0-9]*)? +- (PKCollectionParser *)repeat { + if (!repeat) { + self.repeat = [PKSequence sequence]; + [repeat add:[PKNumber number]]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"-"]]; + [s add:[PKNumber number]]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:s]; + + [repeat add:a]; + } + return repeat; +} + + +//Probability ::= '/' Number '/' +- (PKCollectionParser *)probability { + if (!probability) { + self.probability = [PKSequence sequence]; + [probability add:[PKSymbol symbolWithString:@"/"]]; + [probability add:[PKNumber number]]; + [probability add:[PKSymbol symbolWithString:@"/"]]; + } + return probability; +} + + + +//ExternalRuleRef ::= '$' ABNF_URI | '$' ABNF_URI_with_Media_Type +- (PKCollectionParser *)externalRuleRef { + if (!externalRuleRef) { + self.externalRuleRef = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"$"]]; + [s add:self.ABNF_URI]; + [externalRuleRef add:s]; + + s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"$"]]; + [s add:self.ABNF_URI_with_Media_Type]; + [externalRuleRef add:s]; + } + return externalRuleRef; +} + + +//Token ::= Nmtoken | DoubleQuotedCharacters +- (PKCollectionParser *)token { + if (!token) { + self.token = [PKAlternation alternation]; + [token add:[PKWord word]]; + [token add:[PKQuotedString quotedString]]; + } + return token; +} + + +//LanguageAttachment ::= '!' LanguageCode +- (PKCollectionParser *)languageAttachment { + if (!languageAttachment) { + self.languageAttachment = [PKSequence sequence]; + [languageAttachment add:[PKSymbol symbolWithString:@"!"]]; + [languageAttachment add:self.languageCode]; + } + return languageAttachment; +} + + +//Tag ::= '{' [^}]* '}' | '{!{' (Char* - (Char* '}!}' Char*)) '}!}' +- (PKCollectionParser *)tag { + if (!tag) { + self.tag = [PKAlternation alternation]; + + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"{"]]; + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKWord word]]; + [a add:[PKNumber number]]; + [a add:[PKSymbol symbol]]; + [a add:[PKQuotedString quotedString]]; + [s add:[PKRepetition repetitionWithSubparser:a]]; + [s add:[PKSymbol symbolWithString:@"}"]]; + [tag add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"{!{"]]; + a = [PKAlternation alternation]; + [a add:[PKWord word]]; + [a add:[PKNumber number]]; + [a add:[PKSymbol symbol]]; + [a add:[PKQuotedString quotedString]]; + [s add:[PKRepetition repetitionWithSubparser:a]]; + [s add:[PKLiteral literalWithString:@"}!}"]]; + [tag add:s]; + } + return tag; +} + + +#pragma mark - +#pragma mark Grammar + +// grammar ::= selfIdentHeader declaration* ruleDefinition* +- (PKCollectionParser *)grammar { + if (!grammar) { + self.grammar = [PKSequence sequence]; + [grammar add:self.selfIdentHeader]; + [grammar add:[PKRepetition repetitionWithSubparser:self.declaration]]; + [grammar add:[PKRepetition repetitionWithSubparser:self.ruleDefinition]]; + } + return grammar; +} + +// declaration ::= baseDecl | languageDecl | modeDecl | rootRuleDecl | tagFormatDecl | lexiconDecl | metaDecl | tagDecl +- (PKCollectionParser *)declaration { + if (!declaration) { + self.declaration = [PKAlternation alternation]; + [declaration add:self.baseDecl]; + [declaration add:self.languageDecl]; + [declaration add:self.modeDecl]; + [declaration add:self.rootRuleDecl]; + [declaration add:self.tagFormatDecl]; + [declaration add:self.lexiconDecl]; + [declaration add:self.tagDecl]; + } + return declaration; +} + +// baseDecl ::= 'base' BaseURI ';' +- (PKCollectionParser *)baseDecl { + if (!baseDecl) { + self.baseDecl = [PKSequence sequence]; + [baseDecl add:[PKLiteral literalWithString:@"base"]]; + [baseDecl add:self.baseURI]; + [baseDecl add:[PKSymbol symbolWithString:@";"]]; + } + return baseDecl; +} + +// languageDecl ::= 'language' LanguageCode ';' +- (PKCollectionParser *)languageDecl { + if (!languageDecl) { + self.languageDecl = [PKSequence sequence]; + [languageDecl add:[PKLiteral literalWithString:@"language"]]; + [languageDecl add:self.languageCode]; + [languageDecl add:[PKSymbol symbolWithString:@";"]]; + } + return languageDecl; +} + + + +// modeDecl ::= 'mode' 'voice' ';' | 'mode' 'dtmf' ';' +- (PKCollectionParser *)modeDecl { + if (!modeDecl) { + self.modeDecl = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"mode"]]; + [s add:[PKLiteral literalWithString:@"voice"]]; + [s add:[PKSymbol symbolWithString:@";"]]; + [modeDecl add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"mode"]]; + [s add:[PKLiteral literalWithString:@"dtmf"]]; + [s add:[PKSymbol symbolWithString:@";"]]; + [modeDecl add:s]; + } + return modeDecl; +} + + +// rootRuleDecl ::= 'root' RuleName ';' +- (PKCollectionParser *)rootRuleDecl { + if (!rootRuleDecl) { + self.rootRuleDecl = [PKSequence sequence]; + [rootRuleDecl add:[PKLiteral literalWithString:@"root"]]; + [rootRuleDecl add:self.ruleName]; + [rootRuleDecl add:[PKSymbol symbolWithString:@";"]]; + } + return rootRuleDecl; +} + + +// tagFormatDecl ::= 'tag-format' TagFormat ';' +- (PKCollectionParser *)tagFormatDecl { + if (!tagFormatDecl) { + self.tagFormatDecl = [PKSequence sequence]; + [tagFormatDecl add:[PKLiteral literalWithString:@"tag-format"]]; + [tagFormatDecl add:self.tagFormat]; + [tagFormatDecl add:[PKSymbol symbolWithString:@";"]]; + } + return tagFormatDecl; +} + + + +// lexiconDecl ::= 'lexicon' LexiconURI ';' +- (PKCollectionParser *)lexiconDecl { + if (!lexiconDecl) { + self.lexiconDecl = [PKSequence sequence]; + [lexiconDecl add:[PKLiteral literalWithString:@"lexicon"]]; + [lexiconDecl add:self.lexiconURI]; + [lexiconDecl add:[PKSymbol symbolWithString:@";"]]; + } + return lexiconDecl; +} + + +// metaDecl ::= +// 'http-equiv' QuotedCharacters 'is' QuotedCharacters ';' +// | 'meta' QuotedCharacters 'is' QuotedCharacters ';' +- (PKCollectionParser *)metaDecl { + if (!metaDecl) { + self.metaDecl = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"http-equiv"]]; + [s add:[PKQuotedString quotedString]]; + [s add:[PKLiteral literalWithString:@"is"]]; + [s add:[PKQuotedString quotedString]]; + [s add:[PKSymbol symbolWithString:@";"]]; + [metaDecl add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"meta"]]; + [s add:[PKQuotedString quotedString]]; + [s add:[PKLiteral literalWithString:@"is"]]; + [s add:[PKQuotedString quotedString]]; + [s add:[PKSymbol symbolWithString:@";"]]; + [metaDecl add:s]; + } + return metaDecl; +} + + + +// tagDecl ::= Tag ';' +- (PKCollectionParser *)tagDecl { + if (!tagDecl) { + self.tagDecl = [PKSequence sequence]; + [tagDecl add:self.tag]; + [tagDecl add:[PKSymbol symbolWithString:@";"]]; + } + return tagDecl; +} + + +// ruleDefinition ::= scope? RuleName '=' ruleExpansion ';' +- (PKCollectionParser *)ruleDefinition { + if (!ruleDefinition) { + self.ruleDefinition = [PKSequence sequence]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.scope]; + + [ruleDefinition add:a]; + [ruleDefinition add:self.ruleName]; + [ruleDefinition add:[PKSymbol symbolWithString:@"="]]; + [ruleDefinition add:self.ruleExpansion]; + [ruleDefinition add:[PKSymbol symbolWithString:@";"]]; + } + return ruleDefinition; +} + +// scope ::= 'private' | 'public' +- (PKCollectionParser *)scope { + if (!scope) { + self.scope = [PKAlternation alternation]; + [scope add:[PKLiteral literalWithString:@"private"]]; + [scope add:[PKLiteral literalWithString:@"public"]]; + } + return scope; +} + + +// ruleExpansion ::= ruleAlternative ( '|' ruleAlternative )* +- (PKCollectionParser *)ruleExpansion { + if (!ruleExpansion) { + self.ruleExpansion = [PKSequence sequence]; + [ruleExpansion add:self.ruleAlternative]; + + PKSequence *pipeRuleAlternative = [PKSequence sequence]; + [pipeRuleAlternative add:[PKSymbol symbolWithString:@"|"]]; + [pipeRuleAlternative add:self.ruleAlternative]; + [ruleExpansion add:[PKRepetition repetitionWithSubparser:pipeRuleAlternative]]; + } + return ruleExpansion; +} + + +// ruleAlternative ::= Weight? sequenceElement+ +- (PKCollectionParser *)ruleAlternative { + if (!ruleAlternative) { + self.ruleAlternative = [PKSequence sequence]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.weight]; + + [ruleAlternative add:a]; + [ruleAlternative add:self.sequenceElement]; + [ruleAlternative add:[PKRepetition repetitionWithSubparser:self.sequenceElement]]; + } + return ruleAlternative; +} + +// sequenceElement ::= subexpansion | subexpansion repeatOperator + +// me: changing to: +// sequenceElement ::= subexpansion repeatOperator? +- (PKCollectionParser *)sequenceElement { + if (!sequenceElement) { +// self.sequenceElement = [PKAlternation alternation]; +// [sequenceElement add:self.subexpansion]; +// +// PKSequence *s = [PKSequence sequence]; +// [s add:self.subexpansion]; +// [s add:self.repeatOperator]; +// +// [sequenceElement add:s]; + + self.sequenceElement = [PKSequence sequence]; + [sequenceElement add:self.subexpansion]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.repeatOperator]; + + [sequenceElement add:a]; + } + return sequenceElement; +} + +// subexpansion ::= +// Token LanguageAttachment? +// | ruleRef +// | Tag +// | '(' ')' +// | '(' ruleExpansion ')' LanguageAttachment? +// | '[' ruleExpansion ']' LanguageAttachment? +- (PKCollectionParser *)subexpansion { + if (!subexpansion) { + self.subexpansion = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:self.token]; + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.languageAttachment]; + [s add:a]; + [subexpansion add:s]; + + [subexpansion add:self.ruleRef]; + [subexpansion add:self.tag]; + + s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:[PKSymbol symbolWithString:@")"]]; + [subexpansion add:s]; + + s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:self.ruleExpansion]; + [s add:[PKSymbol symbolWithString:@")"]]; + a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.languageAttachment]; + [s add:a]; + [subexpansion add:s]; + + s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"["]]; + [s add:self.ruleExpansion]; + [s add:[PKSymbol symbolWithString:@"]"]]; + a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.languageAttachment]; + [s add:a]; + [subexpansion add:s]; + } + return subexpansion; +} + + +// ruleRef ::= localRuleRef | ExternalRuleRef | specialRuleRef +- (PKCollectionParser *)ruleRef { + if (!ruleRef) { + self.ruleRef = [PKAlternation alternation]; + [ruleRef add:self.localRuleRef]; + [ruleRef add:self.externalRuleRef]; + [ruleRef add:self.specialRuleRef]; + } + return ruleRef; +} + +// localRuleRef ::= RuleName +- (PKCollectionParser *)localRuleRef { + if (!localRuleRef) { + self.localRuleRef = self.ruleName; + } + return localRuleRef; +} + + +// specialRuleRef ::= '$NULL' | '$VOID' | '$GARBAGE' +- (PKCollectionParser *)specialRuleRef { + if (!specialRuleRef) { + self.specialRuleRef = [PKAlternation alternation]; + [specialRuleRef add:[PKLiteral literalWithString:@"$NULL"]]; + [specialRuleRef add:[PKLiteral literalWithString:@"$VOID"]]; + [specialRuleRef add:[PKLiteral literalWithString:@"$GARBAGE"]]; + } + return specialRuleRef; +} + + +// repeatOperator ::='<' Repeat Probability? '>' +- (PKCollectionParser *)repeatOperator { + if (!repeatOperator) { + self.repeatOperator = [PKSequence sequence]; + [repeatOperator add:[PKSymbol symbolWithString:@"<"]]; + [repeatOperator add:self.repeat]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.probability]; + [repeatOperator add:a]; + + [repeatOperator add:[PKSymbol symbolWithString:@">"]]; + } + return repeatOperator; +} + + +//BaseURI ::= ABNF_URI +- (PKCollectionParser *)baseURI { + if (!baseURI) { + self.baseURI = [PKWord word]; + } + return baseURI; +} + + +//LanguageCode ::= Nmtoken +- (PKCollectionParser *)languageCode { + if (!languageCode) { + self.languageCode = [PKSequence sequence]; + [languageCode add:[PKWord word]]; +// [languageCode add:[PKSymbol symbolWithString:@"-"]]; +// [languageCode add:[PKWord word]]; + } + return languageCode; +} + + +- (PKCollectionParser *)ABNF_URI { + if (!ABNF_URI) { + self.ABNF_URI = [PKWord word]; + } + return ABNF_URI; +} + + +- (PKCollectionParser *)ABNF_URI_with_Media_Type { + if (!ABNF_URI_with_Media_Type) { + self.ABNF_URI_with_Media_Type = [PKWord word]; + } + return ABNF_URI_with_Media_Type; +} + + + +#pragma mark - +#pragma mark Assembler Methods + +- (void)didMatchWord:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + [a push:[PKLiteral literalWithString:tok.stringValue]]; +} + + +- (void)didMatchNum:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + [a push:[PKLiteral literalWithString:tok.stringValue]]; +} + + +- (void)didMatchQuotedString:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + + PKSequence *p = [PKSequence sequence]; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKToken *eof = [PKToken EOFToken]; + while (eof != (tok = [t nextToken])) { + [p add:[PKLiteral literalWithString:tok.stringValue]]; + } + + [a push:p]; +} + + +- (void)didMatchStar:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKRepetition *p = [PKRepetition repetitionWithSubparser:[a pop]]; + [a push:p]; +} + + +- (void)didMatchQuestion:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKAlternation *p = [PKAlternation alternation]; + [p add:[a pop]]; + [p add:[PKEmpty empty]]; + [a push:p]; +} + + +- (void)didMatchAnd:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + id top = [a pop]; + PKSequence *p = [PKSequence sequence]; + [p add:[a pop]]; + [p add:top]; + [a push:p]; +} + + +- (void)didMatchOr:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + id top = [a pop]; +// NSLog(@"top: %@", top); +// NSLog(@"top class: %@", [top class]); + PKAlternation *p = [PKAlternation alternation]; + [p add:[a pop]]; + [p add:top]; + [a push:p]; +} + + +- (void)didMatchAssignment:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + id val = [a pop]; + PKToken *keyTok = [a pop]; + + NSMutableDictionary *table = [NSMutableDictionary dictionaryWithDictionary:a.target]; + [table setObject:val forKey:keyTok.stringValue]; + a.target = table; +} + + +- (void)didMatchVariable:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKToken *keyTok = [a pop]; + id val = [a.target objectForKey:keyTok.stringValue]; + +// PKParser *p = nil; +// if (valTok.isWord) { +// p = [PKWord wordWithString:valTok.value]; +// } else if (valTok.isQuotedString) { +// p = [PKQuotedString quotedStringWithString:valTok.value]; +// } else if (valTok.isNumber) { +// p = [PKNum numWithString:valTok.stringValue]; +// } + + [a push:val]; +} + +@synthesize selfIdentHeader; +@synthesize ruleName; +@synthesize tagFormat; +@synthesize lexiconURI; +@synthesize weight; +@synthesize repeat; +@synthesize probability; +@synthesize externalRuleRef; +@synthesize token; +@synthesize languageAttachment; +@synthesize tag; +@synthesize grammar; +@synthesize declaration; +@synthesize baseDecl; +@synthesize languageDecl; +@synthesize modeDecl; +@synthesize rootRuleDecl; +@synthesize tagFormatDecl; +@synthesize lexiconDecl; +@synthesize metaDecl; +@synthesize tagDecl; +@synthesize ruleDefinition; +@synthesize scope; +@synthesize ruleExpansion; +@synthesize ruleAlternative; +@synthesize sequenceElement; +@synthesize subexpansion; +@synthesize ruleRef; +@synthesize localRuleRef; +@synthesize specialRuleRef; +@synthesize repeatOperator; + +@synthesize baseURI; +@synthesize languageCode; +@synthesize ABNF_URI; +@synthesize ABNF_URI_with_Media_Type; +@end \ No newline at end of file diff --git a/test/.svn/text-base/SRGSParserTest.h.svn-base b/test/.svn/text-base/SRGSParserTest.h.svn-base new file mode 100644 index 0000000..f4f3cab --- /dev/null +++ b/test/.svn/text-base/SRGSParserTest.h.svn-base @@ -0,0 +1,20 @@ +// +// SRGSParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +#import "SRGSParser.h" + +@interface SRGSParserTest : SenTestCase { + NSString *s; + SRGSParser *p; + PKAssembly *a; + PKAssembly *result; +} + +@end diff --git a/test/.svn/text-base/SRGSParserTest.m.svn-base b/test/.svn/text-base/SRGSParserTest.m.svn-base new file mode 100644 index 0000000..399d5e1 --- /dev/null +++ b/test/.svn/text-base/SRGSParserTest.m.svn-base @@ -0,0 +1,196 @@ +// +// SRGSParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "SRGSParserTest.h" + +@implementation SRGSParserTest + +- (void)setUp { + p = [[[SRGSParser alloc] init] autorelease]; +} + + +- (void)test { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"example1" ofType:@"srgs"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDNotNil(result); + NSLog(@"\n\n\n result: %@ \n\n\n", result); +// TDEqualObjects(@"[#, ABNF, 1.0, ;]#/ABNF/1.0/;^", [result description]); +} + +- (void)testSelfIdentHeader { + s = @"#ABNF 1.0;"; + a = [p assemblyWithString:s]; + result = [p.selfIdentHeader bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[#, ABNF, 1.0, ;]#/ABNF/1.0/;^", [result description]); + + s = @"#ABNF 1.0 UTF;"; + a = [p assemblyWithString:s]; + result = [p.selfIdentHeader bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[#, ABNF, 1.0, UTF, ;]#/ABNF/1.0/UTF/;^", [result description]); +} + + +- (void)testRuleName { + s = @"$foobar"; + a = [p assemblyWithString:s]; + result = [p.ruleName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[$, foobar]$/foobar^", [result description]); +} + + +- (void)testWeight { + s = @"/4.0/"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [p.weight bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[/, 4.0, /]//4.0//^", [result description]); +} + + +- (void)testProbability { + s = @"/4.0/"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [p.probability bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[/, 4.0, /]//4.0//^", [result description]); +} + + +- (void)testRepeat { + s = @"1 - 4"; + a = [p assemblyWithString:s]; + result = [p.repeat bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[1, -, 4]1/-/4^", [result description]); + + s = @"1-4"; + a = [p assemblyWithString:s]; + result = [p.repeat bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[1, -, 4]1/-/4^", [result description]); +} + + +- (void)testToken { + s = @"foobar"; + a = [p assemblyWithString:s]; + result = [p.token bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foobar]foobar^", [result description]); + + s = @"'foobar'"; + a = [p assemblyWithString:s]; + result = [p.token bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"['foobar']'foobar'^", [result description]); +} + + +- (void)testTag { + s = @"{foobar}"; + a = [p assemblyWithString:s]; + result = [p.tag bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[{, foobar, }]{/foobar/}^", [result description]); + + s = @"{bar baz}"; + a = [p assemblyWithString:s]; + result = [p.tag bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[{, bar, baz, }]{/bar/baz/}^", [result description]); + + s = @"{bar 1.2 baz}"; + a = [p assemblyWithString:s]; + result = [p.tag bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[{, bar, 1.2, baz, }]{/bar/1.2/baz/}^", [result description]); + + s = @"{!{'foobar'}!}"; + a = [p assemblyWithString:s]; + result = [p.tag bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[{, !, {, 'foobar', }, !, }]{/!/{/'foobar'/}/!/}^", [result description]); + + s = @"{!{'foobar' baz}!}"; + a = [p assemblyWithString:s]; + result = [p.tag bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[{, !, {, 'foobar', baz, }, !, }]{/!/{/'foobar'/baz/}/!/}^", [result description]); +} + + +- (void)testBaseDecl { + s = @"base url-goes-here;"; + a = [p assemblyWithString:s]; + result = [p.baseDecl bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[base, url-goes-here, ;]base/url-goes-here/;^", [result description]); +} + + +- (void)testLanguageDecl { + s = @"language en-us;"; + a = [p assemblyWithString:s]; + result = [p.languageDecl bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[language, en-us, ;]language/en-us/;^", [result description]); +} + + +- (void)testModeDecl { + s = @"mode voice;"; + a = [p assemblyWithString:s]; + result = [p.modeDecl bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[mode, voice, ;]mode/voice/;^", [result description]); + + s = @"mode dtmf;"; + a = [p assemblyWithString:s]; + result = [p.modeDecl bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[mode, dtmf, ;]mode/dtmf/;^", [result description]); +} + + +- (void)testRootRuleDecl { + s = @"root $foobar;"; + a = [p assemblyWithString:s]; + result = [p.rootRuleDecl bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[root, $, foobar, ;]root/$/foobar/;^", [result description]); +} + + +- (void)testLanguageAttachment { + s = @"!en-us"; + a = [p assemblyWithString:s]; + result = [p.languageAttachment bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[!, en-us]!/en-us^", [result description]); +} + + +- (void)testRepeatOperator { + s = @"<0-2 /0.6/>"; + a = [p assemblyWithString:s]; + result = [p.repeatOperator bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[<, 0, -, 2, /, 0.6, /, >]^", [result description]); +} + + + + +@end diff --git a/test/.svn/text-base/TDAlternationTest.h.svn-base b/test/.svn/text-base/TDAlternationTest.h.svn-base new file mode 100644 index 0000000..430b7e2 --- /dev/null +++ b/test/.svn/text-base/TDAlternationTest.h.svn-base @@ -0,0 +1,17 @@ +// +// PKAlternationTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDAlternationTest : SenTestCase { + PKCollectionParser *p; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDAlternationTest.m.svn-base b/test/.svn/text-base/TDAlternationTest.m.svn-base new file mode 100644 index 0000000..37d55b7 --- /dev/null +++ b/test/.svn/text-base/TDAlternationTest.m.svn-base @@ -0,0 +1,97 @@ +// +// PKAlternationTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDAlternationTest.h" + +@implementation TDAlternationTest + +- (void)tearDown { + [a release]; +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz { + s = @"foo baz bar"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKAlternation alternation]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"bar"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo]foo^baz/bar", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz1 { + s = @"123 baz bar"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKAlternation alternation]; + [p add:[PKLiteral literalWithString:@"bar"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + [p add:[PKNumber number]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123]123^baz/bar", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz2 { + s = @"123 baz bar"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + PKParser *w = [PKWord word]; + PKParser *baz = [PKLiteral literalWithString:@"baz"]; + PKParser *n = [PKNumber number]; + p = [PKAlternation alternationWithSubparsers:w, baz, n, nil]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123]123^baz/bar", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz3 { + s = @"123 baz bar"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKAlternation alternation]; + [p add:[PKWord word]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKNumber number]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123]123^baz/bar", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz4 { + s = @"123 baz bar"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKAlternation alternation]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + [p add:[PKNumber number]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123]123^baz/bar", [result description]); +} + +@end diff --git a/test/.svn/text-base/TDArithmeticAssembler.h.svn-base b/test/.svn/text-base/TDArithmeticAssembler.h.svn-base new file mode 100644 index 0000000..409fd74 --- /dev/null +++ b/test/.svn/text-base/TDArithmeticAssembler.h.svn-base @@ -0,0 +1,15 @@ +// +// TDArithmeticAssembler.h +// ParseKit +// +// Created by Todd Ditchendorf on 9/4/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface TDArithmeticAssembler : NSObject { + +} + +@end diff --git a/test/.svn/text-base/TDArithmeticAssembler.m.svn-base b/test/.svn/text-base/TDArithmeticAssembler.m.svn-base new file mode 100644 index 0000000..e480791 --- /dev/null +++ b/test/.svn/text-base/TDArithmeticAssembler.m.svn-base @@ -0,0 +1,58 @@ +// +// TDArithmeticAssembler.m +// ParseKit +// +// Created by Todd Ditchendorf on 9/4/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDArithmeticAssembler.h" +#import + +@implementation TDArithmeticAssembler + +- (void)didMatchPlus:(PKAssembly *)a { + PKToken *tok2 = [a pop]; + PKToken *tok1 = [a pop]; + [a push:[NSNumber numberWithDouble:tok1.floatValue + tok2.floatValue]]; +} + + +- (void)didMatchMinus:(PKAssembly *)a { + PKToken *tok2 = [a pop]; + PKToken *tok1 = [a pop]; + [a push:[NSNumber numberWithDouble:tok1.floatValue - tok2.floatValue]]; +} + + +- (void)didMatchTimes:(PKAssembly *)a { + PKToken *tok2 = [a pop]; + PKToken *tok1 = [a pop]; + [a push:[NSNumber numberWithDouble:tok1.floatValue * tok2.floatValue]]; +} + + +- (void)didMatchDivide:(PKAssembly *)a { + PKToken *tok2 = [a pop]; + PKToken *tok1 = [a pop]; + [a push:[NSNumber numberWithDouble:tok1.floatValue / tok2.floatValue]]; +} + + +- (void)didMatchExp:(PKAssembly *)a { + PKToken *tok2 = [a pop]; + PKToken *tok1 = [a pop]; + + CGFloat n1 = tok1.floatValue; + CGFloat n2 = tok2.floatValue; + + CGFloat res = n1; + NSUInteger i = 1; + for ( ; i < n2; i++) { + res *= n1; + } + + [a push:[NSNumber numberWithDouble:res]]; +} + +@end diff --git a/test/.svn/text-base/TDArithmeticParser.h.svn-base b/test/.svn/text-base/TDArithmeticParser.h.svn-base new file mode 100644 index 0000000..ec2da0e --- /dev/null +++ b/test/.svn/text-base/TDArithmeticParser.h.svn-base @@ -0,0 +1,33 @@ +// +// PKArithmeticParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface TDArithmeticParser : PKSequence { + PKCollectionParser *exprParser; + PKCollectionParser *termParser; + PKCollectionParser *plusTermParser; + PKCollectionParser *minusTermParser; + PKCollectionParser *factorParser; + PKCollectionParser *timesFactorParser; + PKCollectionParser *divFactorParser; + PKCollectionParser *exponentFactorParser; + PKCollectionParser *phraseParser; +} +- (double)parse:(NSString *)s; + +@property (retain) PKCollectionParser *exprParser; +@property (retain) PKCollectionParser *termParser; +@property (retain) PKCollectionParser *plusTermParser; +@property (retain) PKCollectionParser *minusTermParser; +@property (retain) PKCollectionParser *factorParser; +@property (retain) PKCollectionParser *timesFactorParser; +@property (retain) PKCollectionParser *divFactorParser; +@property (retain) PKCollectionParser *exponentFactorParser; +@property (retain) PKCollectionParser *phraseParser; +@end diff --git a/test/.svn/text-base/TDArithmeticParser.m.svn-base b/test/.svn/text-base/TDArithmeticParser.m.svn-base new file mode 100644 index 0000000..6a029de --- /dev/null +++ b/test/.svn/text-base/TDArithmeticParser.m.svn-base @@ -0,0 +1,247 @@ +// +// PKArithmeticParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDArithmeticParser.h" + +/* + expr = term (plusTerm | minusTerm)* + term = factor (timesFactor | divFactor)* + plusTerm = '+' term + minusTerm = '-' term + factor = phrase exponentFactor | phrase + timesFactor = '*' factor + divFactor = '/' factor + exponentFactor = '^' factor + phrase = '(' expr ')' | Number +*/ + +@implementation TDArithmeticParser + +- (id)init { + if (self = [super init]) { + [self add:self.exprParser]; + } + return self; +} + + +- (void)dealloc { + self.exprParser = nil; + self.termParser = nil; + self.plusTermParser = nil; + self.minusTermParser = nil; + self.factorParser = nil; + self.timesFactorParser = nil; + self.divFactorParser = nil; + self.exponentFactorParser = nil; + self.phraseParser = nil; + [super dealloc]; +} + + +- (double)parse:(NSString *)s { + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + a = [self completeMatchFor:a]; +// NSLog(@"\n\na: %@\n\n", a); + NSNumber *n = [a pop]; + double f = [n doubleValue]; + return f; +} + + +// expr = term (plusTerm | minusTerm)* +- (PKCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [PKSequence sequence]; + [exprParser add:self.termParser]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:self.plusTermParser]; + [a add:self.minusTermParser]; + + [exprParser add:[PKRepetition repetitionWithSubparser:a]]; + } + return exprParser; +} + + +// term = factor (timesFactor | divFactor)* +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + [termParser add:self.factorParser]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:self.timesFactorParser]; + [a add:self.divFactorParser]; + + [termParser add:[PKRepetition repetitionWithSubparser:a]]; + } + return termParser; +} + + +// plusTerm = '+' term +- (PKCollectionParser *)plusTermParser { + if (!plusTermParser) { + self.plusTermParser = [PKSequence sequence]; + [plusTermParser add:[[PKSymbol symbolWithString:@"+"] discard]]; + [plusTermParser add:self.termParser]; + [plusTermParser setAssembler:self selector:@selector(didMatchPlus:)]; + } + return plusTermParser; +} + + +// minusTerm = '-' term +- (PKCollectionParser *)minusTermParser { + if (!minusTermParser) { + self.minusTermParser = [PKSequence sequence]; + [minusTermParser add:[[PKSymbol symbolWithString:@"-"] discard]]; + [minusTermParser add:self.termParser]; + [minusTermParser setAssembler:self selector:@selector(didMatchMinus:)]; + } + return minusTermParser; +} + + +// factor = phrase exponentFactor | phrase +- (PKCollectionParser *)factorParser { + if (!factorParser) { + self.factorParser = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:self.phraseParser]; + [s add:self.exponentFactorParser]; + + [factorParser add:s]; + [factorParser add:self.phraseParser]; + } + return factorParser; +} + + +// timesFactor = '*' factor +- (PKCollectionParser *)timesFactorParser { + if (!timesFactorParser) { + self.timesFactorParser = [PKSequence sequence]; + [timesFactorParser add:[[PKSymbol symbolWithString:@"*"] discard]]; + [timesFactorParser add:self.factorParser]; + [timesFactorParser setAssembler:self selector:@selector(didMatchTimes:)]; + } + return timesFactorParser; +} + + +// divFactor = '/' factor +- (PKCollectionParser *)divFactorParser { + if (!divFactorParser) { + self.divFactorParser = [PKSequence sequence]; + [divFactorParser add:[[PKSymbol symbolWithString:@"/"] discard]]; + [divFactorParser add:self.factorParser]; + [divFactorParser setAssembler:self selector:@selector(didMatchDivide:)]; + } + return divFactorParser; +} + + +// exponentFactor = '^' factor +- (PKCollectionParser *)exponentFactorParser { + if (!exponentFactorParser) { + self.exponentFactorParser = [PKSequence sequence]; + [exponentFactorParser add:[[PKSymbol symbolWithString:@"^"] discard]]; + [exponentFactorParser add:self.factorParser]; + [exponentFactorParser setAssembler:self selector:@selector(didMatchExp:)]; + } + return exponentFactorParser; +} + + +// phrase = '(' expr ')' | Number +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + self.phraseParser = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:[[PKSymbol symbolWithString:@"("] discard]]; + [s add:self.exprParser]; + [s add:[[PKSymbol symbolWithString:@")"] discard]]; + + [phraseParser add:s]; + + PKNumber *n = [PKNumber number]; + [n setAssembler:self selector:@selector(didMatchNumber:)]; + [phraseParser add:n]; + } + return phraseParser; +} + + +#pragma mark - +#pragma mark Assembler + +- (void)didMatchNumber:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithDouble:tok.floatValue]]; +} + + +- (void)didMatchPlus:(PKAssembly *)a { + NSNumber *n2 = [a pop]; + NSNumber *n1 = [a pop]; + [a push:[NSNumber numberWithDouble:[n1 doubleValue] + [n2 doubleValue]]]; +} + + +- (void)didMatchMinus:(PKAssembly *)a { + NSNumber *n2 = [a pop]; + NSNumber *n1 = [a pop]; + [a push:[NSNumber numberWithDouble:[n1 doubleValue] - [n2 doubleValue]]]; +} + + +- (void)didMatchTimes:(PKAssembly *)a { + NSNumber *n2 = [a pop]; + NSNumber *n1 = [a pop]; + [a push:[NSNumber numberWithDouble:[n1 doubleValue] * [n2 doubleValue]]]; +} + + +- (void)didMatchDivide:(PKAssembly *)a { + NSNumber *n2 = [a pop]; + NSNumber *n1 = [a pop]; + [a push:[NSNumber numberWithDouble:[n1 doubleValue] / [n2 doubleValue]]]; +} + + +- (void)didMatchExp:(PKAssembly *)a { + NSNumber *n2 = [a pop]; + NSNumber *n1 = [a pop]; + + double d1 = [n1 doubleValue]; + double d2 = [n2 doubleValue]; + + double res = d1; + NSUInteger i = 1; + for ( ; i < d2; i++) { + res *= d1; + } + + [a push:[NSNumber numberWithDouble:res]]; +} + +@synthesize exprParser; +@synthesize termParser; +@synthesize plusTermParser; +@synthesize minusTermParser; +@synthesize factorParser; +@synthesize timesFactorParser; +@synthesize divFactorParser; +@synthesize exponentFactorParser; +@synthesize phraseParser; +@end diff --git a/test/.svn/text-base/TDArithmeticParserTest.h.svn-base b/test/.svn/text-base/TDArithmeticParserTest.h.svn-base new file mode 100644 index 0000000..45ae814 --- /dev/null +++ b/test/.svn/text-base/TDArithmeticParserTest.h.svn-base @@ -0,0 +1,18 @@ +// +// PKArithmeticParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "TDArithmeticParser.h" + +@interface TDArithmeticParserTest : SenTestCase { + NSString *s; + TDArithmeticParser *p; + double result; +} + +@end diff --git a/test/.svn/text-base/TDArithmeticParserTest.m.svn-base b/test/.svn/text-base/TDArithmeticParserTest.m.svn-base new file mode 100644 index 0000000..0fbfddb --- /dev/null +++ b/test/.svn/text-base/TDArithmeticParserTest.m.svn-base @@ -0,0 +1,342 @@ +// +// PKArithmeticParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDArithmeticParserTest.h" + +@implementation TDArithmeticParserTest + +- (void)setUp { + p = [TDArithmeticParser parser]; +} + + +- (void)testOne { + s = @"1"; + result = [p parse:s]; + TDEquals((double)1.0, result); +} + + +- (void)testFortySeven { + s = @"47"; + result = [p parse:s]; + TDEquals((double)47.0, result); +} + + +- (void)testNegativeZero { + s = @"-0"; + result = [p parse:s]; + TDEquals((double)-0.0, result); +} + + +- (void)testNegativeOne { + s = @"-1"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testOnePlusOne { + s = @"1 + 1"; + result = [p parse:s]; + TDEquals((double)2.0, result); +} + + +- (void)testOnePlusNegativeOne { + s = @"1 + -1"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testNegativeOnePlusOne { + s = @"-1 + 1"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testOneHundredPlusZero { + s = @"100 + 0"; + result = [p parse:s]; + TDEquals((double)100.0, result); +} + + +- (void)testNegativeOnePlusZero { + s = @"-1 + 0"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testNegativeZeroPlusZero { + s = @"-0 + 0"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testNegativeZeroPlusNegativeZero { + s = @"-0 + -0"; + result = [p parse:s]; + TDEquals((double)-0.0, result); +} + + +- (void)testOneMinusOne { + s = @"1 - 1"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testOneMinusNegativeOne { + s = @"1 - -1"; + result = [p parse:s]; + TDEquals((double)2.0, result); +} + + +- (void)testNegativeOneMinusOne { + s = @"-1 - 1"; + result = [p parse:s]; + TDEquals((double)-2.0, result); +} + + +- (void)testOneHundredMinusZero { + s = @"100 - 0"; + result = [p parse:s]; + TDEquals((double)100.0, result); +} + + +- (void)testNegativeOneMinusZero { + s = @"-1 - 0"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testNegativeZeroMinusZero { + s = @"-0 - 0"; + result = [p parse:s]; + TDEquals((double)-0.0, result); +} + + +- (void)testNegativeZeroMinusNegativeZero { + s = @"-0 - -0"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testOneTimesOne { + s = @"1 * 1"; + result = [p parse:s]; + TDEquals((double)1.0, result); +} + + +- (void)testTwoTimesFour { + s = @"2 * 4"; + result = [p parse:s]; + TDEquals((double)8.0, result); +} + + +- (void)testOneTimesNegativeOne { + s = @"1 * -1"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testNegativeOneTimesOne { + s = @"-1 * 1"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testOneHundredTimesZero { + s = @"100 * 0"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testNegativeOneTimesZero { + s = @"-1 * 0"; + result = [p parse:s]; + TDEquals((double)-0.0, result); +} + + +- (void)testNegativeZeroTimesZero { + s = @"-0 * 0"; + result = [p parse:s]; + TDEquals((double)-0.0, result); +} + + +- (void)testNegativeZeroTimesNegativeZero { + s = @"-0 * -0"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testOneDivOne { + s = @"1 / 1"; + result = [p parse:s]; + TDEquals((double)1.0, result); +} + + +- (void)testTwoDivFour { + s = @"2 / 4"; + result = [p parse:s]; + TDEquals((double)0.5f, result); +} + + +- (void)testFourDivTwo { + s = @"4 / 2"; + result = [p parse:s]; + TDEquals((double)2.0, result); +} + + +- (void)testOneDivNegativeOne { + s = @"1 / -1"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testNegativeOneDivOne { + s = @"-1 / 1"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testOneHundredDivZero { + s = @"100 / 0"; + result = [p parse:s]; + TDEquals((double)INFINITY, result); +} + + +- (void)testNegativeOneDivZero { + s = @"-1 / 0"; + result = [p parse:s]; + TDEquals((double)-INFINITY, result); +} + + +- (void)testNegativeZeroDivZero { + s = @"-0 / 0"; + result = [p parse:s]; + TDEquals((double)NAN, result); +} + + +- (void)testNegativeZeroDivNegativeZero { + s = @"-0 / -0"; + result = [p parse:s]; + TDEquals((double)NAN, result); +} + + +- (void)test1Exp1 { + s = @"1 ^ 1"; + result = [p parse:s]; + TDEquals((double)1.0, result); +} + + +- (void)test1Exp2 { + s = @"1 ^ 2"; + result = [p parse:s]; + TDEquals((double)1.0, result); +} + + +- (void)test9Exp2 { + s = @"9 ^ 2"; + result = [p parse:s]; + TDEquals((double)81.0, result); +} + + +- (void)test9ExpNegative2 { + s = @"9 ^ -2"; + result = [p parse:s]; + TDEquals((double)9.0, result); +} + + +#pragma mark - +#pragma mark Associativity + +- (void)test7minus3minus1 { // minus associativity + s = @"7 - 3 - 1"; + result = [p parse:s]; + TDEquals((double)3.0, (double)result); +} + + +- (void)test9exp2minus81 { // exp associativity + s = @"9^2 - 81"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)test2exp1exp4 { // exp + s = @"2 ^ 1 ^ 4"; + result = [p parse:s]; + TDEquals((double)2.0, result); +} + + +- (void)test100minus5exp2times3 { // exp + s = @"100 - 5^2*3"; + result = [p parse:s]; + TDEquals((double)25.0, result); +} + + +- (void)test100minus25times3 { // precedence + s = @"100 - 25*3"; + result = [p parse:s]; + STAssertEqualsWithAccuracy((double)25.0, result, 1.0, @""); +} + + +- (void)test100minus25times3Parens { // precedence + s = @"(100 - 25)*3"; + result = [p parse:s]; + TDEquals((double)225.0, result); +} + + +- (void)test100minus5exp2times3Parens { // precedence + s = @"(100 - 5^2)*3"; + result = [p parse:s]; + TDEquals((double)225.0, result); +} + +@end diff --git a/test/.svn/text-base/TDBlob.h.svn-base b/test/.svn/text-base/TDBlob.h.svn-base new file mode 100644 index 0000000..efd81fc --- /dev/null +++ b/test/.svn/text-base/TDBlob.h.svn-base @@ -0,0 +1,17 @@ +// +// PKBlob.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface TDBlob : PKTerminal { + +} ++ (id)blob; + ++ (id)blobWithStartMarker:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDBlob.m.svn-base b/test/.svn/text-base/TDBlob.m.svn-base new file mode 100644 index 0000000..1be3c69 --- /dev/null +++ b/test/.svn/text-base/TDBlob.m.svn-base @@ -0,0 +1,34 @@ +// +// PKBlob.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDBlob.h" +#import +#import "PKToken+Blob.h" + +@implementation TDBlob + ++ (id)blob { + return [self blobWithStartMarker:nil]; +} + + ++ (id)blobWithStartMarker:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + BOOL result = tok.isBlob; + if (self.string) { + result = [tok.stringValue hasPrefix:self.string]; + } + return result; +} + +@end diff --git a/test/.svn/text-base/TDBlobState.h.svn-base b/test/.svn/text-base/TDBlobState.h.svn-base new file mode 100644 index 0000000..d387d5e --- /dev/null +++ b/test/.svn/text-base/TDBlobState.h.svn-base @@ -0,0 +1,15 @@ +// +// PKBlobState.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface TDBlobState : PKTokenizerState { + +} + +@end diff --git a/test/.svn/text-base/TDBlobState.m.svn-base b/test/.svn/text-base/TDBlobState.m.svn-base new file mode 100644 index 0000000..51dcd49 --- /dev/null +++ b/test/.svn/text-base/TDBlobState.m.svn-base @@ -0,0 +1,45 @@ +// +// PKBlobState.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDBlobState.h" +#import +#import +#import "PKToken+Blob.h" + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@implementation TDBlobState + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + [self resetWithReader:r]; + + PKUniChar c = cin; + do { + [self append:c]; + c = [r read]; + } while (PKEOF != c && !isspace(c)); + + if (PKEOF != c) { + [r unread]; + } + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeBlob stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; +} + +@end diff --git a/test/.svn/text-base/TDCharTest.h.svn-base b/test/.svn/text-base/TDCharTest.h.svn-base new file mode 100644 index 0000000..2c7d7ff --- /dev/null +++ b/test/.svn/text-base/TDCharTest.h.svn-base @@ -0,0 +1,19 @@ +// +// PKCharTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + + +@interface TDCharTest : SenTestCase { + NSString *s; + PKCharacterAssembly *a; + PKChar *p; + PKAssembly *result; +} + +@end diff --git a/test/.svn/text-base/TDCharTest.m.svn-base b/test/.svn/text-base/TDCharTest.m.svn-base new file mode 100644 index 0000000..0c517f3 --- /dev/null +++ b/test/.svn/text-base/TDCharTest.m.svn-base @@ -0,0 +1,59 @@ +// +// PKCharTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDCharTest.h" + +@interface PKAssembly () +- (BOOL)hasMore; +@end + +@implementation TDCharTest + +- (void)test123 { + s = @"123"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^123", [a description]); + p = [PKChar char]; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[1]1^23", [result description]); + TDTrue([a hasMore]); +} + + +- (void)testAbc { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^abc", [a description]); + p = [PKChar char]; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[a]a^bc", [result description]); + TDTrue([a hasMore]); +} + +- (void)testRepetition { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^abc", [a description]); + p = [PKChar char]; + PKParser *r = [PKRepetition repetitionWithSubparser:p]; + + result = [r bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[a, b, c]abc^", [result description]); + TDFalse([result hasMore]); +} + + +@end diff --git a/test/.svn/text-base/TDCharacterAssemblyTest.h.svn-base b/test/.svn/text-base/TDCharacterAssemblyTest.h.svn-base new file mode 100644 index 0000000..6df14e3 --- /dev/null +++ b/test/.svn/text-base/TDCharacterAssemblyTest.h.svn-base @@ -0,0 +1,18 @@ +// +// PKCharacterAssemblyTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + + +@interface TDCharacterAssemblyTest : SenTestCase { + NSString *s; + PKCharacterAssembly *a; + PKAssembly *result; +} + +@end diff --git a/test/.svn/text-base/TDCharacterAssemblyTest.m.svn-base b/test/.svn/text-base/TDCharacterAssemblyTest.m.svn-base new file mode 100644 index 0000000..692fdbd --- /dev/null +++ b/test/.svn/text-base/TDCharacterAssemblyTest.m.svn-base @@ -0,0 +1,59 @@ +// +// PKCharacterAssemblyTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDCharacterAssemblyTest.h" + +@interface PKAssembly () +- (id)next; +- (BOOL)hasMore; +@property (nonatomic, readonly) NSUInteger objectsConsumed; +@property (nonatomic, readonly) NSUInteger objectsRemaining; +@end + +@implementation TDCharacterAssemblyTest + +- (void)testAbc { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDNotNil(a); + TDEquals((NSUInteger)3, [s length]); + TDEquals((NSUInteger)0, a.objectsConsumed); + TDEquals((NSUInteger)3, a.objectsRemaining); + TDEquals(YES, [a hasMore]); + + id obj = [a next]; + TDEqualObjects(obj, [NSNumber numberWithInteger:'a']); + TDEquals((NSUInteger)3, [s length]); + TDEquals((NSUInteger)1, a.objectsConsumed); + TDEquals((NSUInteger)2, a.objectsRemaining); + TDEquals(YES, [a hasMore]); + + obj = [a next]; + TDEqualObjects(obj, [NSNumber numberWithInteger:'b']); + TDEquals((NSUInteger)3, [s length]); + TDEquals((NSUInteger)2, a.objectsConsumed); + TDEquals((NSUInteger)1, a.objectsRemaining); + TDEquals(YES, [a hasMore]); + + obj = [a next]; + TDEqualObjects(obj, [NSNumber numberWithInteger:'c']); + TDEquals((NSUInteger)3, [s length]); + TDEquals((NSUInteger)3, a.objectsConsumed); + TDEquals((NSUInteger)0, a.objectsRemaining); + TDEquals(NO, [a hasMore]); + + obj = [a next]; + TDNil(obj); + TDEquals((NSUInteger)3, [s length]); + TDEquals((NSUInteger)3, a.objectsConsumed); + TDEquals((NSUInteger)0, a.objectsRemaining); + TDEquals(NO, [a hasMore]); +} + +@end diff --git a/test/.svn/text-base/TDCommentStateTest.h.svn-base b/test/.svn/text-base/TDCommentStateTest.h.svn-base new file mode 100644 index 0000000..88f45c7 --- /dev/null +++ b/test/.svn/text-base/TDCommentStateTest.h.svn-base @@ -0,0 +1,19 @@ +// +// PKCommentStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/28/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDCommentStateTest : SenTestCase { + PKCommentState *commentState; + PKReader *r; + PKTokenizer *t; + NSString *s; + PKToken *tok; +} + +@end diff --git a/test/.svn/text-base/TDCommentStateTest.m.svn-base b/test/.svn/text-base/TDCommentStateTest.m.svn-base new file mode 100644 index 0000000..a2a72d3 --- /dev/null +++ b/test/.svn/text-base/TDCommentStateTest.m.svn-base @@ -0,0 +1,486 @@ +// +// PKCommentStateTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/28/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDCommentStateTest.h" + +@implementation TDCommentStateTest + +- (void)setUp { + r = [[PKReader alloc] init]; + t = [[PKTokenizer alloc] init]; + commentState = t.commentState; +} + + +- (void)tearDown { + [r release]; + [t release]; +} + + +- (void)testSlashSlashFoo { + s = @"// foo"; + r.string = s; + t.string = s; + tok = [commentState nextTokenFromReader:r startingWith:'/' tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(tok.offset, (NSUInteger)-1); + TDEquals([r read], PKEOF); +} + + +- (void)testReportSlashSlashFoo { + s = @"// foo"; + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.offset, (NSUInteger)0); + TDEqualObjects([t nextToken], [PKToken EOFToken]); +} + + +- (void)testReportSpaceSlashSlashFoo { + s = @" // foo"; + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"// foo"); + TDEquals(tok.offset, (NSUInteger)1); + TDEqualObjects([t nextToken], [PKToken EOFToken]); +} + + +- (void)testTurnOffSlashSlashFoo { + s = @"// foo"; + r.string = s; + t.string = s; + [commentState removeSingleLineStartMarker:@"//"]; + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"/"); + TDEquals(tok.offset, (NSUInteger)0); + TDEquals([r read], (PKUniChar)'/'); +} + + +- (void)testHashFoo { + s = @"# foo"; + r.string = s; + t.string = s; + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.offset, (NSUInteger)2); + + r.string = s; + t.string = s; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)1); +} + + +- (void)testAddHashFoo { + s = @"# foo"; + t.string = s; + [commentState addSingleLineStartMarker:@"#"]; + [t setTokenizerState:commentState from:'#' to:'#']; + tok = [t nextToken]; + TDEquals(tok, [PKToken EOFToken]); + TDEqualObjects(tok.stringValue, [[PKToken EOFToken] stringValue]); + TDEquals(tok.offset, (NSUInteger)-1); +} + + +- (void)testReportAddHashFoo { + s = @"# foo"; + t.string = s; + commentState.reportsCommentTokens = YES; + [commentState addSingleLineStartMarker:@"#"]; + [t setTokenizerState:commentState from:'#' to:'#']; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testSlashStarFooStarSlash { + s = @"/* foo */"; + t.string = s; + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals([r read], PKEOF); +} + + +- (void)testSlashStarFooStarSlashSpace { + s = @"/* foo */ "; + t.string = s; + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals([r read], PKEOF); +} + + +- (void)testReportSlashStarFooStarSlash { + s = @"/* foo */"; + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals([t nextToken], [PKToken EOFToken]); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testReportSlashStarFooStarSlashSpace { + s = @"/* foo */ "; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEquals(tok.offset, (NSUInteger)0); + TDEqualObjects(tok.stringValue, @"/* foo */"); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); +} + + +- (void)testReportSlashStarFooStarSlashSpaceA { + s = @"/* foo */ a"; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)10); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)9); +} + + +- (void)testReportSlashStarStarFooStarSlashSpaceA { + s = @"/** foo */ a"; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/** foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)11); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/** foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)10); +} + + +- (void)testReportSlashStarFooStarStarSlashSpaceA { + s = @"/* foo **/ a"; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo **/"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)11); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo **/"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)10); +} + + +- (void)testReportSlashStarFooStarSlashSpaceStarSlash { + s = @"/* foo */ */"; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"*"); + TDEquals(tok.offset, (NSUInteger)10); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)9); +} + + +- (void)testTurnOffSlashStarFooStarSlash { + s = @"/* foo */"; + t.string = s; + [commentState removeMultiLineStartMarker:@"/*"]; + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"/"); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testReportSlashStarFooStar { + s = @"/* foo *"; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testReportBalancedSlashStarFooStar { + s = @"/* foo *"; + t.string = s; + commentState.reportsCommentTokens = YES; + commentState.balancesEOFTerminatedComments = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo **/"); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testReportBalancedSlashStarFoo { + s = @"/* foo "; + t.string = s; + commentState.reportsCommentTokens = YES; + commentState.balancesEOFTerminatedComments = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testXMLFooStarXMLA { + s = @" a"; + t.string = s; + [commentState addMultiLineStartMarker:@""]; + [t setTokenizerState:commentState from:'<' to:'<']; + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)13); + + t.string = s; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)12); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)13); +} + + +- (void)testReportXMLFooStarXMLA { + s = @" a"; + t.string = s; + commentState.reportsCommentTokens = YES; + [commentState addMultiLineStartMarker:@""]; + [t setTokenizerState:commentState from:'<' to:'<']; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @""); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)13); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @""); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)12); +} + + +- (void)testXXMarker { + s = @"XX foo XX a"; + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + [commentState addMultiLineStartMarker:@"XX" endMarker:@"XX"]; + [t setTokenizerState:commentState from:'X' to:'X']; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"XX foo XX"); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"XX foo XX"); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); +} + + +- (void)testXXMarkerFalseStartMarkerMatch { + s = @"X foo X a"; + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + [commentState addMultiLineStartMarker:@"XX" endMarker:@"XX"]; + [t setTokenizerState:commentState from:'X' to:'X']; + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"X"); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"X"); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLuaComments { + s = @"--[comment"; + t.string = s; + + [t setTokenizerState:t.symbolState from:'/' to:'/']; + [t setTokenizerState:t.commentState from:'-' to:'-']; + + [t.commentState addSingleLineStartMarker:@"--"]; + [t.commentState addMultiLineStartMarker:@"--[[" endMarker:@"]]"]; + + t.commentState.reportsCommentTokens = YES; + + PKToken *eof = [PKToken EOFToken]; + + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + + tok = [t nextToken]; + TDEquals(eof, tok); +} + + +- (void)testLuaComments2 { + s = @"--[[[comment]]"; + t.string = s; + + [t setTokenizerState:t.symbolState from:'/' to:'/']; + [t setTokenizerState:t.commentState from:'-' to:'-']; + + [t.commentState addSingleLineStartMarker:@"--"]; + [t.commentState addMultiLineStartMarker:@"--[[" endMarker:@"]]"]; + + t.commentState.reportsCommentTokens = YES; + + PKToken *eof = [PKToken EOFToken]; + + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + + tok = [t nextToken]; + TDEquals(eof, tok); +} + +@end diff --git a/test/.svn/text-base/TDDelimitStateTest.h.svn-base b/test/.svn/text-base/TDDelimitStateTest.h.svn-base new file mode 100644 index 0000000..65c9c5f --- /dev/null +++ b/test/.svn/text-base/TDDelimitStateTest.h.svn-base @@ -0,0 +1,18 @@ +// +// PKDelimitStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 5/21/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDDelimitStateTest : SenTestCase { + PKDelimitState *delimitState; + PKTokenizer *t; + NSString *s; + PKToken *tok; +} + +@end diff --git a/test/.svn/text-base/TDDelimitStateTest.m.svn-base b/test/.svn/text-base/TDDelimitStateTest.m.svn-base new file mode 100644 index 0000000..bf059e7 --- /dev/null +++ b/test/.svn/text-base/TDDelimitStateTest.m.svn-base @@ -0,0 +1,824 @@ +// +// PKDelimitStateTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 5/21/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDDelimitStateTest.h" + +@implementation TDDelimitStateTest + +- (void)setUp { + t = [[PKTokenizer alloc] init]; + delimitState = t.delimitState; +} + + +- (void)tearDown { + [t release]; +} + + +- (void)testLtFooGt { + s = @""; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testSlashFooSlash { + s = @"/foo/"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'/' to:'/']; + [delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testSlashFooSlashBar { + s = @"/foo/bar"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'/' to:'/']; + [delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"/foo/"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"bar"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testSlashFooSlashSemi { + s = @"/foo/;"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'/' to:'/']; + [delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"/foo/"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @";"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtFooGtWithFOAllowed { + s = @""; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"fo"]; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtFooGtWithFAllowed { + s = @""; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"f"]; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"<"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @">"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtFooGtWithFAllowedAndRemove { + s = @""; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<" endMarker:@">" allowedCharacterSet:cs]; + [delimitState removeStartMarker:@"<"]; + + tok = [t nextToken]; + + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"<"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @">"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooGt { + s = @"<#foo>"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<#" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooGtWithFOAllowed { + s = @"<#foo>"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"fo"]; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<#" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooGtWithFAllowed { + s = @"<#foo>"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"f"]; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<#" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"<"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @">"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooGtWithFAllowedAndMultiCharSymbol { + s = @"<#foo>"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"f"]; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<#" endMarker:@">" allowedCharacterSet:cs]; + + [t.symbolState add:@"<#"]; + + tok = [t nextToken]; + + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"<#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @">"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooHashGt { + s = @"=#foo#="; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'=' to:'=']; + [delimitState addStartMarker:@"=#" endMarker:@"#=" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooHashGtWithFOAllowed { + s = @"=#foo#="; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"fo"]; + + [t setTokenizerState:delimitState from:'=' to:'=']; + [delimitState addStartMarker:@"=#" endMarker:@"#=" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooHashGtWithFAllowed { + s = @"=#foo#="; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"f"]; + + [t setTokenizerState:delimitState from:'=' to:'=']; + [delimitState addStartMarker:@"=#" endMarker:@"#=" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"="); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"="); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollar123Dollar { + s = @"$123$"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$" endMarker:@"$" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarDollar { + s = @"$$123$$"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$$" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarHash { + s = @"$$123$#"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarHashDecimalDigitAllowed { + s = @"$$123$#"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet decimalDigitCharacterSet]; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarHashAlphanumericAllowed { + s = @"$$123$#"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet alphanumericCharacterSet]; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarHashAlphanumericAndWhitespaceAndNewlineAllowed { + s = @"$$123 456\t789\n0$#"; + t.string = s; + NSMutableCharacterSet *cs = [[[NSCharacterSet alphanumericCharacterSet] mutableCopy] autorelease]; + [cs formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]]; + [cs formUnionWithCharacterSet:[NSCharacterSet newlineCharacterSet]]; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarHashWhitespaceAllowed { + s = @"$$123$#"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet whitespaceCharacterSet]; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"123"); + TDEquals(tok.floatValue, (CGFloat)123.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollarDollarHash { + s = @"$$$#"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollarDollar { + s = @"$$$"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollarDollarBalanceEOFStrings { + s = @"$$$"; + t.string = s; + NSCharacterSet *cs = nil; + + delimitState.balancesEOFTerminatedStrings = YES; + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"$$$$#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testPHPPrint { + s = @""; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testPHP { + s = @""; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testEnvVars { + s = @"${PRODUCT_NAME} or ${EXECUTABLE_NAME}"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"ABCDEFGHIJKLMNOPQRSTUVWXYZ_"]; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"${" endMarker:@"}" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"${PRODUCT_NAME}"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"or"); + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"${EXECUTABLE_NAME}"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testCocoaString { + s = @"@\"foo\""; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'@' to:'@']; + [delimitState addStartMarker:@"@\"" endMarker:@"\"" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAlphaMarkerXX { + s = @"XXfooXX"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'X' to:'X']; + [delimitState addStartMarker:@"XX" endMarker:@"XX" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAlphaMarkerXXAndXXX { + s = @"XXfooXXX"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'X' to:'X']; + [delimitState addStartMarker:@"XX" endMarker:@"XXX" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAlphaMarkerXXFails { + s = @"XXfooXX"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet whitespaceCharacterSet]; + + [t setTokenizerState:delimitState from:'X' to:'X']; + [delimitState addStartMarker:@"XX" endMarker:@"XX" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAlphaMarkerXXFalseStartMarker { + s = @"XfooXX"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet whitespaceCharacterSet]; + + [t setTokenizerState:delimitState from:'X' to:'X']; + [delimitState addStartMarker:@"XX" endMarker:@"XX" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAtStartMarkerNilEndMarker { + s = @"@foo"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet alphanumericCharacterSet]; + + [t setTokenizerState:delimitState from:'@' to:'@']; + [delimitState addStartMarker:@"@" endMarker:nil allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAtStartMarkerNilEndMarker2 { + s = @"@foo bar @ @baz "; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet alphanumericCharacterSet]; + + [t setTokenizerState:delimitState from:'@' to:'@']; + [delimitState addStartMarker:@"@" endMarker:nil allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"@foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"bar"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"@"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"@baz"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testUnbalancedElementStartTag { + s = @"" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"<"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + t.string = s; + delimitState.allowsUnbalancedStrings = YES; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @" + +@class PKTokenizer; +@class PKToken; + +@interface TDFastJsonParser : NSObject { + PKTokenizer *tokenizer; + NSMutableArray *stack; + PKToken *curly; + PKToken *bracket; +} +- (id)parse:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDFastJsonParser.m.svn-base b/test/.svn/text-base/TDFastJsonParser.m.svn-base new file mode 100644 index 0000000..b0023f3 --- /dev/null +++ b/test/.svn/text-base/TDFastJsonParser.m.svn-base @@ -0,0 +1,135 @@ +// +// PKFastJsonParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDFastJsonParser.h" +#import "ParseKit.h" +#import "NSString+ParseKitAdditions.h" + +@interface TDFastJsonParser () +- (void)didMatchDictionary; +- (void)didMatchArray; +- (NSArray *)objectsAbove:(id)fence; + +@property (retain) PKTokenizer *tokenizer; +@property (retain) NSMutableArray *stack; +@property (retain) PKToken *curly; +@property (retain) PKToken *bracket; +@end + +@implementation TDFastJsonParser + +- (id)init { + if (self = [super init]) { + self.tokenizer = [PKTokenizer tokenizer]; + + // configure tokenizer + [tokenizer setTokenizerState:tokenizer.symbolState from: '/' to: '/']; // JSON doesn't have slash slash or slash star comments + [tokenizer setTokenizerState:tokenizer.symbolState from: '\'' to: '\'']; // JSON does not have single quoted strings + + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0.0]; + self.bracket = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"[" floatValue:0.0]; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.stack = nil; + self.curly = nil; + self.bracket = nil; + [super dealloc]; +} + + +- (id)parse:(NSString *)s { + self.stack = [NSMutableArray array]; + + tokenizer.string = s; + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + while ((tok = [tokenizer nextToken]) != eof) { + NSString *sval = tok.stringValue; + + if (tok.isSymbol) { + if ([@"{" isEqualToString:sval]) { + [stack addObject:tok]; + } else if ([@"}" isEqualToString:sval]) { + [self didMatchDictionary]; + } else if ([@"[" isEqualToString:sval]) { + [stack addObject:tok]; + } else if ([@"]" isEqualToString:sval]) { + [self didMatchArray]; + } + } else { + id value = nil; + if (tok.isQuotedString) { + value = [sval stringByTrimmingQuotes]; + } else if (tok.isNumber) { + value = [NSNumber numberWithFloat:tok.floatValue]; + } else { // if (tok.isWord) { + if ([@"null" isEqualToString:sval]) { + value = [NSNull null]; + } else if ([@"true" isEqualToString:sval]) { + value = [NSNumber numberWithBool:YES]; + } else if ([@"false" isEqualToString:sval]) { + value = [NSNumber numberWithBool:NO]; + } + } + [stack addObject:value]; + } + } + + return [stack lastObject]; +} + + +- (void)didMatchDictionary { + NSArray *a = [self objectsAbove:curly]; + NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity:[a count]/2.]; + + NSInteger i = [a count] - 1; + for ( ; i >= 0; i--) { + NSString *key = [a objectAtIndex:i--]; + id value = [a objectAtIndex:i]; + [result setObject:value forKey:key]; + } + + [stack addObject:result]; +} + + +- (void)didMatchArray { + NSArray *a = [self objectsAbove:bracket]; + NSMutableArray *result = [NSMutableArray arrayWithCapacity:[a count]]; + for (id obj in [a reverseObjectEnumerator]) { + [result addObject:obj]; + } + [stack addObject:result]; +} + + +- (NSArray *)objectsAbove:(id)fence { + NSMutableArray *result = [NSMutableArray array]; + while (1) { + id obj = [stack lastObject]; + [stack removeLastObject]; + if ([obj isEqual:fence]) { + break; + } + [result addObject:obj]; + } + return result; +} + +@synthesize stack; +@synthesize tokenizer; +@synthesize curly; +@synthesize bracket; +@end diff --git a/test/.svn/text-base/TDFastJsonParserTest.h.svn-base b/test/.svn/text-base/TDFastJsonParserTest.h.svn-base new file mode 100644 index 0000000..29c4d1b --- /dev/null +++ b/test/.svn/text-base/TDFastJsonParserTest.h.svn-base @@ -0,0 +1,16 @@ +// +// PKFastJsonParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "ParseKit.h" + +@interface TDFastJsonParserTest : SenTestCase { + +} + +@end diff --git a/test/.svn/text-base/TDFastJsonParserTest.m.svn-base b/test/.svn/text-base/TDFastJsonParserTest.m.svn-base new file mode 100644 index 0000000..7e75cc9 --- /dev/null +++ b/test/.svn/text-base/TDFastJsonParserTest.m.svn-base @@ -0,0 +1,33 @@ +// +// PKFastJsonParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDFastJsonParserTest.h" +#import "TDFastJsonParser.h" + +@implementation TDFastJsonParserTest + +- (void)testRun { + NSString *s = @"{\"foo\":\"bar\"}"; + TDFastJsonParser *p = [[[TDFastJsonParser alloc] init] autorelease]; + id result = [p parse:s]; + + NSLog(@"result"); + TDNotNil(result); +} + + +- (void)testCrunchBaseJsonParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDFastJsonParser *parser = [[[TDFastJsonParser alloc] init] autorelease]; + [parser parse:s]; + // id res = [parser parse:s]; + //NSLog(@"res %@", res); +} + +@end diff --git a/test/.svn/text-base/TDGenericAssembler.h.svn-base b/test/.svn/text-base/TDGenericAssembler.h.svn-base new file mode 100644 index 0000000..d35f306 --- /dev/null +++ b/test/.svn/text-base/TDGenericAssembler.h.svn-base @@ -0,0 +1,25 @@ +// +// PKGenericAssembler.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/22/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKAssembly; + +@interface TDGenericAssembler : NSObject { + NSMutableDictionary *attributes; + NSMutableDictionary *defaultProperties; + NSMutableDictionary *productionNames; + PKAssembly *currentAssembly; + NSString *prefix; + NSString *suffix; +} +@property (nonatomic, retain) NSMutableDictionary *attributes; +@property (nonatomic, retain) NSMutableDictionary *defaultProperties; +@property (nonatomic, retain) NSMutableDictionary *productionNames; +@property (nonatomic, retain) PKAssembly *currentAssembly; +@end diff --git a/test/.svn/text-base/TDGenericAssembler.m.svn-base b/test/.svn/text-base/TDGenericAssembler.m.svn-base new file mode 100644 index 0000000..e6003ef --- /dev/null +++ b/test/.svn/text-base/TDGenericAssembler.m.svn-base @@ -0,0 +1,169 @@ +// +// PKGenericAssembler.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/22/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDGenericAssembler.h" +#import "NSArray+ParseKitAdditions.h" +#import + +@interface TDGenericAssembler () +- (void)didMatchTerminalNamed:(NSString *)name withAssembly:(PKAssembly *)a; +- (void)appendAttributedStringForObjects:(NSArray *)objs withAttrs:(id)attrs; +- (void)appendAttributedStringForObject:(id)obj withAttrs:(id)attrs; +- (NSMutableArray *)popWhitespaceTokensFrom:(PKAssembly *)a; +- (void)consumeWhitespaceTokens:(NSArray *)whitespaceToks; +- (void)consumeWhitespaceToken:(PKToken *)whitespaceTok; +- (void)consumeWhitespaceFrom:(PKAssembly *)a; + +@property (nonatomic, retain) NSString *prefix; +@property (nonatomic, retain) NSString *suffix; +@end + +@implementation TDGenericAssembler + +- (id)init { + if (self = [super init]) { + self.productionNames = [NSMutableDictionary dictionary]; + self.defaultProperties = [NSDictionary dictionaryWithObjectsAndKeys: + [NSColor blackColor], NSForegroundColorAttributeName, + [NSColor whiteColor], NSBackgroundColorAttributeName, + [NSFont fontWithName:@"Monaco" size:11.0], NSFontAttributeName, + nil]; + self.prefix = @"didMatch"; + self.suffix = @":"; + } + return self; +} + + +- (void)dealloc { + self.attributes = nil; + self.defaultProperties = nil; + self.productionNames = nil; + self.currentAssembly = nil; + self.prefix = nil; + self.suffix = nil; + [super dealloc]; +} + + +- (BOOL)respondsToSelector:(SEL)sel { + return YES; +} + + +- (id)performSelector:(SEL)sel withObject:(id)obj { + NSString *selName = NSStringFromSelector(sel); + + NSString *productionName = [productionNames objectForKey:selName]; + + if (!productionName) { + NSUInteger prefixLen = [prefix length]; + NSInteger c = ((NSInteger)[selName characterAtIndex:prefixLen]) + 32; // lowercase + NSRange r = NSMakeRange(prefixLen + 1, [selName length] - (prefixLen + [suffix length] + 1 /*:*/)); + productionName = [NSString stringWithFormat:@"%C%@", c, [selName substringWithRange:r]]; + [productionNames setObject:productionName forKey:selName]; + } + + [self didMatchTerminalNamed:productionName withAssembly:obj]; + + return nil; +} + + +- (void)didMatchTerminalNamed:(NSString *)name withAssembly:(PKAssembly *)a { + //NSLog(@"%@ : %@", name, a); + self.currentAssembly = a; + NSMutableArray *whitespaceToks = [self popWhitespaceTokensFrom:a]; + + id props = [attributes objectForKey:name]; + if (!props) props = defaultProperties; + + NSMutableArray *toks = nil; + PKToken *tok = nil; + while (tok = [a pop]) { + if (PKTokenTypeWhitespace != tok.tokenType) { + if (!toks) toks = [NSMutableArray array]; + [toks addObject:tok]; + } else { + [self consumeWhitespaceToken:tok]; + break; + } + } + + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:toks withAttrs:props]; + [self consumeWhitespaceTokens:whitespaceToks]; +} + + +- (void)appendAttributedStringForObjects:(NSArray *)objs withAttrs:(id)attrs { + for (id obj in objs) { + [self appendAttributedStringForObject:obj withAttrs:attrs]; + } +} + + +- (void)appendAttributedStringForObject:(id)obj withAttrs:(id)attrs { + NSMutableAttributedString *displayString = currentAssembly.target; + if (!displayString) { + displayString = [[[NSMutableAttributedString alloc] initWithString:@"" attributes:nil] autorelease]; + currentAssembly.target = displayString; + } + + + NSAttributedString *as = [[NSAttributedString alloc] initWithString:[obj stringValue] attributes:attrs]; + [displayString appendAttributedString:as]; + [as release]; +} + + +- (NSMutableArray *)popWhitespaceTokensFrom:(PKAssembly *)a { + NSMutableArray *whitespaceToks = nil; + PKToken *tok = nil; + while (tok = [a pop]) { + if (PKTokenTypeWhitespace == tok.tokenType) { + if (!whitespaceToks) { + whitespaceToks = [NSMutableArray array]; + } + [whitespaceToks addObject:tok]; + } else { + [a push:tok]; + break; + } + } + if (whitespaceToks) { + whitespaceToks = [whitespaceToks reversedMutableArray]; + } + return whitespaceToks; +} + + +- (void)consumeWhitespaceTokens:(NSArray *)whitespaceToks { + [self appendAttributedStringForObjects:whitespaceToks withAttrs:nil]; +} + + +- (void)consumeWhitespaceToken:(PKToken *)whitespaceTok { + [self appendAttributedStringForObject:whitespaceTok withAttrs:nil]; +} + + +- (void)consumeWhitespaceFrom:(PKAssembly *)a { + NSMutableArray *whitespaceToks = [self popWhitespaceTokensFrom:a]; + if (whitespaceToks) { + [self consumeWhitespaceTokens:whitespaceToks]; + } +} + +@synthesize attributes; +@synthesize defaultProperties; +@synthesize productionNames; +@synthesize currentAssembly; +@synthesize prefix; +@synthesize suffix; +@end diff --git a/test/.svn/text-base/TDGenericAssemblerTest.h.svn-base b/test/.svn/text-base/TDGenericAssemblerTest.h.svn-base new file mode 100644 index 0000000..374da85 --- /dev/null +++ b/test/.svn/text-base/TDGenericAssemblerTest.h.svn-base @@ -0,0 +1,25 @@ +// +// PKGenericAssemblerTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" +#import "TDMiniCSSAssembler.h" +#import "TDGenericAssembler.h" + +@interface TDGenericAssemblerTest : SenTestCase { + NSString *path; + NSString *grammarString; + NSString *s; + TDMiniCSSAssembler *cssAssember; + PKParserFactory *factory; + PKParser *cssParser; + PKAssembly *a; + TDGenericAssembler *genericAssember; +} + +@end diff --git a/test/.svn/text-base/TDGenericAssemblerTest.m.svn-base b/test/.svn/text-base/TDGenericAssemblerTest.m.svn-base new file mode 100644 index 0000000..2f574cc --- /dev/null +++ b/test/.svn/text-base/TDGenericAssemblerTest.m.svn-base @@ -0,0 +1,66 @@ +// +// PKGenericAssemblerTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDGenericAssemblerTest.h" + +@implementation TDGenericAssemblerTest + +- (void)setUp { + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + cssAssember = [[TDMiniCSSAssembler alloc] init]; + factory = [PKParserFactory factory]; + cssParser = [factory parserFromGrammar:grammarString assembler:cssAssember]; +} + + +- (void)tearDown { + [cssAssember release]; +} + + +- (void)testColor { + TDNotNil(cssParser); + + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"css"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + a = [PKTokenAssembly assemblyWithString:s]; + a = [cssParser bestMatchFor:a]; + + TDNotNil(cssAssember.attributes); + id props = [cssAssember.attributes objectForKey:@"openCurly"]; + TDNotNil(props); + +// color:red; +// background-color:blue; +// font-family:'Helvetica'; +// font-size:17px; + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEqualObjects([font familyName], @"Monaco"); + TDEquals((CGFloat)[font pointSize], (CGFloat)11.0); + + NSColor *bgColor = [props objectForKey:NSBackgroundColorAttributeName]; + TDNotNil(bgColor); + STAssertEqualsWithAccuracy([bgColor redComponent], (CGFloat)0.117, 0.001, @""); + STAssertEqualsWithAccuracy([bgColor greenComponent], (CGFloat)0.117, 0.001, @""); + STAssertEqualsWithAccuracy([bgColor blueComponent], (CGFloat)0.141, 0.001, @""); + + NSColor *color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)0.7, 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)0.14, 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)0.530, 0.001, @""); + +} + + + + +@end diff --git a/test/.svn/text-base/TDHtmlSyntaxHighlighter.h.svn-base b/test/.svn/text-base/TDHtmlSyntaxHighlighter.h.svn-base new file mode 100644 index 0000000..752cba9 --- /dev/null +++ b/test/.svn/text-base/TDHtmlSyntaxHighlighter.h.svn-base @@ -0,0 +1,54 @@ +// +// PKHtmlSyntaxHighlighter.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/28/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKTokenizer; +@class PKToken; + +@interface TDHtmlSyntaxHighlighter : NSObject { + BOOL isDarkBG; + BOOL inScript; + PKTokenizer *tokenizer; + NSMutableArray *stack; + PKToken *ltToken; + PKToken *gtToken; + PKToken *startCommentToken; + PKToken *endCommentToken; + PKToken *startCDATAToken; + PKToken *endCDATAToken; + PKToken *startPIToken; + PKToken *endPIToken; + PKToken *startDoctypeToken; + PKToken *fwdSlashToken; + PKToken *eqToken; + PKToken *scriptToken; + PKToken *endScriptToken; + + NSMutableAttributedString *highlightedString; + NSDictionary *tagAttributes; + NSDictionary *textAttributes; + NSDictionary *attrNameAttributes; + NSDictionary *attrValueAttributes; + NSDictionary *eqAttributes; + NSDictionary *commentAttributes; + NSDictionary *piAttributes; +} +- (id)initWithAttributesForDarkBackground:(BOOL)isDark; + +- (NSAttributedString *)attributedStringForString:(NSString *)s; + +@property (nonatomic, retain) NSMutableAttributedString *highlightedString; +@property (nonatomic, retain) NSDictionary *tagAttributes; +@property (nonatomic, retain) NSDictionary *textAttributes; +@property (nonatomic, retain) NSDictionary *attrNameAttributes; +@property (nonatomic, retain) NSDictionary *attrValueAttributes; +@property (nonatomic, retain) NSDictionary *eqAttributes; +@property (nonatomic, retain) NSDictionary *commentAttributes; +@property (nonatomic, retain) NSDictionary *piAttributes; +@end diff --git a/test/.svn/text-base/TDHtmlSyntaxHighlighter.m.svn-base b/test/.svn/text-base/TDHtmlSyntaxHighlighter.m.svn-base new file mode 100644 index 0000000..d2a4693 --- /dev/null +++ b/test/.svn/text-base/TDHtmlSyntaxHighlighter.m.svn-base @@ -0,0 +1,577 @@ +// +// PKHtmlSyntaxHighlighter.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/28/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDHtmlSyntaxHighlighter.h" +#import "NSArray+ParseKitAdditions.h" +#import + +@interface TDHtmlSyntaxHighlighter () +- (void)didMatchTag; +- (void)didMatchText; +- (void)didMatchComment; +- (void)didMatchCDATA; +- (void)didMatchPI; +- (void)didMatchDoctype; +- (void)didMatchScript; +- (id)peek; +- (id)pop; +- (NSArray *)objectsAbove:(id)fence; +- (PKToken *)nextNonWhitespaceTokenFrom:(NSEnumerator *)e; +- (void)consumeWhitespaceOnStack; + +@property (retain) PKTokenizer *tokenizer; +@property (retain) NSMutableArray *stack; +@property (retain) PKToken *ltToken; +@property (retain) PKToken *gtToken; +@property (retain) PKToken *startCommentToken; +@property (retain) PKToken *endCommentToken; +@property (retain) PKToken *startCDATAToken; +@property (retain) PKToken *endCDATAToken; +@property (retain) PKToken *startPIToken; +@property (retain) PKToken *endPIToken; +@property (retain) PKToken *startDoctypeToken; +@property (retain) PKToken *fwdSlashToken; +@property (retain) PKToken *eqToken; +@property (retain) PKToken *scriptToken; +@property (retain) PKToken *endScriptToken; +@end + +@implementation TDHtmlSyntaxHighlighter + +- (id)init { + return [self initWithAttributesForDarkBackground:NO]; +} + + +- (id)initWithAttributesForDarkBackground:(BOOL)isDark { + if (self = [super init]) { + isDarkBG = isDark; + self.tokenizer = [PKTokenizer tokenizer]; + + [tokenizer setTokenizerState:tokenizer.symbolState from:'/' to:'/']; // XML doesn't have slash slash or slash star comments + tokenizer.whitespaceState.reportsWhitespaceTokens = YES; + [tokenizer.wordState setWordChars:YES from:':' to:':']; + + self.ltToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"<" floatValue:0.0]; + self.gtToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@">" floatValue:0.0]; + + self.startCommentToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"" floatValue:0.0]; + [tokenizer.symbolState add:startCommentToken.stringValue]; + [tokenizer.symbolState add:endCommentToken.stringValue]; + + self.startCDATAToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"" floatValue:0.0]; + [tokenizer.symbolState add:startCDATAToken.stringValue]; + [tokenizer.symbolState add:endCDATAToken.stringValue]; + + self.startPIToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"" floatValue:0.0]; + [tokenizer.symbolState add:startPIToken.stringValue]; + [tokenizer.symbolState add:endPIToken.stringValue]; + + self.startDoctypeToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"" floatValue:0.0]; +// [tokenizer.symbolState add:endScriptToken.stringValue]; + + NSFont *monacoFont = [NSFont fontWithName:@"Monaco" size:11.]; + + NSColor *textColor = nil; + NSColor *tagColor = nil; + NSColor *attrNameColor = nil; + NSColor *attrValueColor = nil; + NSColor *eqColor = nil; + NSColor *commentColor = nil; + NSColor *piColor = nil; + + if (isDarkBG) { + textColor = [NSColor whiteColor]; + tagColor = [NSColor colorWithDeviceRed:.70 green:.14 blue:.53 alpha:1.]; + attrNameColor = [NSColor colorWithDeviceRed:.33 green:.45 blue:.48 alpha:1.]; + attrValueColor = [NSColor colorWithDeviceRed:.77 green:.18 blue:.20 alpha:1.]; + eqColor = tagColor; + commentColor = [NSColor colorWithDeviceRed:.24 green:.70 blue:.27 alpha:1.]; + piColor = [NSColor colorWithDeviceRed:.09 green:.62 blue:.74 alpha:1.]; + } else { + textColor = [NSColor blackColor]; + tagColor = [NSColor purpleColor]; + attrNameColor = [NSColor colorWithDeviceRed:0. green:0. blue:.75 alpha:1.]; + attrValueColor = [NSColor colorWithDeviceRed:.75 green:0. blue:0. alpha:1.]; + eqColor = [NSColor darkGrayColor]; + commentColor = [NSColor grayColor]; + piColor = [NSColor colorWithDeviceRed:.09 green:.62 blue:.74 alpha:1.]; + } + + self.textAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + textColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.tagAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + tagColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.attrNameAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + attrNameColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.attrValueAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + attrValueColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.eqAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + eqColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.commentAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + commentColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.piAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + piColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.stack = nil; + self.ltToken = nil; + self.gtToken = nil; + self.startCommentToken = nil; + self.endCommentToken = nil; + self.startCDATAToken = nil; + self.endCDATAToken = nil; + self.startPIToken = nil; + self.endPIToken = nil; + self.startDoctypeToken = nil; + self.fwdSlashToken = nil; + self.eqToken = nil; + self.scriptToken = nil; + self.endScriptToken = nil; + self.highlightedString = nil; + self.textAttributes = nil; + self.tagAttributes = nil; + self.attrNameAttributes = nil; + self.attrValueAttributes = nil; + self.eqAttributes = nil; + self.commentAttributes = nil; + self.piAttributes = nil; + [super dealloc]; +} + + +- (NSAttributedString *)attributedStringForString:(NSString *)s { + self.stack = [NSMutableArray array]; + self.highlightedString = [[[NSMutableAttributedString alloc] init] autorelease]; + + tokenizer.string = s; + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + BOOL inComment = NO; + BOOL inCDATA = NO; + BOOL inPI = NO; + BOOL inDoctype = NO; + + while ((tok = [tokenizer nextToken]) != eof) { + + if (!inComment && !inCDATA && !inPI && !inDoctype && !inScript && tok.isSymbol) { + if ([startCommentToken isEqual:tok]) { + [stack addObject:tok]; + inComment = YES; + } else if ([startCDATAToken isEqual:tok]) { + [stack addObject:tok]; + inCDATA = YES; + } else if ([startPIToken isEqual:tok]) { + [stack addObject:tok]; + inPI = YES; + } else if ([startDoctypeToken isEqual:tok]) { + [stack addObject:tok]; + inDoctype = YES; + } else if ([ltToken isEqual:tok]) { + [self didMatchText]; + [stack addObject:tok]; + } else if ([gtToken isEqual:tok]) { + [stack addObject:tok]; + [self didMatchTag]; + } else { + [stack addObject:tok]; + } + } else if (inComment && [endCommentToken isEqual:tok]) { + inComment = NO; + [stack addObject:tok]; + [self didMatchComment]; + } else if (inCDATA && [endCDATAToken isEqual:tok]) { + inCDATA = NO; + [stack addObject:tok]; + [self didMatchCDATA]; + } else if (inPI && [endPIToken isEqual:tok]) { + inPI = NO; + [stack addObject:tok]; + [self didMatchPI]; + } else if (inDoctype && [gtToken isEqual:tok]) { + inDoctype = NO; + [stack addObject:tok]; + [self didMatchDoctype]; + } else if (inScript && [endScriptToken isEqual:tok]) { + inScript = NO; + [stack addObject:tok]; + [self didMatchScript]; + } else { + [stack addObject:tok]; + } + } + + // handle case where no elements were encountered (plain text basically) + if (![highlightedString length]) { + PKToken *tok = nil; + while (tok = [self pop]) { + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:textAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + NSAttributedString *result = [[highlightedString copy] autorelease]; + self.stack = nil; + self.highlightedString = nil; + tokenizer.string = nil; + return result; +} + + +- (PKToken *)nextNonWhitespaceTokenFrom:(NSEnumerator *)e { + PKToken *tok = [e nextObject]; + while (tok.isWhitespace) { + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + tok = [e nextObject]; + } + return tok; +} + + +- (void)consumeWhitespaceOnStack { + PKToken *tok = [self peek]; + while (tok.isWhitespace) { + tok = [self pop]; + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + tok = [self peek]; + } +} + + +- (void)didMatchComment { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:startCommentToken] reversedMutableArray]; + + [self consumeWhitespaceOnStack]; + + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:startCommentToken.stringValue attributes:commentAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + NSEnumerator *e = [toks objectEnumerator]; + + PKToken *tok = nil; + while (tok = [self nextNonWhitespaceTokenFrom:e]) { + if ([tok isEqual:endCommentToken]) { + break; + } else { + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:commentAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:commentAttributes] autorelease]; + [highlightedString appendAttributedString:as]; +} + + +- (void)didMatchCDATA { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:startCDATAToken] reversedMutableArray]; + + [self consumeWhitespaceOnStack]; + + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:startCDATAToken.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + NSEnumerator *e = [toks objectEnumerator]; + + PKToken *tok = nil; + while (tok = [self nextNonWhitespaceTokenFrom:e]) { + if ([tok isEqual:endCDATAToken]) { + break; + } else { + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:textAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; +} + + +- (void)didMatchPI { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:startPIToken] reversedMutableArray]; + + [self consumeWhitespaceOnStack]; + + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:startPIToken.stringValue attributes:piAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + NSEnumerator *e = [toks objectEnumerator]; + + PKToken *tok = nil; + while (tok = [self nextNonWhitespaceTokenFrom:e]) { + if ([tok isEqual:endPIToken]) { + break; + } else { + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:piAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:piAttributes] autorelease]; + [highlightedString appendAttributedString:as]; +} + + +- (void)didMatchDoctype { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:startDoctypeToken] reversedMutableArray]; + + [self consumeWhitespaceOnStack]; + + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:startDoctypeToken.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + NSEnumerator *e = [toks objectEnumerator]; + + PKToken *tok = nil; + while (tok = [self nextNonWhitespaceTokenFrom:e]) { + if ([tok isEqual:gtToken]) { + break; + } else { + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; +} + + +- (void)didMatchScript { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:startDoctypeToken] reversedMutableArray]; + + NSEnumerator *e = [toks objectEnumerator]; + NSAttributedString *as = nil; + + PKToken *tok = nil; + while (tok = [self nextNonWhitespaceTokenFrom:e]) { + if ([tok isEqual:endScriptToken]) { + break; + } else { + NSDictionary *attrs = nil; + if ([tok isEqual:scriptToken] || [tok isEqual:ltToken] || [tok isEqual:fwdSlashToken]) { + attrs = tagAttributes; + } else { + attrs = textAttributes; + } + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:attrs] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + as = [[[NSAttributedString alloc] initWithString:endScriptToken.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; +} + + +- (void)didMatchStartTag:(NSEnumerator *)e { + while (1) { + // attr name or ns prefix decl "xmlns:foo" or "/" for empty element + PKToken *tok = [self nextNonWhitespaceTokenFrom:e]; + if (!tok) return; + + NSDictionary *attrs = nil; + if ([tok isEqual:eqToken]) { + attrs = eqAttributes; + } else if ([tok isEqual:fwdSlashToken] || [tok isEqual:gtToken]) { + attrs = tagAttributes; + } else if (tok.isQuotedString) { + attrs = attrValueAttributes; + } else { + attrs = attrNameAttributes; + } + + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:attrs] autorelease]; + [highlightedString appendAttributedString:as]; + + // "=" + tok = [self nextNonWhitespaceTokenFrom:e]; + if (!tok) return; + + if ([tok isEqual:eqToken]) { + attrs = eqAttributes; + } else if ([tok isEqual:fwdSlashToken] || [tok isEqual:gtToken]) { + attrs = tagAttributes; + } else if (tok.isQuotedString) { + attrs = attrValueAttributes; + } else { + attrs = tagAttributes; + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:attrs] autorelease]; + [highlightedString appendAttributedString:as]; + + // quoted string attr value or ns url value + tok = [self nextNonWhitespaceTokenFrom:e]; + if (!tok) return; + + if ([tok isEqual:fwdSlashToken] || [tok isEqual:gtToken]) { + attrs = tagAttributes; + } else { + attrs = attrValueAttributes; + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:attrs] autorelease]; + [highlightedString appendAttributedString:as]; + } +} + + +- (void)didMatchEndTag:(NSEnumerator *)e { + // consume tagName to ">" + PKToken *tok = nil; + while (tok = [e nextObject]) { + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } +} + + +- (void)didMatchTag { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:nil] reversedMutableArray]; + NSAttributedString *as = nil; + + NSEnumerator *e = [toks objectEnumerator]; + + // append "<" + [self nextNonWhitespaceTokenFrom:e]; // discard + as = [[[NSAttributedString alloc] initWithString:ltToken.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + // consume whitespace to tagName or "/" for end tags or "!" for comments + PKToken *tok = [self nextNonWhitespaceTokenFrom:e]; + + if (tok) { + if ([tok isEqual:scriptToken]) { + inScript = YES; + } else { + inScript = NO; + } + + // consume tagName or "/" or "!" + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + if ([tok isEqual:fwdSlashToken]) { + [self didMatchEndTag:e]; + } else { + [self didMatchStartTag:e]; + } + } +} + + +- (void)didMatchText { + NSArray *a = [self objectsAbove:gtToken]; + for (PKToken *tok in [a reverseObjectEnumerator]) { + NSString *s = tok.stringValue; + if (s) { + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:textAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } +} + + +- (NSArray *)objectsAbove:(id)fence { + NSMutableArray *res = [NSMutableArray array]; + while (1) { + if (![stack count]) { + break; + } + id obj = [self pop]; + if ([obj isEqual:fence]) { + break; + } + [res addObject:obj]; + } + return res; +} + + +- (id)peek { + id obj = nil; + if ([stack count]) { + obj = [stack lastObject]; + } + return obj; +} + + +- (id)pop { + id obj = [self peek]; + if (obj) { + [stack removeLastObject]; + } + return obj; +} + +@synthesize stack; +@synthesize tokenizer; +@synthesize ltToken; +@synthesize gtToken; +@synthesize startCommentToken; +@synthesize endCommentToken; +@synthesize startCDATAToken; +@synthesize endCDATAToken; +@synthesize startPIToken; +@synthesize endPIToken; +@synthesize startDoctypeToken; +@synthesize fwdSlashToken; +@synthesize eqToken; +@synthesize scriptToken; +@synthesize endScriptToken; +@synthesize highlightedString; +@synthesize tagAttributes; +@synthesize textAttributes; +@synthesize attrNameAttributes; +@synthesize attrValueAttributes; +@synthesize eqAttributes; +@synthesize commentAttributes; +@synthesize piAttributes; +@end diff --git a/test/.svn/text-base/TDJavaScriptParser.h.svn-base b/test/.svn/text-base/TDJavaScriptParser.h.svn-base new file mode 100644 index 0000000..e71ef7d --- /dev/null +++ b/test/.svn/text-base/TDJavaScriptParser.h.svn-base @@ -0,0 +1,344 @@ +// +// PKJavaScriptParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 3/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface TDJavaScriptParser : PKRepetition { + PKCollectionParser *assignmentOpParser; + PKCollectionParser *relationalOpParser; + PKCollectionParser *equalityOpParser; + PKCollectionParser *shiftOpParser; + PKCollectionParser *incrementOpParser; + PKCollectionParser *unaryOpParser; + PKCollectionParser *multiplicativeOpParser; + + PKCollectionParser *programParser; + PKCollectionParser *elementParser; + PKCollectionParser *funcParser; + PKCollectionParser *paramListOptParser; + PKCollectionParser *paramListParser; + PKCollectionParser *commaIdentifierParser; + PKCollectionParser *compoundStmtParser; + PKCollectionParser *stmtsParser; + PKCollectionParser *stmtParser; + PKCollectionParser *ifStmtParser; + PKCollectionParser *ifElseStmtParser; + PKCollectionParser *whileStmtParser; + PKCollectionParser *forParenStmtParser; + PKCollectionParser *forBeginStmtParser; + PKCollectionParser *forInStmtParser; + PKCollectionParser *breakStmtParser; + PKCollectionParser *continueStmtParser; + PKCollectionParser *withStmtParser; + PKCollectionParser *returnStmtParser; + PKCollectionParser *variablesOrExprStmtParser; + PKCollectionParser *conditionParser; + PKCollectionParser *forParenParser; + PKCollectionParser *forBeginParser; + PKCollectionParser *variablesOrExprParser; + PKCollectionParser *varVariablesParser; + PKCollectionParser *variablesParser; + PKCollectionParser *commaVariableParser; + PKCollectionParser *variableParser; + PKCollectionParser *assignmentParser; + PKCollectionParser *exprOptParser; + PKCollectionParser *exprParser; + PKCollectionParser *commaAssignmentExprParser; + PKCollectionParser *assignmentExprParser; + PKCollectionParser *assignmentOpConditionalExprParser; + PKCollectionParser *conditionalExprParser; + PKCollectionParser *ternaryExprParser; + PKCollectionParser *orExprParser; + PKCollectionParser *orAndExprParser; + PKCollectionParser *andExprParser; + PKCollectionParser *andBitwiseOrExprParser; + PKCollectionParser *bitwiseOrExprParser; + PKCollectionParser *pipeBitwiseXorExprParser; + PKCollectionParser *bitwiseXorExprParser; + PKCollectionParser *caretBitwiseAndExprParser; + PKCollectionParser *bitwiseAndExprParser; + PKCollectionParser *ampEqualityExprParser; + PKCollectionParser *equalityExprParser; + PKCollectionParser *equalityOpRelationalExprParser; + PKCollectionParser *relationalExprParser; + PKCollectionParser *relationalOpShiftExprParser; + PKCollectionParser *shiftExprParser; + PKCollectionParser *shiftOpAdditiveExprParser; + PKCollectionParser *additiveExprParser; + PKCollectionParser *plusOrMinusExprParser; + PKCollectionParser *plusExprParser; + PKCollectionParser *minusExprParser; + PKCollectionParser *multiplicativeExprParser; + PKCollectionParser *multiplicativeOpUnaryExprParser; + PKCollectionParser *unaryExprParser; + PKCollectionParser *unaryExpr1Parser; + PKCollectionParser *unaryExpr2Parser; + PKCollectionParser *unaryExpr3Parser; + PKCollectionParser *unaryExpr4Parser; + PKCollectionParser *unaryExpr5Parser; + PKCollectionParser *unaryExpr6Parser; + PKCollectionParser *constructorCallParser; + PKCollectionParser *parenArgListOptParenParser; + PKCollectionParser *memberExprParser; + PKCollectionParser *memberExprExtParser; + PKCollectionParser *dotMemberExprParser; + PKCollectionParser *bracketMemberExprParser; + PKCollectionParser *argListOptParser; + PKCollectionParser *argListParser; + PKCollectionParser *primaryExprParser; + PKCollectionParser *parenExprParenParser; + + PKCollectionParser *funcLiteralParser; + PKCollectionParser *arrayLiteralParser; + PKCollectionParser *objectLiteralParser; + + PKParser *identifierParser; + PKParser *stringParser; + PKParser *numberParser; + + // keywords + PKParser *ifParser; + PKParser *elseParser; + PKParser *whileParser; + PKParser *forParser; + PKParser *inParser; + PKParser *breakParser; + PKParser *continueParser; + PKParser *withParser; + PKParser *returnParser; + PKParser *varParser; + PKParser *deleteParser; + PKParser *newParser; + PKParser *thisParser; + PKParser *falseParser; + PKParser *trueParser; + PKParser *nullParser; + PKParser *undefinedParser; + PKParser *voidParser; + PKParser *typeofParser; + PKParser *instanceofParser; + PKParser *functionParser; + + // multi-char symbols + PKParser *orParser; + PKParser *andParser; + PKParser *neParser; + PKParser *isNotParser; + PKParser *eqParser; + PKParser *isParser; + PKParser *leParser; + PKParser *geParser; + PKParser *plusPlusParser; + PKParser *minusMinusParser; + PKParser *plusEqParser; + PKParser *minusEqParser; + PKParser *timesEqParser; + PKParser *divEqParser; + PKParser *modEqParser; + PKParser *shiftLeftParser; + PKParser *shiftRightParser; + PKParser *shiftRightExtParser; + PKParser *shiftLeftEqParser; + PKParser *shiftRightEqParser; + PKParser *shiftRightExtEqParser; + PKParser *andEqParser; + PKParser *xorEqParser; + PKParser *orEqParser; + + // single char symbols + PKParser *openCurlyParser; + PKParser *closeCurlyParser; + PKParser *openParenParser; + PKParser *closeParenParser; + PKParser *openBracketParser; + PKParser *closeBracketParser; + PKParser *commaParser; + PKParser *dotParser; + PKParser *semiOptParser; + PKParser *semiParser; + PKParser *colonParser; + PKParser *equalsParser; + PKParser *notParser; + PKParser *ltParser; + PKParser *gtParser; + PKParser *ampParser; + PKParser *pipeParser; + PKParser *caretParser; + PKParser *tildeParser; + PKParser *questionParser; + PKParser *plusParser; + PKParser *minusParser; + PKParser *timesParser; + PKParser *divParser; + PKParser *modParser; +} +@property (nonatomic, retain) PKCollectionParser *assignmentOpParser; +@property (nonatomic, retain) PKCollectionParser *relationalOpParser; +@property (nonatomic, retain) PKCollectionParser *equalityOpParser; +@property (nonatomic, retain) PKCollectionParser *shiftOpParser; +@property (nonatomic, retain) PKCollectionParser *incrementOpParser; +@property (nonatomic, retain) PKCollectionParser *unaryOpParser; +@property (nonatomic, retain) PKCollectionParser *multiplicativeOpParser; + +@property (nonatomic, retain) PKCollectionParser *programParser; +@property (nonatomic, retain) PKCollectionParser *elementParser; +@property (nonatomic, retain) PKCollectionParser *funcParser; +@property (nonatomic, retain) PKCollectionParser *paramListOptParser; +@property (nonatomic, retain) PKCollectionParser *paramListParser; +@property (nonatomic, retain) PKCollectionParser *commaIdentifierParser; +@property (nonatomic, retain) PKCollectionParser *compoundStmtParser; +@property (nonatomic, retain) PKCollectionParser *stmtsParser; +@property (nonatomic, retain) PKCollectionParser *stmtParser; +@property (nonatomic, retain) PKCollectionParser *ifStmtParser; +@property (nonatomic, retain) PKCollectionParser *ifElseStmtParser; +@property (nonatomic, retain) PKCollectionParser *whileStmtParser; +@property (nonatomic, retain) PKCollectionParser *forParenStmtParser; +@property (nonatomic, retain) PKCollectionParser *forBeginStmtParser; +@property (nonatomic, retain) PKCollectionParser *forInStmtParser; +@property (nonatomic, retain) PKCollectionParser *breakStmtParser; +@property (nonatomic, retain) PKCollectionParser *continueStmtParser; +@property (nonatomic, retain) PKCollectionParser *withStmtParser; +@property (nonatomic, retain) PKCollectionParser *returnStmtParser; +@property (nonatomic, retain) PKCollectionParser *variablesOrExprStmtParser; +@property (nonatomic, retain) PKCollectionParser *conditionParser; +@property (nonatomic, retain) PKCollectionParser *forParenParser; +@property (nonatomic, retain) PKCollectionParser *forBeginParser; +@property (nonatomic, retain) PKCollectionParser *variablesOrExprParser; +@property (nonatomic, retain) PKCollectionParser *varVariablesParser; +@property (nonatomic, retain) PKCollectionParser *variablesParser; +@property (nonatomic, retain) PKCollectionParser *commaVariableParser; +@property (nonatomic, retain) PKCollectionParser *variableParser; +@property (nonatomic, retain) PKCollectionParser *assignmentParser; +@property (nonatomic, retain) PKCollectionParser *exprOptParser; +@property (nonatomic, retain) PKCollectionParser *exprParser; +@property (nonatomic, retain) PKCollectionParser *commaAssignmentExprParser; +@property (nonatomic, retain) PKCollectionParser *assignmentExprParser; +@property (nonatomic, retain) PKCollectionParser *assignmentOpConditionalExprParser; +@property (nonatomic, retain) PKCollectionParser *conditionalExprParser; +@property (nonatomic, retain) PKCollectionParser *ternaryExprParser; +@property (nonatomic, retain) PKCollectionParser *orExprParser; +@property (nonatomic, retain) PKCollectionParser *orAndExprParser; +@property (nonatomic, retain) PKCollectionParser *andExprParser; +@property (nonatomic, retain) PKCollectionParser *andBitwiseOrExprParser; +@property (nonatomic, retain) PKCollectionParser *bitwiseOrExprParser; +@property (nonatomic, retain) PKCollectionParser *pipeBitwiseXorExprParser; +@property (nonatomic, retain) PKCollectionParser *bitwiseXorExprParser; +@property (nonatomic, retain) PKCollectionParser *caretBitwiseAndExprParser; +@property (nonatomic, retain) PKCollectionParser *bitwiseAndExprParser; +@property (nonatomic, retain) PKCollectionParser *ampEqualityExprParser; +@property (nonatomic, retain) PKCollectionParser *equalityExprParser; +@property (nonatomic, retain) PKCollectionParser *equalityOpRelationalExprParser; +@property (nonatomic, retain) PKCollectionParser *relationalExprParser; +@property (nonatomic, retain) PKCollectionParser *relationalOpShiftExprParser; +@property (nonatomic, retain) PKCollectionParser *shiftExprParser; +@property (nonatomic, retain) PKCollectionParser *shiftOpAdditiveExprParser; +@property (nonatomic, retain) PKCollectionParser *additiveExprParser; +@property (nonatomic, retain) PKCollectionParser *plusOrMinusExprParser; +@property (nonatomic, retain) PKCollectionParser *plusExprParser; +@property (nonatomic, retain) PKCollectionParser *minusExprParser; +@property (nonatomic, retain) PKCollectionParser *multiplicativeExprParser; +@property (nonatomic, retain) PKCollectionParser *multiplicativeOpUnaryExprParser; +@property (nonatomic, retain) PKCollectionParser *unaryExprParser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr1Parser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr2Parser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr3Parser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr4Parser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr5Parser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr6Parser; +@property (nonatomic, retain) PKCollectionParser *constructorCallParser; +@property (nonatomic, retain) PKCollectionParser *parenArgListOptParenParser; +@property (nonatomic, retain) PKCollectionParser *memberExprParser; +@property (nonatomic, retain) PKCollectionParser *memberExprExtParser; +@property (nonatomic, retain) PKCollectionParser *dotMemberExprParser; +@property (nonatomic, retain) PKCollectionParser *bracketMemberExprParser; +@property (nonatomic, retain) PKCollectionParser *argListOptParser; +@property (nonatomic, retain) PKCollectionParser *argListParser; +@property (nonatomic, retain) PKCollectionParser *primaryExprParser; +@property (nonatomic, retain) PKCollectionParser *parenExprParenParser; + +@property (nonatomic, retain) PKCollectionParser *funcLiteralParser; +@property (nonatomic, retain) PKCollectionParser *arrayLiteralParser; +@property (nonatomic, retain) PKCollectionParser *objectLiteralParser; + +@property (nonatomic, retain) PKParser *identifierParser; +@property (nonatomic, retain) PKParser *stringParser; +@property (nonatomic, retain) PKParser *numberParser; + +@property (nonatomic, retain) PKParser *ifParser; +@property (nonatomic, retain) PKParser *elseParser; +@property (nonatomic, retain) PKParser *whileParser; +@property (nonatomic, retain) PKParser *forParser; +@property (nonatomic, retain) PKParser *inParser; +@property (nonatomic, retain) PKParser *breakParser; +@property (nonatomic, retain) PKParser *continueParser; +@property (nonatomic, retain) PKParser *withParser; +@property (nonatomic, retain) PKParser *returnParser; +@property (nonatomic, retain) PKParser *varParser; +@property (nonatomic, retain) PKParser *deleteParser; +@property (nonatomic, retain) PKParser *newParser; +@property (nonatomic, retain) PKParser *thisParser; +@property (nonatomic, retain) PKParser *falseParser; +@property (nonatomic, retain) PKParser *trueParser; +@property (nonatomic, retain) PKParser *nullParser; +@property (nonatomic, retain) PKParser *undefinedParser; +@property (nonatomic, retain) PKParser *voidParser; +@property (nonatomic, retain) PKParser *typeofParser; +@property (nonatomic, retain) PKParser *instanceofParser; +@property (nonatomic, retain) PKParser *functionParser; + +@property (nonatomic, retain) PKParser *orParser; +@property (nonatomic, retain) PKParser *andParser; +@property (nonatomic, retain) PKParser *neParser; +@property (nonatomic, retain) PKParser *isNotParser; +@property (nonatomic, retain) PKParser *eqParser; +@property (nonatomic, retain) PKParser *isParser; +@property (nonatomic, retain) PKParser *leParser; +@property (nonatomic, retain) PKParser *geParser; +@property (nonatomic, retain) PKParser *plusPlusParser; +@property (nonatomic, retain) PKParser *minusMinusParser; +@property (nonatomic, retain) PKParser *plusEqParser; +@property (nonatomic, retain) PKParser *minusEqParser; +@property (nonatomic, retain) PKParser *timesEqParser; +@property (nonatomic, retain) PKParser *divEqParser; +@property (nonatomic, retain) PKParser *modEqParser; +@property (nonatomic, retain) PKParser *shiftLeftParser; +@property (nonatomic, retain) PKParser *shiftRightParser; +@property (nonatomic, retain) PKParser *shiftRightExtParser; +@property (nonatomic, retain) PKParser *shiftLeftEqParser; +@property (nonatomic, retain) PKParser *shiftRightEqParser; +@property (nonatomic, retain) PKParser *shiftRightExtEqParser; +@property (nonatomic, retain) PKParser *andEqParser; +@property (nonatomic, retain) PKParser *xorEqParser; +@property (nonatomic, retain) PKParser *orEqParser; + +@property (nonatomic, retain) PKParser *openCurlyParser; +@property (nonatomic, retain) PKParser *closeCurlyParser; +@property (nonatomic, retain) PKParser *openParenParser; +@property (nonatomic, retain) PKParser *closeParenParser; +@property (nonatomic, retain) PKParser *openBracketParser; +@property (nonatomic, retain) PKParser *closeBracketParser; +@property (nonatomic, retain) PKParser *commaParser; +@property (nonatomic, retain) PKParser *dotParser; +@property (nonatomic, retain) PKParser *semiOptParser; +@property (nonatomic, retain) PKParser *semiParser; +@property (nonatomic, retain) PKParser *colonParser; +@property (nonatomic, retain) PKParser *equalsParser; +@property (nonatomic, retain) PKParser *notParser; +@property (nonatomic, retain) PKParser *ltParser; +@property (nonatomic, retain) PKParser *gtParser; +@property (nonatomic, retain) PKParser *ampParser; +@property (nonatomic, retain) PKParser *pipeParser; +@property (nonatomic, retain) PKParser *caretParser; +@property (nonatomic, retain) PKParser *tildeParser; +@property (nonatomic, retain) PKParser *questionParser; +@property (nonatomic, retain) PKParser *plusParser; +@property (nonatomic, retain) PKParser *minusParser; +@property (nonatomic, retain) PKParser *timesParser; +@property (nonatomic, retain) PKParser *divParser; +@property (nonatomic, retain) PKParser *modParser; +@end diff --git a/test/.svn/text-base/TDJavaScriptParser.m.svn-base b/test/.svn/text-base/TDJavaScriptParser.m.svn-base new file mode 100644 index 0000000..f474f8b --- /dev/null +++ b/test/.svn/text-base/TDJavaScriptParser.m.svn-base @@ -0,0 +1,2392 @@ +// +// PKJavaScriptParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 3/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDJavaScriptParser.h" + +@interface PKParser () +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@interface TDJavaScriptParser () +- (PKAlternation *)zeroOrOne:(PKParser *)p; +- (PKSequence *)oneOrMore:(PKParser *)p; +@end + +@implementation TDJavaScriptParser + +- (id)init { + if (self = [super initWithSubparser:self.elementParser]) { + self.tokenizer = [PKTokenizer tokenizer]; + + // JS supports scientific number notation (exponents like 4E+12 or 2.0e-42) + tokenizer.numberState.allowsScientificNotation = YES; + + // Nums cannot end with '.' (e.g. 32. must be 32.0) + tokenizer.numberState.allowsTrailingDot = NO; + + [tokenizer setTokenizerState:tokenizer.numberState from:'-' to:'-']; + [tokenizer setTokenizerState:tokenizer.numberState from:'.' to:'.']; + [tokenizer setTokenizerState:tokenizer.numberState from:'0' to:'9']; + + // Words can start with '_' + [tokenizer setTokenizerState:tokenizer.wordState from:'_' to:'_']; + + // Words cannot contain '-' + [tokenizer.wordState setWordChars:NO from:'-' to:'-']; + + // Comments + tokenizer.commentState.reportsCommentTokens = YES; + [tokenizer setTokenizerState:tokenizer.commentState from:'/' to:'/']; + + // single-line Comments + [tokenizer.commentState addSingleLineStartMarker:@"//"]; + + // multi-line Comments + [tokenizer.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + [tokenizer.symbolState add:@"||"]; + [tokenizer.symbolState add:@"&&"]; + [tokenizer.symbolState add:@"!="]; + [tokenizer.symbolState add:@"!=="]; + [tokenizer.symbolState add:@"=="]; + [tokenizer.symbolState add:@"==="]; + [tokenizer.symbolState add:@"<="]; + [tokenizer.symbolState add:@">="]; + [tokenizer.symbolState add:@"++"]; + [tokenizer.symbolState add:@"--"]; + [tokenizer.symbolState add:@"+="]; + [tokenizer.symbolState add:@"-="]; + [tokenizer.symbolState add:@"*="]; + [tokenizer.symbolState add:@"/="]; + [tokenizer.symbolState add:@"%="]; + [tokenizer.symbolState add:@"<<"]; + [tokenizer.symbolState add:@">>"]; + [tokenizer.symbolState add:@">>>"]; + [tokenizer.symbolState add:@"<<="]; + [tokenizer.symbolState add:@">>="]; + [tokenizer.symbolState add:@">>>="]; + [tokenizer.symbolState add:@"&="]; + [tokenizer.symbolState add:@"^="]; + } + return self; +} + + +- (void)dealloc { + self.assignmentOpParser = nil; + self.relationalOpParser = nil; + self.equalityOpParser = nil; + self.shiftOpParser = nil; + self.incrementOpParser = nil; + self.unaryOpParser = nil; + self.multiplicativeOpParser = nil; + self.programParser = nil; + self.elementParser = nil; + self.funcParser = nil; + self.paramListOptParser = nil; + self.paramListParser = nil; + self.commaIdentifierParser = nil; + self.compoundStmtParser = nil; + self.stmtsParser = nil; + self.stmtParser = nil; + self.ifStmtParser = nil; + self.ifElseStmtParser = nil; + self.whileStmtParser = nil; + self.forParenStmtParser = nil; + self.forBeginStmtParser = nil; + self.forInStmtParser = nil; + self.breakStmtParser = nil; + self.continueStmtParser = nil; + self.withStmtParser = nil; + self.returnStmtParser = nil; + self.variablesOrExprStmtParser = nil; + self.conditionParser = nil; + self.forParenParser = nil; + self.forBeginParser = nil; + self.variablesOrExprParser = nil; + self.varVariablesParser = nil; + self.variablesParser = nil; + self.commaVariableParser = nil; + self.variableParser = nil; + self.assignmentParser = nil; + self.exprOptParser = nil; + self.exprParser = nil; + self.commaAssignmentExprParser = nil; + self.assignmentExprParser = nil; + self.assignmentOpConditionalExprParser = nil; + self.conditionalExprParser = nil; + self.ternaryExprParser = nil; + self.orExprParser = nil; + self.orAndExprParser = nil; + self.andExprParser = nil; + self.andBitwiseOrExprParser = nil; + self.bitwiseOrExprParser = nil; + self.pipeBitwiseXorExprParser = nil; + self.bitwiseXorExprParser = nil; + self.caretBitwiseAndExprParser = nil; + self.bitwiseAndExprParser = nil; + self.ampEqualityExprParser = nil; + self.equalityExprParser = nil; + self.equalityOpRelationalExprParser = nil; + self.relationalExprParser = nil; + self.relationalOpShiftExprParser = nil; + self.shiftExprParser = nil; + self.shiftOpAdditiveExprParser = nil; + self.additiveExprParser = nil; + self.plusOrMinusExprParser = nil; + self.plusExprParser = nil; + self.minusExprParser = nil; + self.multiplicativeExprParser = nil; + self.multiplicativeOpUnaryExprParser = nil; + self.unaryExprParser = nil; + self.unaryExpr1Parser = nil; + self.unaryExpr2Parser = nil; + self.unaryExpr3Parser = nil; + self.unaryExpr4Parser = nil; + self.unaryExpr5Parser = nil; + self.unaryExpr6Parser = nil; + self.constructorCallParser = nil; + self.parenArgListOptParenParser = nil; + self.memberExprParser = nil; + self.memberExprExtParser = nil; + self.dotMemberExprParser = nil; + self.bracketMemberExprParser = nil; + self.argListOptParser = nil; + self.argListParser = nil; + self.primaryExprParser = nil; + self.parenExprParenParser = nil; + + self.funcLiteralParser = nil; + self.arrayLiteralParser = nil; + self.objectLiteralParser = nil; + + self.identifierParser = nil; + self.stringParser = nil; + self.numberParser = nil; + + self.ifParser = nil; + self.elseParser = nil; + self.whileParser = nil; + self.forParser = nil; + self.inParser = nil; + self.breakParser = nil; + self.continueParser = nil; + self.withParser = nil; + self.returnParser = nil; + self.varParser = nil; + self.deleteParser = nil; + self.newParser = nil; + self.thisParser = nil; + self.falseParser = nil; + self.trueParser = nil; + self.nullParser = nil; + self.undefinedParser = nil; + self.voidParser = nil; + self.typeofParser = nil; + self.instanceofParser = nil; + self.functionParser = nil; + + self.orParser = nil; + self.andParser = nil; + self.neParser = nil; + self.isNotParser = nil; + self.eqParser = nil; + self.isParser = nil; + self.leParser = nil; + self.geParser = nil; + self.plusPlusParser = nil; + self.minusMinusParser = nil; + self.plusEqParser = nil; + self.minusEqParser = nil; + self.timesEqParser = nil; + self.divEqParser = nil; + self.modEqParser = nil; + self.shiftLeftParser = nil; + self.shiftRightParser = nil; + self.shiftRightExtParser = nil; + self.shiftLeftEqParser = nil; + self.shiftRightEqParser = nil; + self.shiftRightExtEqParser = nil; + self.andEqParser = nil; + self.xorEqParser = nil; + self.orEqParser = nil; + + self.openCurlyParser = nil; + self.closeCurlyParser = nil; + self.openParenParser = nil; + self.closeParenParser = nil; + self.openBracketParser = nil; + self.closeBracketParser = nil; + self.commaParser = nil; + self.dotParser = nil; + self.semiOptParser = nil; + self.semiParser = nil; + self.colonParser = nil; + self.equalsParser = nil; + self.notParser = nil; + self.ltParser = nil; + self.gtParser = nil; + self.ampParser = nil; + self.pipeParser = nil; + self.caretParser = nil; + self.tildeParser = nil; + self.questionParser = nil; + self.plusParser = nil; + self.minusParser = nil; + self.timesParser = nil; + self.divParser = nil; + self.modParser = nil; + + [super dealloc]; +} + + +- (PKAlternation *)zeroOrOne:(PKParser *)p { + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:p]; + return a; +} + + +- (PKSequence *)oneOrMore:(PKParser *)p { + PKSequence *s = [PKSequence sequence]; + [s add:p]; + [s add:[PKRepetition repetitionWithSubparser:p]]; + return s; +} + + +// assignmentOperator = equals | plusEq | minusEq | timesEq | divEq | modEq | shiftLeftEq | shiftRightEq | shiftRightExtEq | andEq | xorEq | orEq; +- (PKCollectionParser *)assignmentOpParser { + if (!assignmentOpParser) { + self.assignmentOpParser = [PKAlternation alternation]; + assignmentOpParser.name = @"assignmentOp"; + [assignmentOpParser add:self.equalsParser]; + [assignmentOpParser add:self.plusEqParser]; + [assignmentOpParser add:self.minusEqParser]; + [assignmentOpParser add:self.timesEqParser]; + [assignmentOpParser add:self.divEqParser]; + [assignmentOpParser add:self.modEqParser]; + [assignmentOpParser add:self.shiftLeftEqParser]; + [assignmentOpParser add:self.shiftRightEqParser]; + [assignmentOpParser add:self.shiftRightExtEqParser]; + [assignmentOpParser add:self.andEqParser]; + [assignmentOpParser add:self.orEqParser]; + [assignmentOpParser add:self.xorEqParser]; + } + return assignmentOpParser; +} + + +// relationalOperator = lt | gt | ge | le | instanceof; +- (PKCollectionParser *)relationalOpParser { + if (!relationalOpParser) { + self.relationalOpParser = [PKAlternation alternation]; + relationalOpParser.name = @"relationalOp"; + [relationalOpParser add:self.ltParser]; + [relationalOpParser add:self.gtParser]; + [relationalOpParser add:self.geParser]; + [relationalOpParser add:self.leParser]; + [relationalOpParser add:self.instanceofParser]; + } + return relationalOpParser; +} + + +// equalityOp = eq | ne | is | isnot; +- (PKCollectionParser *)equalityOpParser { + if (!equalityOpParser) { + self.equalityOpParser = [PKAlternation alternation];; + equalityOpParser.name = @"equalityOp"; + [equalityOpParser add:self.eqParser]; + [equalityOpParser add:self.neParser]; + [equalityOpParser add:self.isParser]; + [equalityOpParser add:self.isNotParser]; + } + return equalityOpParser; +} + + +//shiftOp = shiftLeft | shiftRight | shiftRightExt; +- (PKCollectionParser *)shiftOpParser { + if (!shiftOpParser) { + self.shiftOpParser = [PKAlternation alternation]; + shiftOpParser.name = @"shiftOp"; + [shiftOpParser add:self.shiftLeftParser]; + [shiftOpParser add:self.shiftRightParser]; + [shiftOpParser add:self.shiftRightExtParser]; + } + return shiftOpParser; +} + + +//incrementOperator = plusPlus | minusMinus; +- (PKCollectionParser *)incrementOpParser { + if (!incrementOpParser) { + self.incrementOpParser = [PKAlternation alternation]; + incrementOpParser.name = @"incrementOp"; + [incrementOpParser add:self.plusPlusParser]; + [incrementOpParser add:self.minusMinusParser]; + } + return incrementOpParser; +} + + +//unaryOperator = tilde | delete | typeof | void; +- (PKCollectionParser *)unaryOpParser { + if (!unaryOpParser) { + self.unaryOpParser = [PKAlternation alternation]; + unaryOpParser.name = @"unaryOp"; + [unaryOpParser add:self.tildeParser]; + [unaryOpParser add:self.deleteParser]; + [unaryOpParser add:self.typeofParser]; + [unaryOpParser add:self.voidParser]; + } + return unaryOpParser; +} + + +// multiplicativeOperator = times | div | mod; +- (PKCollectionParser *)multiplicativeOpParser { + if (!multiplicativeOpParser) { + self.multiplicativeOpParser = [PKAlternation alternation]; + multiplicativeOpParser.name = @"multiplicativeOperator"; + [multiplicativeOpParser add:self.timesParser]; + [multiplicativeOpParser add:self.divParser]; + [multiplicativeOpParser add:self.modParser]; + } + return multiplicativeOpParser; +} + + + +// Program: +// empty +// Element Program +// +//program = element*; +- (PKCollectionParser *)programParser { + if (!programParser) { + self.programParser = [PKRepetition repetitionWithSubparser:self.elementParser]; + programParser.name = @"program"; + } + return programParser; +} + + +// Element: +// function Identifier ( ParameterListOpt ) CompoundStatement +// Statement +// +//element = func | stmt; +- (PKCollectionParser *)elementParser { + if (!elementParser) { + self.elementParser = [PKAlternation alternation]; + elementParser.name = @"element"; + [elementParser add:self.funcParser]; + [elementParser add:self.stmtParser]; + } + return elementParser; +} + + +//func = function identifier openParen paramListOpt closeParen compoundStmt; +- (PKCollectionParser *)funcParser { + if (!funcParser) { + self.funcParser = [PKSequence sequence]; + funcParser.name = @"func"; + [funcParser add:self.functionParser]; + [funcParser add:self.identifierParser]; + [funcParser add:self.openParenParser]; + [funcParser add:self.paramListOptParser]; + [funcParser add:self.closeParenParser]; + [funcParser add:self.compoundStmtParser]; + } + return funcParser; +} + + +// ParameterListOpt: +// empty +// ParameterList +// +//paramListOpt = Empty | paramList; +- (PKCollectionParser *)paramListOptParser { + if (!paramListOptParser) { + self.paramListOptParser = [PKAlternation alternation]; + paramListOptParser.name = @"paramListOpt"; + [paramListOptParser add:[self zeroOrOne:self.paramListParser]]; + } + return paramListOptParser; +} + + +// ParameterList: +// Identifier +// Identifier , ParameterList +// +//paramList = identifier commaIdentifier*; +- (PKCollectionParser *)paramListParser { + if (!paramListParser) { + self.paramListParser = [PKSequence sequence]; + paramListParser.name = @"paramList"; + [paramListParser add:self.identifierParser]; + [paramListParser add:[PKRepetition repetitionWithSubparser:self.commaIdentifierParser]]; + } + return paramListParser; +} + + +//commaIdentifier = comma identifier; +- (PKCollectionParser *)commaIdentifierParser { + if (!commaIdentifierParser) { + self.commaIdentifierParser = [PKSequence sequence]; + commaIdentifierParser.name = @"commaIdentifier"; + [commaIdentifierParser add:self.commaParser]; + [commaIdentifierParser add:self.identifierParser]; + } + return commaIdentifierParser; +} + + +// CompoundStatement: +// { Statements } +// +//compoundStmt = openCurly stmts closeCurly; +- (PKCollectionParser *)compoundStmtParser { + if (!compoundStmtParser) { + self.compoundStmtParser = [PKSequence sequence]; + compoundStmtParser.name = @"compoundStmt"; + [compoundStmtParser add:self.openCurlyParser]; + [compoundStmtParser add:self.stmtsParser]; + [compoundStmtParser add:self.closeCurlyParser]; + } + return compoundStmtParser; +} + + +// Statements: +// empty +// Statement Statements +// +//stmts = stmt*; +- (PKCollectionParser *)stmtsParser { + if (!stmtsParser) { + self.stmtsParser = [PKRepetition repetitionWithSubparser:self.stmtParser]; + stmtsParser.name = @"stmts"; + } + return stmtsParser; +} + + +// Statement: +// ; +// if Condition Statement +// if Condition Statement else Statement +// while Condition Statement +// ForParen ; ExpressionOpt ; ExpressionOpt ) Statement +// ForBegin ; ExpressionOpt ; ExpressionOpt ) Statement +// ForBegin in Expression ) Statement +// break ; +// continue ; +// with ( Expression ) Statement +// return ExpressionOpt ; +// CompoundStatement +// VariablesOrExpression ; +// +//stmt = semi | ifStmt | ifElseStmt | whileStmt | forParenStmt | forBeginStmt | forInStmt | breakStmt | continueStmt | withStmt | returnStmt | compoundStmt | variablesOrExprStmt; +- (PKCollectionParser *)stmtParser { + if (!stmtParser) { + self.stmtParser = [PKAlternation alternation]; + stmtParser.name = @"stmt"; + [stmtParser add:self.semiParser]; + [stmtParser add:self.ifStmtParser]; + [stmtParser add:self.ifElseStmtParser]; + [stmtParser add:self.whileStmtParser]; + [stmtParser add:self.forParenStmtParser]; + [stmtParser add:self.forBeginStmtParser]; + [stmtParser add:self.forInStmtParser]; + [stmtParser add:self.breakStmtParser]; + [stmtParser add:self.continueStmtParser]; + [stmtParser add:self.withStmtParser]; + [stmtParser add:self.returnStmtParser]; + [stmtParser add:self.compoundStmtParser]; + [stmtParser add:self.variablesOrExprStmtParser]; + } + return stmtParser; +} + + +// if Condition Statement +//ifStmt = if condition stmt; +- (PKCollectionParser *)ifStmtParser { + if (!ifStmtParser) { + self.ifStmtParser = [PKSequence sequence]; + ifStmtParser.name = @"ifStmt"; + [ifStmtParser add:self.ifParser]; + [ifStmtParser add:self.conditionParser]; + [ifStmtParser add:self.stmtParser]; + } + return ifStmtParser; +} + + +// if Condition Statement else Statement +//ifElseStmt = if condition stmt else stmt; +- (PKCollectionParser *)ifElseStmtParser { + if (!ifElseStmtParser) { + self.ifElseStmtParser = [PKSequence sequence]; + ifElseStmtParser.name = @"ifElseStmt"; + [ifElseStmtParser add:self.ifParser]; + [ifElseStmtParser add:self.conditionParser]; + [ifElseStmtParser add:self.stmtParser]; + [ifElseStmtParser add:self.elseParser]; + [ifElseStmtParser add:self.stmtParser]; + } + return ifElseStmtParser; +} + + +// while Condition Statement +//whileStmt = while condition stmt; +- (PKCollectionParser *)whileStmtParser { + if (!whileStmtParser) { + self.whileStmtParser = [PKSequence sequence]; + whileStmtParser.name = @"whileStmt"; + [whileStmtParser add:self.whileParser]; + [whileStmtParser add:self.conditionParser]; + [whileStmtParser add:self.stmtParser]; + } + return whileStmtParser; +} + + +// ForParen ; ExpressionOpt ; ExpressionOpt ) Statement +//forParenStmt = forParen semi exprOpt semi exprOpt closeParen stmt; +- (PKCollectionParser *)forParenStmtParser { + if (!forParenStmtParser) { + self.forParenStmtParser = [PKSequence sequence]; + forParenStmtParser.name = @"forParenStmt"; + [forParenStmtParser add:self.forParenParser]; + [forParenStmtParser add:self.semiParser]; + [forParenStmtParser add:self.exprOptParser]; + [forParenStmtParser add:self.semiParser]; + [forParenStmtParser add:self.exprOptParser]; + [forParenStmtParser add:self.closeParenParser]; + [forParenStmtParser add:self.stmtParser]; + } + return forParenStmtParser; +} + + +// ForBegin ; ExpressionOpt ; ExpressionOpt ) Statement +//forBeginStmt = forBegin semi exprOpt semi exprOpt closeParen stmt; +- (PKCollectionParser *)forBeginStmtParser { + if (!forBeginStmtParser) { + self.forBeginStmtParser = [PKSequence sequence]; + forBeginStmtParser.name = @"forBeginStmt"; + [forBeginStmtParser add:self.forBeginParser]; + [forBeginStmtParser add:self.semiParser]; + [forBeginStmtParser add:self.exprOptParser]; + [forBeginStmtParser add:self.semiParser]; + [forBeginStmtParser add:self.exprOptParser]; + [forBeginStmtParser add:self.closeParenParser]; + [forBeginStmtParser add:self.stmtParser]; + } + return forBeginStmtParser; +} + + +// ForBegin in Expression ) Statement +//forInStmt = forBegin in expr closeParen stmt; +- (PKCollectionParser *)forInStmtParser { + if (!forInStmtParser) { + self.forInStmtParser = [PKSequence sequence]; + forInStmtParser.name = @"forInStmt"; + [forInStmtParser add:self.forBeginParser]; + [forInStmtParser add:self.inParser]; + [forInStmtParser add:self.exprParser]; + [forInStmtParser add:self.closeParenParser]; + [forInStmtParser add:self.stmtParser]; + } + return forInStmtParser; +} + + +// break ; +//breakStmt = break semi; +- (PKCollectionParser *)breakStmtParser { + if (!breakStmtParser) { + self.breakStmtParser = [PKSequence sequence]; + breakStmtParser.name = @"breakStmt"; + [breakStmtParser add:self.breakParser]; + [breakStmtParser add:self.semiOptParser]; + } + return breakStmtParser; +} + + +//continueStmt = continue semi; +- (PKCollectionParser *)continueStmtParser { + if (!continueStmtParser) { + self.continueStmtParser = [PKSequence sequence]; + continueStmtParser.name = @"continueStmt"; + [continueStmtParser add:self.continueParser]; + [continueStmtParser add:self.semiOptParser]; + } + return continueStmtParser; +} + + +// with ( Expression ) Statement +//withStmt = with openParen expr closeParen stmt; +- (PKCollectionParser *)withStmtParser { + if (!withStmtParser) { + self.withStmtParser = [PKSequence sequence]; + withStmtParser.name = @"withStmt"; + [withStmtParser add:self.withParser]; + [withStmtParser add:self.openParenParser]; + [withStmtParser add:self.exprParser]; + [withStmtParser add:self.closeParenParser]; + [withStmtParser add:self.stmtParser]; + } + return withStmtParser; +} + + +// return ExpressionOpt ; +//returnStmt = return exprOpt semi; +- (PKCollectionParser *)returnStmtParser { + if (!returnStmtParser) { + self.returnStmtParser = [PKSequence sequence]; + returnStmtParser.name = @"returnStmt"; + [returnStmtParser add:self.returnParser]; + [returnStmtParser add:self.exprOptParser]; + [returnStmtParser add:self.semiOptParser]; + } + return returnStmtParser; +} + + +// VariablesOrExpression ; +//variablesOrExprStmt = variablesOrExpr semi; +- (PKCollectionParser *)variablesOrExprStmtParser { + if (!variablesOrExprStmtParser) { + self.variablesOrExprStmtParser = [PKSequence sequence]; + variablesOrExprStmtParser.name = @"variablesOrExprStmt"; + [variablesOrExprStmtParser add:self.variablesOrExprParser]; + [variablesOrExprStmtParser add:self.semiOptParser]; + } + return variablesOrExprStmtParser; +} + + +// Condition: +// ( Expression ) +// +//condition = openParen expr closeParen; +- (PKCollectionParser *)conditionParser { + if (!conditionParser) { + self.conditionParser = [PKSequence sequence]; + conditionParser.name = @"condition"; + [conditionParser add:self.openParenParser]; + [conditionParser add:self.exprParser]; + [conditionParser add:self.closeParenParser]; + } + return conditionParser; +} + + +// ForParen: +// for ( +// +//forParen = for openParen; +- (PKCollectionParser *)forParenParser { + if (!forParenParser) { + self.forParenParser = [PKSequence sequence]; + forParenParser.name = @"forParen"; + [forParenParser add:self.forParser]; + [forParenParser add:self.openParenParser]; + } + return forParenParser; +} + + +// ForBegin: +// ForParen VariablesOrExpression +// +//forBegin = forParen variablesOrExpr; +- (PKCollectionParser *)forBeginParser { + if (!forBeginParser) { + self.forBeginParser = [PKSequence sequence]; + forBeginParser.name = @"forBegin"; + [forBeginParser add:self.forParenParser]; + [forBeginParser add:self.variablesOrExprParser]; + } + return forBeginParser; +} + + +// VariablesOrExpression: +// var Variables +// Expression +// +//variablesOrExpr = varVariables | expr; +- (PKCollectionParser *)variablesOrExprParser { + if (!variablesOrExprParser) { + self.variablesOrExprParser = [PKAlternation alternation]; + variablesOrExprParser.name = @"variablesOrExpr"; + [variablesOrExprParser add:self.varVariablesParser]; + [variablesOrExprParser add:self.exprParser]; + } + return variablesOrExprParser; +} + + +//varVariables = var variables; +- (PKCollectionParser *)varVariablesParser { + if (!varVariablesParser) { + self.varVariablesParser = [PKSequence sequence]; + varVariablesParser.name = @"varVariables"; + [varVariablesParser add:self.varParser]; + [varVariablesParser add:self.variablesParser]; + } + return varVariablesParser; +} + + +// Variables: +// Variable +// Variable , Variables +// +//variables = variable commaVariable*; +- (PKCollectionParser *)variablesParser { + if (!variablesParser) { + self.variablesParser = [PKSequence sequence]; + variablesParser.name = @"variables"; + [variablesParser add:self.variableParser]; + [variablesParser add:[PKRepetition repetitionWithSubparser:self.commaVariableParser]]; + } + return variablesParser; +} + + +//commaVariable = comma variable; +- (PKCollectionParser *)commaVariableParser { + if (!commaVariableParser) { + self.commaVariableParser = [PKSequence sequence]; + commaVariableParser.name = @"commaVariable"; + [commaVariableParser add:self.commaParser]; + [commaVariableParser add:self.variableParser]; + } + return commaVariableParser; +} + + +// Variable: +// Identifier +// Identifier = AssignmentExpression +// +//variable = identifier assignment?; +- (PKCollectionParser *)variableParser { + if (!variableParser) { + self.variableParser = [PKSequence sequence]; + variableParser.name = @"variableParser"; + [variableParser add:self.identifierParser]; + [variableParser add:[self zeroOrOne:self.assignmentParser]]; + } + return variableParser; +} + + +//assignment = equals assignmentExpr; +- (PKCollectionParser *)assignmentParser { + if (!assignmentParser) { + self.assignmentParser = [PKSequence sequence]; + assignmentParser.name = @"assignment"; + [assignmentParser add:self.equalsParser]; + [assignmentParser add:self.assignmentExprParser]; + } + return assignmentParser; +} + + +// ExpressionOpt: +// empty +// Expression +// +// exprOpt = Empty | expr; +- (PKCollectionParser *)exprOptParser { + if (!exprOptParser) { + self.exprOptParser = [self zeroOrOne:self.exprParser]; + exprOptParser.name = @"exprOpt"; + } + return exprOptParser; +} + + +// Expression: +// AssignmentExpression +// AssignmentExpression , Expression +// +//expr = assignmentExpr commaAssignmentExpr*; +- (PKCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [PKSequence sequence]; + exprParser.name = @"exprParser"; + [exprParser add:self.assignmentExprParser]; + [exprParser add:[PKRepetition repetitionWithSubparser:self.commaAssignmentExprParser]]; + } + return exprParser; +} + + +//commaAssignmentExpr = comma assignmentExpr; +- (PKCollectionParser *)commaAssignmentExprParser { + if (!commaAssignmentExprParser) { + self.commaAssignmentExprParser = [PKSequence sequence]; + commaAssignmentExprParser.name = @"commaAssignmentExpr"; + [commaAssignmentExprParser add:self.commaParser]; + [commaAssignmentExprParser add:self.assignmentExprParser]; + } + return commaAssignmentExprParser; +} + + +// AssignmentExpression: +// ConditionalExpression +// ConditionalExpression AssignmentOperator AssignmentExpression +// +// assignmentExpr = conditionalExpr assignmentOpConditionalExpr*; +- (PKCollectionParser *)assignmentExprParser { + if (!assignmentExprParser) { + self.assignmentExprParser = [PKSequence sequence]; + assignmentExprParser.name = @"assignmentExpr"; + [assignmentExprParser add:self.conditionalExprParser]; + [assignmentExprParser add:[PKRepetition repetitionWithSubparser:self.assignmentOpConditionalExprParser]]; + } + return assignmentExprParser; +} + + +// assignmentOpConditionalExpr = assignmentOperator conditionalExpr; +- (PKCollectionParser *)assignmentOpConditionalExprParser { + if (!assignmentOpConditionalExprParser) { + self.assignmentOpConditionalExprParser = [PKSequence sequence]; + assignmentOpConditionalExprParser.name = @"assignmentOpConditionalExpr"; + [assignmentOpConditionalExprParser add:self.assignmentOpParser]; + [assignmentOpConditionalExprParser add:self.conditionalExprParser]; + } + return assignmentOpConditionalExprParser; +} + + +// ConditionalExpression: +// OrExpression +// OrExpression ? AssignmentExpression : AssignmentExpression +// +// conditionalExpr = orExpr ternaryExpr?; +- (PKCollectionParser *)conditionalExprParser { + if (!conditionalExprParser) { + self.conditionalExprParser = [PKSequence sequence]; + conditionalExprParser.name = @"conditionalExpr"; + [conditionalExprParser add:self.orExprParser]; + [conditionalExprParser add:[self zeroOrOne:self.ternaryExprParser]]; + } + return conditionalExprParser; +} + + +// ternaryExpr = question assignmentExpr colon assignmentExpr; +- (PKCollectionParser *)ternaryExprParser { + if (!ternaryExprParser) { + self.ternaryExprParser = [PKSequence sequence]; + ternaryExprParser.name = @"ternaryExpr"; + [ternaryExprParser add:self.questionParser]; + [ternaryExprParser add:self.assignmentExprParser]; + [ternaryExprParser add:self.colonParser]; + [ternaryExprParser add:self.assignmentExprParser]; + } + return ternaryExprParser; +} + + +// OrExpression: +// AndExpression +// AndExpression || OrExpression +// +// orExpr = andExpr orAndExpr*; +- (PKCollectionParser *)orExprParser { + if (!orExprParser) { + self.orExprParser = [PKSequence sequence]; + orExprParser.name = @"orExpr"; + [orExprParser add:self.andExprParser]; + [orExprParser add:[PKRepetition repetitionWithSubparser:self.orAndExprParser]]; + } + return orExprParser; +} + + +// orAndExpr = or andExpr; +- (PKCollectionParser *)orAndExprParser { + if (!orAndExprParser) { + self.orAndExprParser = [PKSequence sequence]; + orAndExprParser.name = @"orAndExpr"; + [orAndExprParser add:self.orParser]; + [orAndExprParser add:self.andExprParser]; + } + return orAndExprParser; +} + + +// AndExpression: +// BitwiseOrExpression +// BitwiseOrExpression && AndExpression +// +// andExpr = bitwiseOrExpr andBitwiseOrExprParser*; +- (PKCollectionParser *)andExprParser { + if (!andExprParser) { + self.andExprParser = [PKSequence sequence]; + andExprParser.name = @"andExpr"; + [andExprParser add:self.bitwiseOrExprParser]; + [andExprParser add:[PKRepetition repetitionWithSubparser:self.andBitwiseOrExprParser]]; + } + return andExprParser; +} + + +// andBitwiseOrExprParser = and bitwiseOrExpr; +- (PKCollectionParser *)andBitwiseOrExprParser { + if (!andBitwiseOrExprParser) { + self.andBitwiseOrExprParser = [PKSequence sequence]; + andBitwiseOrExprParser.name = @"andBitwiseOrExpr"; + [andBitwiseOrExprParser add:self.andParser]; + [andBitwiseOrExprParser add:self.bitwiseOrExprParser]; + } + return andBitwiseOrExprParser; +} + + +// BitwiseOrExpression: +// BitwiseXorExpression +// BitwiseXorExpression | BitwiseOrExpression +// +// bitwiseOrExpr = bitwiseXorExpr pipeBitwiseXorExpr*; +- (PKCollectionParser *)bitwiseOrExprParser { + if (!bitwiseOrExprParser) { + self.bitwiseOrExprParser = [PKSequence sequence]; + bitwiseOrExprParser.name = @"bitwiseOrExpr"; + [bitwiseOrExprParser add:self.bitwiseXorExprParser]; + [bitwiseOrExprParser add:[PKRepetition repetitionWithSubparser:self.pipeBitwiseXorExprParser]]; + } + return bitwiseOrExprParser; +} + + +// pipeBitwiseXorExprParser = pipe bitwiseXorExpr; +- (PKCollectionParser *)pipeBitwiseXorExprParser { + if (!pipeBitwiseXorExprParser) { + self.pipeBitwiseXorExprParser = [PKSequence sequence]; + pipeBitwiseXorExprParser.name = @"pipeBitwiseXorExpr"; + [pipeBitwiseXorExprParser add:self.pipeParser]; + [pipeBitwiseXorExprParser add:self.bitwiseXorExprParser]; + } + return pipeBitwiseXorExprParser; +} + + +// BitwiseXorExpression: +// BitwiseAndExpression +// BitwiseAndExpression ^ BitwiseXorExpression +// +// bitwiseXorExpr = bitwiseAndExpr caretBitwiseAndExpr*; +- (PKCollectionParser *)bitwiseXorExprParser { + if (!bitwiseXorExprParser) { + self.bitwiseXorExprParser = [PKSequence sequence]; + bitwiseXorExprParser.name = @"bitwiseXorExpr"; + [bitwiseXorExprParser add:self.bitwiseAndExprParser]; + [bitwiseXorExprParser add:[PKRepetition repetitionWithSubparser:self.caretBitwiseAndExprParser]]; + } + return bitwiseXorExprParser; +} + + +// caretBitwiseAndExpr = caret bitwiseAndExpr; +- (PKCollectionParser *)caretBitwiseAndExprParser { + if (!caretBitwiseAndExprParser) { + self.caretBitwiseAndExprParser = [PKSequence sequence]; + caretBitwiseAndExprParser.name = @"caretBitwiseAndExpr"; + [caretBitwiseAndExprParser add:self.caretParser]; + [caretBitwiseAndExprParser add:self.bitwiseAndExprParser]; + } + return caretBitwiseAndExprParser; +} + + +// BitwiseAndExpression: +// EqualityExpression +// EqualityExpression & BitwiseAndExpression +// +// bitwiseAndExpr = equalityExpr ampEqualityExpr*; +- (PKCollectionParser *)bitwiseAndExprParser { + if (!bitwiseAndExprParser) { + self.bitwiseAndExprParser = [PKSequence sequence]; + bitwiseAndExprParser.name = @"bitwiseAndExpr"; + [bitwiseAndExprParser add:self.equalityExprParser]; + [bitwiseAndExprParser add:[PKRepetition repetitionWithSubparser:self.ampEqualityExprParser]]; + } + return bitwiseAndExprParser; +} + + +// ampEqualityExpression = amp equalityExpression; +- (PKCollectionParser *)ampEqualityExprParser { + if (!ampEqualityExprParser) { + self.ampEqualityExprParser = [PKSequence sequence]; + ampEqualityExprParser.name = @"ampEqualityExpr"; + [ampEqualityExprParser add:self.ampParser]; + [ampEqualityExprParser add:self.equalityExprParser]; + } + return ampEqualityExprParser; +} + + +// EqualityExpression: +// RelationalExpression +// RelationalExpression EqualityualityOperator EqualityExpression +// +// equalityExpr = relationalExpr equalityOpRelationalExpr*; +- (PKCollectionParser *)equalityExprParser { + if (!equalityExprParser) { + self.equalityExprParser = [PKSequence sequence]; + equalityExprParser.name = @"equalityExpr"; + [equalityExprParser add:self.relationalExprParser]; + [equalityExprParser add:[PKRepetition repetitionWithSubparser:self.equalityOpRelationalExprParser]]; + } + return equalityExprParser; +} + + +// equalityOpRelationalExpr = equalityOp relationalExpr; +- (PKCollectionParser *)equalityOpRelationalExprParser { + if (!equalityOpRelationalExprParser) { + self.equalityOpRelationalExprParser = [PKSequence sequence]; + equalityOpRelationalExprParser.name = @"equalityOpRelationalExpr"; + [equalityOpRelationalExprParser add:self.equalityOpParser]; + [equalityOpRelationalExprParser add:self.relationalExprParser]; + } + return equalityOpRelationalExprParser; +} + + +// RelationalExpression: +// ShiftExpression +// RelationalExpression RelationalationalOperator ShiftExpression +// + +// relationalExpr = shiftExpr relationalOpShiftExpr*; /// TODO ???? +- (PKCollectionParser *)relationalExprParser { + if (!relationalExprParser) { + self.relationalExprParser = [PKSequence sequence]; + relationalExprParser.name = @"relationalExpr"; + [relationalExprParser add:self.shiftExprParser]; + [relationalExprParser add:[PKRepetition repetitionWithSubparser:self.relationalOpShiftExprParser]]; + } + return relationalExprParser; +} + + +// relationalOpShiftExpr = relationalOperator shiftExpr; +- (PKCollectionParser *)relationalOpShiftExprParser { + if (!relationalOpShiftExprParser) { + self.relationalOpShiftExprParser = [PKSequence sequence]; + relationalOpShiftExprParser.name = @"relationalOpShiftExpr"; + [relationalOpShiftExprParser add:self.relationalOpParser]; + [relationalOpShiftExprParser add:self.shiftExprParser]; + } + return relationalOpShiftExprParser; +} + + +// ShiftExpression: +// AdditiveExpression +// AdditiveExpression ShiftOperator ShiftExpression +// +// shiftExpr = additiveExpr shiftOpAdditiveExpr?; +- (PKCollectionParser *)shiftExprParser { + if (!shiftExprParser) { + self.shiftExprParser = [PKSequence sequence]; + shiftExprParser.name = @"shiftExpr"; + [shiftExprParser add:self.additiveExprParser]; + [shiftExprParser add:[PKRepetition repetitionWithSubparser:self.shiftOpAdditiveExprParser]]; + } + return shiftExprParser; +} + + +// shiftOpShiftExpr = shiftOp additiveExpr; +- (PKCollectionParser *)shiftOpAdditiveExprParser { + if (!shiftOpAdditiveExprParser) { + self.shiftOpAdditiveExprParser = [PKSequence sequence]; + shiftOpAdditiveExprParser.name = @"shiftOpShiftExpr"; + [shiftOpAdditiveExprParser add:self.shiftOpParser]; + [shiftOpAdditiveExprParser add:self.additiveExprParser]; + } + return shiftOpAdditiveExprParser; +} + + +// AdditiveExpression: +// MultiplicativeExpression +// MultiplicativeExpression + AdditiveExpression +// MultiplicativeExpression - AdditiveExpression +// +// additiveExpr = multiplicativeExpr plusOrMinusExpr*; +- (PKCollectionParser *)additiveExprParser { + if (!additiveExprParser) { + self.additiveExprParser = [PKSequence sequence]; + additiveExprParser.name = @"additiveExpr"; + [additiveExprParser add:self.multiplicativeExprParser]; + [additiveExprParser add:[PKRepetition repetitionWithSubparser:self.plusOrMinusExprParser]]; + } + return additiveExprParser; +} + + +// plusOrMinusExpr = plusExpr | minusExpr; +- (PKCollectionParser *)plusOrMinusExprParser { + if (!plusOrMinusExprParser) { + self.plusOrMinusExprParser = [PKAlternation alternation]; + plusOrMinusExprParser.name = @"plusOrMinusExpr"; + [plusOrMinusExprParser add:self.plusExprParser]; + [plusOrMinusExprParser add:self.minusExprParser]; + } + return plusOrMinusExprParser; +} + + +// plusExpr = plus multiplicativeExprParser; +- (PKCollectionParser *)plusExprParser { + if (!plusExprParser) { + self.plusExprParser = [PKSequence sequence]; + plusExprParser.name = @"plusExpr"; + [plusExprParser add:self.plusParser]; + [plusExprParser add:self.multiplicativeExprParser]; + } + return plusExprParser; +} + + +// minusExpr = minus multiplicativeExprParser; +- (PKCollectionParser *)minusExprParser { + if (!minusExprParser) { + self.minusExprParser = [PKSequence sequence]; + minusExprParser.name = @"minusExpr"; + [minusExprParser add:self.minusParser]; + [minusExprParser add:self.multiplicativeExprParser]; + } + return minusExprParser; +} + + +// MultiplicativeExpression: +// UnaryExpression +// UnaryExpression MultiplicativeOperator MultiplicativeExpression +// +// multiplicativeExpr = unaryExpr multiplicativeOpUnaryExpr*; +- (PKCollectionParser *)multiplicativeExprParser { + if (!multiplicativeExprParser) { + self.multiplicativeExprParser = [PKSequence sequence]; + multiplicativeExprParser.name = @"multiplicativeExpr"; + [multiplicativeExprParser add:self.unaryExprParser]; + [multiplicativeExprParser add:[PKRepetition repetitionWithSubparser:self.multiplicativeOpUnaryExprParser]]; + } + return multiplicativeExprParser; +} + + +// multiplicativeOpUnaryExpr = multiplicativeOp unaryExpr; +- (PKCollectionParser *)multiplicativeOpUnaryExprParser { + if (!multiplicativeOpUnaryExprParser) { + self.multiplicativeOpUnaryExprParser = [PKSequence sequence]; + multiplicativeOpUnaryExprParser.name = @"multiplicativeOpUnaryExpr"; + [multiplicativeOpUnaryExprParser add:self.multiplicativeOpParser]; + [multiplicativeOpUnaryExprParser add:self.unaryExprParser]; + } + return multiplicativeOpUnaryExprParser; +} + + +// UnaryExpression: +// MemberExpression +// UnaryOperator UnaryExpression +// - UnaryExpression +// IncrementOperator MemberExpression +// MemberExpression IncrementOperator +// new Constructor +// delete MemberExpression +// +// unaryExpr = memberExpr | unaryExpr1 | unaryExpr2 | unaryExpr3 | unaryExpr4 | unaryExpr5 | unaryExpr6; +- (PKCollectionParser *)unaryExprParser { + if (!unaryExprParser) { + self.unaryExprParser = [PKAlternation alternation]; + unaryExprParser.name = @"unaryExpr"; + [unaryExprParser add:self.memberExprParser]; + [unaryExprParser add:self.unaryExpr1Parser]; + [unaryExprParser add:self.unaryExpr2Parser]; + [unaryExprParser add:self.unaryExpr3Parser]; + [unaryExprParser add:self.unaryExpr4Parser]; + [unaryExprParser add:self.unaryExpr5Parser]; + [unaryExprParser add:self.unaryExpr6Parser]; + } + return unaryExprParser; +} + + +// unaryExpr1 = unaryOperator unaryExpr; +- (PKCollectionParser *)unaryExpr1Parser { + if (!unaryExpr1Parser) { + self.unaryExpr1Parser = [PKSequence sequence]; + unaryExpr1Parser.name = @"unaryExpr1"; + [unaryExpr1Parser add:self.unaryOpParser]; + [unaryExpr1Parser add:self.unaryExprParser]; + } + return unaryExpr1Parser; +} + + +// unaryExpr2 = minus unaryExpr; +- (PKCollectionParser *)unaryExpr2Parser { + if (!unaryExpr2Parser) { + self.unaryExpr2Parser = [PKSequence sequence]; + unaryExpr2Parser.name = @"unaryExpr2"; + [unaryExpr2Parser add:self.minusParser]; + [unaryExpr2Parser add:self.unaryExprParser]; + } + return unaryExpr2Parser; +} + + +// unaryExpr3 = incrementOperator memberExpr; +- (PKCollectionParser *)unaryExpr3Parser { + if (!unaryExpr3Parser) { + self.unaryExpr3Parser = [PKSequence sequence]; + unaryExpr3Parser.name = @"unaryExpr3"; + [unaryExpr3Parser add:self.incrementOpParser]; + [unaryExpr3Parser add:self.memberExprParser]; + } + return unaryExpr3Parser; +} + + +// unaryExpr4 = memberExpr incrementOperator; +- (PKCollectionParser *)unaryExpr4Parser { + if (!unaryExpr4Parser) { + self.unaryExpr4Parser = [PKSequence sequence]; + unaryExpr4Parser.name = @"unaryExpr4"; + [unaryExpr4Parser add:self.memberExprParser]; + [unaryExpr4Parser add:self.incrementOpParser]; + } + return unaryExpr4Parser; +} + + +// unaryExpr5 = new constructor; +- (PKCollectionParser *)unaryExpr5Parser { + if (!unaryExpr5Parser) { + self.unaryExpr5Parser = [PKSequence sequence]; + unaryExpr5Parser.name = @"unaryExpr5"; + [unaryExpr5Parser add:self.newParser]; + [unaryExpr5Parser add:self.constructorCallParser]; + } + return unaryExpr5Parser; +} + + +// unaryExpr6 = delete memberExpr; +- (PKCollectionParser *)unaryExpr6Parser { + if (!unaryExpr6Parser) { + self.unaryExpr6Parser = [PKSequence sequence]; + unaryExpr6Parser.name = @"unaryExpr6"; + [unaryExpr6Parser add:self.deleteParser]; + [unaryExpr6Parser add:self.memberExprParser]; + } + return unaryExpr6Parser; +} + + +// ConstructorCall: +// Identifier +// Identifier ( ArgumentListOpt ) +// Identifier . ConstructorCall +// + +// constructorCall = identifier parentArgListOptParent? memberExprExt* +- (PKCollectionParser *)constructorCallParser { + if (!constructorCallParser) { + self.constructorCallParser = [PKSequence sequence]; + constructorCallParser.name = @"constructorCall"; + [constructorCallParser add:self.identifierParser]; + [constructorCallParser add:[self zeroOrOne:self.parenArgListOptParenParser]]; + [constructorCallParser add:[PKRepetition repetitionWithSubparser:self.memberExprExtParser]]; + } + return constructorCallParser; +} + + +// parenArgListParen = openParen argListOpt closeParen; +- (PKCollectionParser *)parenArgListOptParenParser { + if (!parenArgListOptParenParser) { + self.parenArgListOptParenParser = [PKSequence sequence]; + parenArgListOptParenParser.name = @"parenArgListParen"; + [parenArgListOptParenParser add:self.openParenParser]; + [parenArgListOptParenParser add:self.argListOptParser]; + [parenArgListOptParenParser add:self.closeParenParser]; + } + return parenArgListOptParenParser; +} + + +// MemberExpression: +// PrimaryExpression +// PrimaryExpression . MemberExpression +// PrimaryExpression [ Expression ] +// PrimaryExpression ( ArgumentListOpt ) +// +// memberExpr = primaryExpr memberExprExt?; // TODO ?????? +- (PKCollectionParser *)memberExprParser { + if (!memberExprParser) { + self.memberExprParser = [PKSequence sequence]; + memberExprParser.name = @"memberExpr"; + [memberExprParser add:self.primaryExprParser]; + [memberExprParser add:[PKRepetition repetitionWithSubparser:self.memberExprExtParser]]; + } + return memberExprParser; +} + + +// memberExprExt = dotMemberExpr | bracketMemberExpr | parenMemberExpr; +- (PKCollectionParser *)memberExprExtParser { + if (!memberExprExtParser) { + self.memberExprExtParser = [PKAlternation alternation]; + memberExprExtParser.name = @"memberExprExt"; + [memberExprExtParser add:self.dotMemberExprParser]; + [memberExprExtParser add:self.bracketMemberExprParser]; + [memberExprExtParser add:self.parenArgListOptParenParser]; + } + return memberExprExtParser; +} + + +// dotMemberExpr = dot memberExpr; +- (PKCollectionParser *)dotMemberExprParser { + if (!dotMemberExprParser) { + self.dotMemberExprParser = [PKSequence sequence]; + dotMemberExprParser.name = @"dotMemberExpr"; + [dotMemberExprParser add:self.dotParser]; + [dotMemberExprParser add:self.memberExprParser]; + } + return dotMemberExprParser; +} + + +// bracketMemberExpr = openBracket expr closeBracket; +- (PKCollectionParser *)bracketMemberExprParser { + if (!bracketMemberExprParser) { + self.bracketMemberExprParser = [PKSequence sequence]; + bracketMemberExprParser.name = @"bracketMemberExpr"; + [bracketMemberExprParser add:self.openBracketParser]; + [bracketMemberExprParser add:self.exprParser]; + [bracketMemberExprParser add:self.closeBracketParser]; + } + return bracketMemberExprParser; +} + + +// ArgumentListOpt: +// empty +// ArgumentList +// +// argListOpt = argList?; +- (PKCollectionParser *)argListOptParser { + if (!argListOptParser) { + self.argListOptParser = [self zeroOrOne:self.argListParser]; + argListOptParser.name = @"argListOpt"; + } + return argListOptParser; +} + + +// ArgumentList: +// AssignmentExpression +// AssignmentExpression , ArgumentList +// +// argList = assignmentExpr commaAssignmentExpr*; +- (PKCollectionParser *)argListParser { + if (!argListParser) { + self.argListParser = [PKSequence sequence]; + argListParser.name = @"argList"; + [argListParser add:self.assignmentExprParser]; + [argListParser add:[PKRepetition repetitionWithSubparser:self.commaAssignmentExprParser]]; + } + return argListParser; +} + + + // PrimaryExpression: + // ( Expression ) + // funcLiteral + // arrayLiteral + // Identifier + // IntegerLiteral + // FloatingPointLiteral + // StringLiteral + // false + // true + // null + // this +// primaryExpr = parenExprParen | funcLiteral | arrayLiteral | identifier | Number | QuotedString | false | true | null | undefined | this; +- (PKCollectionParser *)primaryExprParser { + if (!primaryExprParser) { + self.primaryExprParser = [PKAlternation alternation]; + primaryExprParser.name = @"primaryExpr"; + [primaryExprParser add:self.parenExprParenParser]; + [primaryExprParser add:self.funcLiteralParser]; + [primaryExprParser add:self.arrayLiteralParser]; + [primaryExprParser add:self.objectLiteralParser]; + [primaryExprParser add:self.identifierParser]; + [primaryExprParser add:self.numberParser]; + [primaryExprParser add:self.stringParser]; + [primaryExprParser add:self.trueParser]; + [primaryExprParser add:self.falseParser]; + [primaryExprParser add:self.nullParser]; + [primaryExprParser add:self.undefinedParser]; // TODO ?? + [primaryExprParser add:self.thisParser]; + } + return primaryExprParser; +} + + + +// parenExprParen = openParen expr closeParen; +- (PKCollectionParser *)parenExprParenParser { + if (!parenExprParenParser) { + self.parenExprParenParser = [PKSequence sequence]; + parenExprParenParser.name = @"parenExprParen"; + [parenExprParenParser add:self.openParenParser]; + [parenExprParenParser add:self.exprParser]; + [parenExprParenParser add:self.closeParenParser]; + } + return parenExprParenParser; +} + + +//funcLiteral = function openParen paramListOpt closeParen compoundStmt; +- (PKCollectionParser *)funcLiteralParser { + if (!funcLiteralParser) { + self.funcLiteralParser = [PKSequence sequence]; + funcLiteralParser.name = @"funcLiteral"; + [funcLiteralParser add:self.functionParser]; + [funcLiteralParser add:self.openParenParser]; + [funcLiteralParser add:self.paramListOptParser]; + [funcLiteralParser add:self.closeParenParser]; + [funcLiteralParser add:self.compoundStmtParser]; + } + return funcLiteralParser; +} + + +//arrayLiteral = '[' arrayContents ']'; +- (PKCollectionParser *)arrayLiteralParser { + if (!arrayLiteralParser) { + self.arrayLiteralParser = [PKTrack track]; + arrayLiteralParser.name = @"arrayLiteralParser"; + + PKSequence *commaPrimaryExpr = [PKSequence sequence]; + [commaPrimaryExpr add:self.commaParser]; + [commaPrimaryExpr add:self.primaryExprParser]; + + PKSequence *arrayContents = [PKSequence sequence]; + [arrayContents add:self.primaryExprParser]; + [arrayContents add:[PKRepetition repetitionWithSubparser:commaPrimaryExpr]]; + + PKAlternation *arrayContentsOpt = [PKAlternation alternation]; + [arrayContentsOpt add:[PKEmpty empty]]; + [arrayContentsOpt add:arrayContents]; + + [arrayLiteralParser add:self.openBracketParser]; + [arrayLiteralParser add:arrayContentsOpt]; + [arrayLiteralParser add:self.closeBracketParser]; + } + return arrayLiteralParser; +} + + +//objectLiteral = '{' objectContentsOpt '}'; +- (PKCollectionParser *)objectLiteralParser { + if (!objectLiteralParser) { + self.objectLiteralParser = [PKSequence sequence]; + objectLiteralParser.name = @"objectLiteralParser"; + + PKSequence *member = [PKSequence sequence]; + [member add:self.identifierParser]; + [member add:self.colonParser]; + [member add:self.primaryExprParser]; + + PKSequence *commaMember = [PKSequence sequence]; + [commaMember add:self.commaParser]; + [commaMember add:member]; + + PKSequence *objectContents = [PKSequence sequence]; + [objectContents add:member]; + [objectContents add:[PKRepetition repetitionWithSubparser:commaMember]]; + + PKAlternation *objectContentsOpt = [PKAlternation alternation]; + [objectContentsOpt add:[PKEmpty empty]]; + [objectContentsOpt add:objectContents]; + + [objectLiteralParser add:self.openCurlyParser]; + [objectLiteralParser add:objectContentsOpt]; + [objectLiteralParser add:self.closeCurlyParser]; + } + return objectLiteralParser; +} + + +// identifier = Word; +- (PKParser *)identifierParser { + if (!identifierParser) { + self.identifierParser = [PKWord word]; + identifierParser.name = @"identifier"; + } + return identifierParser; +} + + +- (PKParser *)stringParser { + if (!stringParser) { + self.stringParser = [PKQuotedString quotedString]; + stringParser.name = @"string"; + } + return stringParser; +} + + +- (PKParser *)numberParser { + if (!numberParser) { + self.numberParser = [PKNumber number]; + numberParser.name = @"number"; + } + return numberParser; +} + + +#pragma mark - +#pragma mark keywords + +- (PKParser *)ifParser { + if (!ifParser) { + self.ifParser = [PKLiteral literalWithString:@"if"]; + ifParser.name = @"if"; + } + return ifParser; +} + + +- (PKParser *)elseParser { + if (!elseParser) { + self.elseParser = [PKLiteral literalWithString:@"else"]; + elseParser.name = @"else"; + } + return elseParser; +} + + +- (PKParser *)whileParser { + if (!whileParser) { + self.whileParser = [PKLiteral literalWithString:@"while"]; + whileParser.name = @"while"; + } + return whileParser; +} + + +- (PKParser *)forParser { + if (!forParser) { + self.forParser = [PKLiteral literalWithString:@"for"]; + forParser.name = @"for"; + } + return forParser; +} + + +- (PKParser *)inParser { + if (!inParser) { + self.inParser = [PKLiteral literalWithString:@"in"]; + inParser.name = @"in"; + } + return inParser; +} + + +- (PKParser *)breakParser { + if (!breakParser) { + self.breakParser = [PKLiteral literalWithString:@"break"]; + breakParser.name = @"break"; + } + return breakParser; +} + + +- (PKParser *)continueParser { + if (!continueParser) { + self.continueParser = [PKLiteral literalWithString:@"continue"]; + continueParser.name = @"continue"; + } + return continueParser; +} + + +- (PKParser *)withParser { + if (!withParser) { + self.withParser = [PKLiteral literalWithString:@"with"]; + withParser.name = @"with"; + } + return withParser; +} + + +- (PKParser *)returnParser { + if (!returnParser) { + self.returnParser = [PKLiteral literalWithString:@"return"]; + returnParser.name = @"return"; + } + return returnParser; +} + + +- (PKParser *)varParser { + if (!varParser) { + self.varParser = [PKLiteral literalWithString:@"var"]; + varParser.name = @"var"; + } + return varParser; +} + + +- (PKParser *)deleteParser { + if (!deleteParser) { + self.deleteParser = [PKLiteral literalWithString:@"delete"]; + deleteParser.name = @"delete"; + } + return deleteParser; +} + + +- (PKParser *)newParser { + if (!newParser) { + self.newParser = [PKLiteral literalWithString:@"new"]; + newParser.name = @"new"; + } + return newParser; +} + + +- (PKParser *)thisParser { + if (!thisParser) { + self.thisParser = [PKLiteral literalWithString:@"this"]; + thisParser.name = @"this"; + } + return thisParser; +} + + +- (PKParser *)falseParser { + if (!falseParser) { + self.falseParser = [PKLiteral literalWithString:@"false"]; + falseParser.name = @"false"; + } + return falseParser; +} + + +- (PKParser *)trueParser { + if (!trueParser) { + self.trueParser = [PKLiteral literalWithString:@"true"]; + trueParser.name = @"true"; + } + return trueParser; +} + + +- (PKParser *)nullParser { + if (!nullParser) { + self.nullParser = [PKLiteral literalWithString:@"null"]; + nullParser.name = @"null"; + } + return nullParser; +} + + +- (PKParser *)undefinedParser { + if (!undefinedParser) { + self.undefinedParser = [PKLiteral literalWithString:@"undefined"]; + undefinedParser.name = @"undefined"; + } + return undefinedParser; +} + + +- (PKParser *)voidParser { + if (!voidParser) { + self.voidParser = [PKLiteral literalWithString:@"void"]; + voidParser.name = @"void"; + } + return voidParser; +} + + +- (PKParser *)typeofParser { + if (!typeofParser) { + self.typeofParser = [PKLiteral literalWithString:@"typeof"]; + typeofParser.name = @"typeof"; + } + return typeofParser; +} + + +- (PKParser *)instanceofParser { + if (!instanceofParser) { + self.instanceofParser = [PKLiteral literalWithString:@"instanceof"]; + instanceofParser.name = @"instanceof"; + } + return instanceofParser; +} + + +- (PKParser *)functionParser { + if (!functionParser) { + self.functionParser = [PKLiteral literalWithString:@"function"]; + functionParser.name = @"function"; + } + return functionParser; +} + + +#pragma mark - +#pragma mark single-char symbols + +- (PKParser *)orParser { + if (!orParser) { + self.orParser = [PKSymbol symbolWithString:@"||"]; + orParser.name = @"or"; + } + return orParser; +} + + +- (PKParser *)andParser { + if (!andParser) { + self.andParser = [PKSymbol symbolWithString:@"&&"]; + andParser.name = @"and"; + } + return andParser; +} + + +- (PKParser *)neParser { + if (!neParser) { + self.neParser = [PKSymbol symbolWithString:@"!="]; + neParser.name = @"ne"; + } + return neParser; +} + + +- (PKParser *)isNotParser { + if (!isNotParser) { + self.isNotParser = [PKSymbol symbolWithString:@"!=="]; + isNotParser.name = @"isNot"; + } + return isNotParser; +} + + +- (PKParser *)eqParser { + if (!eqParser) { + self.eqParser = [PKSymbol symbolWithString:@"=="]; + eqParser.name = @"eq"; + } + return eqParser; +} + + +- (PKParser *)isParser { + if (!isParser) { + self.isParser = [PKSymbol symbolWithString:@"==="]; + isParser.name = @"is"; + } + return isParser; +} + + +- (PKParser *)leParser { + if (!leParser) { + self.leParser = [PKSymbol symbolWithString:@"<="]; + leParser.name = @"le"; + } + return leParser; +} + + +- (PKParser *)geParser { + if (!geParser) { + self.geParser = [PKSymbol symbolWithString:@">="]; + geParser.name = @"ge"; + } + return geParser; +} + + +- (PKParser *)plusPlusParser { + if (!plusPlusParser) { + self.plusPlusParser = [PKSymbol symbolWithString:@"++"]; + plusPlusParser.name = @"plusPlus"; + } + return plusPlusParser; +} + + +- (PKParser *)minusMinusParser { + if (!minusMinusParser) { + self.minusMinusParser = [PKSymbol symbolWithString:@"--"]; + minusMinusParser.name = @"minusMinus"; + } + return minusMinusParser; +} + + +- (PKParser *)plusEqParser { + if (!plusEqParser) { + self.plusEqParser = [PKSymbol symbolWithString:@"+="]; + plusEqParser.name = @"plusEq"; + } + return plusEqParser; +} + + +- (PKParser *)minusEqParser { + if (!minusEqParser) { + self.minusEqParser = [PKSymbol symbolWithString:@"-="]; + minusEqParser.name = @"minusEq"; + } + return minusEqParser; +} + + +- (PKParser *)timesEqParser { + if (!timesEqParser) { + self.timesEqParser = [PKSymbol symbolWithString:@"*="]; + timesEqParser.name = @"timesEq"; + } + return timesEqParser; +} + + +- (PKParser *)divEqParser { + if (!divEqParser) { + self.divEqParser = [PKSymbol symbolWithString:@"/="]; + divEqParser.name = @"divEq"; + } + return divEqParser; +} + + +- (PKParser *)modEqParser { + if (!modEqParser) { + self.modEqParser = [PKSymbol symbolWithString:@"%="]; + modEqParser.name = @"modEq"; + } + return modEqParser; +} + + +- (PKParser *)shiftLeftParser { + if (!shiftLeftParser) { + self.shiftLeftParser = [PKSymbol symbolWithString:@"<<"]; + shiftLeftParser.name = @"shiftLeft"; + } + return shiftLeftParser; +} + + +- (PKParser *)shiftRightParser { + if (!shiftRightParser) { + self.shiftRightParser = [PKSymbol symbolWithString:@">>"]; + shiftRightParser.name = @"shiftRight"; + } + return shiftRightParser; +} + + +- (PKParser *)shiftRightExtParser { + if (!shiftRightExtParser) { + self.shiftRightExtParser = [PKSymbol symbolWithString:@">>>"]; + shiftRightExtParser.name = @"shiftRightExt"; + } + return shiftRightExtParser; +} + + +- (PKParser *)shiftLeftEqParser { + if (!shiftLeftEqParser) { + self.shiftLeftEqParser = [PKSymbol symbolWithString:@"<<="]; + shiftLeftEqParser.name = @"shiftLeftEq"; + } + return shiftLeftEqParser; +} + + +- (PKParser *)shiftRightEqParser { + if (!shiftRightEqParser) { + self.shiftRightEqParser = [PKSymbol symbolWithString:@">>="]; + shiftRightEqParser.name = @"shiftRightEq"; + } + return shiftRightEqParser; +} + + +- (PKParser *)shiftRightExtEqParser { + if (!shiftRightExtEqParser) { + self.shiftRightExtEqParser = [PKSymbol symbolWithString:@">>>="]; + shiftRightExtEqParser.name = @"shiftRightExtEq"; + } + return shiftRightExtEqParser; +} + + +- (PKParser *)andEqParser { + if (!andEqParser) { + self.andEqParser = [PKSymbol symbolWithString:@"&="]; + andEqParser.name = @"andEq"; + } + return andEqParser; +} + + +- (PKParser *)xorEqParser { + if (!xorEqParser) { + self.xorEqParser = [PKSymbol symbolWithString:@"^="]; + xorEqParser.name = @"xorEq"; + } + return xorEqParser; +} + + +- (PKParser *)orEqParser { + if (!orEqParser) { + self.orEqParser = [PKSymbol symbolWithString:@"|="]; + orEqParser.name = @"orEq"; + } + return orEqParser; +} + + +#pragma mark - +#pragma mark single-char symbols + +- (PKParser *)openCurlyParser { + if (!openCurlyParser) { + self.openCurlyParser = [PKSymbol symbolWithString:@"{"]; + openCurlyParser.name = @"openCurly"; + } + return openCurlyParser; +} + + +- (PKParser *)closeCurlyParser { + if (!closeCurlyParser) { + self.closeCurlyParser = [PKSymbol symbolWithString:@"}"]; + closeCurlyParser.name = @"closeCurly"; + } + return closeCurlyParser; +} + + +- (PKParser *)openParenParser { + if (!openParenParser) { + self.openParenParser = [PKSymbol symbolWithString:@"("]; + openParenParser.name = @"openParen"; + } + return openParenParser; +} + + +- (PKParser *)closeParenParser { + if (!closeParenParser) { + self.closeParenParser = [PKSymbol symbolWithString:@")"]; + closeParenParser.name = @"closeParen"; + } + return closeParenParser; +} + + +- (PKParser *)openBracketParser { + if (!openBracketParser) { + self.openBracketParser = [PKSymbol symbolWithString:@"["]; + openBracketParser.name = @"openBracket"; + } + return openBracketParser; +} + + +- (PKParser *)closeBracketParser { + if (!closeBracketParser) { + self.closeBracketParser = [PKSymbol symbolWithString:@"]"]; + closeBracketParser.name = @"closeBracket"; + } + return closeBracketParser; +} + + +- (PKParser *)commaParser { + if (!commaParser) { + self.commaParser = [PKSymbol symbolWithString:@","]; + commaParser.name = @"comma"; + } + return commaParser; +} + + +- (PKParser *)dotParser { + if (!dotParser) { + self.dotParser = [PKSymbol symbolWithString:@"."]; + dotParser.name = @"dot"; + } + return dotParser; +} + + +- (PKParser *)semiOptParser { + if (!semiOptParser) { + self.semiOptParser = [self zeroOrOne:self.semiParser]; + semiOptParser.name = @"semiOpt"; + } + return semiOptParser; +} + + +- (PKParser *)semiParser { + if (!semiParser) { + self.semiParser = [PKSymbol symbolWithString:@";"]; + semiParser.name = @"semi"; + } + return semiParser; +} + + +- (PKParser *)colonParser { + if (!colonParser) { + self.colonParser = [PKSymbol symbolWithString:@":"]; + colonParser.name = @"colon"; + } + return colonParser; +} + + +- (PKParser *)equalsParser { + if (!equalsParser) { + self.equalsParser = [PKSymbol symbolWithString:@"="]; + equalsParser.name = @"equals"; + } + return equalsParser; +} + + +- (PKParser *)notParser { + if (!notParser) { + self.notParser = [PKSymbol symbolWithString:@"!"]; + notParser.name = @"not"; + } + return notParser; +} + + +- (PKParser *)ltParser { + if (!ltParser) { + self.ltParser = [PKSymbol symbolWithString:@"<"]; + ltParser.name = @"lt"; + } + return ltParser; +} + + +- (PKParser *)gtParser { + if (!gtParser) { + self.gtParser = [PKSymbol symbolWithString:@">"]; + gtParser.name = @"gt"; + } + return gtParser; +} + + +- (PKParser *)ampParser { + if (!ampParser) { + self.ampParser = [PKSymbol symbolWithString:@"&"]; + ampParser.name = @"amp"; + } + return ampParser; +} + + +- (PKParser *)pipeParser { + if (!pipeParser) { + self.pipeParser = [PKSymbol symbolWithString:@"|"]; + pipeParser.name = @"pipe"; + } + return pipeParser; +} + + +- (PKParser *)caretParser { + if (!caretParser) { + self.caretParser = [PKSymbol symbolWithString:@"^"]; + caretParser.name = @"caret"; + } + return caretParser; +} + + +- (PKParser *)tildeParser { + if (!tildeParser) { + self.tildeParser = [PKSymbol symbolWithString:@"~"]; + tildeParser.name = @"tilde"; + } + return tildeParser; +} + + +- (PKParser *)questionParser { + if (!questionParser) { + self.questionParser = [PKSymbol symbolWithString:@"?"]; + questionParser.name = @"question"; + } + return questionParser; +} + + +- (PKParser *)plusParser { + if (!plusParser) { + self.plusParser = [PKSymbol symbolWithString:@"+"]; + plusParser.name = @"plus"; + } + return plusParser; +} + + +- (PKParser *)minusParser { + if (!minusParser) { + self.minusParser = [PKSymbol symbolWithString:@"-"]; + minusParser.name = @"minus"; + } + return minusParser; +} + + +- (PKParser *)timesParser { + if (!timesParser) { + self.timesParser = [PKSymbol symbolWithString:@"x"]; + timesParser.name = @"times"; + } + return timesParser; +} + + +- (PKParser *)divParser { + if (!divParser) { + self.divParser = [PKSymbol symbolWithString:@"/"]; + divParser.name = @"div"; + } + return divParser; +} + + +- (PKParser *)modParser { + if (!modParser) { + self.modParser = [PKSymbol symbolWithString:@"%"]; + modParser.name = @"mod"; + } + return modParser; +} + +@synthesize assignmentOpParser; +@synthesize relationalOpParser; +@synthesize equalityOpParser; +@synthesize shiftOpParser; +@synthesize incrementOpParser; +@synthesize unaryOpParser; +@synthesize multiplicativeOpParser; + +@synthesize programParser; +@synthesize elementParser; +@synthesize funcParser; +@synthesize paramListOptParser; +@synthesize paramListParser; +@synthesize commaIdentifierParser; +@synthesize compoundStmtParser; +@synthesize stmtsParser; +@synthesize stmtParser; +@synthesize ifStmtParser; +@synthesize ifElseStmtParser; +@synthesize whileStmtParser; +@synthesize forParenStmtParser; +@synthesize forBeginStmtParser; +@synthesize forInStmtParser; +@synthesize breakStmtParser; +@synthesize continueStmtParser; +@synthesize withStmtParser; +@synthesize returnStmtParser; +@synthesize variablesOrExprStmtParser; +@synthesize conditionParser; +@synthesize forParenParser; +@synthesize forBeginParser; +@synthesize variablesOrExprParser; +@synthesize varVariablesParser; +@synthesize variablesParser; +@synthesize commaVariableParser; +@synthesize variableParser; +@synthesize assignmentParser; +@synthesize exprOptParser; +@synthesize exprParser; +@synthesize commaAssignmentExprParser; +@synthesize assignmentExprParser; +@synthesize assignmentOpConditionalExprParser; +@synthesize conditionalExprParser; +@synthesize ternaryExprParser; +@synthesize orExprParser; +@synthesize orAndExprParser; +@synthesize andExprParser; +@synthesize andBitwiseOrExprParser; +@synthesize bitwiseOrExprParser; +@synthesize pipeBitwiseXorExprParser; +@synthesize bitwiseXorExprParser; +@synthesize caretBitwiseAndExprParser; +@synthesize bitwiseAndExprParser; +@synthesize ampEqualityExprParser; +@synthesize equalityExprParser; +@synthesize equalityOpRelationalExprParser; +@synthesize relationalExprParser; +@synthesize relationalOpShiftExprParser; +@synthesize shiftExprParser; +@synthesize shiftOpAdditiveExprParser; +@synthesize additiveExprParser; +@synthesize plusOrMinusExprParser; +@synthesize plusExprParser; +@synthesize minusExprParser; +@synthesize multiplicativeExprParser; +@synthesize multiplicativeOpUnaryExprParser; +@synthesize unaryExprParser; +@synthesize unaryExpr1Parser; +@synthesize unaryExpr2Parser; +@synthesize unaryExpr3Parser; +@synthesize unaryExpr4Parser; +@synthesize unaryExpr5Parser; +@synthesize unaryExpr6Parser; +@synthesize constructorCallParser; +@synthesize parenArgListOptParenParser; +@synthesize memberExprParser; +@synthesize memberExprExtParser; +@synthesize dotMemberExprParser; +@synthesize bracketMemberExprParser; +@synthesize argListOptParser; +@synthesize argListParser; +@synthesize primaryExprParser; +@synthesize parenExprParenParser; + +@synthesize funcLiteralParser; +@synthesize arrayLiteralParser; +@synthesize objectLiteralParser; + +@synthesize identifierParser; +@synthesize stringParser; +@synthesize numberParser; + +@synthesize ifParser; +@synthesize elseParser; +@synthesize whileParser; +@synthesize forParser; +@synthesize inParser; +@synthesize breakParser; +@synthesize continueParser; +@synthesize withParser; +@synthesize returnParser; +@synthesize varParser; +@synthesize deleteParser; +@synthesize newParser; +@synthesize thisParser; +@synthesize falseParser; +@synthesize trueParser; +@synthesize nullParser; +@synthesize undefinedParser; +@synthesize voidParser; +@synthesize typeofParser; +@synthesize instanceofParser; +@synthesize functionParser; + +@synthesize orParser; +@synthesize andParser; +@synthesize neParser; +@synthesize isNotParser; +@synthesize eqParser; +@synthesize isParser; +@synthesize leParser; +@synthesize geParser; +@synthesize plusPlusParser; +@synthesize minusMinusParser; +@synthesize plusEqParser; +@synthesize minusEqParser; +@synthesize timesEqParser; +@synthesize divEqParser; +@synthesize modEqParser; +@synthesize shiftLeftParser; +@synthesize shiftRightParser; +@synthesize shiftRightExtParser; +@synthesize shiftLeftEqParser; +@synthesize shiftRightEqParser; +@synthesize shiftRightExtEqParser; +@synthesize andEqParser; +@synthesize xorEqParser; +@synthesize orEqParser; + +@synthesize openCurlyParser; +@synthesize closeCurlyParser; +@synthesize openParenParser; +@synthesize closeParenParser; +@synthesize openBracketParser; +@synthesize closeBracketParser; +@synthesize commaParser; +@synthesize dotParser; +@synthesize semiOptParser; +@synthesize semiParser; +@synthesize colonParser; +@synthesize equalsParser; +@synthesize notParser; +@synthesize ltParser; +@synthesize gtParser; +@synthesize ampParser; +@synthesize pipeParser; +@synthesize caretParser; +@synthesize tildeParser; +@synthesize questionParser; +@synthesize plusParser; +@synthesize minusParser; +@synthesize timesParser; +@synthesize divParser; +@synthesize modParser; +@end diff --git a/test/.svn/text-base/TDJavaScriptParserTest.h.svn-base b/test/.svn/text-base/TDJavaScriptParserTest.h.svn-base new file mode 100644 index 0000000..ddc1e22 --- /dev/null +++ b/test/.svn/text-base/TDJavaScriptParserTest.h.svn-base @@ -0,0 +1,19 @@ +// +// PKJavaScriptParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 3/22/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "TDJavaScriptParser.h" + +@interface TDJavaScriptParserTest : SenTestCase { + TDJavaScriptParser *jsp; + NSString *s; + PKTokenAssembly *a; + id res; +} + +@end diff --git a/test/.svn/text-base/TDJavaScriptParserTest.m.svn-base b/test/.svn/text-base/TDJavaScriptParserTest.m.svn-base new file mode 100644 index 0000000..ce6fb73 --- /dev/null +++ b/test/.svn/text-base/TDJavaScriptParserTest.m.svn-base @@ -0,0 +1,742 @@ +// +// PKJavaScriptParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 3/22/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDJavaScriptParserTest.h" + +@implementation TDJavaScriptParserTest + +- (void)setUp { + jsp = [TDJavaScriptParser parser]; +} + + +- (void)tearDown { + +} + + +- (void)testStmtParser { + s = @";"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.stmtParser bestMatchFor:a]; + TDEqualObjects([res description], @"[;];^"); + + s = @"{}"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.stmtParser bestMatchFor:a]; + TDEqualObjects([res description], @"[{, }]{/}^"); +} + + +- (void)testFunctionParser { + s = @"function"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.functionParser bestMatchFor:a]; + TDEqualObjects([res description], @"[function]function^"); +} + + +- (void)testIdentifierParser { + s = @"foo"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.identifierParser bestMatchFor:a]; + TDEqualObjects([res description], @"[foo]foo^"); +} + + +- (void)testParamListOptParserParser { + s = @"a, b"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.paramListOptParser bestMatchFor:a]; + TDEqualObjects([res description], @"[a, ,, b]a/,/b^"); +} + + +- (void)testCompoundStmtParserParser { + s = @"{}"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.compoundStmtParser bestMatchFor:a]; + TDEqualObjects([res description], @"[{, }]{/}^"); +} + + +- (void)testFuncParser { + s = @"function foo(a, b) {}"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.funcParser bestMatchFor:a]; + TDEqualObjects([res description], @"[function, foo, (, a, ,, b, ), {, }]function/foo/(/a/,/b/)/{/}^"); + + s = @"function foo(a, b) { return a + b; }"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.funcParser bestMatchFor:a]; + TDEqualObjects([res description], @"[function, foo, (, a, ,, b, ), {, return, a, +, b, ;, }]function/foo/(/a/,/b/)/{/return/a/+/b/;/}^"); + + s = @"function foo(a, b) { a++; b--; return a + b; }"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.funcParser bestMatchFor:a]; + TDEqualObjects([res description], @"[function, foo, (, a, ,, b, ), {, a, ++, ;, b, --, ;, return, a, +, b, ;, }]function/foo/(/a/,/b/)/{/a/++/;/b/--/;/return/a/+/b/;/}^"); + + s = @"function foo(a, b) { a++; b--; return a + b; }"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.elementParser bestMatchFor:a]; + TDEqualObjects([res description], @"[function, foo, (, a, ,, b, ), {, a, ++, ;, b, --, ;, return, a, +, b, ;, }]function/foo/(/a/,/b/)/{/a/++/;/b/--/;/return/a/+/b/;/}^"); +} + + +- (void)testBitwiseOrExprParser { + s = @"true"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.bitwiseOrExprParser bestMatchFor:a]; + TDEqualObjects([res description], @"[true]true^"); +} + + +- (void)testAndBitwiseOrExprParser { + s = @"&& true"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.andBitwiseOrExprParser bestMatchFor:a]; + TDEqualObjects([res description], @"[&&, true]&&/true^"); +} + + +- (void)testParamListParser { + s = @"baz, bat"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.paramListParser bestMatchFor:a]; + TDEqualObjects([res description], @"[baz, ,, bat]baz/,/bat^"); + + s = @"foo,bar,c_str"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.paramListParser bestMatchFor:a]; + TDEqualObjects([res description], @"[foo, ,, bar, ,, c_str]foo/,/bar/,/c_str^"); + + s = @"_x, __y"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.paramListParser bestMatchFor:a]; + TDEqualObjects([res description], @"[_x, ,, __y]_x/,/__y^"); +} + + +- (void)testCommaIdentifierParser { + s = @", foo"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.commaIdentifierParser bestMatchFor:a]; + TDEqualObjects([res description], @"[,, foo],/foo^"); + + s = @" ,bar"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.commaIdentifierParser bestMatchFor:a]; + TDEqualObjects([res description], @"[,, bar],/bar^"); +} + + +- (void)testBreakStmtParser { + s = @"break;"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.breakStmtParser bestMatchFor:a]; + TDEqualObjects([res description], @"[break, ;]break/;^"); +} + + +- (void)testContinueStmtParser { + s = @"continue;"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.continueStmtParser bestMatchFor:a]; + TDEqualObjects([res description], @"[continue, ;]continue/;^"); +} + + +- (void)testAssignmentOpParser { + s = @"="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.assignmentOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[=]=^"); + + s = @"*="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.assignmentOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[*=]*=^"); + + s = @"%="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.assignmentOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[%=]%=^"); + + s = @">>>="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.assignmentOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[>>>=]>>>=^"); +} + + +- (void)testRelationalOpParser { + s = @"<="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.relationalOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[<=]<=^"); + + s = @"instanceof"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.relationalOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[instanceof]instanceof^"); +} + + +- (void)testEqualityOpParser { + s = @"=="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.equalityOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[==]==^"); + + s = @"!=="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.equalityOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[!==]!==^"); + + s = @"==="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.equalityOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[===]===^"); +} + + +- (void)testForParenParser { + s = @"for ("; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.forParenParser bestMatchFor:a]; + TDEqualObjects([res description], @"[for, (]for/(^"); + + s = @"for("; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.forParenParser bestMatchFor:a]; + TDEqualObjects([res description], @"[for, (]for/(^"); +} + + +- (void)testExprOptParser { + s = @"true"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.exprOptParser bestMatchFor:a]; + TDEqualObjects([res description], @"[true]true^"); +} + + +- (void)testForBeginParenStmtParser { + s = @"for(1"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.forBeginParser bestMatchFor:a]; + TDEqualObjects([res description], @"[for, (, 1]for/(/1^"); + + s = @";"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.semiParser bestMatchFor:a]; + TDEqualObjects([res description], @"[;];^"); + + s = @"3<2"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.exprOptParser bestMatchFor:a]; + TDEqualObjects([res description], @"[3, <, 2]3/ + +@interface TDJsonParser : PKAlternation { + BOOL shouldAssemble; + PKParser *stringParser; + PKParser *numberParser; + PKParser *nullParser; + PKCollectionParser *booleanParser; + PKCollectionParser *arrayParser; + PKCollectionParser *objectParser; + PKCollectionParser *valueParser; + PKCollectionParser *commaValueParser; + PKCollectionParser *propertyParser; + PKCollectionParser *commaPropertyParser; + + PKToken *curly; + PKToken *bracket; +} + +- (id)initWithIntentToAssemble:(BOOL)shouldAssemble; + +- (id)parse:(NSString *)s; + +@property (nonatomic, retain) PKParser *stringParser; +@property (nonatomic, retain) PKParser *numberParser; +@property (nonatomic, retain) PKParser *nullParser; +@property (nonatomic, retain) PKCollectionParser *booleanParser; +@property (nonatomic, retain) PKCollectionParser *arrayParser; +@property (nonatomic, retain) PKCollectionParser *objectParser; +@property (nonatomic, retain) PKCollectionParser *valueParser; +@property (nonatomic, retain) PKCollectionParser *commaValueParser; +@property (nonatomic, retain) PKCollectionParser *propertyParser; +@property (nonatomic, retain) PKCollectionParser *commaPropertyParser; +@end \ No newline at end of file diff --git a/test/.svn/text-base/TDJsonParser.m.svn-base b/test/.svn/text-base/TDJsonParser.m.svn-base new file mode 100644 index 0000000..dc3ef74 --- /dev/null +++ b/test/.svn/text-base/TDJsonParser.m.svn-base @@ -0,0 +1,316 @@ +// +// PKJsonParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/18/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDJsonParser.h" +#import "ParseKit.h" +#import "NSString+ParseKitAdditions.h" + +@interface PKParser (PKParserFactoryAdditionsFriend) +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@interface PKCollectionParser () +@property (nonatomic, readwrite, retain) NSMutableArray *subparsers; +@end + +@interface TDJsonParser () +@property (nonatomic, retain) PKToken *curly; +@property (nonatomic, retain) PKToken *bracket; +@end + +@implementation TDJsonParser + +- (id)init { + return [self initWithIntentToAssemble:YES]; +} + + +- (id)initWithIntentToAssemble:(BOOL)yn { + if (self = [super init]) { + shouldAssemble = yn; + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0.0]; + self.bracket = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"[" floatValue:0.0]; + + self.tokenizer = [PKTokenizer tokenizer]; + [self.tokenizer setTokenizerState:self.tokenizer.symbolState from: '/' to: '/']; // JSON doesn't have slash slash or slash star comments + [self.tokenizer setTokenizerState:self.tokenizer.symbolState from: '\'' to: '\'']; // JSON does not have single quoted strings + + [self add:self.objectParser]; + [self add:self.arrayParser]; + } + return self; +} + + +- (void)dealloc { + // yikes. this is necessary to prevent a very nasty retain cycle leak. + // to be safe, release the subparsers of all collection parsers (as they may have retain cycles in complex grammars like this one) + // technically i only need to release the valueParser.subparers in this case, but better to be paranoid than to leak. + booleanParser.subparsers = nil; + arrayParser.subparsers = nil; + objectParser.subparsers = nil; + valueParser.subparsers = nil; + commaValueParser.subparsers = nil; + propertyParser.subparsers = nil; + commaPropertyParser.subparsers = nil; + + self.tokenizer = nil; + self.stringParser = nil; + self.numberParser = nil; + self.nullParser = nil; + self.booleanParser = nil; + self.arrayParser = nil; + self.objectParser = nil; + self.valueParser = nil; + self.propertyParser = nil; + self.commaPropertyParser = nil; + self.commaValueParser = nil; + self.curly = nil; + self.bracket = nil; + [super dealloc]; +} + + +- (id)parse:(NSString *)s { + self.tokenizer.string = s; + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:self.tokenizer]; + + PKAssembly *result = [self completeMatchFor:a]; + return [result pop]; +} + + +- (PKParser *)stringParser { + if (!stringParser) { + self.stringParser = [PKQuotedString quotedString]; + if (shouldAssemble) { + [stringParser setAssembler:self selector:@selector(didMatchString:)]; + } + } + return stringParser; +} + + +- (PKParser *)numberParser { + if (!numberParser) { + self.numberParser = [PKNumber number]; + if (shouldAssemble) { + [numberParser setAssembler:self selector:@selector(didMatchNumber:)]; + } + } + return numberParser; +} + + +- (PKParser *)nullParser { + if (!nullParser) { + self.nullParser = [[PKLiteral literalWithString:@"null"] discard]; + if (shouldAssemble) { + [nullParser setAssembler:self selector:@selector(didMatchNull:)]; + } + } + return nullParser; +} + + +- (PKCollectionParser *)booleanParser { + if (!booleanParser) { + self.booleanParser = [PKAlternation alternation]; + [booleanParser add:[PKLiteral literalWithString:@"true"]]; + [booleanParser add:[PKLiteral literalWithString:@"false"]]; + if (shouldAssemble) { + [booleanParser setAssembler:self selector:@selector(didMatchBoolean:)]; + } + } + return booleanParser; +} + + +- (PKCollectionParser *)arrayParser { + if (!arrayParser) { + + // array = '[' content ']' + // content = Empty | actualArray + // actualArray = value commaValue* + + PKTrack *actualArray = [PKTrack sequence]; + [actualArray add:self.valueParser]; + [actualArray add:[PKRepetition repetitionWithSubparser:self.commaValueParser]]; + + PKAlternation *content = [PKAlternation alternation]; + [content add:[PKEmpty empty]]; + [content add:actualArray]; + + self.arrayParser = [PKSequence sequence]; + [arrayParser add:[PKSymbol symbolWithString:@"["]]; // serves as fence + [arrayParser add:content]; + [arrayParser add:[[PKSymbol symbolWithString:@"]"] discard]]; + + if (shouldAssemble) { + [arrayParser setAssembler:self selector:@selector(didMatchArray:)]; + } + } + return arrayParser; +} + + +- (PKCollectionParser *)objectParser { + if (!objectParser) { + + // object = '{' content '}' + // content = Empty | actualObject + // actualObject = property commaProperty* + // property = QuotedString ':' value + // commaProperty = ',' property + + PKTrack *actualObject = [PKTrack sequence]; + [actualObject add:self.propertyParser]; + [actualObject add:[PKRepetition repetitionWithSubparser:self.commaPropertyParser]]; + + PKAlternation *content = [PKAlternation alternation]; + [content add:[PKEmpty empty]]; + [content add:actualObject]; + + self.objectParser = [PKSequence sequence]; + [objectParser add:[PKSymbol symbolWithString:@"{"]]; // serves as fence + [objectParser add:content]; + [objectParser add:[[PKSymbol symbolWithString:@"}"] discard]]; + + if (shouldAssemble) { + [objectParser setAssembler:self selector:@selector(didMatchObject:)]; + } + } + return objectParser; +} + + +- (PKCollectionParser *)valueParser { + if (!valueParser) { + self.valueParser = [PKAlternation alternation]; + [valueParser add:self.stringParser]; + [valueParser add:self.numberParser]; + [valueParser add:self.nullParser]; + [valueParser add:self.booleanParser]; + [valueParser add:self.arrayParser]; + [valueParser add:self.objectParser]; + } + return valueParser; +} + + +- (PKCollectionParser *)commaValueParser { + if (!commaValueParser) { + self.commaValueParser = [PKTrack sequence]; + [commaValueParser add:[[PKSymbol symbolWithString:@","] discard]]; + [commaValueParser add:self.valueParser]; + } + return commaValueParser; +} + + +- (PKCollectionParser *)propertyParser { + if (!propertyParser) { + self.propertyParser = [PKSequence sequence]; + [propertyParser add:[PKQuotedString quotedString]]; + [propertyParser add:[[PKSymbol symbolWithString:@":"] discard]]; + [propertyParser add:self.valueParser]; + if (shouldAssemble) { + [propertyParser setAssembler:self selector:@selector(didMatchProperty:)]; + } + } + return propertyParser; +} + + +- (PKCollectionParser *)commaPropertyParser { + if (!commaPropertyParser) { + self.commaPropertyParser = [PKTrack sequence]; + [commaPropertyParser add:[[PKSymbol symbolWithString:@","] discard]]; + [commaPropertyParser add:self.propertyParser]; + } + return commaPropertyParser; +} + + +- (void)didMatchNull:(PKAssembly *)a { + [a push:[NSNull null]]; +} + + +- (void)didMatchNumber:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)didMatchString:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[tok.stringValue stringByTrimmingQuotes]]; +} + + +- (void)didMatchBoolean:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithBool:[tok.stringValue isEqualToString:@"true"] ? YES : NO]]; +} + + +- (void)didMatchArray:(PKAssembly *)a { + NSArray *elements = [a objectsAbove:self.bracket]; + NSMutableArray *array = [NSMutableArray arrayWithCapacity:[elements count]]; + + for (id element in [elements reverseObjectEnumerator]) { + if (element) { + [array addObject:element]; + } + } + [a pop]; // pop the [ + [a push:array]; +} + + +- (void)didMatchObject:(PKAssembly *)a { + NSArray *elements = [a objectsAbove:self.curly]; + NSMutableDictionary *d = [NSMutableDictionary dictionaryWithCapacity:[elements count] / 2.]; + + NSInteger i = 0; + for ( ; i < [elements count] - 1; i++) { + id value = [elements objectAtIndex:i++]; + NSString *key = [elements objectAtIndex:i]; + if (key && value) { + [d setObject:value forKey:key]; + } + } + + [a pop]; // pop the { + [a push:d]; +} + + +- (void)didMatchProperty:(PKAssembly *)a { + id value = [a pop]; + PKToken *tok = [a pop]; + NSString *key = [tok.stringValue stringByTrimmingQuotes]; + + [a push:key]; + [a push:value]; +} + +@synthesize stringParser; +@synthesize numberParser; +@synthesize nullParser; +@synthesize booleanParser; +@synthesize arrayParser; +@synthesize objectParser; +@synthesize valueParser; +@synthesize commaValueParser; +@synthesize propertyParser; +@synthesize commaPropertyParser; +@synthesize curly; +@synthesize bracket; +@end diff --git a/test/.svn/text-base/TDJsonParserTest.h.svn-base b/test/.svn/text-base/TDJsonParserTest.h.svn-base new file mode 100644 index 0000000..5867a36 --- /dev/null +++ b/test/.svn/text-base/TDJsonParserTest.h.svn-base @@ -0,0 +1,20 @@ +// +// PKJsonParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/17/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@class TDJsonParser; + +@interface TDJsonParserTest : SenTestCase { + TDJsonParser *p; + NSString *s; + PKAssembly *a; + PKAssembly *result; +} + +@end diff --git a/test/.svn/text-base/TDJsonParserTest.m.svn-base b/test/.svn/text-base/TDJsonParserTest.m.svn-base new file mode 100644 index 0000000..ba8bf24 --- /dev/null +++ b/test/.svn/text-base/TDJsonParserTest.m.svn-base @@ -0,0 +1,537 @@ +// +// PKJsonParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/17/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDJsonParserTest.h" +#import "TDJsonParser.h" +#import "TDFastJsonParser.h" + +@implementation TDJsonParserTest + +- (void)setUp { + p = [TDJsonParser parser]; +} + + +- (void)testForAppleBossResultTokenization { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKTokenizer *t = [[[PKTokenizer alloc] initWithString:s] autorelease]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + while (eof != (tok = [t nextToken])) { + //NSLog(@"tok: %@", tok); + } +} + + +- (void)testForAppleBossResult { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + @try { + result = [p parse:s]; + } + @catch (NSException *e) { + //NSLog(@"\n\n\nexception:\n\n %@", [e reason]); + } + + //NSLog(@"result %@", result); +} + + +- (void)testEmptyString { + s = @""; + a = [PKTokenAssembly assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDNil(result); +} + + +- (void)testNum { + s = @"456"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p numberParser] bestMatchFor:a]; + TDNotNil(result); + + TDEqualObjects(@"[456]456^", [result description]); + id obj = [result pop]; + TDNotNil(obj); + TDEqualObjects([NSNumber numberWithFloat:456], obj); + + + s = @"-3.47"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p numberParser] bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[-3.47]-3.47^", [result description]); + obj = [result pop]; + TDNotNil(obj); + TDEqualObjects([NSNumber numberWithFloat:-3.47], obj); +} + + +- (void)testString { + s = @"'foobar'"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p stringParser] bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foobar]'foobar'^", [result description]); + id obj = [result pop]; + TDNotNil(obj); + TDEqualObjects(@"foobar", obj); + + s = @"\"baz boo boo\""; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p stringParser] bestMatchFor:a]; + TDNotNil(result); + + TDEqualObjects(@"[baz boo boo]\"baz boo boo\"^", [result description]); + obj = [result pop]; + TDNotNil(obj); + TDEqualObjects(@"baz boo boo", obj); +} + + +- (void)testBoolean { + s = @"true"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p booleanParser] bestMatchFor:a]; + TDNotNil(result); + + TDEqualObjects(@"[1]true^", [result description]); + id obj = [result pop]; + TDNotNil(obj); + TDEqualObjects([NSNumber numberWithBool:YES], obj); + + s = @"false"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p booleanParser] bestMatchFor:a]; + TDNotNil(result); + + TDEqualObjects(@"[0]false^", [result description]); + obj = [result pop]; + TDNotNil(obj); + TDEqualObjects([NSNumber numberWithBool:NO], obj); +} + + +- (void)testArray { + s = @"[1, 2, 3]"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p arrayParser] bestMatchFor:a]; + + NSLog(@"result: %@", result); + TDNotNil(result); + id obj = [result pop]; + TDEquals((int)3, (int)[obj count]); + TDEqualObjects([NSNumber numberWithInteger:1], [obj objectAtIndex:0]); + TDEqualObjects([NSNumber numberWithInteger:2], [obj objectAtIndex:1]); + TDEqualObjects([NSNumber numberWithInteger:3], [obj objectAtIndex:2]); + TDEqualObjects(@"[][/1/,/2/,/3/]^", [result description]); + + s = @"[true, 'garlic jazz!', .888]"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p arrayParser] bestMatchFor:a]; + TDNotNil(result); + + //TDEqualObjects(@"[true, 'garlic jazz!', .888]true/'garlic jazz!'/.888^", [result description]); + obj = [result pop]; + TDEqualObjects([NSNumber numberWithBool:YES], [obj objectAtIndex:0]); + TDEqualObjects(@"garlic jazz!", [obj objectAtIndex:1]); + TDEqualObjects([NSNumber numberWithFloat:.888], [obj objectAtIndex:2]); + + s = @"[1, [2, [3, 4]]]"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p arrayParser] bestMatchFor:a]; + TDNotNil(result); + //NSLog(@"result: %@", [a stack]); + TDEqualObjects([NSNumber numberWithInteger:1], [obj objectAtIndex:0]); +} + + +- (void)testObject { + s = @"{'key': 'value'}"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p objectParser] bestMatchFor:a]; + TDNotNil(result); + + id obj = [result pop]; + TDEqualObjects([obj objectForKey:@"key"], @"value"); + + s = @"{'foo': false, 'bar': true, \"baz\": -9.457}"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p objectParser] bestMatchFor:a]; + TDNotNil(result); + + obj = [result pop]; + TDEqualObjects([obj objectForKey:@"foo"], [NSNumber numberWithBool:NO]); + TDEqualObjects([obj objectForKey:@"bar"], [NSNumber numberWithBool:YES]); + TDEqualObjects([obj objectForKey:@"baz"], [NSNumber numberWithFloat:-9.457]); + + s = @"{'baz': {'foo': [1,2]}}"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p objectParser] bestMatchFor:a]; + TDNotNil(result); + + obj = [result pop]; + NSDictionary *dict = [obj objectForKey:@"baz"]; + TDTrue([dict isKindOfClass:[NSDictionary class]]); + NSArray *arr = [dict objectForKey:@"foo"]; + TDTrue([arr isKindOfClass:[NSArray class]]); + TDEqualObjects([NSNumber numberWithInteger:1], [arr objectAtIndex:0]); + + // TDEqualObjects(@"['baz', 'foo', 1, 2]'baz'/'foo'/1/2^", [result description]); +} + + +- (void)testCrunchBaseJsonParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDJsonParser *parser = [[[TDJsonParser alloc] init] autorelease]; + [parser parse:s]; +// id res = [parser parse:s]; + //NSLog(@"res %@", res); +} + + +- (void)testCrunchBaseJsonParserTokenization { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKTokenizer *t = [[[PKTokenizer alloc] initWithString:s] autorelease]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + while (eof != (tok = [t nextToken])) { + //NSLog(@"tok: %@", tok); + } +} + + +- (void)testCrunchBaseJsonTokenParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDFastJsonParser *parser = [[[TDFastJsonParser alloc] init] autorelease]; + [parser parse:s]; + // id res = [parser parse:s]; + //NSLog(@"res %@", res); +} + + +- (void)testYahoo1 { + s = + @"{" + @"\"name\": \"Yahoo!\"," + @"\"permalink\": \"yahoo\"," + @"\"homepage_url\": \"http://www.yahoo.com\"," + @"\"blog_url\": \"http://yodel.yahoo.com/\"," + @"\"blog_feed_url\": \"http://ycorpblog.com/feed/\"," + @"\"category_code\": \"web\"," + @"\"number_of_employees\": 13600," + @"\"founded_year\": 1994," + @"\"founded_month\": null," + @"\"founded_day\": null," + @"\"deadpooled_year\": null," + @"\"deadpooled_month\": null," + @"\"deadpooled_day\": null," + @"\"deadpooled_url\": null," + @"\"tag_list\": \"search, portal, webmail, photos\"," + @"\"email_address\": \"\"," + @"\"phone_number\": \"(408) 349-3300\"" + @"}"; + result = [p parse:s]; + //NSLog(@"result %@", result); + TDNotNil(result); + id d = result; + TDNotNil(d); + TDTrue([d isKindOfClass:[NSDictionary class]]); + TDEqualObjects([d objectForKey:@"name"], @"Yahoo!"); + TDEqualObjects([d objectForKey:@"permalink"], @"yahoo"); + TDEqualObjects([d objectForKey:@"homepage_url"], @"http://www.yahoo.com"); + TDEqualObjects([d objectForKey:@"blog_url"], @"http://yodel.yahoo.com/"); + TDEqualObjects([d objectForKey:@"blog_feed_url"], @"http://ycorpblog.com/feed/"); + TDEqualObjects([d objectForKey:@"category_code"], @"web"); + TDEqualObjects([d objectForKey:@"number_of_employees"], [NSNumber numberWithInteger:13600]); + TDEqualObjects([d objectForKey:@"founded_year"], [NSNumber numberWithInteger:1994]); + TDEqualObjects([d objectForKey:@"founded_month"], [NSNull null]); + TDEqualObjects([d objectForKey:@"founded_day"], [NSNull null]); + TDEqualObjects([d objectForKey:@"deadpooled_year"], [NSNull null]); + TDEqualObjects([d objectForKey:@"deadpooled_month"], [NSNull null]); + TDEqualObjects([d objectForKey:@"deadpooled_day"], [NSNull null]); + TDEqualObjects([d objectForKey:@"deadpooled_url"], [NSNull null]); + TDEqualObjects([d objectForKey:@"tag_list"], @"search, portal, webmail, photos"); + TDEqualObjects([d objectForKey:@"email_address"], @""); + TDEqualObjects([d objectForKey:@"phone_number"], @"(408) 349-3300"); +} + + +- (void)testYahoo2 { + s = @"{\"image\":" + @" {\"available_sizes\":" + @" [[[150, 37]," + @" \"assets/images/resized/0001/0836/10836v1-max-250x150.png\"]," + @" [[200, 50]," + @" \"assets/images/resized/0001/0836/10836v1-max-250x250.png\"]," + @" [[200, 50]," + @" \"assets/images/resized/0001/0836/10836v1-max-450x450.png\"]]," + @" \"attribution\": null}" + @"}"; + result = [p parse:s]; + //NSLog(@"result %@", result); + + TDNotNil(result); + + id d = result; + TDNotNil(d); + TDTrue([d isKindOfClass:[NSDictionary class]]); + + id image = [d objectForKey:@"image"]; + TDNotNil(image); + TDTrue([image isKindOfClass:[NSDictionary class]]); + + NSArray *sizes = [image objectForKey:@"available_sizes"]; + TDNotNil(sizes); + TDTrue([sizes isKindOfClass:[NSArray class]]); + + TDEquals(3, (int)[sizes count]); + + NSArray *first = [sizes objectAtIndex:0]; + TDNotNil(first); + TDTrue([first isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[first count]); + + NSArray *firstKey = [first objectAtIndex:0]; + TDNotNil(firstKey); + TDTrue([firstKey isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[firstKey count]); + TDEqualObjects([NSNumber numberWithInteger:150], [firstKey objectAtIndex:0]); + TDEqualObjects([NSNumber numberWithInteger:37], [firstKey objectAtIndex:1]); + + NSArray *second = [sizes objectAtIndex:1]; + TDNotNil(second); + TDTrue([second isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[second count]); + + NSArray *secondKey = [second objectAtIndex:0]; + TDNotNil(secondKey); + TDTrue([secondKey isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[secondKey count]); + TDEqualObjects([NSNumber numberWithInteger:200], [secondKey objectAtIndex:0]); + TDEqualObjects([NSNumber numberWithInteger:50], [secondKey objectAtIndex:1]); + + NSArray *third = [sizes objectAtIndex:2]; + TDNotNil(third); + TDTrue([third isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[third count]); + + NSArray *thirdKey = [third objectAtIndex:0]; + TDNotNil(thirdKey); + TDTrue([thirdKey isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[thirdKey count]); + TDEqualObjects([NSNumber numberWithInteger:200], [thirdKey objectAtIndex:0]); + TDEqualObjects([NSNumber numberWithInteger:50], [thirdKey objectAtIndex:1]); + + +// TDEqualObjects([d objectForKey:@"name"], @"Yahoo!"); +} + + +- (void)testYahoo3 { + s = + @"{\"products\":" + @"[" + @"{\"name\": \"Yahoo.com\", \"permalink\": \"yahoo-com\"}," + @"{\"name\": \"Yahoo! Mail\", \"permalink\": \"yahoo-mail\"}," + @"{\"name\": \"Yahoo! Search\", \"permalink\": \"yahoo-search\"}," + @"{\"name\": \"Yahoo! Directory\", \"permalink\": \"yahoo-directory\"}," + @"{\"name\": \"Yahoo! Finance\", \"permalink\": \"yahoo-finance\"}," + @"{\"name\": \"My Yahoo\", \"permalink\": \"my-yahoo\"}," + @"{\"name\": \"Yahoo! News\", \"permalink\": \"yahoo-news\"}," + @"{\"name\": \"Yahoo! Groups\", \"permalink\": \"yahoo-groups\"}," + @"{\"name\": \"Yahoo! Messenger\", \"permalink\": \"yahoo-messenger\"}," + @"{\"name\": \"Yahoo! Games\", \"permalink\": \"yahoo-games\"}," + @"{\"name\": \"Yahoo! People Search\", \"permalink\": \"yahoo-people-search\"}," + @"{\"name\": \"Yahoo! Movies\", \"permalink\": \"yahoo-movies\"}," + @"{\"name\": \"Yahoo! Weather\", \"permalink\": \"yahoo-weather\"}," + @"{\"name\": \"Yahoo! Video\", \"permalink\": \"yahoo-video\"}," + @"{\"name\": \"Yahoo! Music\", \"permalink\": \"yahoo-music\"}," + @"{\"name\": \"Yahoo! Sports\", \"permalink\": \"yahoo-sports\"}," + @"{\"name\": \"Yahoo! Maps\", \"permalink\": \"yahoo-maps\"}," + @"{\"name\": \"Yahoo! Auctions\", \"permalink\": \"yahoo-auctions\"}," + @"{\"name\": \"Yahoo! Widgets\", \"permalink\": \"yahoo-widgets\"}," + @"{\"name\": \"Yahoo! Shopping\", \"permalink\": \"yahoo-shopping\"}," + @"{\"name\": \"Yahoo! Real Estate\", \"permalink\": \"yahoo-real-estate\"}," + @"{\"name\": \"Yahoo! Travel\", \"permalink\": \"yahoo-travel\"}," + @"{\"name\": \"Yahoo! Classifieds\", \"permalink\": \"yahoo-classifieds\"}," + @"{\"name\": \"Yahoo! Answers\", \"permalink\": \"yahoo-answers\"}," + @"{\"name\": \"Yahoo! Mobile\", \"permalink\": \"yahoo-mobile\"}," + @"{\"name\": \"Yahoo! Buzz\", \"permalink\": \"yahoo-buzz\"}," + @"{\"name\": \"Yahoo! Open Search Platform\", \"permalink\": \"yahoo-open-search-platform\"}," + @"{\"name\": \"Fire Eagle\", \"permalink\": \"fireeagle\"}," + @"{\"name\": \"Shine\", \"permalink\": \"shine\"}," + @"{\"name\": \"Yahoo! Shortcuts\", \"permalink\": \"yahoo-shortcuts\"}" + @"]" + @"}"; + result = [p parse:s]; + //NSLog(@"result %@", result); + + TDNotNil(result); + + id d = result; + TDNotNil(d); + TDTrue([d isKindOfClass:[NSDictionary class]]); + + NSArray *products = [d objectForKey:@"products"]; + TDNotNil(products); + TDTrue([products isKindOfClass:[NSArray class]]); +} + + +- (void)testYahoo4 { + s = @"[" + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" + @"]"; + + p = [[[TDFastJsonParser alloc] init] autorelease]; + result = [p parse:s]; + //NSLog(@"result %@", result); + + TDNotNil(result); + + id d = result; + TDNotNil(d); + TDTrue([d isKindOfClass:[NSArray class]]); + +// NSArray *products = [d objectForKey:@"products"]; +// TDNotNil(products); +// TDTrue([products isKindOfClass:[NSArray class]]); +} +@end diff --git a/test/.svn/text-base/TDLetterTest.h.svn-base b/test/.svn/text-base/TDLetterTest.h.svn-base new file mode 100644 index 0000000..530ef93 --- /dev/null +++ b/test/.svn/text-base/TDLetterTest.h.svn-base @@ -0,0 +1,19 @@ +// +// PKLetterTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + + +@interface TDLetterTest : SenTestCase { + NSString *s; + PKCharacterAssembly *a; + PKChar *p; + PKAssembly *result; +} + +@end diff --git a/test/.svn/text-base/TDLetterTest.m.svn-base b/test/.svn/text-base/TDLetterTest.m.svn-base new file mode 100644 index 0000000..2075dd5 --- /dev/null +++ b/test/.svn/text-base/TDLetterTest.m.svn-base @@ -0,0 +1,59 @@ +// +// PKLetterTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDLetterTest.h" + +@interface PKAssembly () +- (BOOL)hasMore; +@end + +@implementation TDLetterTest + +- (void)test123 { + s = @"123"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^123", [a description]); + p = [PKLetter letter]; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDNil(result); + TDTrue([a hasMore]); +} + + +- (void)testAbc { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^abc", [a description]); + p = [PKLetter letter]; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[a]a^bc", [result description]); + TDTrue([result hasMore]); +} + + +- (void)testRepetition { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^abc", [a description]); + p = [PKLetter letter]; + PKParser *r = [PKRepetition repetitionWithSubparser:p]; + + result = [r bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[a, b, c]abc^", [result description]); + TDFalse([result hasMore]); +} + +@end diff --git a/test/.svn/text-base/TDLiteralTest.h.svn-base b/test/.svn/text-base/TDLiteralTest.h.svn-base new file mode 100644 index 0000000..650053d --- /dev/null +++ b/test/.svn/text-base/TDLiteralTest.h.svn-base @@ -0,0 +1,17 @@ +// +// PKLiteralTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDLiteralTest : SenTestCase { + PKParser *p; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDLiteralTest.m.svn-base b/test/.svn/text-base/TDLiteralTest.m.svn-base new file mode 100644 index 0000000..e9a6c24 --- /dev/null +++ b/test/.svn/text-base/TDLiteralTest.m.svn-base @@ -0,0 +1,91 @@ +// +// PKLiteralTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDLiteralTest.h" + +@implementation TDLiteralTest + +- (void)tearDown { + [a release]; +} + +- (void)testTrueCompleteMatchForLiteral123 { + s = @"123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + NSLog(@"a: %@", a); + + p = [PKNumber number]; + PKAssembly *result = [p completeMatchFor:a]; + + // -[PKParser completeMatchFor:] + // -[PKParser bestMatchFor:] + // -[PKParser matchAndAssemble:] + // -[PKTerminal allMatchesFor:] + // -[PKTerminal matchOneAssembly:] + // -[PKLiteral qualifies:] + // -[PKParser best:] + + NSLog(@"result: %@", result); + TDNotNil(result); + TDEqualObjects(@"[123]123^", [result description]); +} + + +- (void)testFalseCompleteMatchForLiteral123 { + s = @"1234"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKLiteral literalWithString:@"123"]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); + TDEqualObjects(@"[]^1234", [a description]); +} + + +- (void)testTrueCompleteMatchForLiteralFoo { + s = @"Foo"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKLiteral literalWithString:@"Foo"]; + PKAssembly *result = [p completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[Foo]Foo^", [result description]); +} + + +- (void)testFalseCompleteMatchForLiteralFoo { + s = @"Foo"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKLiteral literalWithString:@"foo"]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testFalseCompleteMatchForCaseInsensitiveLiteralFoo { + s = @"Fool"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKCaseInsensitiveLiteral literalWithString:@"Foo"]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testTrueCompleteMatchForCaseInsensitiveLiteralFoo { + s = @"Foo"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKCaseInsensitiveLiteral literalWithString:@"foo"]; + PKAssembly *result = [p completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[Foo]Foo^", [result description]); +} + +@end diff --git a/test/.svn/text-base/TDLowercaseWordTest.h.svn-base b/test/.svn/text-base/TDLowercaseWordTest.h.svn-base new file mode 100644 index 0000000..ae4ca31 --- /dev/null +++ b/test/.svn/text-base/TDLowercaseWordTest.h.svn-base @@ -0,0 +1,15 @@ +// +// PKLowercaseWordTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDLowercaseWordTest : SenTestCase { + +} +@end + diff --git a/test/.svn/text-base/TDLowercaseWordTest.m.svn-base b/test/.svn/text-base/TDLowercaseWordTest.m.svn-base new file mode 100644 index 0000000..c28182b --- /dev/null +++ b/test/.svn/text-base/TDLowercaseWordTest.m.svn-base @@ -0,0 +1,57 @@ +// +// PKLowercaseWordTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDLowercaseWordTest.h" + +@implementation TDLowercaseWordTest + +- (void)testFoobar { + NSString *s = @"Foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKLowercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + + +- (void)testfoobar { + NSString *s = @"foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKLowercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foobar]foobar^", [result description]); +} + + +- (void)test123 { + NSString *s = @"123"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKLowercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + + +- (void)testPercentFoobar { + NSString *s = @"%Foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKLowercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + +@end diff --git a/test/.svn/text-base/TDMiniCSSAssembler.h.svn-base b/test/.svn/text-base/TDMiniCSSAssembler.h.svn-base new file mode 100644 index 0000000..880c528 --- /dev/null +++ b/test/.svn/text-base/TDMiniCSSAssembler.h.svn-base @@ -0,0 +1,21 @@ +// +// PKMiniCSSAssembler.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/23/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKToken; + +@interface TDMiniCSSAssembler : NSObject { + NSMutableDictionary *attributes; + PKToken *paren; + PKToken *curly; +} +@property (nonatomic, retain) NSMutableDictionary *attributes; +@property (nonatomic, retain) PKToken *paren; +@property (nonatomic, retain) PKToken *curly; +@end diff --git a/test/.svn/text-base/TDMiniCSSAssembler.m.svn-base b/test/.svn/text-base/TDMiniCSSAssembler.m.svn-base new file mode 100644 index 0000000..2ac843b --- /dev/null +++ b/test/.svn/text-base/TDMiniCSSAssembler.m.svn-base @@ -0,0 +1,184 @@ +// +// PKMiniCSSAssembler.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/23/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDMiniCSSAssembler.h" +#import "NSString+ParseKitAdditions.h" +#import + +@interface TDMiniCSSAssembler () +- (void)gatherPropertiesIn:(id)props; +@end + +@implementation TDMiniCSSAssembler + +- (id)init { + if (self = [super init]) { + self.attributes = [NSMutableDictionary dictionary]; + self.paren = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"(" floatValue:0.0]; + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0.0]; + } + return self; +} + + +- (void)dealloc { + self.attributes = nil; + self.paren = nil; + self.curly = nil; + [super dealloc]; +} + + +#pragma mark - +#pragma mark Assembler Callbacks + +// @start = ruleset*; +// ruleset = selector '{' decls >'}'; +// selector = LowercaseWord; // forcing selectors to be lowercase words for use in a future syntax-highlight framework where i want that +// decls = Empty | actualDecls; +// actualDecls = decl decl*; +// decl = property >':' expr >';'?; +// property = 'color' | 'background-color' | 'font-family' | 'font-size'; +// expr = pixelValue | rgb | string | constants; +// pixelValue = Number >'px'; +// rgb = >'rgb' '(' Number >',' Number >',' Number >')'; +// string = QuotedString; +// constants = 'bold' | 'normal' | 'italic'; + +- (void)didMatchProperty:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:tok.stringValue]; +} + + +- (void)didMatchString:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[tok.stringValue stringByTrimmingQuotes]]; +} + + +- (void)didMatchConstant:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:tok.stringValue]; +} + + +- (void)didMatchNum:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)didMatchPixelValue:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)didMatchRgb:(PKAssembly *)a { + NSArray *objs = [a objectsAbove:paren]; + [a pop]; // discard '(' + CGFloat blue = [(PKToken *)[objs objectAtIndex:0] floatValue]/255.0; + CGFloat green = [(PKToken *)[objs objectAtIndex:1] floatValue]/255.0; + CGFloat red = [(PKToken *)[objs objectAtIndex:2] floatValue]/255.0; + [a push:[NSColor colorWithDeviceRed:red green:green blue:blue alpha:1.0]]; +} + + +- (void)didMatchActualDecls:(PKAssembly *)a { + id d = [NSMutableDictionary dictionary]; + NSArray *objs = [a objectsAbove:curly]; + [a pop]; // discard curly + + NSInteger i = 0; + NSInteger count = [objs count]; + for ( ; i < count - 1; i++) { + id propVal = [objs objectAtIndex:i]; + id propName = [objs objectAtIndex:++i]; + [d setObject:propVal forKey:propName]; + } + + [a push:d]; +} + + +- (void)didMatchRuleset:(PKAssembly *)a { + id props = [a pop]; + [self gatherPropertiesIn:props]; + + for (PKToken *selectorTok in [a objectsAbove:nil]) { + NSString *selector = selectorTok.stringValue; + [attributes setObject:props forKey:selector]; + } +} + + +- (void)gatherPropertiesIn:(id)props { + NSColor *color = [props objectForKey:@"color"]; + if (!color) { + color = [NSColor blackColor]; + } + [props setObject:color forKey:NSForegroundColorAttributeName]; + [props removeObjectForKey:@"color"]; + + color = [props objectForKey:@"background-color"]; + if (!color) { + color = [NSColor whiteColor]; + } + [props setObject:color forKey:NSBackgroundColorAttributeName]; + [props removeObjectForKey:@"background-color"]; + + NSString *fontFamily = [props objectForKey:@"font-family"]; + if (![fontFamily length]) { + fontFamily = @"Monaco"; + } + + CGFloat fontSize = [[props objectForKey:@"font-size"] doubleValue]; + if (fontSize < 9.0) { + fontSize = 9.0; + } + + NSFont *font = [NSFont fontWithName:fontFamily size:fontSize]; + [props setObject:font forKey:NSFontAttributeName]; + [props removeObjectForKey:@"font-family"]; + [props removeObjectForKey:@"font-size"]; +} + +@synthesize attributes; +@synthesize paren; +@synthesize curly; +@end + + +//- (NSUInteger)hexValueFor:(NSString *)inStr { +// NSUInteger i = [[inStr substringWithRange:NSMakeRange(0, 1)] integerValue]; +// i = i *= 16; +// i += [[inStr substringWithRange:NSMakeRange(1, 1)] integerValue]; +// return i; +//} +// +//- (void)didMatchHexcolor:(PKAssembly *)a { +// PKToken *tok = [a pop]; +// NSString *s = tok.stringValue; +// NSColor *color = nil; +// +// if (6 == [s length]) { +// NSString *redStr = [s substringWithRange:NSMakeRange(0, 2)]; +// NSString *greenStr = [s substringWithRange:NSMakeRange(2, 2)]; +// NSString *blueStr = [s substringWithRange:NSMakeRange(4, 2)]; +// +// NSUInteger red = [self hexValueFor:redStr]; +// NSUInteger green = [self hexValueFor:greenStr]; +// NSUInteger blue = [self hexValueFor:blueStr]; +// +// color = [NSColor colorWithDeviceRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:1.0]; +// } else { +// color = [NSColor magentaColor]; // signals incorrect value in stylesheet +// } +// [a push:color]; +//} diff --git a/test/.svn/text-base/TDMiniCSSAssemblerTest.h.svn-base b/test/.svn/text-base/TDMiniCSSAssemblerTest.h.svn-base new file mode 100644 index 0000000..8953d05 --- /dev/null +++ b/test/.svn/text-base/TDMiniCSSAssemblerTest.h.svn-base @@ -0,0 +1,23 @@ +// +// PKMiniCSSAssemblerTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" +#import "TDMiniCSSAssembler.h" + +@interface TDMiniCSSAssemblerTest : SenTestCase { + NSString *path; + NSString *grammarString; + NSString *s; + TDMiniCSSAssembler *ass; + PKParserFactory *factory; + PKParser *lp; + PKAssembly *a; +} + +@end diff --git a/test/.svn/text-base/TDMiniCSSAssemblerTest.m.svn-base b/test/.svn/text-base/TDMiniCSSAssemblerTest.m.svn-base new file mode 100644 index 0000000..f166f0d --- /dev/null +++ b/test/.svn/text-base/TDMiniCSSAssemblerTest.m.svn-base @@ -0,0 +1,233 @@ +// +// PKMiniCSSAssemblerTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDMiniCSSAssemblerTest.h" + +@implementation TDMiniCSSAssemblerTest + +- (void)setUp { + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + ass = [[TDMiniCSSAssembler alloc] init]; + factory = [PKParserFactory factory]; + lp = [factory parserFromGrammar:grammarString assembler:ass]; +} + + +- (void)tearDown { + [ass release]; +} + + +- (void)testColor { + TDNotNil(lp); + + s = @"bar { color:rgb(10, 200, 30); }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]bar/{/color/:/rgb/(/10/,/200/,/30/)/;/}^", [a description]); + TDNotNil(ass.attributes); + id props = [ass.attributes objectForKey:@"bar"]; + TDNotNil(props); + + NSColor *color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); +} + + +- (void)testMultiSelectorColor { + TDNotNil(lp); + + s = @"foo, bar { color:rgb(10, 200, 30); }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]foo/,/bar/{/color/:/rgb/(/10/,/200/,/30/)/;/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"bar"]; + TDNotNil(props); + + NSColor *color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); + + props = [ass.attributes objectForKey:@"foo"]; + TDNotNil(props); + + color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); +} + + +- (void)testBackgroundColor { + TDNotNil(lp); + + s = @"foo { background-color:rgb(255.0, 0.0, 255.0) }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]foo/{/background-color/:/rgb/(/255.0/,/0.0/,/255.0/)/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"foo"]; + TDNotNil(props); + + NSColor *color = [props objectForKey:NSBackgroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(255.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(0.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(255.0/255.0), 0.001, @""); +} + + +- (void)testFontSize { + TDNotNil(lp); + + s = @"decl { font-size:12px }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]decl/{/font-size/:/12/px/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"decl"]; + TDNotNil(props); + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEquals((CGFloat)[font pointSize], (CGFloat)12.0); + TDEqualObjects([font familyName], @"Monaco"); +} + + +- (void)testSmallFontSize { + TDNotNil(lp); + + s = @"decl { font-size:8px }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]decl/{/font-size/:/8/px/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"decl"]; + TDNotNil(props); + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEquals((CGFloat)[font pointSize], (CGFloat)9.0); + TDEqualObjects([font familyName], @"Monaco"); +} + + +- (void)testFont { + TDNotNil(lp); + + s = @"expr { font-size:16px; font-family:'Helvetica' }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]expr/{/font-size/:/16/px/;/font-family/:/'Helvetica'/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"expr"]; + TDNotNil(props); + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEqualObjects([font familyName], @"Helvetica"); + TDEquals((CGFloat)[font pointSize], (CGFloat)16.0); +} + + +- (void)testAll { + TDNotNil(lp); + + s = @"expr { font-size:9.0px; font-family:'Courier'; background-color:rgb(255.0, 0.0, 255.0) ; color:rgb(10, 200, 30);}"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]expr/{/font-size/:/9.0/px/;/font-family/:/'Courier'/;/background-color/:/rgb/(/255.0/,/0.0/,/255.0/)/;/color/:/rgb/(/10/,/200/,/30/)/;/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"expr"]; + TDNotNil(props); + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEqualObjects([font familyName], @"Courier"); + TDEquals((CGFloat)[font pointSize], (CGFloat)9.0); + + NSColor *bgColor = [props objectForKey:NSBackgroundColorAttributeName]; + TDNotNil(bgColor); + STAssertEqualsWithAccuracy([bgColor redComponent], (CGFloat)(255.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor greenComponent], (CGFloat)(0.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor blueComponent], (CGFloat)(255.0/255.0), 0.001, @""); + + NSColor *color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); +} + + +- (void)testMultiAll { + TDNotNil(lp); + + s = @"expr, decl { font-size:9.0px; font-family:'Courier'; background-color:rgb(255.0, 0.0, 255.0) ; color:rgb(10, 200, 30);}"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]expr/,/decl/{/font-size/:/9.0/px/;/font-family/:/'Courier'/;/background-color/:/rgb/(/255.0/,/0.0/,/255.0/)/;/color/:/rgb/(/10/,/200/,/30/)/;/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"expr"]; + TDNotNil(props); + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEqualObjects([font familyName], @"Courier"); + TDEquals((CGFloat)[font pointSize], (CGFloat)9.0); + + NSColor *bgColor = [props objectForKey:NSBackgroundColorAttributeName]; + TDNotNil(bgColor); + STAssertEqualsWithAccuracy([bgColor redComponent], (CGFloat)(255.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor greenComponent], (CGFloat)(0.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor blueComponent], (CGFloat)(255.0/255.0), 0.001, @""); + + NSColor *color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); + + props = [ass.attributes objectForKey:@"decl"]; + TDNotNil(props); + + font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEqualObjects([font familyName], @"Courier"); + TDEquals((CGFloat)[font pointSize], (CGFloat)9.0); + + bgColor = [props objectForKey:NSBackgroundColorAttributeName]; + TDNotNil(bgColor); + STAssertEqualsWithAccuracy([bgColor redComponent], (CGFloat)(255.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor greenComponent], (CGFloat)(0.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor blueComponent], (CGFloat)(255.0/255.0), 0.001, @""); + + color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); +} + +@end diff --git a/test/.svn/text-base/TDNCName.h.svn-base b/test/.svn/text-base/TDNCName.h.svn-base new file mode 100644 index 0000000..9717f88 --- /dev/null +++ b/test/.svn/text-base/TDNCName.h.svn-base @@ -0,0 +1,22 @@ +// +// PKNCName.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKTerminal.h" +#import "PKToken.h" + +extern const NSInteger PKTokenTypeNCName; + +@interface PKToken (NCNameAdditions) +@property (readonly, getter=isNCName) BOOL NCName; +@end + +@interface TDNCName : PKTerminal { + +} ++ (id)NCName; +@end diff --git a/test/.svn/text-base/TDNCName.m.svn-base b/test/.svn/text-base/TDNCName.m.svn-base new file mode 100644 index 0000000..c5a1ad7 --- /dev/null +++ b/test/.svn/text-base/TDNCName.m.svn-base @@ -0,0 +1,33 @@ +// +// PKNCName.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDNCName.h" + +const NSInteger PKTokenTypeNCName = 300; + +@implementation PKToken (NCNameAdditions) + +- (BOOL)isNCName { + return self.tokenType == PKTokenTypeNCName; +} + +@end + +@implementation TDNCName + ++ (id)NCName { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isNCName; +} + +@end diff --git a/test/.svn/text-base/TDNCNameState.h.svn-base b/test/.svn/text-base/TDNCNameState.h.svn-base new file mode 100644 index 0000000..06505e7 --- /dev/null +++ b/test/.svn/text-base/TDNCNameState.h.svn-base @@ -0,0 +1,15 @@ +// +// PKNCNameState.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKTokenizerState.h" + +@interface TDNCNameState : PKTokenizerState { + +} + +@end diff --git a/test/.svn/text-base/TDNCNameState.m.svn-base b/test/.svn/text-base/TDNCNameState.m.svn-base new file mode 100644 index 0000000..149d65a --- /dev/null +++ b/test/.svn/text-base/TDNCNameState.m.svn-base @@ -0,0 +1,79 @@ +// +// PKNCNameState.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDNCNameState.h" +#import "PKTokenizer.h" +#import "PKReader.h" +#import "TDXmlToken.h" + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface TDNCNameState () ++ (BOOL)isNameChar:(PKUniChar)c; ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c; ++ (BOOL)isValidNonStartSymbolChar:(PKUniChar)c; +@end + +// NCName ::= (Letter | '_') (NameChar)* +@implementation TDNCNameState + +//- (BOOL)isWhitespace:(PKUniChar)c { +// return (' ' == c || '\n' == c || '\r' == c || '\t' == c); +//} + + +// NameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender ++ (BOOL)isNameChar:(PKUniChar)c { + if (isalnum(c)) { + return YES; + } else if ([self isValidNonStartSymbolChar:c]) { + return YES; + } + // TODO CombiningChar & Extender + return NO; +} + + ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c { + return ('_' == c); +} + + ++ (BOOL)isValidNonStartSymbolChar:(PKUniChar)c { + return ('_' == c || '.' == c || '-' == c); +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + [self resetWithReader:r]; + + NSInteger c = cin; + do { + [self append:c]; + c = [r read]; + } while ([TDNCNameState isNameChar:c]); + + if (PKEOF != c) { + [r unread]; + } + + if ([[self bufferedString] length] == 1 && [TDNCNameState isValidStartSymbolChar:cin]) { + return [t.symbolState nextTokenFromReader:r startingWith:cin tokenizer:t]; + } else { +// return [[[TDXmlToken alloc] initWithTokenType:TDTT_NAME +// stringValue:[[stringbuf copy] autorelease] +// floatValue:0.0] autorelease]; + return nil; + } +} + +@end diff --git a/test/.svn/text-base/TDNSPredicateBuilder.h.svn-base b/test/.svn/text-base/TDNSPredicateBuilder.h.svn-base new file mode 100644 index 0000000..9b6c010 --- /dev/null +++ b/test/.svn/text-base/TDNSPredicateBuilder.h.svn-base @@ -0,0 +1,76 @@ +// +// PredicateParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 5/27/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface TDNSPredicateBuilder : NSObject { + NSString *defaultAttr; + NSString *defaultRelation; + NSString *defaultValue; + PKToken *nonReservedWordFence; + PKCollectionParser *exprParser; + PKCollectionParser *orTermParser; + PKCollectionParser *termParser; + PKCollectionParser *andPrimaryExprParser; + PKCollectionParser *primaryExprParser; + PKCollectionParser *phraseParser; + PKCollectionParser *negatedPredicateParser; + PKCollectionParser *predicateParser; + PKCollectionParser *completePredicateParser; + PKCollectionParser *attrValuePredicateParser; + PKCollectionParser *attrPredicateParser; + PKCollectionParser *valuePredicateParser; + PKCollectionParser *attrParser; + PKCollectionParser *tagParser; + PKCollectionParser *relationParser; + PKCollectionParser *valueParser; + PKCollectionParser *boolParser; + PKParser *trueParser; + PKParser *falseParser; + PKCollectionParser *stringParser; + PKParser *quotedStringParser; + PKCollectionParser *unquotedStringParser; + PKCollectionParser *reservedWordParser; + PKCollectionParser *nonReservedWordParser; + PKPattern *reservedWordPattern; + PKParser *numberParser; + +} +- (NSPredicate *)buildFrom:(NSString *)s; + +@property (nonatomic, copy) NSString *defaultAttr; +@property (nonatomic, copy) NSString *defaultRelation; +@property (nonatomic, copy) NSString *defaultValue; + +@property (nonatomic, retain) PKCollectionParser *exprParser; +@property (nonatomic, retain) PKCollectionParser *orTermParser; +@property (nonatomic, retain) PKCollectionParser *termParser; +@property (nonatomic, retain) PKCollectionParser *andPrimaryExprParser; +@property (nonatomic, retain) PKCollectionParser *primaryExprParser; +@property (nonatomic, retain) PKCollectionParser *phraseParser; +@property (nonatomic, retain) PKCollectionParser *negatedPredicateParser; +@property (nonatomic, retain) PKCollectionParser *predicateParser; +@property (nonatomic, retain) PKCollectionParser *completePredicateParser; +@property (nonatomic, retain) PKCollectionParser *attrValuePredicateParser; +@property (nonatomic, retain) PKCollectionParser *attrPredicateParser; +@property (nonatomic, retain) PKCollectionParser *valuePredicateParser; +@property (nonatomic, retain) PKCollectionParser *attrParser; +@property (nonatomic, retain) PKCollectionParser *tagParser; +@property (nonatomic, retain) PKCollectionParser *relationParser; +@property (nonatomic, retain) PKCollectionParser *valueParser; +@property (nonatomic, retain) PKCollectionParser *boolParser; +@property (nonatomic, retain) PKParser *trueParser; +@property (nonatomic, retain) PKParser *falseParser; +@property (nonatomic, retain) PKCollectionParser *stringParser; +@property (nonatomic, retain) PKParser *quotedStringParser; +@property (nonatomic, retain) PKCollectionParser *unquotedStringParser; +@property (nonatomic, retain) PKCollectionParser *reservedWordParser; +@property (nonatomic, retain) PKCollectionParser *nonReservedWordParser; +@property (nonatomic, retain) PKPattern *reservedWordPattern; +@property (nonatomic, retain) PKParser *numberParser; +@end diff --git a/test/.svn/text-base/TDNSPredicateBuilder.m.svn-base b/test/.svn/text-base/TDNSPredicateBuilder.m.svn-base new file mode 100644 index 0000000..da933ae --- /dev/null +++ b/test/.svn/text-base/TDNSPredicateBuilder.m.svn-base @@ -0,0 +1,587 @@ +// +// PKNSPredicateBuilder.m +// ParseKit +// +// Created by Todd Ditchendorf on 5/27/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDNSPredicateBuilder.h" +#import "NSString+ParseKitAdditions.h" + +// expr = term orTerm*; +// orTerm = 'or' term; +// term = primaryExpr andPrimaryExpr*; +// andPrimaryExpr = 'and' primaryExpr; +// primaryExpr = phrase | '(' expr ')'; +// phrase = predicate | negatedPredicate; +// negatedPredicate = 'not' predicate; +// predicate = completePredicate | attrValuePredicate | attrPredicate | valuePredicate; +// completePredicate = attr relation value; +// attrValuePredicate = attr value; +// attrPredicate = attr; +// valuePredicate = value; +// attr = tag | Word; +// tag = '@' Word; +// value = string | Number | bool; +// string = QuotedString | unquotedString; +// unquotedString = nonReservedWord+; +// bool = 'true' | 'false'; + +@interface TDNSPredicateBuilder () +@property (nonatomic, retain) PKToken *nonReservedWordFence; +@end + +@implementation TDNSPredicateBuilder + +- (id)init { + if (self = [super init]) { + self.defaultAttr = @"content"; + self.defaultRelation = @"="; + self.defaultValue = @""; + self.nonReservedWordFence = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"." floatValue:0.0]; + } + return self; +} + + +- (void)dealloc { + self.defaultAttr = nil; + self.defaultRelation = nil; + self.defaultValue = nil; + self.nonReservedWordFence = nil; + self.exprParser = nil; + self.orTermParser = nil; + self.termParser = nil; + self.andPrimaryExprParser = nil; + self.primaryExprParser = nil; + self.phraseParser = nil; + self.negatedPredicateParser = nil; + self.predicateParser = nil; + self.completePredicateParser = nil; + self.attrValuePredicateParser = nil; + self.attrPredicateParser = nil; + self.valuePredicateParser = nil; + self.attrParser = nil; + self.tagParser = nil; + self.relationParser = nil; + self.valueParser = nil; + self.boolParser = nil; + self.trueParser = nil; + self.falseParser = nil; + self.stringParser = nil; + self.quotedStringParser = nil; + self.unquotedStringParser = nil; + self.reservedWordParser = nil; + self.nonReservedWordParser = nil; + self.reservedWordPattern = nil; + self.numberParser = nil; + [super dealloc]; +} + + +- (NSPredicate *)buildFrom:(NSString *)s; { + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + return [[self.exprParser completeMatchFor:a] pop]; +} + + +// expression = term orTerm* +- (PKCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [PKSequence sequence]; + [exprParser add:self.termParser]; + [exprParser add:[PKRepetition repetitionWithSubparser:self.orTermParser]]; + } + return exprParser; +} + + +// orTerm = 'or' term +- (PKCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [PKSequence sequence]; + orTermParser.name = @"orTerm"; + [orTermParser add:[[PKCaseInsensitiveLiteral literalWithString:@"or"] discard]]; + [orTermParser add:self.termParser]; + [orTermParser setAssembler:self selector:@selector(didMatchOr:)]; + } + return orTermParser; +} + + +// term = primaryExpr andPrimaryExpr* +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + termParser.name = @"term"; + [termParser add:self.primaryExprParser]; + [termParser add:[PKRepetition repetitionWithSubparser:self.andPrimaryExprParser]]; + } + return termParser; +} + + +// andPrimaryExpr = 'and' primaryExpr +- (PKCollectionParser *)andPrimaryExprParser { + if (!andPrimaryExprParser) { + self.andPrimaryExprParser = [PKSequence sequence]; + andPrimaryExprParser.name = @"andPrimaryExpr"; + [andPrimaryExprParser add:[[PKCaseInsensitiveLiteral literalWithString:@"and"] discard]]; + [andPrimaryExprParser add:self.primaryExprParser]; + [andPrimaryExprParser setAssembler:self selector:@selector(didMatchAnd:)]; + } + return andPrimaryExprParser; +} + + +// primaryExpr = phrase | '(' expression ')' +- (PKCollectionParser *)primaryExprParser { + if (!primaryExprParser) { + self.primaryExprParser = [PKAlternation alternation]; + primaryExprParser.name = @"primaryExpr"; + [primaryExprParser add:self.phraseParser]; + + PKSequence *s = [PKSequence sequence]; + [s add:[[PKSymbol symbolWithString:@"("] discard]]; + [s add:self.exprParser]; + [s add:[[PKSymbol symbolWithString:@")"] discard]]; + + [primaryExprParser add:s]; + } + return primaryExprParser; +} + + +// phrase = predicate | negatedPredicate +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + self.phraseParser = [PKAlternation alternation]; + phraseParser.name = @"phrase"; + [phraseParser add:self.predicateParser]; + [phraseParser add:self.negatedPredicateParser]; + } + return phraseParser; +} + + +// negatedPredicate = 'not' predicate +- (PKCollectionParser *)negatedPredicateParser { + if (!negatedPredicateParser) { + self.negatedPredicateParser = [PKSequence sequence]; + negatedPredicateParser.name = @"negatedPredicate"; + [negatedPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"not"] discard]]; + [negatedPredicateParser add:self.predicateParser]; + [negatedPredicateParser setAssembler:self selector:@selector(didMatchNegatedValue:)]; + } + return negatedPredicateParser; +} + + +// predicate = bool | eqPredicate | nePredicate | gtPredicate | gteqPredicate | ltPredicate | lteqPredicate | beginswithPredicate | containsPredicate | endswithPredicate | matchesPredicate +- (PKCollectionParser *)predicateParser { + if (!predicateParser) { + self.predicateParser = [PKAlternation alternation]; + predicateParser.name = @"predicate"; + [predicateParser add:self.completePredicateParser]; + [predicateParser add:self.attrValuePredicateParser]; + [predicateParser add:self.attrPredicateParser]; + [predicateParser add:self.valuePredicateParser]; + [predicateParser setAssembler:self selector:@selector(didMatchPredicate:)]; + } + return predicateParser; +} + + +// completePredicate = attribute relation value +- (PKCollectionParser *)completePredicateParser { + if (!completePredicateParser) { + self.completePredicateParser = [PKSequence sequence]; + completePredicateParser.name = @"completePredicate"; + [completePredicateParser add:self.attrParser]; + [completePredicateParser add:self.relationParser]; + [completePredicateParser add:self.valueParser]; + } + return completePredicateParser; +} + + +// attrValuePredicate = attribute value +- (PKCollectionParser *)attrValuePredicateParser { + if (!attrValuePredicateParser) { + self.attrValuePredicateParser = [PKSequence sequence]; + attrValuePredicateParser.name = @"attrValuePredicate"; + [attrValuePredicateParser add:self.attrParser]; + [attrValuePredicateParser add:self.valueParser]; + [attrValuePredicateParser setAssembler:self selector:@selector(didMatchAttrValuePredicate:)]; + } + return attrValuePredicateParser; +} + + +// attrPredicate = attribute +- (PKCollectionParser *)attrPredicateParser { + if (!attrPredicateParser) { + self.attrPredicateParser = [PKSequence sequence]; + attrPredicateParser.name = @"attrPredicate"; + [attrPredicateParser add:self.attrParser]; + [attrPredicateParser setAssembler:self selector:@selector(didMatchAttrPredicate:)]; + } + return attrPredicateParser; +} + + +// valuePredicate = value +- (PKCollectionParser *)valuePredicateParser { + if (!valuePredicateParser) { + self.valuePredicateParser = [PKSequence sequence]; + valuePredicateParser.name = @"valuePredicate"; + [valuePredicateParser add:self.valueParser]; + [valuePredicateParser setAssembler:self selector:@selector(didMatchValuePredicate:)]; + } + return valuePredicateParser; +} + + +// attr = tag | 'uniqueid' | 'line' | 'type' | 'isgroupheader' | 'level' | 'index' | 'content' | 'parent' | 'project' | 'countofchildren' +- (PKCollectionParser *)attrParser { + if (!attrParser) { + self.attrParser = [PKAlternation alternation]; + attrParser.name = @"attr"; + [attrParser add:self.tagParser]; + [attrParser add:self.nonReservedWordParser]; + [attrParser setAssembler:self selector:@selector(didMatchAttr:)]; + } + return attrParser; +} + + +// relation = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'beginswith' | 'contains' | 'endswith' | 'matches' +- (PKCollectionParser *)relationParser { + if (!relationParser) { + self.relationParser = [PKAlternation alternation]; + relationParser.name = @"relation"; + [relationParser add:[PKSymbol symbolWithString:@"="]]; + [relationParser add:[PKSymbol symbolWithString:@"!="]]; + [relationParser add:[PKSymbol symbolWithString:@">"]]; + [relationParser add:[PKSymbol symbolWithString:@">="]]; + [relationParser add:[PKSymbol symbolWithString:@"<"]]; + [relationParser add:[PKSymbol symbolWithString:@"<="]]; + [relationParser add:[PKCaseInsensitiveLiteral literalWithString:@"beginswith"]]; + [relationParser add:[PKCaseInsensitiveLiteral literalWithString:@"contains"]]; + [relationParser add:[PKCaseInsensitiveLiteral literalWithString:@"endswith"]]; + [relationParser add:[PKCaseInsensitiveLiteral literalWithString:@"matches"]]; + [relationParser setAssembler:self selector:@selector(didMatchRelation:)]; + } + return relationParser; +} + + +// tag = '@' Word +- (PKCollectionParser *)tagParser { + if (!tagParser) { + self.tagParser = [PKSequence sequence]; + tagParser.name = @"tag"; + [tagParser add:[[PKSymbol symbolWithString:@"@"] discard]]; + [tagParser add:[PKWord word]]; + } + return tagParser; +} + + +// value = QuotedString | Number | bool +- (PKCollectionParser *)valueParser { + if (!valueParser) { + self.valueParser = [PKAlternation alternation]; + valueParser.name = @"value"; + [valueParser add:self.stringParser]; + [valueParser add:self.numberParser]; + [valueParser add:self.boolParser]; + } + return valueParser; +} + + +- (PKCollectionParser *)boolParser { + if (!boolParser) { + self.boolParser = [PKAlternation alternation]; + boolParser.name = @"bool"; + [boolParser add:self.trueParser]; + [boolParser add:self.falseParser]; + [boolParser setAssembler:self selector:@selector(didMatchBool:)]; + } + return boolParser; +} + + +- (PKParser *)trueParser { + if (!trueParser) { + self.trueParser = [[PKCaseInsensitiveLiteral literalWithString:@"true"] discard]; + trueParser.name = @"true"; + [trueParser setAssembler:self selector:@selector(didMatchTrue:)]; + } + return trueParser; +} + + +- (PKParser *)falseParser { + if (!falseParser) { + self.falseParser = [[PKCaseInsensitiveLiteral literalWithString:@"false"] discard]; + falseParser.name = @"false"; + [falseParser setAssembler:self selector:@selector(didMatchFalse:)]; + } + return falseParser; +} + + +// string = quotedString | unquotedString +- (PKCollectionParser *)stringParser { + if (!stringParser) { + self.stringParser = [PKAlternation alternation]; + stringParser.name = @"string"; + [stringParser add:self.quotedStringParser]; + [stringParser add:self.unquotedStringParser]; + } + return stringParser; +} + + +// quotedString = QuotedString +- (PKParser *)quotedStringParser { + if (!quotedStringParser) { + self.quotedStringParser = [PKQuotedString quotedString]; + quotedStringParser.name = @"quotedString"; + [quotedStringParser setAssembler:self selector:@selector(didMatchQuotedString:)]; + } + return quotedStringParser; +} + + +// unquotedString = nonReservedWord+ +- (PKCollectionParser *)unquotedStringParser { + if (!unquotedStringParser) { + self.unquotedStringParser = [PKSequence sequence]; + unquotedStringParser.name = @"unquotedString"; + [unquotedStringParser add:self.nonReservedWordParser]; + [unquotedStringParser add:[PKRepetition repetitionWithSubparser:self.nonReservedWordParser]]; + [unquotedStringParser setAssembler:self selector:@selector(didMatchUnquotedString:)]; + } + return unquotedStringParser; +} + + +- (PKCollectionParser *)reservedWordParser { + if (!reservedWordParser) { + self.reservedWordParser = [PKIntersection intersection]; + [reservedWordParser add:[PKWord word]]; + [reservedWordParser add:self.reservedWordPattern]; + reservedWordParser.name = @"reservedWord"; + [reservedWordParser setAssembler:self selector:@selector(didMatchReservedWord:)]; + } + return reservedWordParser; +} + + +// nonReservedWord = Word +- (PKCollectionParser *)nonReservedWordParser { + if (!nonReservedWordParser) { + self.nonReservedWordParser = [PKDifference differenceWithSubparser:[PKWord word] minus:self.reservedWordParser]; + nonReservedWordParser.name = @"nonReservedWord"; + [nonReservedWordParser setAssembler:self selector:@selector(didMatchNonReservedWord:)]; + } + return nonReservedWordParser; +} + + +- (PKPattern *)reservedWordPattern { + if (!reservedWordPattern) { + NSString *s = @"true|false|and|or|not|contains|beginswith|endswith|matches"; + self.reservedWordPattern = [PKPattern patternWithString:s options:PKPatternOptionsIgnoreCase]; + reservedWordPattern.name = @"reservedWordPattern"; + } + return reservedWordPattern; +} + + +- (PKParser *)numberParser { + if (!numberParser) { + self.numberParser = [PKNumber number]; + numberParser.name = @"number"; + [numberParser setAssembler:self selector:@selector(didMatchNumber:)]; + } + return numberParser; +} + + +- (void)didMatchAnd:(PKAssembly *)a { + NSPredicate *p2 = [a pop]; + NSPredicate *p1 = [a pop]; + NSArray *subs = [NSArray arrayWithObjects:p1, p2, nil]; + [a push:[NSCompoundPredicate andPredicateWithSubpredicates:subs]]; +} + + +- (void)didMatchOr:(PKAssembly *)a { + NSPredicate *p2 = [a pop]; + NSPredicate *p1 = [a pop]; + NSArray *subs = [NSArray arrayWithObjects:p1, p2, nil]; + [a push:[NSCompoundPredicate orPredicateWithSubpredicates:subs]]; +} + + +- (void)didMatchPredicate:(PKAssembly *)a { + id value = [a pop]; + id relation = [a pop]; + id attr = [a pop]; + NSString *predicateFormat = [NSString stringWithFormat:@"%@ %@ %%@", attr, relation, nil]; + NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateFormat, value, nil]; + [a push:predicate]; +} + + +- (void)didMatchAttrValuePredicate:(PKAssembly *)a { + id value = [a pop]; + id attr = [a pop]; + [a push:attr]; + [a push:defaultRelation]; + [a push:value]; +} + + +- (void)didMatchAttrPredicate:(PKAssembly *)a { + id attr = [a pop]; + [a push:attr]; + [a push:defaultRelation]; + [a push:defaultValue]; +} + + +- (void)didMatchValuePredicate:(PKAssembly *)a { + id value = [a pop]; + [a push:defaultAttr]; + [a push:defaultRelation]; + [a push:value]; +} + + +- (void)didMatchAttr:(PKAssembly *)a { + [a push:[[a pop] stringValue]]; +} + + +- (void)didMatchRelation:(PKAssembly *)a { + [a push:[[a pop] stringValue]]; +} + + +- (void)didMatchNegatedValue:(PKAssembly *)a { + id p = [a pop]; + [a push:[NSCompoundPredicate notPredicateWithSubpredicate:p]]; +} + + +- (void)didMatchBool:(PKAssembly *)a { + NSNumber *b = [a pop]; + [a push:[NSPredicate predicateWithValue:[b boolValue]]]; +} + + +- (void)didMatchTrue:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:YES]]; +} + + +- (void)didMatchFalse:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:NO]]; +} + + +- (void)didMatchQuotedString:(PKAssembly *)a { + [a push:[[[a pop] stringValue] stringByTrimmingQuotes]]; +} + + +- (void)didMatchReservedWord:(PKAssembly *)a { +// PKToken *tok = [a pop]; +// [a push:tok.stringValue]; +} + + +- (void)didMatchNonReservedWord:(PKAssembly *)a { +// id obj = [a pop]; +// [a push:nonReservedWordFence]; +// [a push:obj]; +} + + +- (void)didMatchUnquotedString:(PKAssembly *)a { + NSMutableArray *wordStrings = [NSMutableArray array]; + + while (1) { + NSArray *objs = [a objectsAbove:nonReservedWordFence]; + id next = [a pop]; // is the next obj a fence? + if (![nonReservedWordFence isEqual:next]) { + // if not, put the next token back + if (next) { + [a push:next]; + } + // also put back any toks we didnt mean to pop + for (id obj in [objs reverseObjectEnumerator]) { + [a push:obj]; + } + break; + } + NSAssert(1 == [objs count], @""); + [wordStrings addObject:[objs objectAtIndex:0]]; + } + + NSInteger last = [wordStrings count] - 1; + NSInteger i = 0; + NSMutableString *ms = [NSMutableString string]; + for (NSString *wordString in [wordStrings reverseObjectEnumerator]) { + if (i++ == last) { + [ms appendString:wordString]; + } else { + [ms appendFormat:@"%@ ", wordString]; + } + } + [a push:[[ms copy] autorelease]]; +} + + +- (void)didMatchNumber:(PKAssembly *)a { + NSNumber *n = [NSNumber numberWithFloat:[(PKToken *)[a pop] floatValue]]; + [a push:n]; +} + +@synthesize defaultAttr; +@synthesize defaultRelation; +@synthesize defaultValue; +@synthesize nonReservedWordFence; +@synthesize exprParser; +@synthesize orTermParser; +@synthesize termParser; +@synthesize andPrimaryExprParser; +@synthesize primaryExprParser; +@synthesize phraseParser; +@synthesize negatedPredicateParser; +@synthesize predicateParser; +@synthesize completePredicateParser; +@synthesize attrValuePredicateParser; +@synthesize attrPredicateParser; +@synthesize valuePredicateParser; +@synthesize attrParser; +@synthesize tagParser; +@synthesize relationParser; +@synthesize valueParser; +@synthesize boolParser; +@synthesize trueParser; +@synthesize falseParser; +@synthesize stringParser; +@synthesize quotedStringParser; +@synthesize unquotedStringParser; +@synthesize reservedWordParser; +@synthesize nonReservedWordParser; +@synthesize reservedWordPattern; +@synthesize numberParser; +@end diff --git a/test/.svn/text-base/TDNSPredicateBuilderTest.h.svn-base b/test/.svn/text-base/TDNSPredicateBuilderTest.h.svn-base new file mode 100644 index 0000000..a9fa376 --- /dev/null +++ b/test/.svn/text-base/TDNSPredicateBuilderTest.h.svn-base @@ -0,0 +1,18 @@ +// +// PredicateParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 5/27/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "TDNSPredicateBuilder.h" + +@interface TDNSPredicateBuilderTest : SenTestCase { + TDNSPredicateBuilder *b; + NSString *s; + PKAssembly *a; +} + +@end diff --git a/test/.svn/text-base/TDNSPredicateBuilderTest.m.svn-base b/test/.svn/text-base/TDNSPredicateBuilderTest.m.svn-base new file mode 100644 index 0000000..8ab1802 --- /dev/null +++ b/test/.svn/text-base/TDNSPredicateBuilderTest.m.svn-base @@ -0,0 +1,213 @@ +// +// PredicateParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 5/27/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDNSPredicateBuilderTest.h" + +@implementation TDNSPredicateBuilderTest + +- (void)setUp { + b = [[[TDNSPredicateBuilder alloc] init] autorelease]; +} + + +- (void)testEq { + // test numbers + s = @"foo = 1.0"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == 1]foo/=/1.0^", [a description]); + + s = @"foo = -1.0"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == -1]foo/=/-1.0^", [a description]); + + + // test bools + s = @"foo = true"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == TRUEPREDICATE]foo/=/true^", [a description]); + + s = @"foo = false"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == FALSEPREDICATE]foo/=/false^", [a description]); + + + // test strings + s = @"foo = 'bar'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == \"bar\"]foo/=/'bar'^", [a description]); + + s = @"foo = 'baz'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == \"baz\"]foo/=/'baz'^", [a description]); +} + + +- (void)testNe { + // test numbers + s = @"foo != 1.0"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != 1]foo/!=/1.0^", [a description]); + + s = @"foo != 1.00"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != 1]foo/!=/1.00^", [a description]); + + + // test bools + s = @"foo != true"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != TRUEPREDICATE]foo/!=/true^", [a description]); + + s = @"foo != false"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != FALSEPREDICATE]foo/!=/false^", [a description]); + + + // test strings + s = @"foo != 'bar'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != \"bar\"]foo/!=/'bar'^", [a description]); + + s = @"foo != 'baz'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != \"baz\"]foo/!=/'baz'^", [a description]); +} + + +- (void)testGt { + s = @"foo > 42"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo > 42]foo/>/42^", [a description]); +} + + +- (void)testLt { + s = @"foo < .3"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo < 0.3]foo/= 42"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo >= 42]foo/>=/42^", [a description]); +} + + +- (void)testLteq { + s = @"foo <= .3"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo <= 0.3]foo/<=/.3^", [a description]); +} + + +- (void)testBeginswith { + s = @"foo beginswith 'bar'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo BEGINSWITH \"bar\"]foo/beginswith/'bar'^", [a description]); +} + + +- (void)testContains { + s = @"foo contains 'baz'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo CONTAINS \"baz\"]foo/contains/'baz'^", [a description]); +} + + +- (void)testEndswith { + s = @"foo endswith 'baz'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo ENDSWITH \"baz\"]foo/endswith/'baz'^", [a description]); +} + + +- (void)testMatches { + s = @"foo matches 'baz'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo MATCHES \"baz\"]foo/matches/'baz'^", [a description]); +} + + +- (void)testUnqotedString { +// s = @"foo contains bar"; +// a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; +// TDEqualObjects(@"[foo CONTAINS \"bar\"]foo/contains/bar^", [a description]); +// +// s = @"foo matches bar baz"; +// a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; +// TDEqualObjects(@"[foo MATCHES \"bar baz\"]foo/matches/bar/baz^", [a description]); +// +// s = @"foo matches foo bar baz"; +// a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; +// TDEqualObjects(@"[foo MATCHES \"foo bar baz\"]foo/matches/foo/bar/baz^", [a description]); +// +// s = @"foo matches bar and baz contains bat"; +// a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; +// TDEqualObjects(@"[foo MATCHES \"bar\" AND baz CONTAINS \"bat\"]foo/matches/bar/and/baz/contains/bat^", [a description]); +// +// s = @"foo matches foo bar and baz contains bat"; +// a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; +// TDEqualObjects(@"[foo MATCHES \"foo bar\" AND baz CONTAINS \"bat\"]foo/matches/foo/bar/and/baz/contains/bat^", [a description]); +} + + +- (void)testBools { + s = @"true"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[content == TRUEPREDICATE]true^", [a description]); + + s = @"not true"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[NOT content == TRUEPREDICATE]not/true^", [a description]); + + s = @"false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[content == FALSEPREDICATE]false^", [a description]); + + s = @"not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[NOT content == FALSEPREDICATE]not/false^", [a description]); + + s = @"true and false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[content == TRUEPREDICATE AND content == FALSEPREDICATE]true/and/false^", [a description]); + + s = @"not true and false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[(NOT content == TRUEPREDICATE) AND content == FALSEPREDICATE]not/true/and/false^", [a description]); + + s = @"not true and not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[(NOT content == TRUEPREDICATE) AND (NOT content == FALSEPREDICATE)]not/true/and/not/false^", [a description]); + + s = @"true or false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[content == TRUEPREDICATE OR content == FALSEPREDICATE]true/or/false^", [a description]); + + s = @"(true and false) or false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[(content == TRUEPREDICATE AND content == FALSEPREDICATE) OR content == FALSEPREDICATE](/true/and/false/)/or/false^", [a description]); + + s = @"(true and false) or not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[(content == TRUEPREDICATE AND content == FALSEPREDICATE) OR (NOT content == FALSEPREDICATE)](/true/and/false/)/or/not/false^", [a description]); +} + +@end diff --git a/test/.svn/text-base/TDNSPredicateEvaluator.h.svn-base b/test/.svn/text-base/TDNSPredicateEvaluator.h.svn-base new file mode 100644 index 0000000..dc6e3fe --- /dev/null +++ b/test/.svn/text-base/TDNSPredicateEvaluator.h.svn-base @@ -0,0 +1,28 @@ +// +// PKNSPredicateEvaluator.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class TDNSPredicateEvaluator; + +@protocol TDKeyPathResolver +- (id)resolvedValueForKeyPath:(NSString *)s; +@end + +@interface TDNSPredicateEvaluator : NSObject { + id resolver; + PKParser *parser; + PKToken *openCurly; +} +- (id)initWithKeyPathResolver:(id )r; + +- (BOOL)evaluate:(NSString *)s; + +@property (nonatomic, retain) PKParser *parser; +@end diff --git a/test/.svn/text-base/TDNSPredicateEvaluator.m.svn-base b/test/.svn/text-base/TDNSPredicateEvaluator.m.svn-base new file mode 100644 index 0000000..d5af388 --- /dev/null +++ b/test/.svn/text-base/TDNSPredicateEvaluator.m.svn-base @@ -0,0 +1,224 @@ +// +// PKNSPredicateEvaluator.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDNSPredicateEvaluator.h" +#import "PKParserFactory.h" +#import "NSString+ParseKitAdditions.h" +#import "NSArray+ParseKitAdditions.h" + +@interface TDNSPredicateEvaluator () +- (void)didMatchCollectionPredicateAssembly:(PKAssembly *)a ordered:(NSComparisonResult)ordered; + +@property (nonatomic, assign) id resolver; +@property (nonatomic, retain) PKToken *openCurly; +@end + +@implementation TDNSPredicateEvaluator + +- (id)initWithKeyPathResolver:(id )r { + if (self = [super init]) { + self.resolver = r; + + self.openCurly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0]; + + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"nspredicate" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + self.parser = [[PKParserFactory factory] parserFromGrammar:s assembler:self]; + } + return self; +} + + +- (void)dealloc { + resolver = nil; + self.parser = nil; + self.openCurly = nil; + [super dealloc]; +} + + +- (BOOL)evaluate:(NSString *)s { + id result = [parser parse:s]; + return [result boolValue]; +} + + +- (void)didMatchNegatedPredicate:(PKAssembly *)a { + BOOL b = [[a pop] boolValue]; + [a push:[NSNumber numberWithBool:!b]]; +} + + +- (void)didMatchNumComparisonPredicate:(PKAssembly *)a { + CGFloat n2 = [(PKToken *)[a pop] floatValue]; + NSString *op = [[a pop] stringValue]; + CGFloat n1 = [(PKToken *)[a pop] floatValue]; + + BOOL result = NO; + if ([op isEqualToString:@"<"]) { + result = n1 < n2; + } else if ([op isEqualToString:@">"]) { + result = n1 > n2; + } else if ([op isEqualToString:@"="] || [op isEqualToString:@"=="]) { + result = n1 == n2; + } else if ([op isEqualToString:@"<="] || [op isEqualToString:@"=<"]) { + result = n1 <= n2; + } else if ([op isEqualToString:@">="] || [op isEqualToString:@"=>"]) { + result = n1 >= n2; + } else if ([op isEqualToString:@"!="] || [op isEqualToString:@"<>"]) { + result = n1 != n2; + } + + [a push:[NSNumber numberWithBool:result]]; +} + + +- (void)didMatchCollectionLtPredicate:(PKAssembly *)a { + [self didMatchCollectionPredicateAssembly:a ordered:NSOrderedAscending]; +} + + +- (void)didMatchCollectionGtPredicate:(PKAssembly *)a { + [self didMatchCollectionPredicateAssembly:a ordered:NSOrderedDescending]; +} + + +- (void)didMatchCollectionEqPredicate:(PKAssembly *)a { + [self didMatchCollectionPredicateAssembly:a ordered:NSOrderedSame]; +} + + +- (void)didMatchCollectionPredicateAssembly:(PKAssembly *)a ordered:(NSComparisonResult)ordered { + id value = [a pop]; + [a pop]; // discard op + NSArray *array = [a pop]; + NSString *aggOp = [[a pop] stringValue]; + + BOOL isAny = NSOrderedSame == [aggOp caseInsensitiveCompare:@"ANY"]; + BOOL isSome = NSOrderedSame == [aggOp caseInsensitiveCompare:@"SOME"]; + BOOL isNone = NSOrderedSame == [aggOp caseInsensitiveCompare:@"NONE"]; + BOOL isAll = NSOrderedSame == [aggOp caseInsensitiveCompare:@"ALL"]; + + BOOL result = NO; + if (isAny || isSome || isNone) { + for (id obj in array) { + if (ordered == [obj compare:value]) { + result = YES; + break; + } + } + } else if (isAll) { + NSInteger c = 0; + for (id obj in array) { + if (ordered != [obj compare:value]) { + break; + } + c++; + } + result = c == [array count]; + } + + if (isNone) { + result = !result; + } + + [a push:[NSNumber numberWithBool:result]]; +} + + +- (void)didMatchString:(PKAssembly *)a { + NSString *s = [[[a pop] stringValue] stringByTrimmingQuotes]; + [a push:s]; +} + + +- (void)didMatchStringTestPredicate:(PKAssembly *)a { + NSString *s2 = [a pop]; + NSString *op = [[a pop] stringValue]; + NSString *s1 = [a pop]; + + BOOL result = NO; + if (NSOrderedSame == [op caseInsensitiveCompare:@"BEGINSWITH"]) { + result = [s1 hasPrefix:s2]; + } else if (NSOrderedSame == [op caseInsensitiveCompare:@"CONTAINS"]) { + result = (NSNotFound != [s1 rangeOfString:s2].location); + } else if (NSOrderedSame == [op caseInsensitiveCompare:@"ENDSWITH"]) { + result = [s1 hasSuffix:s2]; + } else if (NSOrderedSame == [op caseInsensitiveCompare:@"LIKE"]) { + result = NSOrderedSame == [s1 caseInsensitiveCompare:s2]; // TODO + } else if (NSOrderedSame == [op caseInsensitiveCompare:@"MATCHES"]) { + result = NSOrderedSame == [s1 caseInsensitiveCompare:s2]; // TODO + } + + [a push:[NSNumber numberWithBool:result]]; +} + + +- (void)didMatchAndAndTerm:(PKAssembly *)a { + BOOL b2 = [[a pop] boolValue]; + BOOL b1 = [[a pop] boolValue]; + [a push:[NSNumber numberWithBool:b1 && b2]]; +} + + +- (void)didMatchOrOrTerm:(PKAssembly *)a { + BOOL b2 = [[a pop] boolValue]; + BOOL b1 = [[a pop] boolValue]; + [a push:[NSNumber numberWithBool:b1 || b2]]; +} + + +- (void)didMatchArray:(PKAssembly *)a { + NSArray *objs = [a objectsAbove:openCurly]; + [a pop]; // discard '{' + [a push:[objs reversedArray]]; +} + + +- (void)didMatchCollectionTestPredicate:(PKAssembly *)a { + NSArray *array = [a pop]; + NSAssert([array isKindOfClass:[NSArray class]], @""); + id value = [a pop]; + [a push:[NSNumber numberWithBool:[array containsObject:value]]]; +} + + +- (void)didMatchKeyPath:(PKAssembly *)a { + NSString *keyPath = [[a pop] stringValue]; + [a push:[resolver resolvedValueForKeyPath:keyPath]]; +} + + +- (void)didMatchNum:(PKAssembly *)a { + [a push:[NSNumber numberWithFloat:[(PKToken *)[a pop] floatValue]]]; +} + + +- (void)didMatchTrue:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:YES]]; +} + + +- (void)didMatchFalse:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:NO]]; +} + + +- (void)didMatchTruePredicate:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:YES]]; +} + + +- (void)didMatchFalsePredicate:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:NO]]; +} + +@synthesize resolver; +@synthesize parser; +@synthesize openCurly; +@end diff --git a/test/.svn/text-base/TDNSPredicateEvaluatorTest.h.svn-base b/test/.svn/text-base/TDNSPredicateEvaluatorTest.h.svn-base new file mode 100644 index 0000000..5649760 --- /dev/null +++ b/test/.svn/text-base/TDNSPredicateEvaluatorTest.h.svn-base @@ -0,0 +1,22 @@ +// +// PKNSPredicateEvaluatorTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "TDNSPredicateEvaluator.h" + +@interface TDNSPredicateEvaluatorTest : SenTestCase { + TDNSPredicateEvaluator *eval; + NSString *s; + PKAssembly *a; + PKAssembly *res; + PKTokenizer *t; + + NSMutableDictionary *d; +} + +@end diff --git a/test/.svn/text-base/TDNSPredicateEvaluatorTest.m.svn-base b/test/.svn/text-base/TDNSPredicateEvaluatorTest.m.svn-base new file mode 100644 index 0000000..96bbe6b --- /dev/null +++ b/test/.svn/text-base/TDNSPredicateEvaluatorTest.m.svn-base @@ -0,0 +1,272 @@ +// +// PKNSPredicateEvaluatorTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDNSPredicateEvaluatorTest.h" + +@implementation TDNSPredicateEvaluatorTest + +- (id)resolvedValueForKeyPath:(NSString *)kp { + id result = [d objectForKey:kp]; + if (!result) { + result = [NSNumber numberWithBool:NO]; + } + return result; +} + + +- (void)dealloc { + [eval release]; + [super dealloc]; +} + + +- (void)setUp { + d = [NSMutableDictionary dictionary]; + eval = [[TDNSPredicateEvaluator alloc] initWithKeyPathResolver:self]; + t = eval.parser.tokenizer; +} + + +- (void)testKeyPath { + [d setObject:[NSNumber numberWithBool:YES] forKey:@"foo"]; + [d setObject:[NSNumber numberWithBool:NO] forKey:@"baz"]; + + t.string = @"foo"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[eval.parser parserNamed:@"keyPath"] completeMatchFor:a]; + TDEqualObjects(@"[1]foo^", [res description]); + + t.string = @"bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[eval.parser parserNamed:@"keyPath"] completeMatchFor:a]; + TDEqualObjects(@"[0]bar^", [res description]); + + t.string = @"baz"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[eval.parser parserNamed:@"keyPath"] completeMatchFor:a]; + TDEqualObjects(@"[0]baz^", [res description]); + + t.string = @"foo.bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[eval.parser parserNamed:@"keyPath"] completeMatchFor:a]; + TDEqualObjects(@"[0]foo.bar^", [res description]); +} + + +- (void)testNegatedPredicate { + t.string = @"not 0 < 2"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]not/0/ 2"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]1/>/2^", [res description]); + + t.string = @"1 != 2"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]1/!=/2^", [res description]); + + t.string = @"1 == 2"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]1/==/2^", [res description]); + + t.string = @"1 = 2"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]1/=/2^", [res description]); +} + + +- (void)testArray { + t.string = @"{1, 3}"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [[eval.parser parserNamed:@"array"] completeMatchFor:a]; + NSArray *array = [res pop]; + TDEquals((NSUInteger)2, [array count]); + TDEqualObjects([array objectAtIndex:0], [NSNumber numberWithInteger:1]); + TDEqualObjects([array objectAtIndex:1], [NSNumber numberWithInteger:3]); +} + + +- (void)testTrue { + t.string = @"true"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [[eval.parser parserNamed:@"bool"] completeMatchFor:a]; + TDEqualObjects(@"[1]true^", [res description]); +} + + +- (void)testFalse { + t.string = @"false"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [[eval.parser parserNamed:@"bool"] completeMatchFor:a]; + TDEqualObjects(@"[0]false^", [res description]); +} + + +- (void)testTruePredicate { + t.string = @"TRUEPREDICATE"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]TRUEPREDICATE^", [res description]); +} + + +- (void)testFalsePredicate { + t.string = @"FALSEPREDICATE"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]FALSEPREDICATE^", [res description]); +} + + +- (void)testCollectionTest { + t.string = @"1 IN {1}"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]1/IN/{/1/}^", [res description]); +} + + +- (void)testCollectionLtComparison { + t.string = @"ANY {3} < 4"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]ANY/{/3/}/ 4"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]ANY/{/3/}/>/4^", [res description]); + + t.string = @"SOME {3} > 4"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]SOME/{/3/}/>/4^", [res description]); + + t.string = @"NONE {3} > 4"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]NONE/{/3/}/>/4^", [res description]); + + t.string = @"ALL {3} > 4"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]ALL/{/3/}/>/4^", [res description]); +} + + +- (void)testOr { + t.string = @"TRUEPREDICATE OR FALSEPREDICATE"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]TRUEPREDICATE/OR/FALSEPREDICATE^", [res description]); +} + + +- (void)testAnd { + t.string = @"TRUEPREDICATE AND FALSEPREDICATE"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]TRUEPREDICATE/AND/FALSEPREDICATE^", [res description]); +} + + +- (void)testCompoundExpr { + t.string = @"(TRUEPREDICATE)"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1](/TRUEPREDICATE/)^", [res description]); +} + +@end diff --git a/test/.svn/text-base/TDNegationTest.h.svn-base b/test/.svn/text-base/TDNegationTest.h.svn-base new file mode 100644 index 0000000..c336c22 --- /dev/null +++ b/test/.svn/text-base/TDNegationTest.h.svn-base @@ -0,0 +1,19 @@ +// +// TDNegationTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDNegationTest : SenTestCase { + PKNegation *n; + PKTokenizer *t; + PKAssembly *a; + PKAssembly *res; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDNegationTest.m.svn-base b/test/.svn/text-base/TDNegationTest.m.svn-base new file mode 100644 index 0000000..7397726 --- /dev/null +++ b/test/.svn/text-base/TDNegationTest.m.svn-base @@ -0,0 +1,60 @@ +// +// TDNegationTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/2/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDNegationTest.h" + +@implementation TDNegationTest + +- (void)testFoo { + n = [PKNegation negationWithSubparser:[PKWord word]]; + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [n bestMatchFor:a]; + TDNil(res); + + s = @"'foo'"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [n bestMatchFor:a]; + TDEqualObjects(@"['foo']'foo'^", [res description]); + + n = [PKNegation negationWithSubparser:[PKLiteral literalWithString:@"foo"]]; + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [n bestMatchFor:a]; + TDNil(res); +} + + +- (void)testParserNamed { + PKWord *w = [PKWord word]; + w.name = @"w"; + n = [PKNegation negationWithSubparser:w]; + + TDEquals(w, [n parserNamed:@"w"]); + + PKCollectionParser *alt = [PKAlternation alternation]; + alt.name = @"alt"; + + PKParser *foo = [PKLiteral literalWithString:@"foo"]; + foo.name = @"foo"; + [alt add:foo]; + + PKParser *bar = [PKLiteral literalWithString:@"bar"]; + bar.name = @"bar"; + [alt add:bar]; + + n = [PKNegation negationWithSubparser:alt]; + + TDEquals(alt, [n parserNamed:@"alt"]); + TDEquals(foo, [n parserNamed:@"foo"]); + TDEquals(bar, [n parserNamed:@"bar"]); +} + +@end diff --git a/test/.svn/text-base/TDNonReservedWord.h.svn-base b/test/.svn/text-base/TDNonReservedWord.h.svn-base new file mode 100644 index 0000000..aa50f32 --- /dev/null +++ b/test/.svn/text-base/TDNonReservedWord.h.svn-base @@ -0,0 +1,16 @@ +// +// PKNonReservedWord.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface TDNonReservedWord : PKWord { + +} + +@end diff --git a/test/.svn/text-base/TDNonReservedWord.m.svn-base b/test/.svn/text-base/TDNonReservedWord.m.svn-base new file mode 100644 index 0000000..1b9c6b8 --- /dev/null +++ b/test/.svn/text-base/TDNonReservedWord.m.svn-base @@ -0,0 +1,29 @@ +// +// PKNonReservedWord.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import + +@interface TDReservedWord () ++ (NSArray *)reservedWords; +@end + +@implementation TDNonReservedWord + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + if (!tok.isWord) { + return NO; + } + + NSString *s = tok.stringValue; + return [s length] && ![[TDReservedWord reservedWords] containsObject:s]; +} + +@end diff --git a/test/.svn/text-base/TDNumberStateTest.h.svn-base b/test/.svn/text-base/TDNumberStateTest.h.svn-base new file mode 100644 index 0000000..0664fb9 --- /dev/null +++ b/test/.svn/text-base/TDNumberStateTest.h.svn-base @@ -0,0 +1,17 @@ +// +// PKNumberStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/29/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDNumberStateTest : SenTestCase { + PKNumberState *numberState; + PKTokenizer *t; + PKReader *r; + NSString *s; +} +@end diff --git a/test/.svn/text-base/TDNumberStateTest.m.svn-base b/test/.svn/text-base/TDNumberStateTest.m.svn-base new file mode 100644 index 0000000..775e758 --- /dev/null +++ b/test/.svn/text-base/TDNumberStateTest.m.svn-base @@ -0,0 +1,662 @@ +// +// PKNumberStateTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/29/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDNumberStateTest.h" + +@implementation TDNumberStateTest + +- (void)setUp { + t = [[PKTokenizer alloc] init]; + r = [[PKReader alloc] init]; + numberState = t.numberState; +} + + +- (void)tearDown { + [t release]; + [r release]; +} + + +- (void)testSingleDigit { + s = @"3"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)3.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"3", tok.stringValue); +} + + +- (void)testDoubleDigit { + s = @"47"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)47.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"47", tok.stringValue); +} + + +- (void)testTripleDigit { + s = @"654"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)654.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"654", tok.stringValue); +} + + +- (void)testSingleDigitPositive { + s = @"+3"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)3.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+3", tok.stringValue); +} + + +- (void)testDoubleDigitPositive { + s = @"+22"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)22.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)testDoubleDigitPositiveSpace { + s = @"+22 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)22.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)testMultipleDots { + s = @"1.1.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.1", tok.stringValue); + + tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".1", tok.stringValue); +} + + +- (void)testOneDot { + s = @"1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1", tok.stringValue); +} + + +- (void)testCustomOneDot { + s = @"1."; + t.string = s; + r.string = s; + numberState.allowsTrailingDot = YES; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.", tok.stringValue); +} + + +- (void)testOneDotZero { + s = @"1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.0", tok.stringValue); +} + + +- (void)testPositiveOneDot { + s = @"+1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1", tok.stringValue); +} + + +- (void)testPositiveOneDotCustom { + s = @"+1."; + t.string = s; + r.string = s; + numberState.allowsTrailingDot = YES; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.", tok.stringValue); +} + + +- (void)testPositiveOneDotZero { + s = @"+1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.0", tok.stringValue); +} + + +- (void)testPositiveOneDotZeroSpace { + s = @"+1.0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.0", tok.stringValue); +} + + +- (void)testNegativeOneDot { + s = @"-1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testNegativeOneDotCustom { + s = @"-1."; + t.string = s; + r.string = s; + numberState.allowsTrailingDot = YES; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.", tok.stringValue); +} + + +- (void)testNegativeOneDotSpace { + s = @"-1. "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testNegativeOneDotZero { + s = @"-1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.0", tok.stringValue); +} + + +- (void)testNegativeOneDotZeroSpace { + s = @"-1.0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.0", tok.stringValue); +} + + +- (void)testOneDotOne { + s = @"1.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.1", tok.stringValue); +} + + +- (void)testZeroDotOne { + s = @"0.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0.1", tok.stringValue); +} + + +- (void)testDotOne { + s = @".1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".1", tok.stringValue); +} + + +- (void)testDotZero { + s = @".0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); +} + + +- (void)testNegativeDotZero { + s = @"-.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.0", tok.stringValue); +} + + +- (void)testPositiveDotZero { + s = @"+.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+.0", tok.stringValue); +} + + +- (void)testPositiveDotOne { + s = @"+.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+.1", tok.stringValue); +} + + +- (void)testNegativeDotOne { + s = @"-.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1", tok.stringValue); +} + + +- (void)testNegativeDotOneOne { + s = @"-.11"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.11, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.11", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOne { + s = @"-.111"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.111", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZero { + s = @"-.1110"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1110", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZeroZero { + s = @"-.11100"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.11100", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZeroSpace { + s = @"-.1110 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1110", tok.stringValue); +} + + +- (void)testZeroDotThreeSixtyFive { + s = @"0.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0.365", tok.stringValue); +} + + +- (void)testNegativeZeroDotThreeSixtyFive { + s = @"-0.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0.365", tok.stringValue); +} + + +- (void)testNegativeTwentyFourDotThreeSixtyFive { + s = @"-24.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-24.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-24.365", tok.stringValue); +} + + +- (void)testTwentyFourDotThreeSixtyFive { + s = @"24.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)24.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"24.365", tok.stringValue); +} + + +- (void)testZero { + s = @"0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0", tok.stringValue); +} + + +- (void)testNegativeOne { + s = @"-1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testOne { + s = @"1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1", tok.stringValue); +} + + +- (void)testPositiveOne { + s = @"+1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1", tok.stringValue); +} + + +- (void)testPositiveZero { + s = @"+0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+0", tok.stringValue); +} + + +- (void)testPositiveZeroSpace { + s = @"+0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+0", tok.stringValue); +} + + +- (void)testNegativeZero { + s = @"-0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0", tok.stringValue); +} + + +- (void)testNull { + s = @"NULL"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testNil { + s = @"nil"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testEmptyString { + s = @""; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDot { + s = @"."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDotSpace { + s = @". "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDotSpaceOne { + s = @". 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlus { + s = @"+"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlusSpace { + s = @"+ "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlusSpaceOne { + s = @"+ 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinus { + s = @"-"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinusSpace { + s = @"- "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinusSpaceOne { + s = @"- 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testInitSig { + s = @"- (id)init {"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + TDEquals((CGFloat)0.0, tok.floatValue); +} + + +- (void)testInitSig2 { + s = @"-(id)init {"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + TDEquals((CGFloat)0.0, tok.floatValue); +} + + +- (void)testParenStuff { + s = @"-(ab+5)"; + t.string = s; + r.string = s; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + TDEquals((CGFloat)0.0, tok.floatValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); +} + +@end diff --git a/test/.svn/text-base/TDParseTreeTest.h.svn-base b/test/.svn/text-base/TDParseTreeTest.h.svn-base new file mode 100644 index 0000000..9c2d051 --- /dev/null +++ b/test/.svn/text-base/TDParseTreeTest.h.svn-base @@ -0,0 +1,28 @@ +// +// TDParseTreeTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/1/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "PKParseTree.h" +#import "PKRuleNode.h" +#import "PKTokenNode.h" +#import "PKParseTreeAssembler.h" + + +@interface TDParseTreeTest : SenTestCase { + PKParserFactory *factory; + PKParseTreeAssembler *as; + NSString *g; + NSString *s; + PKTokenAssembly *a; + PKAssembly *res; + PKParser *lp; // language parser + PKTokenizer *t; + PKToken *tok; +} + +@end diff --git a/test/.svn/text-base/TDParseTreeTest.m.svn-base b/test/.svn/text-base/TDParseTreeTest.m.svn-base new file mode 100644 index 0000000..f3e3a5e --- /dev/null +++ b/test/.svn/text-base/TDParseTreeTest.m.svn-base @@ -0,0 +1,164 @@ +// +// TDParseTreeTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/1/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDParseTreeTest.h" + +@implementation TDParseTreeTest + +- (void)setUp { + factory = [PKParserFactory factory]; + as = [[[PKParseTreeAssembler alloc] init] autorelease]; +} + + +- (void)testAddExpr { + g = @"@start = expr;" + @"expr = addExpr;" + @"addExpr = atom (('+'|'-') atom)*;" + @"atom = Number;"; + lp = [factory parserFromGrammar:g assembler:as preassembler:as]; + + lp.tokenizer.string = @"1 + 2"; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp completeMatchFor:a]; + TDNotNil(res); + TDEqualObjects([res description], @"[]1/+/2^"); + + PKParseTree *tr = res.target; + TDEqualObjects([tr class], [PKParseTree class]); + TDEquals([[tr children] count], (NSUInteger)1); + + PKRuleNode *expr = [[tr children] objectAtIndex:0]; + TDEqualObjects([expr name], @"expr"); + TDEqualObjects([expr class], [PKRuleNode class]); + TDEquals([[expr children] count], (NSUInteger)1); + + PKRuleNode *addExpr = [[expr children] objectAtIndex:0]; + TDEqualObjects([addExpr name], @"addExpr"); + TDEqualObjects([addExpr class], [PKRuleNode class]); + TDEquals([[addExpr children] count], (NSUInteger)3); + + PKRuleNode *atom1 = [[addExpr children] objectAtIndex:0]; + TDEqualObjects([atom1 class], [PKRuleNode class]); + TDEqualObjects([atom1 name], @"atom"); + TDEquals([[atom1 children] count], (NSUInteger)1); + + PKTokenNode *one = [[atom1 children] objectAtIndex:0]; + TDEqualObjects([one class], [PKTokenNode class]); + TDEqualObjects([one token], [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:@"1" floatValue:1.0]); + + PKTokenNode *plus = [[addExpr children] objectAtIndex:1]; + TDEqualObjects([plus class], [PKTokenNode class]); + TDEqualObjects([plus token], [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"+" floatValue:0]); + + PKRuleNode *atom2 = [[addExpr children] objectAtIndex:2]; + TDEqualObjects([atom2 class], [PKRuleNode class]); + TDEqualObjects([atom2 name], @"atom"); + TDEquals([[atom2 children] count], (NSUInteger)1); + + PKTokenNode *two = [[atom2 children] objectAtIndex:0]; + TDEqualObjects([two class], [PKTokenNode class]); + TDEqualObjects([two token], [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:@"2" floatValue:2.0]); +} + + +- (void)testFoo { + g = @"@start = expr;" + @"expr = Word+;"; + lp = [factory parserFromGrammar:g assembler:as preassembler:as]; + + lp.tokenizer.string = @"foo"; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp completeMatchFor:a]; + TDNotNil(res); + TDEqualObjects([res description], @"[]foo^"); + + PKParseTree *tr = res.target; + TDEqualObjects([tr class], [PKParseTree class]); + TDEquals([[tr children] count], (NSUInteger)1); + + PKRuleNode *expr = [[tr children] objectAtIndex:0]; + TDEqualObjects([expr name], @"expr"); + TDEqualObjects([expr class], [PKRuleNode class]); + TDEquals([[expr children] count], (NSUInteger)1); + + PKTokenNode *foo = [[expr children] objectAtIndex:0]; + TDEqualObjects([foo class], [PKTokenNode class]); + TDEqualObjects([foo token], [PKToken tokenWithTokenType:PKTokenTypeWord stringValue:@"foo" floatValue:0.0]); +} + + +- (void)testFooBar { + g = @"@start = expr;" + @"expr = Word+;"; + lp = [factory parserFromGrammar:g assembler:as preassembler:as]; + + lp.tokenizer.string = @"foo bar"; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp completeMatchFor:a]; + TDNotNil(res); + TDEqualObjects([res description], @"[]foo/bar^"); + + PKParseTree *tr = res.target; + TDEqualObjects([tr class], [PKParseTree class]); + TDEquals([[tr children] count], (NSUInteger)1); + + PKRuleNode *expr = [[tr children] objectAtIndex:0]; + TDEqualObjects([expr name], @"expr"); + TDEqualObjects([expr class], [PKRuleNode class]); + TDEquals([[expr children] count], (NSUInteger)2); + + PKTokenNode *foo = [[expr children] objectAtIndex:0]; + TDEqualObjects([foo class], [PKTokenNode class]); + TDEqualObjects([foo token], [PKToken tokenWithTokenType:PKTokenTypeWord stringValue:@"foo" floatValue:0.0]); + + PKTokenNode *bar = [[expr children] objectAtIndex:1]; + TDEqualObjects([bar class], [PKTokenNode class]); + TDEqualObjects([bar token], [PKToken tokenWithTokenType:PKTokenTypeWord stringValue:@"bar" floatValue:0.0]); +} + + +- (void)testArray { + g = @"@start = array;" + @"array = '[' Number (commaNumber)* ']';" + @"commaNumber = ',' Number;"; + + lp = [factory parserFromGrammar:g assembler:as preassembler:as]; + + lp.tokenizer.string = @"[1,2]"; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp completeMatchFor:a]; + TDNotNil(res); + TDEqualObjects([res description], @"[][/1/,/2/]^"); + + PKRuleNode *root = res.target; + PKRuleNode *array = [[root children] objectAtIndex:0]; + + TDEqualObjects([array name], @"array"); + TDEqualObjects([array class], [PKRuleNode class]); + TDEquals([[array children] count], (NSUInteger)4); + + PKTokenNode *open = [[array children] objectAtIndex:0]; + TDEqualObjects([open class], [PKTokenNode class]); + TDEqualObjects([open token], [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"[" floatValue:0.0]); + + PKTokenNode *one = [[array children] objectAtIndex:1]; + TDEqualObjects([one class], [PKTokenNode class]); + TDEqualObjects([one token], [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:@"1" floatValue:1.0]); + + PKRuleNode *commaNumber = [[array children] objectAtIndex:2]; + TDEqualObjects([commaNumber name], @"commaNumber"); + TDEqualObjects([commaNumber class], [PKRuleNode class]); + TDEquals([[commaNumber children] count], (NSUInteger)2); + + PKTokenNode *close = [[array children] objectAtIndex:3]; + TDEqualObjects([close class], [PKTokenNode class]); + TDEqualObjects([close token], [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"]" floatValue:1.0]); +} + +@end diff --git a/test/.svn/text-base/TDParserBlocksTest.h.svn-base b/test/.svn/text-base/TDParserBlocksTest.h.svn-base new file mode 100644 index 0000000..b468aab --- /dev/null +++ b/test/.svn/text-base/TDParserBlocksTest.h.svn-base @@ -0,0 +1,17 @@ +// +// TDParserBlocksTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 9/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDParserBlocksTest : SenTestCase { + PKAssembly *start; + NSString *s; + PKParser *p; +} + +@end diff --git a/test/.svn/text-base/TDParserBlocksTest.m.svn-base b/test/.svn/text-base/TDParserBlocksTest.m.svn-base new file mode 100644 index 0000000..82a7e2d --- /dev/null +++ b/test/.svn/text-base/TDParserBlocksTest.m.svn-base @@ -0,0 +1,84 @@ +// +// TDParserBlocksTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 9/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDParserBlocksTest.h" + +@implementation TDParserBlocksTest + +- (void)setUp { +} + + +- (void)tearDown { +} + + +#ifdef TARGET_OS_SNOW_LEOPARD +- (void)testMath { + s = @"2 4 6 8"; + start = [PKTokenAssembly assemblyWithString:s]; + + PKNumber *n = [PKNumber number]; + p = [PKRepetition repetitionWithSubparser:n]; + + n.assemblerBlock = ^(PKAssembly *a) { + if (![a isStackEmpty]) { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; + } + }; + + p.assemblerBlock = ^(PKAssembly *a) { + NSNumber *total = [a pop]; + if (!total) { + total = [NSNumber numberWithFloat:0]; + } + + while (![a isStackEmpty]) { + NSNumber *n = [a pop]; + total = [NSNumber numberWithFloat:[total floatValue] + [n floatValue]]; + } + + [a push:total]; + }; + + PKAssembly *result = [p completeMatchFor:start]; + TDNotNil(result); + TDEqualObjects(@"[20]2/4/6/8^", [result description]); + TDEquals((double)20.0, [[result pop] doubleValue]); +} + + +- (void)testMath2 { + PKParser *addParser = [PKRepetition repetitionWithSubparser:[PKNumber number]]; + + addParser.assemblerBlock = ^(PKAssembly *a) { + NSArray *toks = [a objectsAbove:nil]; + double total = 0.0; + + for (PKToken *tok in toks) { + total += [tok floatValue]; + } + + [a push:[NSNumber numberWithDouble:total]]; + }; + + s = @"2.5 -5.5 8"; + +// NSNumber *result = [addParser parse:s]; +// NSAssert([result doubleValue] == 5.0, @""); + + start = [PKTokenAssembly assemblyWithString:s]; + PKAssembly *result = [addParser completeMatchFor:start]; + TDNotNil(result); + TDEqualObjects(@"[5]2.5/-5.5/8^", [result description]); + TDEquals(5.0, [(NSNumber *)[result pop] doubleValue]); +} +#endif + +@end diff --git a/test/.svn/text-base/TDParserFactoryPatternTest.h.svn-base b/test/.svn/text-base/TDParserFactoryPatternTest.h.svn-base new file mode 100644 index 0000000..62d6b62 --- /dev/null +++ b/test/.svn/text-base/TDParserFactoryPatternTest.h.svn-base @@ -0,0 +1,22 @@ +// +// PKParserFactoryPatternTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/6/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" + +@interface TDParserFactoryPatternTest : SenTestCase { + NSString *g; + NSString *s; + PKTokenAssembly *a; + PKParserFactory *factory; + PKAssembly *res; + PKParser *lp; // language parser + PKTokenizer *t; +} + +@end diff --git a/test/.svn/text-base/TDParserFactoryPatternTest.m.svn-base b/test/.svn/text-base/TDParserFactoryPatternTest.m.svn-base new file mode 100644 index 0000000..7914638 --- /dev/null +++ b/test/.svn/text-base/TDParserFactoryPatternTest.m.svn-base @@ -0,0 +1,84 @@ +// +// PKParserFactoryPatternTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/6/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDParserFactoryPatternTest.h" + +@implementation TDParserFactoryPatternTest + +- (void)setUp { + factory = [PKParserFactory factory]; +} + + +- (void)test1 { + g = @"@start = /foo/;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + + g = @"@start = /fo+/;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + + g = @"@start = /fo+/;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + + g = @"@start = /[fo]+/;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + + g = @"@start = /\\w+/;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); +} + + +- (void)testOptions { + g = @"@start = /foo/i;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"FOO"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[FOO]FOO^", [res description]); + + + g = @"@start = /foo/i;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"FoO"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[FoO]FoO^", [res description]); +} + +@end diff --git a/test/.svn/text-base/TDParserFactoryTest.h.svn-base b/test/.svn/text-base/TDParserFactoryTest.h.svn-base new file mode 100644 index 0000000..1d65617 --- /dev/null +++ b/test/.svn/text-base/TDParserFactoryTest.h.svn-base @@ -0,0 +1,23 @@ +// +// PKParserFactoryTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2009 Todd Ditchendorf All rights reserved. +// + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" + +@interface TDParserFactoryTest : SenTestCase { + NSString *s; + PKTokenAssembly *a; + PKParserFactory *factory; + PKAssembly *res; + + PKSequence *exprSeq; + PKTokenizer *t; + PKParser *lp; // language parser +} + +@end diff --git a/test/.svn/text-base/TDParserFactoryTest.m.svn-base b/test/.svn/text-base/TDParserFactoryTest.m.svn-base new file mode 100644 index 0000000..1c863ae --- /dev/null +++ b/test/.svn/text-base/TDParserFactoryTest.m.svn-base @@ -0,0 +1,1256 @@ +// +// PKParserFactoryTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2009 Todd Ditchendorf All rights reserved. +// + +#import "TDParserFactoryTest.h" +#import + +@interface PKParserFactory () +- (PKTokenizer *)tokenizerForParsingGrammar; +- (PKSequence *)parserFromExpression:(NSString *)s; +@property (retain) PKCollectionParser *exprParser; +@end + +@protocol TDMockAssember +- (void)didMatchFoo:(PKAssembly *)a; +- (void)didMatchBaz:(PKAssembly *)a; +- (void)didMatchStart:(PKAssembly *)a; +- (void)didMatchStart:(PKAssembly *)a; +- (void)didMatch_Start:(PKAssembly *)a; +@end + +@implementation TDParserFactoryTest + +- (void)setUp { + factory = [PKParserFactory factory]; + PKSequence *seq = [PKSequence sequence]; + [seq add:factory.exprParser]; + exprSeq = seq; + t = [factory tokenizerForParsingGrammar]; +} + + +- (void)testJavaScript { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"javascript" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"var foo = 'bar';"; + lp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; +// res = [lp bestMatchFor:a]; +// TDEqualObjects(@"[var, foo, =, 'bar', ;]var/foo/=/bar/;^", [res description]); +} + + +- (void)testCSS2_1 { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"css2_1" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + +// s = @"foo {font-size:12px}"; +// a = [PKTokenAssembly assemblyWithString:s]; +// res = [lp bestMatchFor:a]; +// TDEqualObjects(@"[foo, {, font-family, :, 'helvetica', ;, }]foo/{/font-family/:/'helvetica'/;/}^", [res description]); +} + + +- (void)testCSS { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + PKParser *selectorParser = [lp parserNamed:@"selector"]; + TDNotNil(selectorParser); + TDEqualObjects(selectorParser.name, @"selector"); + TDEqualObjects([selectorParser class], [PKLowercaseWord class]); + + PKParser *declParser = [lp parserNamed:@"decl"]; + TDNotNil(declParser); + TDEqualObjects(declParser.name, @"decl"); + TDEqualObjects([declParser class], [PKSequence class]); + + PKParser *rulesetParser = [lp parserNamed:@"ruleset"]; + TDNotNil(rulesetParser); + TDEqualObjects(rulesetParser, [(PKRepetition *)lp subparser]); + TDEqualObjects(rulesetParser.name, @"ruleset"); + TDEqualObjects([rulesetParser class], [PKSequence class]); + + PKParser *startParser = [lp parserNamed:@"@start"]; + TDNotNil(startParser); + TDEqualObjects(startParser, lp); + TDEqualObjects(startParser.name, @"@start"); + TDEqualObjects([startParser class], [PKRepetition class]); + + s = @"foo {font-family:'helvetica';}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, {, font-family, 'helvetica']foo/{/font-family/:/'helvetica'/;/}^", [res description]); + + s = @"foo {font-family:'helvetica'}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, {, font-family, 'helvetica']foo/{/font-family/:/'helvetica'/}^", [res description]); + + s = @"bar {color:rgb(1, 255, 255); font-size:13px;}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar, {, color, (, 1, 255, 255, font-size, 13]bar/{/color/:/rgb/(/1/,/255/,/255/)/;/font-size/:/13/px/;/}^", [res description]); + + s = @"bar {color:rgb(1, 255, 47.0); font-family:'Helvetica'}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar, {, color, (, 1, 255, 47.0, font-family, 'Helvetica']bar/{/color/:/rgb/(/1/,/255/,/47.0/)/;/font-family/:/'Helvetica'/}^", [res description]); + + s = @"foo {font-family:'Lucida Grande'} bar {color:rgb(1, 255, 255); font-size:9px;}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, {, font-family, 'Lucida Grande', bar, {, color, (, 1, 255, 255, font-size, 9]foo/{/font-family/:/'Lucida Grande'/}/bar/{/color/:/rgb/(/1/,/255/,/255/)/;/font-size/:/9/px/;/}^", [res description]); +} + + +- (void)testJSON { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"{'foo':'bar'}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', :, 'bar', }]{/'foo'/:/'bar'/}^", [res description]); + + s = @"{'foo':{}}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', :, {, }, }]{/'foo'/:/{/}/}^", [res description]); + + s = @"{'foo':{'bar':[]}}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', :, {, 'bar', :, [, ], }, }]{/'foo'/:/{/'bar'/:/[/]/}/}^", [res description]); + + s = @"['foo', true, null]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, 'foo', ,, true, ,, null, ]][/'foo'/,/true/,/null/]^", [res description]); + + s = @"[[]]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, [, ], ]][/[/]/]^", [res description]); + + s = @"[[[1]]]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, [, [, 1, ], ], ]][/[/[/1/]/]/]^", [res description]); +} + + +- (void)testJSONWithDiscards { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json_with_discards" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"{'foo':'bar'}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', 'bar']{/'foo'/:/'bar'/}^", [res description]); + + s = @"{'foo':{}}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', {]{/'foo'/:/{/}/}^", [res description]); + + s = @"{'foo':{'bar':[]}}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', {, 'bar', []{/'foo'/:/{/'bar'/:/[/]/}/}^", [res description]); + + s = @"['foo', true, null]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, 'foo'][/'foo'/,/true/,/null/]^", [res description]); + + s = @"[[]]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, [][/[/]/]^", [res description]); + + s = @"[[[1]]]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, [, [, 1][/[/[/1/]/]/]^", [res description]); +} + + +- (void)testStartLiteral { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = 'bar';"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testStartLiteralNonReserved { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo*; foo = 'bar';"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + s = @"bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar, bar]bar/bar^", [res description]); + [mock verify]; +} + + +- (void)testStartLiteralNonReserved2 { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = (foo|baz)*; foo = 'bar'; baz = 'bat'"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + [[mock expect] didMatchBaz:OCMOCK_ANY]; + s = @"bar bat"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar, bat]bar/bat^", [res description]); + [mock verify]; +} + + +- (void)testStartLiteralNonReserved3 { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = (foo|baz)+; foo = 'bar'; baz = 'bat'"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + [[mock expect] didMatchBaz:OCMOCK_ANY]; + s = @"bar bat"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar, bat]bar/bat^", [res description]); + [mock verify]; +} + + +- (void)testStartLiteralNonReserved4 { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = (foo|baz)+; foo = 'bar'; baz = 'bat'"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + [[mock expect] didMatchBaz:OCMOCK_ANY]; + [[mock expect] didMatchBaz:OCMOCK_ANY]; + s = @"bar bat bat"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar, bat, bat]bar/bat/bat^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorDefault { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo|baz; foo = 'bar'; baz = 'bat'"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorOnAll { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo|baz; foo = 'bar'; baz = 'bat'"; + factory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnAll; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorOnTerminals { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo|baz; foo = 'bar'; baz = 'bat'"; + factory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnTerminals; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); + TDNil(lp.assembler); + TDNil(NSStringFromSelector(lp.assemblerSelector)); + + [[mock expect] didMatchFoo:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorOnExplicit { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo|baz; foo (didMatchFoo:) = 'bar'; baz (didMatchBaz:) = 'bat'"; + factory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnExplicit; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); + TDNil(lp.assembler); + TDNil(NSStringFromSelector(lp.assemblerSelector)); + + [[mock expect] didMatchFoo:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorOnExplicitNone { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo|baz; foo = 'bar'; baz = 'bat'"; + factory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnExplicit; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); + TDNil(lp.assembler); + TDNil(NSStringFromSelector(lp.assemblerSelector)); + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorOnExplicitOrTerminal { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = (foo|baz)+; foo (didMatchFoo:) = 'bar'; baz = 'bat'"; + factory.assemblerSettingBehavior = (PKParserFactoryAssemblerSettingBehaviorOnExplicit | PKParserFactoryAssemblerSettingBehaviorOnTerminals); + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); + TDNil(lp.assembler); + TDNil(NSStringFromSelector(lp.assemblerSelector)); + + [[mock expect] didMatchFoo:OCMOCK_ANY]; + [[mock expect] didMatchBaz:OCMOCK_ANY]; + s = @"bar bat"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar, bat]bar/bat^", [res description]); + [mock verify]; +} + + +- (void)testStartLiteralWithCallback { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start (didMatchStart:) = 'bar';"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); + TDTrue(lp.assembler == mock); + TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatchStart:"); + + [[mock expect] didMatchStart:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testStartRefToLiteral { + s = @" @start = foo; foo = 'bar';"; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); +} + + +- (void)testStartRefToLiteral3 { + s = @" @start = foo|baz; baz = 'bat'; foo = 'bar';"; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); +} + + +- (void)testStartRefToLiteral2 { + s = @"foo = 'bar'; baz = 'bat'; @start = (foo | baz)*;"; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + + s = @"bat bat"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bat, bat]bat/bat^", [res description]); + + s = @"bat bat bat bat bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bat, bat, bat, bat, bar]bat/bat/bat/bat/bar^", [res description]); +} + + +#ifndef TARGET_CPU_X86_64 +- (void)testStmtTrackException { + s = @"@start ="; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testCallbackTrackException { + s = @"@start ( = 'foo';"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start (foo: = 'foo'"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testSelectorTrackException { + s = @"@start (foo) = 'foo';"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testOrTrackException { + s = @"@start = 'foo'|;"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +//- (void)testExprTrackException { +// s = @"@start=(foo;"; +// STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +//} + + +- (void)testIntersectionTrackException { + s = @"@start='foo' &;"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testExclusionTrackException { + s = @"@start='foo' -;"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testDelimitedStringTrackException { + s = @"@start=DelimitedString('/';"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start=DelimitedString('/', ;"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testCardinalityTrackException { + s = @"@start='foo'{;"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start='foo'{};"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start='foo'{,};"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start='foo'{m};"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} +#endif + + +- (void)testExprHelloPlus { + s = @"'hello'+"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[hello, hello]hello/hello^", [res description]); +} + + +- (void)testExprHelloStar { + s = @"'hello'*"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKRepetition class]); + + s = @"hello hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[hello, hello, hello]hello/hello/hello^", [res description]); +} + + +- (void)testExprHelloQuestion { + s = @"'hello'?"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKAlternation class]); + + s = @"hello hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[hello]hello^hello/hello", [res description]); +} + + +- (void)testExprOhHaiThereQuestion { + s = @"'oh'? 'hai'? 'there'?"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + s = @"there"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[there]there^", [res description]); +} + + +- (void)testExprFooBar { + s = @"'foo' 'bar'"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]'foo'/ /'bar'^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + TDEquals((NSUInteger)2, [seq.subparsers count]); + + PKLiteral *c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + c = [seq.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + s = @"foo bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, bar]foo/bar^", [res description]); +} + + +- (void)testExprFooBarBaz { + s = @"'foo' 'bar' 'baz'"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]'foo'/ /'bar'/ /'baz'^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + TDEquals((NSUInteger)3, [seq.subparsers count]); + + PKLiteral *c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + c = [seq.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + c = [seq.subparsers objectAtIndex:2]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"baz", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [res description]); +} + + +- (void)testExprFooOrBar { + s = @"'foo'|'bar'"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]'foo'/|/'bar'^", [res description]); + + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKAlternation class]); + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^", [res description]); +} + + +- (void)testExprFooOrBarStar { + s = @"'foo'|'bar'*"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]'foo'/|/'bar'/*^", [res description]); + + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + PKRepetition *rep = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKRepetition class], [rep class]); + c = (PKLiteral *)rep.subparser; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKAlternation class]]); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^", [res description]); + + s = @"foo foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^foo", [res description]); + + s = @"bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar, bar]bar/bar^", [res description]); +} + + +- (void)testExprFooOrBarPlus { + s = @"'foo'|'bar'+"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]'foo'/|/'bar'/+^", [res description]); + + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + PKSequence *seq = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKSequence class], [seq class]); + + c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + PKRepetition *rep = [seq.subparsers objectAtIndex:1]; + TDEqualObjects([PKRepetition class], [rep class]); + c = (PKLiteral *)rep.subparser; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKAlternation class]]); + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^", [res description]); + + s = @"foo foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^foo", [res description]); + + s = @"foo bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^bar", [res description]); + + s = @"bar bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar, bar, bar]bar/bar/bar^", [res description]); +} + + +- (void)testExprFooOrBarQuestion { + s = @"'foo'|'bar'?"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]'foo'/|/'bar'/?^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + alt = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKAlternation class], [alt class]); + + PKEmpty *e = [alt.subparsers objectAtIndex:0]; + TDTrue([e isMemberOfClass:[PKEmpty class]]); + + c = (PKLiteral *)[alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKAlternation class]]); + s = @"bar bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^bar/bar", [res description]); + + s = @"foo bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^bar/bar", [res description]); +} + + +- (void)testExprParenFooOrBarParenStar { + s = @"('foo'|'bar')*"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Repetition](/'foo'/|/'bar'/)/*^", [res description]); + PKRepetition *rep = [res pop]; + TDTrue([rep isMemberOfClass:[PKRepetition class]]); + + PKAlternation *alt = (PKAlternation *)rep.subparser; + TDTrue([alt class] == [PKAlternation class]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKRepetition class]); + s = @"foo bar bar foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, bar, bar, foo]foo/bar/bar/foo^", [res description]); +} + + +- (void)testExprParenFooOrBooParenPlus { + s = @"('foo'|'bar')+"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence](/'foo'/|/'bar'/)/+^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + + TDEquals((NSUInteger)2, [seq.subparsers count]); + + PKAlternation *alt = [seq.subparsers objectAtIndex:0]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + PKRepetition *rep = [seq.subparsers objectAtIndex:1]; + TDTrue([rep isMemberOfClass:[PKRepetition class]]); + + alt = (PKAlternation *)rep.subparser; + TDEqualObjects([PKAlternation class], [alt class]); + + c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + s = @"foo foo bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, foo, bar, bar]foo/foo/bar/bar^", [res description]); +} + + +- (void)testExprParenFooOrBarParenQuestion { + s = @"('foo'|'bar')?"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation](/'foo'/|/'bar'/)/?^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + + TDEquals((NSUInteger)2, [alt.subparsers count]); + PKEmpty *e = [alt.subparsers objectAtIndex:0]; + TDTrue([PKEmpty class] == [e class]); + + alt = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([alt class], [PKAlternation class]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKAlternation class]); + s = @"foo bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^bar", [res description]); + + s = @"bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^bar", [res description]); +} + + +- (void)testExprWord { + s = @"Word"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Word]Word^", [res description]); + PKWord *w = [res pop]; + TDTrue([w isMemberOfClass:[PKWord class]]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKWord class]); + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[hello]hello^hello", [res description]); +} + + +- (void)testExprWordPlus { + s = @"Word+"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[hello, hello]hello/hello^", [res description]); +} + + +- (void)testExprNum { + s = @"Number"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Number]Number^", [res description]); + PKNumber *w = [res pop]; + TDTrue([w isMemberOfClass:[PKNumber class]]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKNumber class]]); + + s = @"333 444"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[333]333^444", [res description]); + + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDNil(res); +} + + +- (void)testExprNumCardinality { + s = @"Number{2}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]Number/{/2/}^", [res description]); + PKSequence *seq = [res pop]; + TDEqualObjects([seq class], [PKSequence class]); + + TDEquals((NSUInteger)2, [seq.subparsers count]); + PKNumber *n = [seq.subparsers objectAtIndex:0]; + TDEqualObjects([n class], [PKNumber class]); + + n = [seq.subparsers objectAtIndex:1]; + TDEqualObjects([n class], [PKNumber class]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + + s = @"333 444"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[333, 444]333/444^", [res description]); + + s = @"1.1 2.2 3.3"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[1.1, 2.2]1.1/2.2^3.3", [res description]); + + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDNil(res); +} + + +- (void)testExprNumCardinality2 { + s = @"Number{2,3}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]Number/{/2/,/3/}^", [res description]); + PKSequence *seq = [res pop]; + TDEqualObjects([seq class], [PKSequence class]); + + TDEquals((NSUInteger)3, [seq.subparsers count]); + + PKNumber *n = [seq.subparsers objectAtIndex:0]; + TDEqualObjects([n class], [PKNumber class]); + + n = [seq.subparsers objectAtIndex:1]; + TDEqualObjects([n class], [PKNumber class]); + + n = [seq.subparsers objectAtIndex:2]; + TDEqualObjects([n class], [PKAlternation class]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + + s = @"333 444"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[333, 444]333/444^", [res description]); + + s = @"1.1 2.2 3.3"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[1.1, 2.2, 3.3]1.1/2.2/3.3^", [res description]); + + s = @"1.1 2.2 3.3 4"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[1.1, 2.2, 3.3]1.1/2.2/3.3^4", [res description]); + + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDNil(res); +} + + +- (void)testExprNumPlus { + s = @"Number+"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + s = @"333 444"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[333, 444]333/444^", [res description]); +} + + +- (void)testExprSymbol { + s = @"Symbol"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Symbol]Symbol^", [res description]); + PKSymbol *w = [res pop]; + TDTrue([w isMemberOfClass:[PKSymbol class]]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSymbol class]]); + + s = @"? #"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[?]?^#", [res description]); + + s = @"hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDNil(res); +} + + +- (void)testExprSymbolPlus { + s = @"Symbol+"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + s = @"% *"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[%, *]%/*^", [res description]); +} + + +- (void)testExprQuotedString { + s = @"QuotedString"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[QuotedString]QuotedString^", [res description]); + PKQuotedString *w = [res pop]; + TDTrue([w isMemberOfClass:[PKQuotedString class]]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKQuotedString class]); + s = @"'hello' 'hello'"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"['hello']'hello'^'hello'", [res description]); +} + + +- (void)testExprQuotedStringPlus { + s = @"QuotedString+"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + s = @"'hello' 'hello'"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"['hello', 'hello']'hello'/'hello'^", [res description]); +} + + +- (void)testRubyHash { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"rubyhash" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + +// s = @"{\"brand\"=>{\"name\"=>\"something\"," +// @"\"logo\"=>#," +// @"\"summary\"=>\"wee\", \"content\"=>\"woopy doo\"}, \"commit\"=>\"Save\"," +// @"\"authenticity_token\"=>\"43a94d60304a7fb13a4ff61a5960461ce714e92b\"," +// @"\"action\"=>\"create\", \"controller\"=>\"admin/brands\"}"; + + lp.tokenizer.string = @"{'foo'=> {'logo' => # } }"; + + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', =>, {, 'logo', =>, #, }, }]{/'foo'/=>/{/'logo'/=>/#/}/}^", [res description]); +} + + +- (void)testSymbolState { + s = @"@symbolState = 'b'; @start = ('b'|'ar')*;"; + lp = [factory parserFromGrammar:s assembler:nil]; + + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + lp.tokenizer.string = @"bar"; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[b, ar]b/ar^", [res description]); + [res pop]; // discar 'ar' + PKToken *tok = [res pop]; + TDEqualObjects([tok class], [PKToken class]); + TDEqualObjects(tok.stringValue, @"b"); + TDTrue(tok.isSymbol); +} + +@end \ No newline at end of file diff --git a/test/.svn/text-base/TDParserFactoryTest2.h.svn-base b/test/.svn/text-base/TDParserFactoryTest2.h.svn-base new file mode 100644 index 0000000..269074c --- /dev/null +++ b/test/.svn/text-base/TDParserFactoryTest2.h.svn-base @@ -0,0 +1,23 @@ +// +// PKParserFactoryTest2.h +// ParseKit +// +// Created by Todd Ditchendorf on 5/31/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" + +@interface TDParserFactoryTest2 : SenTestCase { + NSString *g; + NSString *s; + PKTokenAssembly *a; + PKParserFactory *factory; + PKAssembly *res; + PKParser *lp; // language parser + PKTokenizer *t; + PKToken *tok; +} + +@end diff --git a/test/.svn/text-base/TDParserFactoryTest2.m.svn-base b/test/.svn/text-base/TDParserFactoryTest2.m.svn-base new file mode 100644 index 0000000..0a3667e --- /dev/null +++ b/test/.svn/text-base/TDParserFactoryTest2.m.svn-base @@ -0,0 +1,704 @@ +// +// PKParserFactoryTest2.m +// ParseKit +// +// Created by Todd Ditchendorf on 5/31/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDParserFactoryTest2.h" + +@implementation TDParserFactoryTest2 + +- (void)setUp { + factory = [PKParserFactory factory]; +} + + +- (void)testOrVsAndPrecendence { + g = @"@start = Word | Number Symbol;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + s = @"foo %"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + g = @"@start = Word Number | Symbol;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo 3"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 3]foo/3^", [res description]); + + s = @"%"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[%]%^", [res description]); + + s = @"foo %"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + g = @"@start = Word (Number | Symbol);"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo 3"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 3]foo/3^", [res description]); + + s = @"foo"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + s = @"foo %"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, %]foo/%^", [res description]); +} + + +- (void)test1 { + g = @"@start = (Word | Number)*;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + s = @"24.5"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[24.5]24.5^", [res description]); + + s = @"foo bar 2 baz"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, baz]foo/bar/2/baz^", [res description]); + + s = @"foo bar 2 4 baz"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, 4, baz]foo/bar/2/4/baz^", [res description]); +} + + +- (void)test2 { + g = @"@start = (Word | Number)* QuotedString;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 'bar']foo/'bar'^", [res description]); + + s = @"24.5 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[24.5, 'bar']24.5/'bar'^", [res description]); + + s = @"foo bar 2 baz 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, baz, 'bar']foo/bar/2/baz/'bar'^", [res description]); + + s = @"foo bar 2 4 baz 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, 4, baz, 'bar']foo/bar/2/4/baz/'bar'^", [res description]); +} + + +- (void)test3 { + g = @"@start = (Word | Number)* '$'+ QuotedString;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo $ 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, 'bar']foo/$/'bar'^", [res description]); + + s = @"foo $ $ 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, $, 'bar']foo/$/$/'bar'^", [res description]); + + s = @"24.5 $ 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[24.5, $, 'bar']24.5/$/'bar'^", [res description]); + + s = @"foo bar 2 baz $ 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, baz, $, 'bar']foo/bar/2/baz/$/'bar'^", [res description]); + + s = @"foo bar 2 4 baz $ 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, 4, baz, $, 'bar']foo/bar/2/4/baz/$/'bar'^", [res description]); +} + + +- (void)test4 { + g = @"@start = (Word | Number)* ('$' '%')+ QuotedString;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, 'bar']foo/$/%/'bar'^", [res description]); + + s = @"foo $ % $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, $, %, 'bar']foo/$/%/$/%/'bar'^", [res description]); +} + + +- (void)test5 { + g = @"@start = (Word | Number)* ('$' '%')+ QuotedString;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, 'bar']foo/$/%/'bar'^", [res description]); + + s = @"foo $ % $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, $, %, 'bar']foo/$/%/$/%/'bar'^", [res description]); + + s = @"foo 33 4 $ % $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 33, 4, $, %, $, %, 'bar']foo/33/4/$/%/$/%/'bar'^", [res description]); + + s = @"foo 33 bar 4 $ % $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 33, bar, 4, $, %, $, %, 'bar']foo/33/bar/4/$/%/$/%/'bar'^", [res description]); +} + + +- (void)test6 { + g = @"@start = ((Word | Number)* ('$' '%')+) | QuotedString;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"['bar']'bar'^", [res description]); + + s = @"foo $ % $ %"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, $, %]foo/$/%/$/%^", [res description]); +} + + +- (void)test7 { + g = @"@start = ((Word | Number)* ('$' '%')+) | QuotedString+;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"'bar' 'foo'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"['bar', 'foo']'bar'/'foo'^", [res description]); + + s = @"foo $ % $ %"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, $, %]foo/$/%/$/%^", [res description]); + + s = @"$ % $ %"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[$, %, $, %]$/%/$/%^", [res description]); +} + + +- (void)test8 { + g = @"@start = ((Word | Number)* ('$' '%')+) | QuotedString+;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"'bar' 'foo'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"['bar', 'foo']'bar'/'foo'^", [res description]); + + s = @"foo $ % $ %"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, $, %]foo/$/%/$/%^", [res description]); + + s = @"$ % $ %"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[$, %, $, %]$/%/$/%^", [res description]); +} + + +- (void)test9 { + g = @"@start = Word | (Number);"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"42"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[42]42^", [res description]); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); +} + + +- (void)test10 { + g = @"@start = Word | (Number QuotedString);"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + s = @"42 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[42, 'bar']42/'bar'^", [res description]); +} + + +- (void)test11 { + g = @"@start = ((Word | Number)* | ('$' '%')+) QuotedString+;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 'bar']foo/'bar'^", [res description]); + + s = @"$ % $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[$, %, $, %, 'bar']$/%/$/%/'bar'^", [res description]); +} + + +- (void)test12 { + g = @"@delimitState = '$'; @delimitedString = '$' '%' nil; @start = DelimitedString('$', '%');"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"$foo%"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[$foo%]$foo%^", [res description]); + + + g = @"@delimitState = '$'; @delimitedString = '$' '%' nil; @start = DelimitedString('$', '');"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"$foo%"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[$foo%]$foo%^", [res description]); + + + g = @"@delimitState = '$'; @delimitedString = '$' '%' 'fo'; @start = DelimitedString('$', '%');"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"$foo%"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[$foo%]$foo%^", [res description]); + + + g = @"@delimitState = '$'; @delimitedString = '$' '%' 'f'; @start = DelimitedString('$', '%');"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"$foo%"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + + +- (void)testWhitespace { + g = @"@reportsWhitespaceTokens = YES; @start = 'foo' S '+' S 'bar';"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo + bar"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo, , +, , bar]foo/ /+/ /bar^", [res description]); + + s = @"foo +bar"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + g = @"@start = 'foo' S '+' S 'bar';"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo + bar"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + g = @"@reportsWhitespaceTokens = NO; @start = 'foo' S '+' S 'bar';"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo + bar"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + + g = @"@reportsWhitespaceTokens = YES; @start = 'foo' S '+' S 'bar';"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo \t \t + bar"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo, \t \t , +, , bar]foo/ \t \t /+/ /bar^", [res description]); +} + + +- (void)testDiscard { + g = @"@start = 'foo'!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]foo^", [res description]); + + g = @"@start = /foo/!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]foo^", [res description]); + + g = @"@delimitState='<'; @delimitedStrings='<%' '%>' nil; @start=DelimitedString('<%', '%>')!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"<% foo %>"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]<% foo %>^", [res description]); +} + + +- (void)testDiscard2 { + g = @"@reportsWhitespaceTokens=YES;@start=S!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @" "; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[] ^", [res description]); + + g = @"@start=Any!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]foo^", [res description]); + + g = @"@start=Word!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]foo^", [res description]); + +} + + +- (void)testComments { + g = + @"@commentState = '/';" + @"@singleLineComments = '//';" + @"@reportsCommentTokens = YES;" + @"@start = Any+;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"# // foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[#, // foo]#/// foo^", [res description]); + + tok = [res pop]; + TDTrue(tok.isComment); + +} + + + +- (void)testFallbackState { + g = + @"@commentState = '/';" + @"@commentState.fallbackState = delimitState;" + @"@delimitedString = '/' '/' nil;" + @"@singleLineComments = '//';" + @"@multiLineComments = '/*' '*/';" + @"@start = Any+;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"/ %"; + t = lp.tokenizer; + + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, %]//%^", [res description]); + tok = [res pop]; + TDTrue(tok.isSymbol); + + s = @"/ /"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/ /]/ /^", [res description]); + tok = [res pop]; + TDTrue(tok.isDelimitedString); + + s = @"/foo/"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/foo/]/foo/^", [res description]); + tok = [res pop]; + TDTrue(tok.isDelimitedString); + + s = @"# // foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[#]#^", [res description]); + tok = [res pop]; + TDTrue(tok.isSymbol); + +} + + +- (void)testPatternPredicate1 { + g = @"@wordChar = ':'; @start = Word;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"foo:bar"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo:bar]foo:bar^", [res description]); + tok = [res pop]; + TDTrue(tok.isWord); + + g = @"@wordChar = ':'; @start = Word & /[^:]+/;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo]foo^", [res description]); + tok = [res pop]; + TDTrue(tok.isWord); + + s = @"foo:bar"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + + +- (void)testPatternPredicate2 { + g = @"@wordChar = ':'; @start=ncName+; name=Word; ncName=name & /[^:]+/;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo]foo^", [res description]); + tok = [res pop]; + TDTrue(tok.isWord); + + s = @"foo:bar"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + + +- (void)testExclusionFoo { + g = @"@start = ex; ex = Word - 'foo';"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"bar"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[bar]bar^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[wee]wee^", [res description]); +} + + +- (void)testExclusionAlt { + g = @"@start = ex; m = ('foo'|'bar'); ex = Word - m;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"baz"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[baz]baz^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[wee]wee^", [res description]); +} + + +- (void)testExclusionAlt2 { + g = @"@start = ex; ex = Word - ('foo'|'bar');"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"baz"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[baz]baz^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[wee]wee^", [res description]); +} + + +- (void)testExclusionAlt3 { + g = @"@start = ex; s = 'foo'|'baz'; m = ('foo'|'bar'); ex = s - m;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"baz"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[baz]baz^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + + +- (void)testExclusionAlt4 { + g = @"@start = ex; m = ('foo'|'bar'); ex = ('foo'|'baz') - m;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"baz"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[baz]baz^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + + +- (void)testExclusionAlt5 { + g = @"@start = ex; ex = ('foo'|'baz') - ('foo'|'bar');"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"baz"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[baz]baz^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + +@end diff --git a/test/.svn/text-base/TDParserFactoryTest3.h.svn-base b/test/.svn/text-base/TDParserFactoryTest3.h.svn-base new file mode 100644 index 0000000..493a9a8 --- /dev/null +++ b/test/.svn/text-base/TDParserFactoryTest3.h.svn-base @@ -0,0 +1,22 @@ +// +// PKParserFactoryTest3.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/27/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDParserFactoryTest3 : SenTestCase { + NSString *g; + NSString *s; + PKTokenAssembly *a; + PKParserFactory *factory; + PKAssembly *res; + PKParser *lp; // language parser + PKTokenizer *t; + PKToken *tok; +} + +@end diff --git a/test/.svn/text-base/TDParserFactoryTest3.m.svn-base b/test/.svn/text-base/TDParserFactoryTest3.m.svn-base new file mode 100644 index 0000000..dd4e6f8 --- /dev/null +++ b/test/.svn/text-base/TDParserFactoryTest3.m.svn-base @@ -0,0 +1,176 @@ +// +// PKParserFactoryTest3.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/27/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDParserFactoryTest3.h" + +@implementation TDParserFactoryTest3 + +- (void)setUp { + factory = [PKParserFactory factory]; +} + + +- (void)testOrVsAndPrecendence { + g = @" @start ( didMatchFoo: ) = foo;\n" + @" foo = Word & /foo/ | Number! { 1 } ( DelimitedString ( '/' , '/' ) Symbol- '%' ) * /bar/ ;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); +} + + +- (void)testNegation { + g = @"@start = ~'foo';"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + s = @"'bar'"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"['bar']'bar'^", [res description]); + + s = @"bar"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[bar]bar^", [res description]); +} + + +- (void)testNegateSymbol { + g = @"@start = ~Symbol;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"1"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]1^", [res description]); + + s = @"'bar'"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"['bar']'bar'^", [res description]); + + s = @"bar"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[bar]bar^", [res description]); + + s = @"$"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + +} + + +- (void)testNegateMore { + g = @"@start = ~Symbol & ~Number;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"1"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + s = @"$"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); +} + + +- (void)testNegateMore2 { + g = @"@start = ~(Symbol|Number);"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"1"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + s = @"$"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); +} + + +- (void)testNcName { + g = @"@wordChars=':' '_'; @wordState='_';" + @"@start = name;" + @"ncName = name & /[^:]+/;" + @"name = Word;"; + // @"nameTest = '*' | ncName ':' '*' | qName;" + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + t.string = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + t.string = @"foo:bar"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo:bar]foo:bar^", [res description]); +} + + +- (void)testFunctionName { + g = + @"@wordState = '_';" + @"@wordChars = '_' '.' '-';" + @"@start = functionName;" + @"functionName = qName - nodeType;" + @"nodeType = 'comment' | 'text' | 'processing-instruction' | 'node';" + @"qName = prefixedName | unprefixedName;" + @"prefixedName = prefix ':' localPart;" + @"unprefixedName = localPart;" + @"localPart = ncName;" + @"prefix = ncName;" + @"ncName = Word;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + t.string = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + t.string = @"foo:bar"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo, :, bar]foo/:/bar^", [res description]); + + t.string = @":bar"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + t.string = @"text"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + t.string = @"comment"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + t.string = @"node"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + t.string = @"processing-instruction"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + t.string = @"texts"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[texts]texts^", [res description]); + +} + +@end diff --git a/test/.svn/text-base/TDParserTest.h.svn-base b/test/.svn/text-base/TDParserTest.h.svn-base new file mode 100644 index 0000000..ac4d9ee --- /dev/null +++ b/test/.svn/text-base/TDParserTest.h.svn-base @@ -0,0 +1,17 @@ +// +// PKParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDParserTest : SenTestCase { + PKAssembly *a; + NSString *s; + PKParser *p; +} + +@end diff --git a/test/.svn/text-base/TDParserTest.m.svn-base b/test/.svn/text-base/TDParserTest.m.svn-base new file mode 100644 index 0000000..e37188d --- /dev/null +++ b/test/.svn/text-base/TDParserTest.m.svn-base @@ -0,0 +1,177 @@ +// +// PKParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDParserTest.h" + +@implementation TDParserTest + +- (void)setUp { +} + + +- (void)tearDown { +} + + +#pragma mark - + +- (void)testMath { + s = @"2 4 6 8"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKRepetition repetitionWithSubparser:[PKNumber number]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[2, 4, 6, 8]2/4/6/8^", [result description]); +} + + +- (void)testMiniMath { + s = @"4.5 - 5.6 - 222.0"; + a = [PKTokenAssembly assemblyWithString:s]; + + PKSequence *minusNum = [PKSequence sequence]; + [minusNum add:[[PKSymbol symbolWithString:@"-"] discard]]; + [minusNum add:[PKNumber number]]; + + PKSequence *e = [PKSequence sequence]; + [e add:[PKNumber number]]; + [e add:[PKRepetition repetitionWithSubparser:minusNum]]; + + PKAssembly *result = [e completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[4.5, 5.6, 222.0]4.5/-/5.6/-/222.0^", [result description]); +} + + +- (void)testMiniMathWithBrackets { + s = @"[4.5 - 5.6 - 222.0]"; + a = [PKTokenAssembly assemblyWithString:s]; + + PKSequence *minusNum = [PKSequence sequence]; + [minusNum add:[[PKSymbol symbolWithString:@"-"] discard]]; + [minusNum add:[PKNumber number]]; + + PKSequence *e = [PKSequence sequence]; + [e add:[[PKSymbol symbolWithString:@"["] discard]]; + [e add:[PKNumber number]]; + [e add:[PKRepetition repetitionWithSubparser:minusNum]]; + [e add:[[PKSymbol symbolWithString:@"]"] discard]]; + + PKAssembly *result = [e completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[4.5, 5.6, 222.0][/4.5/-/5.6/-/222.0/]^", [result description]); +} + + +- (void)testHotHotSteamingHotCoffee { + PKAlternation *adjective = [PKAlternation alternation]; + [adjective add:[PKLiteral literalWithString:@"hot"]]; + [adjective add:[PKLiteral literalWithString:@"steaming"]]; + + PKRepetition *adjectives = [PKRepetition repetitionWithSubparser:adjective]; + + PKSequence *sentence = [PKSequence sequence]; + [sentence add:adjectives]; + [sentence add:[PKLiteral literalWithString:@"coffee"]]; + + s = @"hot hot steaming hot coffee"; + a = [PKTokenAssembly assemblyWithString:s]; + + PKAssembly *result = [sentence bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[hot, hot, steaming, hot, coffee]hot/hot/steaming/hot/coffee^", [result description]); +} + + +- (void)testList { + PKAssembly *result = nil; + + PKSequence *commaTerm = [PKSequence sequence]; + [commaTerm add:[[PKSymbol symbolWithString:@","] discard]]; + [commaTerm add:[PKWord word]]; + + PKSequence *actualList = [PKSequence sequence]; + [actualList add:[PKWord word]]; + [actualList add:[PKRepetition repetitionWithSubparser:commaTerm]]; + + PKSequence *list = [PKSequence sequence]; + [list add:[[PKSymbol symbolWithString:@"["] discard]]; + [list add:actualList]; + [list add:[[PKSymbol symbolWithString:@"]"] discard]]; + + s = @"[foo, bar, baz]"; + a = [PKTokenAssembly assemblyWithString:s]; + + result = [list bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz][/foo/,/bar/,/baz/]^", [result description]); +} + + +- (void)testJavaScriptStatement { + s = @"123 'boo'"; + a = [PKTokenAssembly assemblyWithString:s]; + + PKAlternation *literals = [PKAlternation alternation]; + [literals add:[PKQuotedString quotedString]]; + [literals add:[PKNumber number]]; + + PKAssembly *result = [literals bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[123]123^'boo'", [result description]); +} + + +- (void)testParserNamed { + + // seq = (foo|bar|seq) foo* w sy; + PKCollectionParser *seq = [PKSequence sequence]; + seq.name = @"seq"; + + PKCollectionParser *alt = [PKAlternation alternation]; + alt.name = @"alt"; + + PKParser *foo = [PKLiteral literalWithString:@"foo"]; + foo.name = @"w"; + [alt add:foo]; + + PKParser *bar = [PKLiteral literalWithString:@"bar"]; + bar.name = @"w"; + [alt add:bar]; + + [alt add:seq]; + + PKRepetition *r = [PKRepetition repetitionWithSubparser:foo]; + + PKWord *w = [PKWord word]; + w.name = @"w"; + + PKSymbol *sy = [PKSymbol symbol]; + sy.name = @"sy"; + + + [seq add:alt]; + [seq add:r]; + [seq add:w]; + [seq add:sy]; + + TDEquals(seq, [seq parserNamed:@"seq"]); + TDEquals(seq, [alt parserNamed:@"seq"]); + + TDEquals(alt, [seq parserNamed:@"alt"]); + TDEquals(w, [seq parserNamed:@"w"]); + TDEquals(sy, [seq parserNamed:@"sy"]); + + TDEquals(foo, [alt parserNamed:@"w"]); + TDEquals(foo, [r parserNamed:@"w"]); +} + +@end diff --git a/test/.svn/text-base/TDPatternTest.h.svn-base b/test/.svn/text-base/TDPatternTest.h.svn-base new file mode 100644 index 0000000..5dea5f3 --- /dev/null +++ b/test/.svn/text-base/TDPatternTest.h.svn-base @@ -0,0 +1,19 @@ +// +// PKPatternTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 5/31/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDPatternTest : SenTestCase { + PKTokenizer *t; + PKPattern *p; + PKIntersection *inter; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDPatternTest.m.svn-base b/test/.svn/text-base/TDPatternTest.m.svn-base new file mode 100644 index 0000000..4a144a3 --- /dev/null +++ b/test/.svn/text-base/TDPatternTest.m.svn-base @@ -0,0 +1,239 @@ +// +// PKPatternTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 5/31/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDPatternTest.h" + +@implementation TDPatternTest + +- (void)testFoo { + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"foo"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"foo"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"foo"]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKWord word]]; + + a = [inter completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"foo"]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKSymbol symbol]]; + + a = [inter completeMatchFor:a]; + + TDNil(a); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"fo+"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"fo*"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"fo{1,2}"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"fo{3,4}"]; + a = [p completeMatchFor:a]; + + TDNil(a); +} + + +- (void)testSlashFooSlash { + s = @"/foo/"; + + t = [PKTokenizer tokenizerWithString:s]; + [t setTokenizerState:t.quoteState from:'/' to:'/']; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + p = [PKPattern patternWithString:@"/foo/" options:PKPatternOptionsNone]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKQuotedString quotedString]]; + + a = [inter completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[/foo/]/foo/^"); + + t = [PKTokenizer tokenizerWithString:s]; + [t setTokenizerState:t.quoteState from:'/' to:'/']; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + p = [PKPattern patternWithString:@"/[^/]+/" options:PKPatternOptionsNone]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKQuotedString quotedString]]; + + a = [inter completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[/foo/]/foo/^"); +} + + +- (void)testAndOrOr { + s = @"and"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"and|or"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[and]and^"); + + s = @"and"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"an|or"]; + a = [p completeMatchFor:a]; + + TDNil(a); + + s = @"or"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"(and)|(or)"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[or]or^"); +} + + +- (void)testNotAnd { + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"[^and]+"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"and"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"[^(and)]"]; + a = [p completeMatchFor:a]; + + TDNil(a); +} + + +- (void)testInvertFoo { + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"fo+"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + p = [PKNegation negationWithSubparser:p]; + a = [p completeMatchFor:a]; + + TDNil(a); +} + + +- (void)testInvertAndOrNotTrueFalse { + s = @"true"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"and|or|not|true|false"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[true]true^"); + + p = [PKNegation negationWithSubparser:p]; + a = [p completeMatchFor:a]; + + TDNil(a); + + s = @"TRUE"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"and|or|not|true|false" options:PKPatternOptionsIgnoreCase]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[TRUE]TRUE^"); + + p = [PKNegation negationWithSubparser:p]; + a = [p completeMatchFor:a]; + + TDNil(a); + + s = @"NOT"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"and|or|not|true|false" options:PKPatternOptionsIgnoreCase]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKWord word]]; + + a = [inter completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[NOT]NOT^"); + + p = [PKNegation negationWithSubparser:p]; + a = [p completeMatchFor:a]; + + TDNil(a); + + s = @"oR"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"and|or|not|true|false" options:PKPatternOptionsIgnoreCase]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKSymbol symbol]]; + + a = [inter completeMatchFor:a]; + + TDNil(a); +} + +@end diff --git a/test/.svn/text-base/TDPlistParser.h.svn-base b/test/.svn/text-base/TDPlistParser.h.svn-base new file mode 100644 index 0000000..52986da --- /dev/null +++ b/test/.svn/text-base/TDPlistParser.h.svn-base @@ -0,0 +1,35 @@ +// +// PKPlistParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/9/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface TDPlistParser : PKAlternation { + PKCollectionParser *dictParser; + PKCollectionParser *keyValuePairParser; + PKCollectionParser *arrayParser; + PKCollectionParser *commaValueParser; + PKCollectionParser *keyParser; + PKCollectionParser *valueParser; + PKCollectionParser *stringParser; + PKParser *numParser; + PKParser *nullParser; + PKToken *curly; + PKToken *paren; +} +- (id)parse:(NSString *)s; + +@property (nonatomic, retain) PKCollectionParser *dictParser; +@property (nonatomic, retain) PKCollectionParser *keyValuePairParser; +@property (nonatomic, retain) PKCollectionParser *arrayParser; +@property (nonatomic, retain) PKCollectionParser *commaValueParser; +@property (nonatomic, retain) PKCollectionParser *keyParser; +@property (nonatomic, retain) PKCollectionParser *valueParser; +@property (nonatomic, retain) PKCollectionParser *stringParser; +@property (nonatomic, retain) PKParser *numParser; +@property (nonatomic, retain) PKParser *nullParser; +@end diff --git a/test/.svn/text-base/TDPlistParser.m.svn-base b/test/.svn/text-base/TDPlistParser.m.svn-base new file mode 100644 index 0000000..52fd123 --- /dev/null +++ b/test/.svn/text-base/TDPlistParser.m.svn-base @@ -0,0 +1,316 @@ +// +// PKPlistParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/9/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDPlistParser.h" +#import "NSString+ParseKitAdditions.h" + +//{ +// 0 = 0; +// dictKey = { +// bar = foo; +// }; +// 47 = 0; +// IntegerKey = 1; +// 47.7 = 0; +// = ; +// ArrayKey = ( +// "one one", +// two, +// three +// ); +// "Null Key" = ; +// emptyDictKey = { +// }; +// StringKey = String; +// "1.0" = 1; +// YESKey = 1; +// "NO Key" = 0; +//} + + +// dict = '{' dictContent '}' +// dictContent = keyValuePair* +// keyValuePair = key '=' value ';' +// key = num | string | null +// value = num | string | null | array | dict +// null = '' +// string = Word | QuotedString +// num = Number + +// array = '(' arrayContent ')' +// arrayContent = Empty | actualArray +// actualArray = value commaValue* +// commaValue = ',' value + +static NSString *kTDPlistNullString = @""; + +@interface PKParser (PKParserFactoryAdditionsFriend) +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@interface PKCollectionParser () +@property (nonatomic, readwrite, retain) NSMutableArray *subparsers; +@end + +@interface TDPlistParser () +@property (nonatomic, retain) PKToken *curly; +@property (nonatomic, retain) PKToken *paren; +@end + +@implementation TDPlistParser + +- (id)init { + self = [super init]; + if (self != nil) { + + self.tokenizer = [PKTokenizer tokenizer]; + // add '' as a multichar symbol + [self.tokenizer.symbolState add:kTDPlistNullString]; + + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0.]; + self.paren = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"(" floatValue:0.]; + [self add:[PKEmpty empty]]; + [self add:self.arrayParser]; + [self add:self.dictParser]; + } + return self; +} + + +- (void)dealloc { + // avoid retain cycle leaks by releasing the subparsers of all collection parsers + dictParser.subparsers = nil; + keyValuePairParser.subparsers = nil; + arrayParser.subparsers = nil; + commaValueParser.subparsers = nil; + keyParser.subparsers = nil; + valueParser.subparsers = nil; + stringParser.subparsers = nil; + + self.tokenizer = nil; + self.dictParser = nil; + self.keyValuePairParser = nil; + self.arrayParser = nil; + self.commaValueParser = nil; + self.keyParser = nil; + self.valueParser = nil; + self.stringParser = nil; + self.numParser = nil; + self.nullParser = nil; + self.curly = nil; + self.paren = nil; + [super dealloc]; +} + + +- (id)parse:(NSString *)s { + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:self.tokenizer]; + + // parse + PKAssembly *res = [self completeMatchFor:a]; + + // pop the built result off the assembly's stack and return. + // this will be an array or a dictionary or nil + return [res pop]; +} + + +// dict = '{' dictContent '}' +// dictContent = keyValuePair* +- (PKCollectionParser *)dictParser { + if (!dictParser) { + self.dictParser = [PKTrack track]; + [dictParser add:[PKSymbol symbolWithString:@"{"]]; // dont discard. serves as fence + [dictParser add:[PKRepetition repetitionWithSubparser:self.keyValuePairParser]]; + [dictParser add:[[PKSymbol symbolWithString:@"}"] discard]]; + [dictParser setAssembler:self selector:@selector(didMatchDict:)]; + } + return dictParser; +} + + +// keyValuePair = key '=' value ';' +- (PKCollectionParser *)keyValuePairParser { + if (!keyValuePairParser) { + self.keyValuePairParser = [PKTrack track]; + [keyValuePairParser add:self.keyParser]; + [keyValuePairParser add:[[PKSymbol symbolWithString:@"="] discard]]; + [keyValuePairParser add:self.valueParser]; + [keyValuePairParser add:[[PKSymbol symbolWithString:@";"] discard]]; + } + return keyValuePairParser; +} + + +// array = '(' arrayContent ')' +// arrayContent = Empty | actualArray +// actualArray = value commaValue* +- (PKCollectionParser *)arrayParser { + if (!arrayParser) { + self.arrayParser = [PKTrack track]; + [arrayParser add:[PKSymbol symbolWithString:@"("]]; // dont discard. serves as fence + + PKAlternation *arrayContent = [PKAlternation alternation]; + [arrayContent add:[PKEmpty empty]]; + + PKSequence *actualArray = [PKSequence sequence]; + [actualArray add:self.valueParser]; + [actualArray add:[PKRepetition repetitionWithSubparser:self.commaValueParser]]; + + [arrayContent add:actualArray]; + [arrayParser add:arrayContent]; + [arrayParser add:[[PKSymbol symbolWithString:@")"] discard]]; + [arrayParser setAssembler:self selector:@selector(didMatchArray:)]; + } + return arrayParser; +} + + +// key = num | string | null +- (PKCollectionParser *)keyParser { + if (!keyParser) { + self.keyParser = [PKAlternation alternation]; + [keyParser add:self.numParser]; + [keyParser add:self.stringParser]; + [keyParser add:self.nullParser]; + } + return keyParser; +} + + +// value = num | string | null | array | dict +- (PKCollectionParser *)valueParser { + if (!valueParser) { + self.valueParser = [PKAlternation alternation]; + [valueParser add:self.arrayParser]; + [valueParser add:self.dictParser]; + [valueParser add:self.stringParser]; + [valueParser add:self.numParser]; + [valueParser add:self.nullParser]; + } + return valueParser; +} + + +- (PKCollectionParser *)commaValueParser { + if (!commaValueParser) { + self.commaValueParser = [PKSequence sequence]; + [commaValueParser add:[[PKSymbol symbolWithString:@","] discard]]; + [commaValueParser add:self.valueParser]; + } + return commaValueParser; +} + + +// string = QuotedString | Word +- (PKCollectionParser *)stringParser { + if (!stringParser) { + self.stringParser = [PKAlternation alternation]; + + // we have to remove the quotes from QuotedString string values. so set an assembler method to do that + PKParser *quotedString = [PKQuotedString quotedString]; + [quotedString setAssembler:self selector:@selector(didMatchQuotedString:)]; + [stringParser add:quotedString]; + + // handle non-quoted string values (Words) in a separate assembler method for simplicity. + PKParser *word = [PKWord word]; + [word setAssembler:self selector:@selector(didMatchWord:)]; + [stringParser add:word]; + } + return stringParser; +} + + +- (PKParser *)numParser { + if (!numParser) { + self.numParser = [PKNumber number]; + [numParser setAssembler:self selector:@selector(didMatchNum:)]; + } + return numParser; +} + + +// null = '' +- (PKParser *)nullParser { + if (!nullParser) { + // thus must be a PKSymbol (not a PKLiteral) to match the resulting '' symbol tok + self.nullParser = [PKSymbol symbolWithString:kTDPlistNullString]; + [nullParser setAssembler:self selector:@selector(didMatchNull:)]; + } + return nullParser; +} + + +- (void)didMatchDict:(PKAssembly *)a { + NSArray *objs = [a objectsAbove:self.curly]; + NSInteger count = [objs count]; + NSAssert1(0 == count % 2, @"in -%s, the assembly's stack's count should be a multiple of 2", _cmd); + + NSMutableDictionary *res = [NSMutableDictionary dictionaryWithCapacity:count / 2.]; + if (count) { + NSInteger i = 0; + for ( ; i < [objs count] - 1; i++) { + id value = [objs objectAtIndex:i++]; + id key = [objs objectAtIndex:i]; + [res setObject:value forKey:key]; + } + } + + [a pop]; // discard '{' tok + [a push:[[res copy] autorelease]]; +} + + +- (void)didMatchArray:(PKAssembly *)a { + NSArray *objs = [a objectsAbove:self.paren]; + NSMutableArray *res = [NSMutableArray arrayWithCapacity:[objs count]]; + + for (id obj in [objs reverseObjectEnumerator]) { + [res addObject:obj]; + } + + [a pop]; // discard '(' tok + [a push:[[res copy] autorelease]]; +} + + +- (void)didMatchQuotedString:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[tok.stringValue stringByTrimmingQuotes]]; +} + + +- (void)didMatchWord:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:tok.stringValue]; +} + + +- (void)didMatchNum:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)didMatchNull:(PKAssembly *)a { + [a pop]; // discard '' tok + [a push:[NSNull null]]; +} + +@synthesize dictParser; +@synthesize keyValuePairParser; +@synthesize arrayParser; +@synthesize commaValueParser; +@synthesize keyParser; +@synthesize valueParser; +@synthesize stringParser; +@synthesize numParser; +@synthesize nullParser; +@synthesize curly; +@synthesize paren; +@end diff --git a/test/.svn/text-base/TDPlistParserTest.h.svn-base b/test/.svn/text-base/TDPlistParserTest.h.svn-base new file mode 100644 index 0000000..27a1d4c --- /dev/null +++ b/test/.svn/text-base/TDPlistParserTest.h.svn-base @@ -0,0 +1,19 @@ +// +// PKPlistParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/9/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "TDPlistParser.h" + +@interface TDPlistParserTest : SenTestCase { + TDPlistParser *p; + NSString *s; + PKTokenAssembly *a; + PKAssembly *res; +} + +@end diff --git a/test/.svn/text-base/TDPlistParserTest.m.svn-base b/test/.svn/text-base/TDPlistParserTest.m.svn-base new file mode 100644 index 0000000..ab76797 --- /dev/null +++ b/test/.svn/text-base/TDPlistParserTest.m.svn-base @@ -0,0 +1,465 @@ +// +// PKPlistParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/9/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDPlistParserTest.h" + +@implementation TDPlistParserTest + +- (void)setUp { + p = [[TDPlistParser alloc] init]; +} + + +- (void)tearDown { + [p release]; +} + + +- (void)testARealDict { + s = @" {" + @" ArrayKey = (" + @" one," + @" two," + @" three" + @" );" + @" FloatKey = 1;" + @" IntegerKey = 1;" + @" NOKey = 0;" + @" StringKey = String;" + @" YESKey = 1;" + @" }"; + + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + TDNotNil(res); + + id obj = [res pop]; + TDNotNil(obj); + TDTrue([obj isKindOfClass:[NSDictionary class]]); + TDEquals((NSUInteger)6, [obj count]); + + id arr = [obj objectForKey:@"ArrayKey"]; + TDNotNil(arr); + TDEquals((NSUInteger)3, [arr count]); + + id b = [obj objectForKey:@"YESKey"]; + TDNotNil(b); + TDEqualObjects([NSNumber numberWithInteger:1], b); +} + + +- (void)testARealDict2 { + //NSDictionary *d = [NSDictionary dictionaryWithObjectsAndKeys: + // [NSNumber numberWithBool:NO], @"NO Key", + // [NSNumber numberWithBool:YES], @"YESKey", + // [NSNumber numberWithInteger:1], @"IntegerKey", + // [NSNumber numberWithFloat:1.0], @"1.0", + // [NSNumber numberWithInteger:0], @"0", + // [NSNumber numberWithInteger:0], [NSNumber numberWithInteger:47], + // [NSNumber numberWithInteger:0], [NSNumber numberWithFloat:47.7], + // @"String", @"StringKey", + // [NSNull null], @"Null Key", + // [NSNull null], [NSNull null], + // [NSDictionary dictionaryWithObject:@"foo" forKey:@"bar"], @"dictKey", + // [NSDictionary dictionary], @"emptyDictKey", + // [NSArray arrayWithObjects:@"one one", @"two", @"three", nil], @"ArrayKey", + // nil]; + //NSLog(@"%@", d); + + s = @"{" + @" 0 = 0;" + @" dictKey = {" + @" bar = foo;" + @" };" + @" 47 = 0;" + @" IntegerKey = 1;" + @" 47.7 = 0;" + @" = ;" + @" ArrayKey = (" + @" \"one one\"," + @" two," + @" three" + @" );" + @" \"Null Key\" = ;" + @" emptyDictKey = {" + @" };" + @" StringKey = String;" + @" \"1.0\" = 1;" + @" YESKey = 1;" + @" \"NO Key\" = 0;" + @"}"; + + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + TDNotNil(res); + + id obj = [res pop]; + TDNotNil(obj); + TDTrue([obj isKindOfClass:[NSDictionary class]]); + TDEquals((NSUInteger)13, [obj count]); + + id arr = [obj objectForKey:@"ArrayKey"]; + TDNotNil(arr); + TDEquals((NSUInteger)3, [arr count]); + + id b = [obj objectForKey:@"YESKey"]; + TDNotNil(b); + TDEqualObjects([NSNumber numberWithInteger:1], b); +} + + +- (void)testDictFooEqBar { + s = @"{foo = bar;}"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchDictionaryAssembly: has already executed. + id obj = [res pop]; // NSDictionary * + TDTrue([obj isKindOfClass:[NSDictionary class]]); + TDEquals((NSUInteger)1, [obj count]); + + TDEqualObjects(@"bar", [obj objectForKey:@"foo"]); +} + + +#ifndef TARGET_CPU_X86_64 +- (void)testDictTrackFooEqBarMisingCurly { + s = @"{foo = bar;"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + STAssertThrowsSpecific([p.dictParser completeMatchFor:a], PKTrackException, @""); +} +#endif + + +- (void)testDictQuoteFooFooQuoteEqBarOneEq2 { + s = @"{\"foo foo\" = bar; 1 = 2.2;}"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchDictionaryAssembly: has already executed. + id obj = [res pop]; // NSDictionary * + TDTrue([obj isKindOfClass:[NSDictionary class]]); + TDEquals((NSUInteger)2, [obj count]); + + TDEqualObjects(@"bar", [obj objectForKey:@"foo foo"]); + TDEqualObjects([NSNumber numberWithFloat:2.2], [obj objectForKey:[NSNumber numberWithInteger:1]]); +} + + +- (void)testKeyValuePairFooEqBar { + s = @"foo = bar;"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.keyValuePairParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchKeyValuePairAssembly: has already executed. + id value = [res pop]; // NSString * + id key = [res pop]; // NSString * + + TDTrue([key isKindOfClass:[NSString class]]); + TDEqualObjects(@"foo", key); + + TDTrue([value isKindOfClass:[NSString class]]); + TDEqualObjects(@"bar", value); +} + + +#ifndef TARGET_CPU_X86_64 +- (void)testKeyValuePairTrackFooEqBarNoSemi { + s = @"foo = bar"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + STAssertThrowsSpecific([p.keyValuePairParser completeMatchFor:a], PKTrackException, @""); +} +#endif + + +- (void)testCommaValueComma1 { + s = @", 1"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.commaValueParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumberAssembly: has already executed. + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEquals((NSInteger)1, [obj integerValue]); +} + + +- (void)testCommaValueCommaFoo { + s = @", Foo"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.commaValueParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchWordAssembly: has already executed. + id obj = [res pop]; // NSString * + TDTrue([obj isKindOfClass:[NSString class]]); + TDEqualObjects(@"Foo", obj); +} + + +- (void)testCommaValueCommaQuoteFooSpaceBarQuote { + s = @", \"Foo Bar\""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.commaValueParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchQuotedStringAssembly: has already executed. + id obj = [res pop]; // NSString * + TDTrue([obj isKindOfClass:[NSString class]]); + TDEqualObjects(@"Foo Bar", obj); +} + + +- (void)testArrayEmptyArray { + s = @"()"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.arrayParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchArrayAssembly: has already executed. + id obj = [res pop]; // NSArray * + TDTrue([obj isKindOfClass:[NSArray class]]); + TDEquals((NSUInteger)0, [obj count]); +} + + +- (void)testArrayNumArray { + s = @"(1, 2, 3)"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.arrayParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchArrayAssembly: has already executed. + id obj = [res pop]; // NSArray * + TDTrue([obj isKindOfClass:[NSArray class]]); + TDEquals((NSUInteger)3, [obj count]); + TDEqualObjects([NSNumber numberWithInt:1], [obj objectAtIndex:0]); + TDEqualObjects([NSNumber numberWithInt:2], [obj objectAtIndex:1]); + TDEqualObjects([NSNumber numberWithInt:3], [obj objectAtIndex:2]); +} + + +#ifndef TARGET_CPU_X86_64 +- (void)testArrayTrackNumArrayMissingParen { + s = @"(1, 2, 3"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + STAssertThrowsSpecific([p.arrayParser completeMatchFor:a], PKTrackException, @""); +} + + +- (void)testArrayTrackNumArrayMissingComma { + s = @"(1, 2 3)"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + STAssertThrowsSpecific([p.arrayParser completeMatchFor:a], PKTrackException, @""); +} +#endif + + +- (void)testNullLtNullGt { + s = @""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.nullParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNullAssembly: has already executed. + id obj = [res pop]; // NSNull * + TDTrue([obj isKindOfClass:[NSNull class]]); + TDEqualObjects([NSNull null], obj); +} + + +- (void)testNullQuoteLtNullGtQuote { + s = @"\"\""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.nullParser completeMatchFor:a]; + TDNil(res); +} + + +- (void)testStringQuote1Dot0Quote { + s = @"\"1.0\""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.stringParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchStringAssembly: has already executed. + id obj = [res pop]; // NSString * + TDTrue([obj isKindOfClass:[NSString class]]); + TDEqualObjects(@"1.0", obj); +} + + +- (void)testStringFoo { + s = @"foo"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.stringParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchStringAssembly: has already executed. + id obj = [res pop]; // NSString * + TDTrue([obj isKindOfClass:[NSString class]]); + TDEqualObjects(@"foo", obj); +} + + +- (void)testStringQuoteFooQuote { + s = @"\"foo\""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.stringParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchStringAssembly: has already executed. + id obj = [res pop]; // NSString * + TDTrue([obj isKindOfClass:[NSString class]]); + TDEqualObjects(@"foo", obj); +} + + +- (void)testNum1Dot0 { + s = @"1.0"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. 'floatness' has been lost + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"1", [obj stringValue]); + TDEquals((NSInteger)1, [obj integerValue]); + TDEquals((CGFloat)1.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNumMinus1Dot0 { + s = @"-1.0"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. 'floatness' has been lost + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"-1", [obj stringValue]); + TDEquals((NSInteger)-1, [obj integerValue]); + TDEquals((CGFloat)-1.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNumMinus1 { + s = @"-1"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"-1", [obj stringValue]); + TDEquals((NSInteger)-1, [obj integerValue]); + TDEquals((CGFloat)-1.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNum0 { + s = @"0"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"0", [obj stringValue]); + TDEquals((NSInteger)0, [obj integerValue]); + TDEquals((CGFloat)0.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNum0Dot0 { + s = @"0.0"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. 'floatness' has been lost + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"0", [obj stringValue]); + TDEquals((NSInteger)0, [obj integerValue]); + TDEquals((CGFloat)0.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNumMinus0Dot0 { + s = @"-0.0"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. 'floatness' has been lost + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"-0", [obj stringValue]); + TDEquals((NSInteger)-0, [obj integerValue]); + TDEquals((CGFloat)-0.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNum300 { + s = @"300"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"300", [obj stringValue]); + TDEquals((NSInteger)300, [obj integerValue]); + TDEquals((CGFloat)300.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNumEmptyString { + s = @""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNil(res); +} + +@end diff --git a/test/.svn/text-base/TDPredicateEvaluator.h.svn-base b/test/.svn/text-base/TDPredicateEvaluator.h.svn-base new file mode 100644 index 0000000..d77626b --- /dev/null +++ b/test/.svn/text-base/TDPredicateEvaluator.h.svn-base @@ -0,0 +1,83 @@ +// +// PKPredicateEvaluator.h +// ParseKit +// +// Created by Todd Ditchendorf on 5/28/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@protocol TDPredicateEvaluatorDelegate +- (id)valueForAttributeKey:(NSString *)key; +- (CGFloat)floatForAttributeKey:(NSString *)key; +- (BOOL)boolForAttributeKey:(NSString *)key; +@end + +@interface TDPredicateEvaluator : NSObject { + id delegate; + PKCollectionParser *exprParser; + PKCollectionParser *orTermParser; + PKCollectionParser *termParser; + PKCollectionParser *andPrimaryExprParser; + PKCollectionParser *primaryExprParser; + PKCollectionParser *phraseParser; + PKCollectionParser *negatedPredicateParser; + PKCollectionParser *predicateParser; + PKCollectionParser *attrParser; + PKCollectionParser *tagParser; + PKCollectionParser *eqStringPredicateParser; + PKCollectionParser *eqNumberPredicateParser; + PKCollectionParser *eqBoolPredicateParser; + PKCollectionParser *neStringPredicateParser; + PKCollectionParser *neNumberPredicateParser; + PKCollectionParser *neBoolPredicateParser; + PKCollectionParser *gtPredicateParser; + PKCollectionParser *gteqPredicateParser; + PKCollectionParser *ltPredicateParser; + PKCollectionParser *lteqPredicateParser; + PKCollectionParser *beginswithPredicateParser; + PKCollectionParser *containsPredicateParser; + PKCollectionParser *endswithPredicateParser; + PKCollectionParser *matchesPredicateParser; + PKCollectionParser *valueParser; + PKCollectionParser *boolParser; + PKParser *trueParser; + PKParser *falseParser; + PKParser *stringParser; + PKParser *numberParser; +} +- (id)initWithDelegate:(id )d; +- (BOOL)evaluate:(NSString *)s; + +@property (nonatomic, retain) PKCollectionParser *exprParser; +@property (nonatomic, retain) PKCollectionParser *orTermParser; +@property (nonatomic, retain) PKCollectionParser *termParser; +@property (nonatomic, retain) PKCollectionParser *andPrimaryExprParser; +@property (nonatomic, retain) PKCollectionParser *primaryExprParser; +@property (nonatomic, retain) PKCollectionParser *phraseParser; +@property (nonatomic, retain) PKCollectionParser *negatedPredicateParser; +@property (nonatomic, retain) PKCollectionParser *predicateParser; +@property (nonatomic, retain) PKCollectionParser *attrParser; +@property (nonatomic, retain) PKCollectionParser *tagParser; +@property (nonatomic, retain) PKCollectionParser *eqStringPredicateParser; +@property (nonatomic, retain) PKCollectionParser *eqNumberPredicateParser; +@property (nonatomic, retain) PKCollectionParser *eqBoolPredicateParser; +@property (nonatomic, retain) PKCollectionParser *neStringPredicateParser; +@property (nonatomic, retain) PKCollectionParser *neNumberPredicateParser; +@property (nonatomic, retain) PKCollectionParser *neBoolPredicateParser; +@property (nonatomic, retain) PKCollectionParser *gtPredicateParser; +@property (nonatomic, retain) PKCollectionParser *gteqPredicateParser; +@property (nonatomic, retain) PKCollectionParser *ltPredicateParser; +@property (nonatomic, retain) PKCollectionParser *lteqPredicateParser; +@property (nonatomic, retain) PKCollectionParser *beginswithPredicateParser; +@property (nonatomic, retain) PKCollectionParser *containsPredicateParser; +@property (nonatomic, retain) PKCollectionParser *endswithPredicateParser; +@property (nonatomic, retain) PKCollectionParser *matchesPredicateParser; +@property (nonatomic, retain) PKCollectionParser *valueParser; +@property (nonatomic, retain) PKCollectionParser *boolParser; +@property (nonatomic, retain) PKParser *trueParser; +@property (nonatomic, retain) PKParser *falseParser; +@property (nonatomic, retain) PKParser *stringParser; +@property (nonatomic, retain) PKParser *numberParser; +@end diff --git a/test/.svn/text-base/TDPredicateEvaluator.m.svn-base b/test/.svn/text-base/TDPredicateEvaluator.m.svn-base new file mode 100644 index 0000000..531bbe9 --- /dev/null +++ b/test/.svn/text-base/TDPredicateEvaluator.m.svn-base @@ -0,0 +1,656 @@ +// +// PKPredicateEvaluator.m +// ParseKit +// +// Created by Todd Ditchendorf on 5/28/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDPredicateEvaluator.h" +#import "NSString+ParseKitAdditions.h" + +// expr = term orTerm* +// orTerm = 'or' term +// term = primaryExpr andPrimaryExpr* +// andPrimaryExpr = 'and' primaryExpr +// primaryExpr = phrase | '(' expression ')' +// phrase = predicate | negatedPredicate +// negatedPredicate = 'not' predicate +// predicate = bool | eqPredicate | nePredicate | gtPredicate | gteqPredicate | ltPredicate | lteqPredicate | beginswithPredicate | containsPredicate | endswithPredicate | matchesPredicate +// eqPredicate = attr '=' value +// nePredicate = attr '!=' value +// gtPredicate = attr '>' value +// gteqPredicate = attr '>=' value +// ltPredicate = attr '<' value +// lteqPredicate = attr '<=' value +// beginswithPredicate = attr 'beginswith' value +// containsPredicate = attr 'contains' value +// endswithPredicate = attr 'endswith' value +// matchesPredicate = attr 'matches' value + +// attr = tag | Word +// tag = '@' Word +// value = QuotedString | Number | bool +// bool = 'true' | 'false' + +@implementation TDPredicateEvaluator + +- (id)initWithDelegate:(id )d { + if (self = [super init]) { + delegate = d; + } + return self; +} + + +- (void)dealloc { + delegate = nil; + self.exprParser = nil; + self.orTermParser = nil; + self.termParser = nil; + self.andPrimaryExprParser = nil; + self.primaryExprParser = nil; + self.negatedPredicateParser = nil; + self.predicateParser = nil; + self.phraseParser = nil; + self.attrParser = nil; + self.tagParser = nil; + self.eqStringPredicateParser = nil; + self.eqNumberPredicateParser = nil; + self.eqBoolPredicateParser = nil; + self.neStringPredicateParser = nil; + self.neNumberPredicateParser = nil; + self.neBoolPredicateParser = nil; + self.gtPredicateParser = nil; + self.gteqPredicateParser = nil; + self.ltPredicateParser = nil; + self.lteqPredicateParser = nil; + self.beginswithPredicateParser = nil; + self.containsPredicateParser = nil; + self.endswithPredicateParser = nil; + self.matchesPredicateParser = nil; + self.valueParser = nil; + self.boolParser = nil; + self.trueParser = nil; + self.falseParser = nil; + self.stringParser = nil; + self.numberParser = nil; + [super dealloc]; +} + + +- (BOOL)evaluate:(NSString *)s { + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + return [[[self.exprParser completeMatchFor:a] pop] boolValue]; +} + + +// expression = term orTerm* +- (PKCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [PKSequence sequence]; + [exprParser add:self.termParser]; + [exprParser add:[PKRepetition repetitionWithSubparser:self.orTermParser]]; + } + return exprParser; +} + + +// orTerm = 'or' term +- (PKCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [PKSequence sequence]; + [orTermParser add:[[PKCaseInsensitiveLiteral literalWithString:@"or"] discard]]; + [orTermParser add:self.termParser]; + [orTermParser setAssembler:self selector:@selector(didMatchOr:)]; + } + return orTermParser; +} + + +// term = primaryExpr andPrimaryExpr* +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + [termParser add:self.primaryExprParser]; + [termParser add:[PKRepetition repetitionWithSubparser:self.andPrimaryExprParser]]; + } + return termParser; +} + + +// andPrimaryExpr = 'and' primaryExpr +- (PKCollectionParser *)andPrimaryExprParser { + if (!andPrimaryExprParser) { + self.andPrimaryExprParser = [PKSequence sequence]; + [andPrimaryExprParser add:[[PKCaseInsensitiveLiteral literalWithString:@"and"] discard]]; + [andPrimaryExprParser add:self.primaryExprParser]; + [andPrimaryExprParser setAssembler:self selector:@selector(didMatchAnd:)]; + } + return andPrimaryExprParser; +} + + +// primaryExpr = phrase | '(' expression ')' +- (PKCollectionParser *)primaryExprParser { + if (!primaryExprParser) { + self.primaryExprParser = [PKAlternation alternation]; + [primaryExprParser add:self.phraseParser]; + + PKSequence *s = [PKSequence sequence]; + [s add:[[PKSymbol symbolWithString:@"("] discard]]; + [s add:self.exprParser]; + [s add:[[PKSymbol symbolWithString:@")"] discard]]; + + [primaryExprParser add:s]; + } + return primaryExprParser; +} + + +// phrase = predicate | negatedPredicate +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + self.phraseParser = [PKAlternation alternation]; + [phraseParser add:self.predicateParser]; + [phraseParser add:self.negatedPredicateParser]; + } + return phraseParser; +} + + +// negatedPredicate = 'not' predicate +- (PKCollectionParser *)negatedPredicateParser { + if (!negatedPredicateParser) { + self.negatedPredicateParser = [PKSequence sequence]; + [negatedPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"not"] discard]]; + [negatedPredicateParser add:self.predicateParser]; + [negatedPredicateParser setAssembler:self selector:@selector(didMatchNegatedValue:)]; + } + return negatedPredicateParser; +} + + +// predicate = bool | eqPredicate | nePredicate | gtPredicate | gteqPredicate | ltPredicate | lteqPredicate | beginswithPredicate | containsPredicate | endswithPredicate | matchesPredicate +- (PKCollectionParser *)predicateParser { + if (!predicateParser) { + self.predicateParser = [PKAlternation alternation]; + [predicateParser add:self.boolParser]; + [predicateParser add:self.eqStringPredicateParser]; + [predicateParser add:self.eqNumberPredicateParser]; + [predicateParser add:self.eqBoolPredicateParser]; + [predicateParser add:self.neStringPredicateParser]; + [predicateParser add:self.neNumberPredicateParser]; + [predicateParser add:self.neBoolPredicateParser]; + [predicateParser add:self.gtPredicateParser]; + [predicateParser add:self.gteqPredicateParser]; + [predicateParser add:self.ltPredicateParser]; + [predicateParser add:self.lteqPredicateParser]; + [predicateParser add:self.beginswithPredicateParser]; + [predicateParser add:self.containsPredicateParser]; + [predicateParser add:self.endswithPredicateParser]; + [predicateParser add:self.matchesPredicateParser]; + } + return predicateParser; +} + + +// attr = tag | Word +- (PKCollectionParser *)attrParser { + if (!attrParser) { + self.attrParser = [PKAlternation alternation]; + [attrParser add:self.tagParser]; + [attrParser add:[PKWord word]]; + [attrParser setAssembler:self selector:@selector(didMatchAttr:)]; + } + return attrParser; +} + + +// tag = '@' Word +- (PKCollectionParser *)tagParser { + if (!tagParser) { + self.tagParser = [PKSequence sequence]; + [tagParser add:[[PKSymbol symbolWithString:@"@"] discard]]; + [tagParser add:[PKWord word]]; + } + return tagParser; +} + + +// eqPredicate = attr '=' value +- (PKCollectionParser *)eqStringPredicateParser { + if (!eqStringPredicateParser) { + self.eqStringPredicateParser = [PKSequence sequence]; + [eqStringPredicateParser add:self.attrParser]; + [eqStringPredicateParser add:[[PKSymbol symbolWithString:@"="] discard]]; + [eqStringPredicateParser add:self.stringParser]; + [eqStringPredicateParser setAssembler:self selector:@selector(didMatchEqStringPredicate:)]; + } + return eqStringPredicateParser; +} + + +- (PKCollectionParser *)eqNumberPredicateParser { + if (!eqNumberPredicateParser) { + self.eqNumberPredicateParser = [PKSequence sequence]; + [eqNumberPredicateParser add:self.attrParser]; + [eqNumberPredicateParser add:[[PKSymbol symbolWithString:@"="] discard]]; + [eqNumberPredicateParser add:self.numberParser]; + [eqNumberPredicateParser setAssembler:self selector:@selector(didMatchEqNumberPredicate:)]; + } + return eqNumberPredicateParser; +} + + +- (PKCollectionParser *)eqBoolPredicateParser { + if (!eqBoolPredicateParser) { + self.eqBoolPredicateParser = [PKSequence sequence]; + [eqBoolPredicateParser add:self.attrParser]; + [eqBoolPredicateParser add:[[PKSymbol symbolWithString:@"="] discard]]; + [eqBoolPredicateParser add:self.boolParser]; + [eqBoolPredicateParser setAssembler:self selector:@selector(didMatchEqBoolPredicate:)]; + } + return eqBoolPredicateParser; +} + + +// nePredicate = attr '!=' value +- (PKCollectionParser *)neStringPredicateParser { + if (!neStringPredicateParser) { + self.neStringPredicateParser = [PKSequence sequence]; + [neStringPredicateParser add:self.attrParser]; + [neStringPredicateParser add:[[PKSymbol symbolWithString:@"!="] discard]]; + [neStringPredicateParser add:self.stringParser]; + [neStringPredicateParser setAssembler:self selector:@selector(didMatchNeStringPredicate:)]; + } + return neStringPredicateParser; +} + + +- (PKCollectionParser *)neNumberPredicateParser { + if (!neNumberPredicateParser) { + self.neNumberPredicateParser = [PKSequence sequence]; + [neNumberPredicateParser add:self.attrParser]; + [neNumberPredicateParser add:[[PKSymbol symbolWithString:@"!="] discard]]; + [neNumberPredicateParser add:self.numberParser]; + [neNumberPredicateParser setAssembler:self selector:@selector(didMatchNeNumberPredicate:)]; + } + return neNumberPredicateParser; +} + + +- (PKCollectionParser *)neBoolPredicateParser { + if (!neBoolPredicateParser) { + self.neBoolPredicateParser = [PKSequence sequence]; + [neBoolPredicateParser add:self.attrParser]; + [neBoolPredicateParser add:[[PKSymbol symbolWithString:@"!="] discard]]; + [neBoolPredicateParser add:self.boolParser]; + [neBoolPredicateParser setAssembler:self selector:@selector(didMatchNeBoolPredicate:)]; + } + return neBoolPredicateParser; +} + + +// gtPredicate = attr '>' value +- (PKCollectionParser *)gtPredicateParser { + if (!gtPredicateParser) { + self.gtPredicateParser = [PKSequence sequence]; + [gtPredicateParser add:self.attrParser]; + [gtPredicateParser add:[[PKSymbol symbolWithString:@">"] discard]]; + [gtPredicateParser add:self.valueParser]; + [gtPredicateParser setAssembler:self selector:@selector(didMatchGtPredicate:)]; + } + return gtPredicateParser; +} + + +// gteqPredicate = attr '>=' value +- (PKCollectionParser *)gteqPredicateParser { + if (!gteqPredicateParser) { + self.gteqPredicateParser = [PKSequence sequence]; + [gteqPredicateParser add:self.attrParser]; + [gteqPredicateParser add:[[PKSymbol symbolWithString:@">="] discard]]; + [gteqPredicateParser add:self.valueParser]; + [gteqPredicateParser setAssembler:self selector:@selector(didMatchGteqPredicate:)]; + } + return gteqPredicateParser; +} + + +// ltPredicate = attr '<' value +- (PKCollectionParser *)ltPredicateParser { + if (!ltPredicateParser) { + self.ltPredicateParser = [PKSequence sequence]; + [ltPredicateParser add:self.attrParser]; + [ltPredicateParser add:[[PKSymbol symbolWithString:@"<"] discard]]; + [ltPredicateParser add:self.valueParser]; + [ltPredicateParser setAssembler:self selector:@selector(didMatchLtPredicate:)]; + } + return ltPredicateParser; +} + + +// lteqPredicate = attr '<=' value +- (PKCollectionParser *)lteqPredicateParser { + if (!lteqPredicateParser) { + self.lteqPredicateParser = [PKSequence sequence]; + [lteqPredicateParser add:self.attrParser]; + [lteqPredicateParser add:[[PKSymbol symbolWithString:@"<="] discard]]; + [lteqPredicateParser add:self.valueParser]; + [lteqPredicateParser setAssembler:self selector:@selector(didMatchLteqPredicate:)]; + } + return lteqPredicateParser; +} + + +// beginswithPredicate = attr 'beginswith' value +- (PKCollectionParser *)beginswithPredicateParser { + if (!beginswithPredicateParser) { + self.beginswithPredicateParser = [PKSequence sequence]; + [beginswithPredicateParser add:self.attrParser]; + [beginswithPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"beginswith"] discard]]; + [beginswithPredicateParser add:self.valueParser]; + [beginswithPredicateParser setAssembler:self selector:@selector(didMatchBeginswithPredicate:)]; + } + return beginswithPredicateParser; +} + + +// containsPredicate = attr 'contains' value +- (PKCollectionParser *)containsPredicateParser { + if (!containsPredicateParser) { + self.containsPredicateParser = [PKSequence sequence]; + [containsPredicateParser add:self.attrParser]; + [containsPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"contains"] discard]]; + [containsPredicateParser add:self.valueParser]; + [containsPredicateParser setAssembler:self selector:@selector(didMatchContainsPredicate:)]; + } + return containsPredicateParser; +} + + +// endswithPredicate = attr 'endswith' value +- (PKCollectionParser *)endswithPredicateParser { + if (!endswithPredicateParser) { + self.endswithPredicateParser = [PKSequence sequence]; + [endswithPredicateParser add:self.attrParser]; + [endswithPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"endswith"] discard]]; + [endswithPredicateParser add:self.valueParser]; + [endswithPredicateParser setAssembler:self selector:@selector(didMatchEndswithPredicate:)]; + } + return endswithPredicateParser; +} + + +// matchesPredicate = attr 'matches' value +- (PKCollectionParser *)matchesPredicateParser { + if (!matchesPredicateParser) { + self.matchesPredicateParser = [PKSequence sequence]; + [matchesPredicateParser add:self.attrParser]; + [matchesPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"matches"] discard]]; + [matchesPredicateParser add:self.valueParser]; + [matchesPredicateParser setAssembler:self selector:@selector(didMatchMatchesPredicate:)]; + } + return matchesPredicateParser; +} + + +// value = QuotedString | Number | bool +- (PKCollectionParser *)valueParser { + if (!valueParser) { + self.valueParser = [PKAlternation alternation]; + [valueParser add:self.stringParser]; + [valueParser add:self.numberParser]; + [valueParser add:self.boolParser]; + } + return valueParser; +} + + +- (PKCollectionParser *)boolParser { + if (!boolParser) { + self.boolParser = [PKAlternation alternation]; + [boolParser add:self.trueParser]; + [boolParser add:self.falseParser]; + [boolParser setAssembler:self selector:@selector(didMatchBool:)]; + } + return boolParser; +} + + +- (PKParser *)trueParser { + if (!trueParser) { + self.trueParser = [[PKCaseInsensitiveLiteral literalWithString:@"true"] discard]; + [trueParser setAssembler:self selector:@selector(didMatchTrue:)]; + } + return trueParser; +} + + +- (PKParser *)falseParser { + if (!falseParser) { + self.falseParser = [[PKCaseInsensitiveLiteral literalWithString:@"false"] discard]; + [falseParser setAssembler:self selector:@selector(didMatchFalse:)]; + } + return falseParser; +} + + +- (PKParser *)stringParser { + if (!stringParser) { + self.stringParser = [PKQuotedString quotedString]; + [stringParser setAssembler:self selector:@selector(didMatchString:)]; + } + return stringParser; +} + + +- (PKParser *)numberParser { + if (!numberParser) { + self.numberParser = [PKNumber number]; + [numberParser setAssembler:self selector:@selector(didMatchNumber:)]; + } + return numberParser; +} + + +- (void)didMatchAnd:(PKAssembly *)a { + NSNumber *b2 = [a pop]; + NSNumber *b1 = [a pop]; + BOOL yn = ([b1 boolValue] && [b2 boolValue]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchOr:(PKAssembly *)a { + NSNumber *b2 = [a pop]; + NSNumber *b1 = [a pop]; + BOOL yn = ([b1 boolValue] || [b2 boolValue]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchEqStringPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = [[delegate valueForAttributeKey:attrKey] isEqual:value]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchEqNumberPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = [value isEqualToNumber:[delegate valueForAttributeKey:attrKey]]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchEqBoolPredicate:(PKAssembly *)a { + NSNumber *b = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = ([delegate boolForAttributeKey:attrKey] == [b boolValue]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchNeStringPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + + BOOL yn = ![[delegate valueForAttributeKey:attrKey] isEqual:value]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchNeNumberPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = ![value isEqualToNumber:[delegate valueForAttributeKey:attrKey]]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchNeBoolPredicate:(PKAssembly *)a { + NSNumber *b = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = ([delegate boolForAttributeKey:attrKey] != [b boolValue]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchGtPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = (NSOrderedDescending == [[delegate valueForAttributeKey:attrKey] compare:value]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchGteqPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = (NSOrderedAscending != [[delegate valueForAttributeKey:attrKey] compare:value]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchLtPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = (NSOrderedAscending == [[delegate valueForAttributeKey:attrKey] compare:value]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchLteqPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = (NSOrderedDescending != [[delegate valueForAttributeKey:attrKey] compare:value]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchBeginswithPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = [[delegate valueForAttributeKey:attrKey] hasPrefix:value]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchContainsPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + NSRange r = [[delegate valueForAttributeKey:attrKey] rangeOfString:value]; + BOOL yn = (NSNotFound != r.location); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchEndswithPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = [[delegate valueForAttributeKey:attrKey] hasSuffix:value]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchMatchesPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = [[delegate valueForAttributeKey:attrKey] isEqual:value]; // TODO should this be a regex match? + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchAttr:(PKAssembly *)a { + [a push:[[a pop] stringValue]]; +} + + +- (void)didMatchNegatedValue:(PKAssembly *)a { + NSNumber *b = [a pop]; + [a push:[NSNumber numberWithBool:![b boolValue]]]; +} + + +- (void)didMatchBool:(PKAssembly *)a { + NSNumber *b = [a pop]; + [a push:[NSNumber numberWithBool:[b boolValue]]]; +} + + +- (void)didMatchTrue:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:YES]]; +} + + +- (void)didMatchFalse:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:NO]]; +} + + +- (void)didMatchString:(PKAssembly *)a { + NSString *s = [[[a pop] stringValue] stringByTrimmingQuotes]; + [a push:s]; +} + + +- (void)didMatchNumber:(PKAssembly *)a { + NSNumber *b = [NSNumber numberWithFloat:[(PKToken *)[a pop] floatValue]]; + [a push:b]; +} + +@synthesize exprParser; +@synthesize orTermParser; +@synthesize termParser; +@synthesize andPrimaryExprParser; +@synthesize primaryExprParser; +@synthesize phraseParser; +@synthesize negatedPredicateParser; +@synthesize predicateParser; +@synthesize attrParser; +@synthesize tagParser; +@synthesize eqStringPredicateParser; +@synthesize eqNumberPredicateParser; +@synthesize eqBoolPredicateParser; +@synthesize neStringPredicateParser; +@synthesize neNumberPredicateParser; +@synthesize neBoolPredicateParser; +@synthesize gtPredicateParser; +@synthesize gteqPredicateParser; +@synthesize ltPredicateParser; +@synthesize lteqPredicateParser; +@synthesize beginswithPredicateParser; +@synthesize containsPredicateParser; +@synthesize endswithPredicateParser; +@synthesize matchesPredicateParser; +@synthesize valueParser; +@synthesize boolParser; +@synthesize trueParser; +@synthesize falseParser; +@synthesize stringParser; +@synthesize numberParser; +@end diff --git a/test/.svn/text-base/TDPredicateEvaluatorTest.h.svn-base b/test/.svn/text-base/TDPredicateEvaluatorTest.h.svn-base new file mode 100644 index 0000000..ba46841 --- /dev/null +++ b/test/.svn/text-base/TDPredicateEvaluatorTest.h.svn-base @@ -0,0 +1,20 @@ +// +// PKPredicateEvaluatorTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 5/28/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "TDPredicateEvaluator.h" + +@interface TDPredicateEvaluatorTest : SenTestCase { + TDPredicateEvaluator *p; + NSString *s; + PKAssembly *a; + + NSMutableDictionary *d; +} + +@end diff --git a/test/.svn/text-base/TDPredicateEvaluatorTest.m.svn-base b/test/.svn/text-base/TDPredicateEvaluatorTest.m.svn-base new file mode 100644 index 0000000..dfe1375 --- /dev/null +++ b/test/.svn/text-base/TDPredicateEvaluatorTest.m.svn-base @@ -0,0 +1,303 @@ +// +// PKPredicateEvaluatorTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 5/28/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDPredicateEvaluatorTest.h" + +@implementation TDPredicateEvaluatorTest + +- (id)valueForAttributeKey:(NSString *)key { + return [d objectForKey:key]; +} + + +- (CGFloat)floatForAttributeKey:(NSString *)key { + return [(NSNumber *)[d objectForKey:key] floatValue]; +} + + +- (BOOL)boolForAttributeKey:(NSString *)key { + return [[d objectForKey:key] boolValue]; +} + + +- (void)setUp { + d = [NSMutableDictionary dictionary]; + p = [[[TDPredicateEvaluator alloc] initWithDelegate:self] autorelease]; +} + + +- (void)testEq { + // test numbers + [d setValue:[NSNumber numberWithFloat:1.0] forKey:@"foo"]; + s = @"foo = 1.0"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/=/1.0^", [a description]); + + s = @"foo = -1.0"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/=/-1.0^", [a description]); + + + // test bools + [d setValue:[NSNumber numberWithBool:YES] forKey:@"foo"]; + s = @"foo = true"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/=/true^", [a description]); + + s = @"foo = false"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/=/false^", [a description]); + + [d setValue:[NSNumber numberWithBool:NO] forKey:@"foo"]; + s = @"foo = true"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/=/true^", [a description]); + + s = @"foo = false"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/=/false^", [a description]); + + + // test strings + [d setValue:@"bar" forKey:@"foo"]; + s = @"foo = 'bar'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/=/'bar'^", [a description]); + + s = @"foo = 'baz'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/=/'baz'^", [a description]); +} + + +- (void)testNe { + // test numbers + [d setValue:[NSNumber numberWithFloat:1.0] forKey:@"foo"]; + s = @"foo != 1.0"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/!=/1.0^", [a description]); + + s = @"foo != -1.0"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/!=/-1.0^", [a description]); + + + // test bools + [d setValue:[NSNumber numberWithBool:YES] forKey:@"foo"]; + s = @"foo != true"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/!=/true^", [a description]); + + s = @"foo != false"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/!=/false^", [a description]); + + [d setValue:[NSNumber numberWithBool:NO] forKey:@"foo"]; + s = @"foo != true"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/!=/true^", [a description]); + + s = @"foo != false"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/!=/false^", [a description]); + + + // test strings + [d setValue:@"bar" forKey:@"foo"]; + s = @"foo != 'bar'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/!=/'bar'^", [a description]); + + s = @"foo != 'baz'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/!=/'baz'^", [a description]); +} + + +- (void)testGt { + [d setValue:[NSNumber numberWithInteger:41] forKey:@"foo"]; + s = @"foo > 42"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/>/42^", [a description]); + + [d setValue:[NSNumber numberWithInteger:43] forKey:@"foo"]; + s = @"foo > 42"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/>/42^", [a description]); + + [d setValue:[NSNumber numberWithFloat:1.2] forKey:@"foo"]; + s = @"foo > 1.2"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/>/1.2^", [a description]); + + [d setValue:[NSNumber numberWithFloat:1.2001] forKey:@"foo"]; + s = @"foo > 1.2"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/>/1.2^", [a description]); +} + + +- (void)testLt { + [d setValue:[NSNumber numberWithInteger:41] forKey:@"foo"]; + s = @"foo < .3"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/= 42"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/>=/42^", [a description]); + + [d setValue:[NSNumber numberWithFloat:41.99] forKey:@"foo"]; + s = @"foo >= 42"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/>=/42^", [a description]); + + [d setValue:[NSNumber numberWithInteger:42] forKey:@"foo"]; + s = @"foo >= 42"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/>=/42^", [a description]); +} + + +- (void)testLteq { + [d setValue:[NSNumber numberWithInteger:41] forKey:@"foo"]; + s = @"foo <= .3"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/<=/.3^", [a description]); + + [d setValue:[NSNumber numberWithFloat:.3] forKey:@"foo"]; + s = @"foo <= .3"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/<=/.3^", [a description]); + + [d setValue:[NSNumber numberWithFloat:.3111] forKey:@"foo"]; + s = @"foo <= .3"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/<=/.3^", [a description]); +} + + +- (void)testBeginswith { + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo beginswith 'foo'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/beginswith/'foo'^", [a description]); + + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo beginswith 'bar'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/beginswith/'bar'^", [a description]); +} + + +- (void)testContains { + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo contains 'baz'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/contains/'baz'^", [a description]); + + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo contains 'bat'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/contains/'bat'^", [a description]); +} + + +- (void)testEndswith { + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo endswith 'baz'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/endswith/'baz'^", [a description]); + + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo endswith 'bat'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/endswith/'bat'^", [a description]); +} + + +- (void)testMatches { + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo matches 'baz'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/matches/'baz'^", [a description]); +} + + +- (void)testBools { + s = @"true"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[1]true^", [a description]); + + s = @"not true"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0]not/true^", [a description]); + + s = @"false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0]false^", [a description]); + + s = @"not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[1]not/false^", [a description]); + + s = @"true and false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0]true/and/false^", [a description]); + + s = @"not true and false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0]not/true/and/false^", [a description]); + + s = @"not true and not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0]not/true/and/not/false^", [a description]); + + s = @"true or false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[1]true/or/false^", [a description]); + + s = @"(true and false) or false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0](/true/and/false/)/or/false^", [a description]); + + s = @"(true and false) or not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[1](/true/and/false/)/or/not/false^", [a description]); +} + +@end diff --git a/test/.svn/text-base/TDQuoteStateTest.h.svn-base b/test/.svn/text-base/TDQuoteStateTest.h.svn-base new file mode 100644 index 0000000..117ae2f --- /dev/null +++ b/test/.svn/text-base/TDQuoteStateTest.h.svn-base @@ -0,0 +1,17 @@ +// +// QuoteStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/21/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + + +@interface TDQuoteStateTest : SenTestCase { + PKQuoteState *quoteState; + PKReader *r; + NSString *s; +} +@end diff --git a/test/.svn/text-base/TDQuoteStateTest.m.svn-base b/test/.svn/text-base/TDQuoteStateTest.m.svn-base new file mode 100644 index 0000000..801a3ab --- /dev/null +++ b/test/.svn/text-base/TDQuoteStateTest.m.svn-base @@ -0,0 +1,104 @@ +// +// PKQuoteStateTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/21/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDQuoteStateTest.h" + + +@implementation TDQuoteStateTest + +- (void)setUp { + quoteState = [[PKQuoteState alloc] init]; + r = [[PKReader alloc] init]; +} + + +- (void)tearDown { + [quoteState release]; + [r release]; +} + + +- (void)testQuotedString { + s = @"'stuff'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + +} + + +- (void)testQuotedStringEOFTerminated { + s = @"'stuff"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); +} + + +- (void)testQuotedStringRepairEOFTerminated { + s = @"'stuff"; + r.string = s; + quoteState.balancesEOFTerminatedQuotes = YES; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"'stuff'", tok.stringValue); +} + + +- (void)testQuotedStringPlus { + s = @"'a quote here' more"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"'a quote here'", tok.stringValue); +} + + +- (void)test14CharQuotedString { + s = @"'123456789abcef'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDTrue(tok.isQuotedString); +} + + +- (void)test15CharQuotedString { + s = @"'123456789abcefg'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDTrue(tok.isQuotedString); +} + + +- (void)test16CharQuotedString { + s = @"'123456789abcefgh'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDTrue(tok.isQuotedString); +} + + +- (void)test31CharQuotedString { + s = @"'123456789abcefgh123456789abcefg'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDTrue(tok.isQuotedString); +} + + +- (void)test32CharQuotedString { + s = @"'123456789abcefgh123456789abcefgh'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDTrue(tok.isQuotedString); +} + +@end diff --git a/test/.svn/text-base/TDReaderTest.h.svn-base b/test/.svn/text-base/TDReaderTest.h.svn-base new file mode 100644 index 0000000..fc9c2ac --- /dev/null +++ b/test/.svn/text-base/TDReaderTest.h.svn-base @@ -0,0 +1,16 @@ +// +// PKReaderTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/21/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDReaderTest : SenTestCase { + PKReader *reader; + NSString *string; +} + +@end diff --git a/test/.svn/text-base/TDReaderTest.m.svn-base b/test/.svn/text-base/TDReaderTest.m.svn-base new file mode 100644 index 0000000..6a8c88c --- /dev/null +++ b/test/.svn/text-base/TDReaderTest.m.svn-base @@ -0,0 +1,78 @@ +// +// PKReaderTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/21/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDReaderTest.h" + + +@implementation TDReaderTest + +- (void)setUp { + string = @"abcdefghijklmnopqrstuvwxyz"; + [string retain]; + reader = [[PKReader alloc] initWithString:string]; +} + + +- (void)tearDown { + [string release]; + [reader release]; +} + + +#pragma mark - + +- (void)testReadCharsMatch { + TDNotNil(reader); + NSInteger len = [string length]; + PKUniChar c; + NSInteger i = 0; + for ( ; i < len; i++) { + c = [string characterAtIndex:i]; + TDEquals(c, [reader read]); + } +} + + +- (void)testReadTooFar { + NSInteger len = [string length]; + NSInteger i = 0; + for ( ; i < len; i++) { + [reader read]; + } + TDEquals(PKEOF, [reader read]); +} + + +- (void)testUnread { + [reader read]; + [reader unread]; + PKUniChar a = 'a'; + TDEquals(a, [reader read]); + + [reader read]; + [reader read]; + [reader unread]; + PKUniChar c = 'c'; + TDEquals(c, [reader read]); +} + + +- (void)testUnreadTooFar { + [reader unread]; + PKUniChar a = 'a'; + TDEquals(a, [reader read]); + + [reader unread]; + [reader unread]; + [reader unread]; + [reader unread]; + PKUniChar a2 = 'a'; + TDEquals(a2, [reader read]); +} + +@end diff --git a/test/.svn/text-base/TDRegularParser.h.svn-base b/test/.svn/text-base/TDRegularParser.h.svn-base new file mode 100644 index 0000000..a4ea92b --- /dev/null +++ b/test/.svn/text-base/TDRegularParser.h.svn-base @@ -0,0 +1,35 @@ +// +// PKRegularParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface TDRegularParser : PKSequence { + PKCollectionParser *expressionParser; + PKCollectionParser *termParser; + PKCollectionParser *orTermParser; + PKCollectionParser *factorParser; + PKCollectionParser *nextFactorParser; + PKCollectionParser *phraseParser; + PKCollectionParser *phraseStarParser; + PKCollectionParser *phrasePlusParser; + PKCollectionParser *phraseQuestionParser; + PKCollectionParser *letterOrDigitParser; +} ++ (id)parserFromGrammar:(NSString *)s; + +@property (retain) PKCollectionParser *expressionParser; +@property (retain) PKCollectionParser *termParser; +@property (retain) PKCollectionParser *orTermParser; +@property (retain) PKCollectionParser *factorParser; +@property (retain) PKCollectionParser *nextFactorParser; +@property (retain) PKCollectionParser *phraseParser; +@property (retain) PKCollectionParser *phraseStarParser; +@property (retain) PKCollectionParser *phrasePlusParser; +@property (retain) PKCollectionParser *phraseQuestionParser; +@property (retain) PKCollectionParser *letterOrDigitParser; +@end diff --git a/test/.svn/text-base/TDRegularParser.m.svn-base b/test/.svn/text-base/TDRegularParser.m.svn-base new file mode 100644 index 0000000..a7c1fa4 --- /dev/null +++ b/test/.svn/text-base/TDRegularParser.m.svn-base @@ -0,0 +1,315 @@ +// +// PKRegularParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDRegularParser.h" + +@interface TDRegularParser () +- (void)didMatchChar:(PKAssembly *)a; +- (void)didMatchStar:(PKAssembly *)a; +- (void)didMatchPlus:(PKAssembly *)a; +- (void)didMatchQuestion:(PKAssembly *)a; +//- (void)didMatchAnd:(PKAssembly *)a; +- (void)didMatchOr:(PKAssembly *)a; +- (void)didMatchExpression:(PKAssembly *)a; +@end + +@implementation TDRegularParser + +- (id)init { + if (self = [super init]) { + [self add:self.expressionParser]; + } + return self; +} + + +- (void)dealloc { + self.expressionParser = nil; + self.termParser = nil; + self.orTermParser = nil; + self.factorParser = nil; + self.nextFactorParser = nil; + self.phraseParser = nil; + self.phraseStarParser = nil; + self.phrasePlusParser = nil; + self.phraseQuestionParser = nil; + self.letterOrDigitParser = nil; + [super dealloc]; +} + + ++ (id)parserFromGrammar:(NSString *)s { + TDRegularParser *p = [TDRegularParser parser]; + PKAssembly *a = [PKCharacterAssembly assemblyWithString:s]; + a = [p completeMatchFor:a]; + return [a pop]; +} + + +// expression = term orTerm* +// term = factor nextFactor* +// orTerm = '|' term +// factor = phrase | phraseStar | phrasePlus | phraseQuestion +// nextFactor = factor +// phrase = letterOrDigit | '(' expression ')' +// phraseStar = phrase '*' +// phraseStar = phrase '+' +// phraseStar = phrase '?' +// letterOrDigit = Letter | Digit + + +// expression = term orTerm* +- (PKCollectionParser *)expressionParser { + if (!expressionParser) { + self.expressionParser = [PKSequence sequence]; + expressionParser.name = @"expression"; + [expressionParser add:self.termParser]; + [expressionParser add:[PKRepetition repetitionWithSubparser:self.orTermParser]]; + [expressionParser setAssembler:self selector:@selector(didMatchExpression:)]; + } + return expressionParser; +} + + +// term = factor nextFactor* +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + termParser.name = @"term"; + [termParser add:self.factorParser]; + [termParser add:[PKRepetition repetitionWithSubparser:self.nextFactorParser]]; + } + return termParser; +} + + +// orTerm = '|' term +- (PKCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [PKSequence sequence]; + orTermParser.name = @"orTerm"; + [orTermParser add:[[PKSpecificChar specificCharWithChar:'|'] discard]]; + [orTermParser add:self.termParser]; + [orTermParser setAssembler:self selector:@selector(didMatchOr:)]; + } + return orTermParser; +} + + +// factor = phrase | phraseStar | phrasePlus | phraseQuestion +- (PKCollectionParser *)factorParser { + if (!factorParser) { + self.factorParser = [PKAlternation alternation]; + factorParser.name = @"factor"; + [factorParser add:self.phraseParser]; + [factorParser add:self.phraseStarParser]; + [factorParser add:self.phrasePlusParser]; + [factorParser add:self.phraseQuestionParser]; + } + return factorParser; +} + + +// nextFactor = factor +- (PKCollectionParser *)nextFactorParser { + if (!nextFactorParser) { + self.nextFactorParser = [PKAlternation alternation]; + nextFactorParser.name = @"nextFactor"; + [nextFactorParser add:self.phraseParser]; + [nextFactorParser add:self.phraseStarParser]; + [nextFactorParser add:self.phrasePlusParser]; + [nextFactorParser add:self.phraseQuestionParser]; +// [nextFactorParser setAssembler:self selector:@selector(didMatchAnd:)]; + } + return nextFactorParser; +} + + +// phrase = letterOrDigit | '(' expression ')' +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + PKSequence *s = [PKSequence sequence]; + [s add:[[PKSpecificChar specificCharWithChar:'('] discard]]; + [s add:self.expressionParser]; + [s add:[[PKSpecificChar specificCharWithChar:')'] discard]]; + + self.phraseParser = [PKAlternation alternation]; + phraseParser.name = @"phrase"; + [phraseParser add:self.letterOrDigitParser]; + [phraseParser add:s]; + } + return phraseParser; +} + + +// phraseStar = phrase '*' +- (PKCollectionParser *)phraseStarParser { + if (!phraseStarParser) { + self.phraseStarParser = [PKSequence sequence]; + phraseStarParser.name = @"phraseStar"; + [phraseStarParser add:self.phraseParser]; + [phraseStarParser add:[[PKSpecificChar specificCharWithChar:'*'] discard]]; + [phraseStarParser setAssembler:self selector:@selector(didMatchStar:)]; + } + return phraseStarParser; +} + + +// phrasePlus = phrase '+' +- (PKCollectionParser *)phrasePlusParser { + if (!phrasePlusParser) { + self.phrasePlusParser = [PKSequence sequence]; + phrasePlusParser.name = @"phrasePlus"; + [phrasePlusParser add:self.phraseParser]; + [phrasePlusParser add:[[PKSpecificChar specificCharWithChar:'+'] discard]]; + [phrasePlusParser setAssembler:self selector:@selector(didMatchPlus:)]; + } + return phrasePlusParser; +} + + +// phrasePlus = phrase '?' +- (PKCollectionParser *)phraseQuestionParser { + if (!phraseQuestionParser) { + self.phraseQuestionParser = [PKSequence sequence]; + phraseQuestionParser.name = @"phraseQuestion"; + [phraseQuestionParser add:self.phraseParser]; + [phraseQuestionParser add:[[PKSpecificChar specificCharWithChar:'?'] discard]]; + [phraseQuestionParser setAssembler:self selector:@selector(didMatchQuestion:)]; + } + return phraseQuestionParser; +} + + +// letterOrDigit = Letter | Digit +- (PKCollectionParser *)letterOrDigitParser { + if (!letterOrDigitParser) { + self.letterOrDigitParser = [PKAlternation alternation]; + letterOrDigitParser.name = @"letterOrDigit"; + [letterOrDigitParser add:[PKLetter letter]]; + [letterOrDigitParser add:[PKDigit digit]]; + [letterOrDigitParser setAssembler:self selector:@selector(didMatchChar:)]; + } + return letterOrDigitParser; +} + + +- (void)didMatchChar:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + id obj = [a pop]; + NSAssert([obj isKindOfClass:[NSNumber class]], @""); + NSInteger c = [obj integerValue]; + [a push:[PKSpecificChar specificCharWithChar:c]]; +} + + +- (void)didMatchStar:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + NSAssert([top isKindOfClass:[PKParser class]], @""); + PKRepetition *rep = [PKRepetition repetitionWithSubparser:top]; + [a push:rep]; +} + + +- (void)didMatchPlus:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + NSAssert([top isKindOfClass:[PKParser class]], @""); + PKSequence *seq = [PKSequence sequence]; + [seq add:top]; + [seq add:[PKRepetition repetitionWithSubparser:top]]; + [a push:seq]; +} + + +- (void)didMatchQuestion:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + NSAssert([top isKindOfClass:[PKParser class]], @""); + PKAlternation *alt = [PKAlternation alternation]; + [alt add:[PKEmpty empty]]; + [alt add:top]; + [a push:alt]; +} + + +//- (void)didMatchAnd:(PKAssembly *)a { +//// NSLog(@"%s", _cmd); +//// NSLog(@"a: %@", a); +// id second = [a pop]; +// id first = [a pop]; +// NSAssert([first isKindOfClass:[PKParser class]], @""); +// NSAssert([second isKindOfClass:[PKParser class]], @""); +// PKSequence *p = [PKSequence sequence]; +// [p add:first]; +// [p add:second]; +// [a push:p]; +//} + + +- (void)didMatchExpression:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + + NSAssert(![a isStackEmpty], @""); + + id obj = nil; + NSMutableArray *objs = [NSMutableArray array]; + while (![a isStackEmpty]) { + obj = [a pop]; + [objs addObject:obj]; + NSAssert([obj isKindOfClass:[PKParser class]], @""); + } + + if ([objs count] > 1) { + PKSequence *seq = [PKSequence sequence]; + for (id obj in [objs reverseObjectEnumerator]) { + [seq add:obj]; + } + [a push:seq]; + } else { + NSAssert((NSUInteger)1 == [objs count], @""); + PKParser *p = [objs objectAtIndex:0]; + [a push:p]; + } +} + + +- (void)didMatchOr:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + id second = [a pop]; + id first = [a pop]; +// NSLog(@"first: %@", first); +// NSLog(@"second: %@", second); + NSAssert(first, @""); + NSAssert(second, @""); + NSAssert([first isKindOfClass:[PKParser class]], @""); + NSAssert([second isKindOfClass:[PKParser class]], @""); + PKAlternation *p = [PKAlternation alternation]; + [p add:first]; + [p add:second]; + [a push:p]; +} + +@synthesize expressionParser; +@synthesize termParser; +@synthesize orTermParser; +@synthesize factorParser; +@synthesize nextFactorParser; +@synthesize phraseParser; +@synthesize phraseStarParser; +@synthesize phrasePlusParser; +@synthesize phraseQuestionParser; +@synthesize letterOrDigitParser; +@end diff --git a/test/.svn/text-base/TDRegularParserTest.h.svn-base b/test/.svn/text-base/TDRegularParserTest.h.svn-base new file mode 100644 index 0000000..89638f3 --- /dev/null +++ b/test/.svn/text-base/TDRegularParserTest.h.svn-base @@ -0,0 +1,19 @@ +// +// PKRegularParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "TDRegularParser.h" + +@interface TDRegularParserTest : SenTestCase { + NSString *s; + PKCharacterAssembly *a; + TDRegularParser *p; + PKAssembly *res; +} + +@end diff --git a/test/.svn/text-base/TDRegularParserTest.m.svn-base b/test/.svn/text-base/TDRegularParserTest.m.svn-base new file mode 100644 index 0000000..6e608b0 --- /dev/null +++ b/test/.svn/text-base/TDRegularParserTest.m.svn-base @@ -0,0 +1,401 @@ +// +// PKRegularParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDRegularParserTest.h" + +@implementation TDRegularParserTest + +- (void)setUp { + p = [TDRegularParser parser]; +} + + +- (void)testAabPlus { + s = @"aab+"; + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"aabbbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a, a, b, b, b, b]aabbbb^", [res description]); +} + + +- (void)testAabStar { + s = @"aab*"; + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"aabbbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a, a, b, b, b, b]aabbbb^", [res description]); +} + + +- (void)testAabQuestion { + s = @"aab?"; + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"aabbbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a, a, b]aab^bbb", [res description]); +} + + +- (void)testAb { + s = @"ab"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]ab^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + TDEquals((NSUInteger)2, [seq.subparsers count]); + + PKSpecificChar *c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + c = [seq.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"ab"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a, b]ab^", [res description]); +} + + +- (void)testAbc { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]abc^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + TDEquals((NSUInteger)3, [seq.subparsers count]); + + PKSpecificChar *c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + c = [seq.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + c = [seq.subparsers objectAtIndex:2]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"c", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a, b, c]abc^", [res description]); +} + + +- (void)testAOrB { + s = @"a|b"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]a|b^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"b"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b]b^", [res description]); +} + + +- (void)test4Or7 { + s = @"4|7"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]4|7^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"4", c.string); + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"7", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"4"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[4]4^", [res description]); +} + + +- (void)testAOrBStar { + s = @"a|b*"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]a|b*^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + PKRepetition *rep = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKRepetition class], [rep class]); + c = (PKSpecificChar *)rep.subparser; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"bbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b, b, b]bbb^", [res description]); +} + + +- (void)testAOrBPlus { + s = @"a|b+"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]a|b+^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + PKSequence *seq = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKSequence class], [seq class]); + + c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + PKRepetition *rep = [seq.subparsers objectAtIndex:1]; + TDEqualObjects([PKRepetition class], [rep class]); + c = (PKSpecificChar *)rep.subparser; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"bbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b, b, b]bbb^", [res description]); + + s = @"abbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a]a^bbb", [res description]); +} + + +- (void)testAOrBQuestion { + s = @"a|b?"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]a|b?^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + alt = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKAlternation class], [alt class]); + + PKEmpty *e = [alt.subparsers objectAtIndex:0]; + TDTrue([e isMemberOfClass:[PKEmpty class]]); + + c = (PKSpecificChar *)[alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"bbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b]b^bb", [res description]); + + s = @"abbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a]a^bbb", [res description]); +} + + +- (void)testParenAOrBParenStar { + s = @"(a|b)*"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Repetition](a|b)*^", [res description]); + PKRepetition *rep = [res pop]; + TDTrue([rep isMemberOfClass:[PKRepetition class]]); + + PKAlternation *alt = (PKAlternation *)rep.subparser; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKRepetition class]]); + s = @"bbbaaa"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b, b, b, a, a, a]bbbaaa^", [res description]); +} + + +- (void)testParenAOrBParenPlus { + s = @"(a|b)+"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence](a|b)+^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + + TDEquals((NSUInteger)2, [seq.subparsers count]); + + PKAlternation *alt = [seq.subparsers objectAtIndex:0]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + PKRepetition *rep = [seq.subparsers objectAtIndex:1]; + TDTrue([rep isMemberOfClass:[PKRepetition class]]); + + alt = (PKAlternation *)rep.subparser; + TDEqualObjects([PKAlternation class], [alt class]); + + c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"bbbaaa"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b, b, b, a, a, a]bbbaaa^", [res description]); +} + + +- (void)testParenAOrBParenQuestion { + s = @"(a|b)?"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation](a|b)?^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + + TDEquals((NSUInteger)2, [alt.subparsers count]); + PKEmpty *e = [alt.subparsers objectAtIndex:0]; + TDTrue([PKEmpty class] == [e class]); + + alt = [alt.subparsers objectAtIndex:1]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"bbbaaa"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b]b^bbaaa", [res description]); +} + +@end diff --git a/test/.svn/text-base/TDRepetitionTest.h.svn-base b/test/.svn/text-base/TDRepetitionTest.h.svn-base new file mode 100644 index 0000000..1cf4e54 --- /dev/null +++ b/test/.svn/text-base/TDRepetitionTest.h.svn-base @@ -0,0 +1,17 @@ +// +// PKRepetitionTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDRepetitionTest : SenTestCase { + PKParser *p; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDRepetitionTest.m.svn-base b/test/.svn/text-base/TDRepetitionTest.m.svn-base new file mode 100644 index 0000000..c97c2cd --- /dev/null +++ b/test/.svn/text-base/TDRepetitionTest.m.svn-base @@ -0,0 +1,222 @@ +// +// PKRepetitionTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDRepetitionTest.h" + +@interface PKParser () +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@implementation TDRepetitionTest + +- (void)setUp { +} + + +- (void)tearDown { + [a release]; + [p release]; +} + + +#pragma mark - + +- (void)testWordRepetitionAllMatchesForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + NSSet *all = [p allMatchesFor:[NSSet setWithObject:a]]; + NSLog(@"all: %@", all); + + TDNotNil(all); + NSUInteger c = [all count]; + TDEquals((NSUInteger)4, c); +} + + +- (void)testWordRepetitionBestMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + + PKAssembly *result = [p bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [result description]); +} + + +- (void)testWordRepetitionBestMatchForFooSpaceBarSpace123 { + s = @"foo bar 123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, bar]foo/bar^123", [result description]); +} + + +- (void)testWordRepetitionAllMatchesForFooSpaceBarSpace123 { + s = @"foo bar 123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + NSSet *all = [p allMatchesFor:[NSSet setWithObject:a]]; + NSLog(@"all: %@", all); + + TDNotNil(all); + NSUInteger c = [all count]; + TDEquals((NSUInteger)3, c); +} + + +- (void)testWordRepetitionAllMatchesFooSpace123SpaceBaz { + s = @"foo 123 baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + NSSet *all = [p allMatchesFor:[NSSet setWithObject:a]]; + NSLog(@"all: %@", all); + + TDNotNil(all); + NSUInteger c = [all count]; + TDEquals((NSUInteger)2, c); +} + + +- (void)testNumRepetitionAllMatchesForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKNumber number]]; + + NSSet *all = [p allMatchesFor:[NSSet setWithObject:a]]; + NSLog(@"all: %@", all); + + TDNotNil(all); + NSUInteger c = [all count]; + TDEquals((NSUInteger)1, c); +} + + +- (void)testWordRepetitionCompleteMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [result description]); +} + + +- (void)testWordRepetitionCompleteMatchForFooSpaceBarSpace123 { + s = @"foo bar 123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testWordRepetitionCompleteMatchFor456SpaceBarSpace123 { + s = @"456 bar 123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testNumRepetitionCompleteMatchFor456SpaceBarSpace123 { + s = @"456 bar 123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKNumber number]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testNumRepetitionAllMatchesFor123Space456SpaceBaz { + s = @"123 456 baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKNumber number]]; + + NSSet *all = [p allMatchesFor:[NSSet setWithObject:a]]; + + TDNotNil(all); + NSInteger c = [all count]; + TDEquals((NSUInteger)3, (NSUInteger)c); +} + + +- (void)testNumRepetitionBestMatchFor123Space456SpaceBaz { + s = @"123 456 baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKNumber number]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123, 456]123/456^baz", [result description]); +} + + +- (void)testNumRepetitionCompleteMatchFor123 { + s = @"123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKNumber number]]; + + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123]123^", [result description]); +} + + +- (void)testWordRepetitionCompleteMatchFor123 { + s = @"123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + + +- (void)testWordRepetitionBestMatchForFoo { + s = @"foo"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo]foo^", [result description]); +} + +@end diff --git a/test/.svn/text-base/TDReservedWord.h.svn-base b/test/.svn/text-base/TDReservedWord.h.svn-base new file mode 100644 index 0000000..a2028c2 --- /dev/null +++ b/test/.svn/text-base/TDReservedWord.h.svn-base @@ -0,0 +1,17 @@ +// +// PKReservedWord.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface TDReservedWord : PKWord { + +} + ++ (void)setReservedWords:(NSArray *)inWords; +@end diff --git a/test/.svn/text-base/TDReservedWord.m.svn-base b/test/.svn/text-base/TDReservedWord.m.svn-base new file mode 100644 index 0000000..417fa09 --- /dev/null +++ b/test/.svn/text-base/TDReservedWord.m.svn-base @@ -0,0 +1,43 @@ +// +// PKReservedWord.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +static NSArray *sTDReservedWords = nil; + +@interface TDReservedWord () ++ (NSArray *)reservedWords; +@end + +@implementation TDReservedWord + ++ (NSArray *)reservedWords { + return [[sTDReservedWords retain] autorelease]; +} + + ++ (void)setReservedWords:(NSArray *)inWords { + if (inWords != sTDReservedWords) { + [sTDReservedWords autorelease]; + sTDReservedWords = [inWords copy]; + } +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + if (!tok.isWord) { + return NO; + } + + NSString *s = tok.stringValue; + return [s length] && [[TDReservedWord reservedWords] containsObject:s]; +} + +@end diff --git a/test/.svn/text-base/TDReservedWordTest.h.svn-base b/test/.svn/text-base/TDReservedWordTest.h.svn-base new file mode 100644 index 0000000..6f08d3f --- /dev/null +++ b/test/.svn/text-base/TDReservedWordTest.h.svn-base @@ -0,0 +1,15 @@ +// +// PKReservedWordTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDReservedWordTest : SenTestCase { + +} + +@end diff --git a/test/.svn/text-base/TDReservedWordTest.m.svn-base b/test/.svn/text-base/TDReservedWordTest.m.svn-base new file mode 100644 index 0000000..b5c7767 --- /dev/null +++ b/test/.svn/text-base/TDReservedWordTest.m.svn-base @@ -0,0 +1,41 @@ +// +// PKReservedWordTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDReservedWordTest.h" +#import "ParseKit.h" + +@implementation TDReservedWordTest + +- (void)testFoobar { + NSString *s = @"Foobar"; + [TDReservedWord setReservedWords:[NSArray arrayWithObject:@"Foobar"]]; + + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [TDReservedWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[Foobar]Foobar^", [result description]); +// TDNil(result); +} + + +- (void)testfoobar { + NSString *s = @"foobar"; + [TDReservedWord setReservedWords:[NSArray arrayWithObject:@"Foobar"]]; + + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [TDReservedWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + +@end diff --git a/test/.svn/text-base/TDRobotCommandTest.h.svn-base b/test/.svn/text-base/TDRobotCommandTest.h.svn-base new file mode 100644 index 0000000..897ed44 --- /dev/null +++ b/test/.svn/text-base/TDRobotCommandTest.h.svn-base @@ -0,0 +1,15 @@ +// +// PKRobotCommandTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDRobotCommandTest : SenTestCase { + +} + +@end diff --git a/test/.svn/text-base/TDRobotCommandTest.m.svn-base b/test/.svn/text-base/TDRobotCommandTest.m.svn-base new file mode 100644 index 0000000..0b2936e --- /dev/null +++ b/test/.svn/text-base/TDRobotCommandTest.m.svn-base @@ -0,0 +1,177 @@ +// +// PKRobotCommandTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDRobotCommandTest.h" + +@interface RobotCommand : NSObject { + NSString *location; +} +@property (copy) NSString *location; +@end + +@implementation RobotCommand + +- (void)dealloc { + self.location = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + RobotCommand *c = [[RobotCommand allocWithZone:zone] init]; + c->location = [location copy]; + return c; +} + +@synthesize location; +@end + +@interface RobotPickCommand : RobotCommand {} +@end +@implementation RobotPickCommand +- (NSString *)description { return [NSString stringWithFormat:@"pick %@", self.location]; } +@end + +@interface RobotPlaceCommand : RobotCommand {} +@end +@implementation RobotPlaceCommand +- (NSString *)description { return [NSString stringWithFormat:@"place %@", self.location]; } +@end + +@interface RobotScanCommand : RobotCommand {} +@end +@implementation RobotScanCommand +- (NSString *)description { return [NSString stringWithFormat:@"scan %@", self.location]; } +@end + +@implementation TDRobotCommandTest + +// e = command* +// command = pickCommand | placeCommand | scanCommand +// pickCommand = "pick" "carrier" "from" location +// placeCommand = "place" "carrier" "at" location +// scanCommand = "scan" location +// location = Word + +- (PKParser *)location { + return [PKWord word]; +} + + +- (PKParser *)pickCommand { + PKSequence *s = [PKSequence sequence]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"pick"] discard]]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"carrier"] discard]]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"from"] discard]]; + [s add:[self location]]; + [s setAssembler:self selector:@selector(didMatchPickCommand:)]; + return s; +} + + +- (PKParser *)placeCommand { + PKSequence *s = [PKSequence sequence]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"place"] discard]]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"carrier"] discard]]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"at"] discard]]; + [s add:[self location]]; + [s setAssembler:self selector:@selector(didMatchPlaceCommand:)]; + return s; +} + + +- (PKParser *)scanCommand { + PKSequence *s = [PKSequence sequence]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"scan"] discard]]; + [s add:[self location]]; + [s setAssembler:self selector:@selector(didMatchScanCommand:)]; + return s; +} + + +- (PKParser *)command { + PKAlternation *a = [PKAlternation alternation]; + [a add:[self pickCommand]]; + [a add:[self placeCommand]]; + [a add:[self scanCommand]]; + return a; +} + + +- (void)testPick { + NSString *s1 = @"pick carrier from LINE_IN"; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithString:s1]; + PKParser *p = [self command]; + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[]pick/carrier/from/LINE_IN^", [result description]); + + id target = result.target; + TDNotNil(target); + TDEqualObjects(@"pick LINE_IN", [target description]); +} + + +- (void)testPlace { + NSString *s2 = @"place carrier at LINE_OUT"; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithString:s2]; + PKParser *p = [self command]; + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[]place/carrier/at/LINE_OUT^", [result description]); + + id target = result.target; + TDNotNil(target); + TDEqualObjects(@"place LINE_OUT", [target description]); +} + + +- (void)testScan { + NSString *s3 = @"scan DB101_OUT"; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithString:s3]; + PKParser *p = [self command]; + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[]scan/DB101_OUT^", [result description]); + + id target = result.target; + TDNotNil(target); + TDEqualObjects(@"scan DB101_OUT", [target description]); +} + + +- (void)didMatchPickCommand:(PKAssembly *)a { + RobotPickCommand *c = [[[RobotPickCommand alloc] init] autorelease]; + PKToken *location = [a pop]; + c.location = location.stringValue; + a.target = c; +} + + +- (void)didMatchPlaceCommand:(PKAssembly *)a { + RobotPlaceCommand *c = [[[RobotPlaceCommand alloc] init] autorelease]; + PKToken *location = [a pop]; + c.location = location.stringValue; + a.target = c; +} + + +- (void)didMatchScanCommand:(PKAssembly *)a { + RobotScanCommand *c = [[[RobotScanCommand alloc] init] autorelease]; + PKToken *location = [a pop]; + c.location = location.stringValue; + a.target = c; +} + +@end diff --git a/test/.svn/text-base/TDScientificNumberStateTest.h.svn-base b/test/.svn/text-base/TDScientificNumberStateTest.h.svn-base new file mode 100644 index 0000000..30e9988 --- /dev/null +++ b/test/.svn/text-base/TDScientificNumberStateTest.h.svn-base @@ -0,0 +1,18 @@ +// +// PKScientificNumberStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDScientificNumberStateTest : SenTestCase { + PKNumberState *numberState; + PKTokenizer *t; + PKReader *r; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDScientificNumberStateTest.m.svn-base b/test/.svn/text-base/TDScientificNumberStateTest.m.svn-base new file mode 100644 index 0000000..e611e55 --- /dev/null +++ b/test/.svn/text-base/TDScientificNumberStateTest.m.svn-base @@ -0,0 +1,1223 @@ +// +// PKScientificNumberStateTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/25/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDScientificNumberStateTest.h" +#import "TDArithmeticParser.h" + +@implementation TDScientificNumberStateTest + +- (void)setUp { + t = [[PKTokenizer alloc] init]; + r = [[PKReader alloc] init]; + numberState = t.numberState; + numberState.allowsScientificNotation = YES; + [t setTokenizerState:numberState from:'0' to:'9']; + [t setTokenizerState:numberState from:'.' to:'.']; + [t setTokenizerState:numberState from:'-' to:'-']; +// NSLog(@"\n\n\n\n\n %f \n\n\n\n\n", 020); +} + + +- (void)tearDown { + [numberState release]; + [r release]; +} + + +//- (void)testScientificNumberStringArithmetic { +// t.string = @"1e2 + 1e1 + 1e0 + 1e-1 + 1e-2 + 1e-3"; +// TDArithmeticParser *p = [[[TDArithmeticParser alloc] init] autorelease]; +// PKAssembly *a = [PKTokenAssembly assemblyWithTokenizer:t]; +// PKAssembly *res = [p bestMatchFor:a]; +// PKToken *tok = [res pop]; +// TDEquals((CGFloat)111.111, tok.floatValue); +//} + + +- (void)testSingleDigit { + s = @"3"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)3.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"3", tok.stringValue); +} + + +- (void)testDoubleDigit { + s = @"47"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)47.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"47", tok.stringValue); +} + + +- (void)testTripleDigit { + s = @"654"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)654.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"654", tok.stringValue); +} + + +- (void)testSingleDigitPositive { + s = @"+3"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)3.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+3", tok.stringValue); +} + + +- (void)testDoubleDigitPositive { + s = @"+22"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)22.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)testDoubleDigitPositiveSpace { + s = @"+22 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)22.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)testMultipleDots { + s = @"1.1.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.1", tok.stringValue); + + tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".1", tok.stringValue); +} + + +- (void)testOneDot { + s = @"1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1", tok.stringValue); +} + + +- (void)testCustomOneDot1 { + s = @"1."; + t.string = s; + numberState.allowsTrailingDot = YES; + numberState.allowsScientificNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.", tok.stringValue); +} + + +- (void)testCustomOneDot2 { + s = @"1."; + t.string = s; + numberState.allowsTrailingDot = YES; + numberState.allowsScientificNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.", tok.stringValue); +} + + +- (void)testOneDotZero { + s = @"1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.0", tok.stringValue); +} + + +- (void)testPositiveOneDot { + s = @"+1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1", tok.stringValue); +} + + +- (void)testPositiveOneDotCustom { + s = @"+1."; + t.string = s; + r.string = s; + numberState.allowsTrailingDot = YES; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.", tok.stringValue); +} + + +- (void)testPositiveOneDotZero { + s = @"+1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.0", tok.stringValue); +} + + +- (void)testPositiveOneDotZeroSpace { + s = @"+1.0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.0", tok.stringValue); +} + + +- (void)testNegativeOneDot { + s = @"-1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testNegativeOneDotCustom { + s = @"-1."; + t.string = s; + r.string = s; + numberState.allowsTrailingDot = YES; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.", tok.stringValue); +} + + +- (void)testNegativeOneDotSpace { + s = @"-1. "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testNegativeOneDotZero { + s = @"-1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.0", tok.stringValue); +} + + +- (void)testNegativeOneDotZeroSpace { + s = @"-1.0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.0", tok.stringValue); +} + + +- (void)testOneDotOne { + s = @"1.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.1", tok.stringValue); +} + + +- (void)testZeroDotOne { + s = @"0.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0.1", tok.stringValue); +} + + +- (void)testDotOne { + s = @".1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".1", tok.stringValue); +} + + +- (void)testDotZero { + s = @".0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); +} + + +- (void)testNegativeDotZero { + s = @"-.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.0", tok.stringValue); +} + + +- (void)testPositiveDotZero { + s = @"+.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+.0", tok.stringValue); +} + + +- (void)testPositiveDotOne { + s = @"+.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+.1", tok.stringValue); +} + + +- (void)testNegativeDotOne { + s = @"-.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1", tok.stringValue); +} + + +- (void)testNegativeDotOneOne { + s = @"-.11"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.11, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.11", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOne { + s = @"-.111"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.111", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZero { + s = @"-.1110"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1110", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZeroZero { + s = @"-.11100"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.11100", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZeroSpace { + s = @"-.1110 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1110", tok.stringValue); +} + + +- (void)testZeroDotThreeSixtyFive { + s = @"0.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0.365", tok.stringValue); +} + + +- (void)testNegativeZeroDotThreeSixtyFive { + s = @"-0.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0.365", tok.stringValue); +} + + +- (void)testNegativeTwentyFourDotThreeSixtyFive { + s = @"-24.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-24.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-24.365", tok.stringValue); +} + + +- (void)testTwentyFourDotThreeSixtyFive { + s = @"24.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)24.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"24.365", tok.stringValue); +} + + +- (void)testZero { + s = @"0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0", tok.stringValue); +} + + +- (void)testNegativeOne { + s = @"-1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testOne { + s = @"1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1", tok.stringValue); +} + + +- (void)testPositiveOne { + s = @"+1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1", tok.stringValue); +} + + +- (void)testPositiveZero { + s = @"+0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+0", tok.stringValue); +} + + +- (void)testPositiveZeroSpace { + s = @"+0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+0", tok.stringValue); +} + + +- (void)testNegativeZero { + s = @"-0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0", tok.stringValue); +} + + +- (void)testNull { + s = @"NULL"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testNil { + s = @"nil"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testEmptyString { + s = @""; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDot { + s = @"."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDotSpace { + s = @". "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDotSpaceOne { + s = @". 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlus { + s = @"+"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlusSpace { + s = @"+ "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlusSpaceOne { + s = @"+ 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinus { + s = @"-"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinusSpace { + s = @"- "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinusSpaceOne { + s = @"- 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testInitSig { + s = @"- (id)init {"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(@"-", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); +} + + +#pragma mark - + +- (void)test1e1 { + s = @"1e1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)10.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)test1e2 { + s = @"1e2"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)100.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)test2dot0e2 { + s = @"2.0e2"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(s, tok.stringValue); +} + + +- (void)test2dot0E2 { + s = @"2.0E2"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(s, tok.stringValue); +} + + +- (void)test2e2 { + s = @"2e2"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(s, tok.stringValue); +} + + +- (void)test2eNegative2Tok { + s = @"2e-2"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.02, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(s, tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2e2Tok { + s = @"2e2"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(s, tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2e2fooTok { + s = @"2e2 foo"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2e2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2eNegative2fooTok { + s = @"2e-2 foo"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.02, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2e-2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2ePositive2fooTok { + s = @"2e+2 foo"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2e+2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2dot0ePositive2fooTok { + s = @"2.0e+2 foo"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2.0e+2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2dot0eNegative2fooTok { + s = @"2.0e-2 foo"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.02, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2.0e-2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testNotAllowsScientificNotation2dot0e2 { + s = @"2.0e2"; + t.string = s; + r.string = s; + numberState.allowsScientificNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2.0", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"e2", tok.stringValue); +} + + +- (void)testNotAllowsScientificNotation2dot0E2 { + s = @"2.0E2"; + t.string = s; + r.string = s; + numberState.allowsScientificNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2.0", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"E2", tok.stringValue); +} + + +- (void)testNotAllowsScientificNotation2e2 { + s = @"2e2"; + t.string = s; + r.string = s; + numberState.allowsScientificNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"e2", tok.stringValue); +} + + +- (void)testOctal { + s = @"020"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"020", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testOctal2 { + s = @"020"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"020", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testMinusOctal { + s = @"-020"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)-16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-020", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testMinusOctal2 { + s = @"-020"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)-16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-020", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testOctalDecimal { + s = @"020.0"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"020", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testOctalDecimal2 { + s = @"020.0"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"020", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testOctalDecimalNO { + s = @"020.0"; + t.string = s; + numberState.allowsOctalNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)20.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"020.0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHex { + s = @"0x20"; + t.string = s; + numberState.allowsOctalNotation = NO; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)32.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0x20", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHex2 { + s = @"0x20"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)32.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0x20", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testNotHex { + s = @"0x"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isWord); + TDEqualObjects(@"x", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHexAlpha { + s = @"0xA"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)10.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0xA", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); + + s = @"0xa"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + tok = [t nextToken]; + TDEquals((CGFloat)10.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0xa", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); + + s = @"0xB7"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + tok = [t nextToken]; + TDEquals((CGFloat)183.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0xB7", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); + + s = @"0x8EE"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + tok = [t nextToken]; + TDEquals((CGFloat)2286.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0x8EE", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testMinusHex { + s = @"-0x20"; + t.string = s; + numberState.allowsHexadecimalNotation = NO; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)-32.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0x20", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testMinusHex2 { + s = @"-0x20"; + t.string = s; + numberState.allowsHexadecimalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)-32.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0x20", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHexDecimal { + s = @"0x30.0"; + t.string = s; + numberState.allowsOctalNotation = NO; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)48.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0x30", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHexDecimal2 { + s = @"0x40.0"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)64.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0x40", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHexDecimal3 { + s = @"00x30.0"; + t.string = s; + numberState.allowsOctalNotation = NO; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"00", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"x30", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHexDecimal4 { + s = @"00x30.0"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"00", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"x30", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + +@end diff --git a/test/.svn/text-base/TDSequenceTest.h.svn-base b/test/.svn/text-base/TDSequenceTest.h.svn-base new file mode 100644 index 0000000..adaca13 --- /dev/null +++ b/test/.svn/text-base/TDSequenceTest.h.svn-base @@ -0,0 +1,17 @@ +// +// PKSequenceTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDSequenceTest : SenTestCase { + PKCollectionParser *p; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDSequenceTest.m.svn-base b/test/.svn/text-base/TDSequenceTest.m.svn-base new file mode 100644 index 0000000..3c83301 --- /dev/null +++ b/test/.svn/text-base/TDSequenceTest.m.svn-base @@ -0,0 +1,251 @@ +// +// PKSequenceTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDSequenceTest.h" + +@interface PKParser () +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@implementation TDSequenceTest + +- (void)tearDown { +} + +- (void)testDiscard { + s = @"foo -"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo]foo/-^", [result description]); +} + + +- (void)testDiscard2 { + s = @"foo foo -"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, foo]foo/foo/-^", [result description]); +} + + +- (void)testDiscard3 { + s = @"foo - foo"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, foo]foo/-/foo^", [result description]); +} + + +- (void)testDiscard1 { + s = @"- foo"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo]-/foo^", [result description]); +} + + +- (void)testDiscard4 { + s = @"- foo -"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo]-/foo/-^", [result description]); +} + + +- (void)testDiscard5 { + s = @"- foo + foo"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[[PKSymbol symbolWithString:@"+"] discard]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, foo]-/foo/+/foo^", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"bar"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz1 { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *foo = [PKLiteral literalWithString:@"foo"]; + PKParser *bar = [PKLiteral literalWithString:@"bar"]; + PKParser *baz = [PKLiteral literalWithString:@"baz"]; + p = [PKSequence sequenceWithSubparsers:foo, baz, bar, nil]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNil(result); +} + + +- (void)testFalseLiteralBestMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p bestMatchFor:a]; + TDNil(result); +} + + +- (void)testTrueLiteralCompleteMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"bar"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [result description]); +} + + +- (void)testTrueLiteralCompleteMatchForFooSpaceBarSpaceBaz1 { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKWord word]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [result description]); +} + + +- (void)testFalseLiteralCompleteMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testFalseLiteralCompleteMatchForFooSpaceBarSpaceBaz1 { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKNumber number]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testTrueLiteralAllMatchsForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"bar"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); +} + + +- (void)testFalseLiteralAllMatchsForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"123"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + NSSet *result = [p allMatchesFor:[NSSet setWithObject:a]]; + + TDNotNil(result); + NSUInteger c = [result count]; + TDEquals((NSUInteger)0, c); +} + +@end diff --git a/test/.svn/text-base/TDSignificantWhitespaceState.h.svn-base b/test/.svn/text-base/TDSignificantWhitespaceState.h.svn-base new file mode 100644 index 0000000..dff96d2 --- /dev/null +++ b/test/.svn/text-base/TDSignificantWhitespaceState.h.svn-base @@ -0,0 +1,24 @@ +// +// PKSignificantWhitespaceState.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import + +// NOTE: this class is not currently in use or included in the Framework. It is an example of how to add a new token type + +static const NSInteger PKTokenTypeWhitespace = 5; + +@interface PKToken (TDSignificantWhitespaceStateAdditions) +@property (nonatomic, readonly, getter=isWhitespace) BOOL whitespace; +@end + +@interface TDSignificantWhitespaceState : PKWhitespaceState { + +} +@end diff --git a/test/.svn/text-base/TDSignificantWhitespaceState.m.svn-base b/test/.svn/text-base/TDSignificantWhitespaceState.m.svn-base new file mode 100644 index 0000000..231db96 --- /dev/null +++ b/test/.svn/text-base/TDSignificantWhitespaceState.m.svn-base @@ -0,0 +1,69 @@ +// +// PKSignificantWhitespaceState.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@implementation PKToken (TDSignificantWhitespaceStateAdditions) + +- (BOOL)isWhitespace { + return self.tokenType == PKTokenTypeWhitespace; +} + + +- (NSString *)debugDescription { + NSString *typeString = nil; + if (self.isNumber) { + typeString = @"Number"; + } else if (self.isQuotedString) { + typeString = @"Quoted String"; + } else if (self.isSymbol) { + typeString = @"Symbol"; + } else if (self.isWord) { + typeString = @"Word"; + } else if (self.isWhitespace) { + typeString = @"Whitespace"; + } + return [NSString stringWithFormat:@"<%@ %C%@%C>", typeString, 0x00ab, self.value, 0x00bb]; +} + +@end + +@implementation TDSignificantWhitespaceState + +- (void)dealloc { + [super dealloc]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + [self resetWithReader:r]; + + c = cin; + while ([self isWhitespaceChar:c]) { + [self append:c]; + c = [r read]; + } + if (c != -1) { + [r unread]; + } + + return [PKToken tokenWithTokenType:PKTokenTypeWhitespace stringValue:[self bufferedString] floatValue:0.0]; +} + +@end diff --git a/test/.svn/text-base/TDSignificantWhitespaceStateTest.h.svn-base b/test/.svn/text-base/TDSignificantWhitespaceStateTest.h.svn-base new file mode 100644 index 0000000..20699b5 --- /dev/null +++ b/test/.svn/text-base/TDSignificantWhitespaceStateTest.h.svn-base @@ -0,0 +1,18 @@ +// +// PKSignificantWhitespaceStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@interface TDSignificantWhitespaceStateTest : SenTestCase { + TDSignificantWhitespaceState *whitespaceState; + PKReader *r; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDSignificantWhitespaceStateTest.m.svn-base b/test/.svn/text-base/TDSignificantWhitespaceStateTest.m.svn-base new file mode 100644 index 0000000..a5efeed --- /dev/null +++ b/test/.svn/text-base/TDSignificantWhitespaceStateTest.m.svn-base @@ -0,0 +1,164 @@ +// +// PKSignificantWhitespaceStateTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDSignificantWhitespaceStateTest.h" + + +@implementation TDSignificantWhitespaceStateTest + +- (void)setUp { + whitespaceState = [[TDSignificantWhitespaceState alloc] init]; +} + + +- (void)tearDown { + [whitespaceState release]; + [r release]; +} + + +- (void)testSpace { + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testTwoSpaces { + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testEmptyString { + s = @""; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testTab { + s = @"\t"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testNewLine { + s = @"\n"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testCarriageReturn { + s = @"\r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testSpaceCarriageReturn { + s = @" \r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testSpaceTabNewLineSpace { + s = @" \t\n "; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testSpaceA { + s = @" a"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@" ", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + +- (void)testSpaceASpace { + s = @" a "; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@" ", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + + +- (void)testTabA { + s = @"\ta"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@"\t", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + + +- (void)testNewLineA { + s = @"\na"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@"\n", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + + +- (void)testCarriageReturnA { + s = @"\ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@"\r", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + + +- (void)testNewLineSpaceCarriageReturnA { + s = @"\n \ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@"\n \r", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + + +@end diff --git a/test/.svn/text-base/TDSlashSlashState.h.svn-base b/test/.svn/text-base/TDSlashSlashState.h.svn-base new file mode 100644 index 0000000..a090d15 --- /dev/null +++ b/test/.svn/text-base/TDSlashSlashState.h.svn-base @@ -0,0 +1,20 @@ +// +// PKSlashSlashState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class TDSlashSlashState + @brief A slash slash state ignores everything up to an end-of-line and returns the tokenizer's next token. +*/ +@interface TDSlashSlashState : PKTokenizerState { + +} + +@end diff --git a/test/.svn/text-base/TDSlashSlashState.m.svn-base b/test/.svn/text-base/TDSlashSlashState.m.svn-base new file mode 100644 index 0000000..5483cfe --- /dev/null +++ b/test/.svn/text-base/TDSlashSlashState.m.svn-base @@ -0,0 +1,53 @@ +// +// PKSlashSlashState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import +#import + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@implementation TDSlashSlashState + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + BOOL reportTokens = t.slashState.reportsCommentTokens; + if (reportTokens) { + [self resetWithReader:r]; + [self append:'/']; + } + + NSInteger c = cin; + + while ('\n' != c && '\r' != c && -1 != c) { + if (reportTokens) { + [self append:c]; + } + c = [r read]; + } + if (-1 != c) { + [r unread]; + } + + if (reportTokens) { + return [PKToken tokenWithTokenType:PKTokenTypeComment stringValue:[self bufferedString] floatValue:0.0]; + } else { + return [t nextToken]; + } +} + +@end diff --git a/test/.svn/text-base/TDSlashStarState.h.svn-base b/test/.svn/text-base/TDSlashStarState.h.svn-base new file mode 100644 index 0000000..1a94b9b --- /dev/null +++ b/test/.svn/text-base/TDSlashStarState.h.svn-base @@ -0,0 +1,20 @@ +// +// PKSlashStarState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class TDSlashStarState + @brief A slash star state ignores everything up to a closing star and slash, and then returns the tokenizer's next token. +*/ +@interface TDSlashStarState : PKTokenizerState { + +} + +@end diff --git a/test/.svn/text-base/TDSlashStarState.m.svn-base b/test/.svn/text-base/TDSlashStarState.m.svn-base new file mode 100644 index 0000000..07114b8 --- /dev/null +++ b/test/.svn/text-base/TDSlashStarState.m.svn-base @@ -0,0 +1,72 @@ +// +// PKSlashStarState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import +#import + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@implementation TDSlashStarState + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + BOOL reportTokens = t.slashState.reportsCommentTokens; + if (reportTokens) { + [self resetWithReader:r]; + [self append:'/']; + } + + NSInteger c = cin; + while (-1 != c) { + if (reportTokens) { + [self append:c]; + } + c = [r read]; + + if ('*' == c) { + NSInteger peek = [r read]; + if ('/' == peek) { + if (reportTokens) { + [self append:c]; + [self append:peek]; + } + c = [r read]; + break; + } else if ('*' == peek) { + [r unread]; + } else { + if (reportTokens) { + [self append:c]; + } + c = peek; + } + } + } + + if (-1 != c) { + [r unread]; + } + + if (reportTokens) { + return [PKToken tokenWithTokenType:PKTokenTypeComment stringValue:[self bufferedString] floatValue:0.0]; + } else { + return [t nextToken]; + } +} + +@end diff --git a/test/.svn/text-base/TDSlashState.h.svn-base b/test/.svn/text-base/TDSlashState.h.svn-base new file mode 100644 index 0000000..fc8146e --- /dev/null +++ b/test/.svn/text-base/TDSlashState.h.svn-base @@ -0,0 +1,27 @@ +// +// PKSlashState.h +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +@class TDSlashSlashState; +@class TDSlashStarState; + +/*! + @class TDSlashState + @brief This state will either delegate to a comment-handling state, or return a PKSymbol token with just a slash in it. +*/ +@interface TDSlashState : PKTokenizerState { + TDSlashSlashState *slashSlashState; + TDSlashStarState *slashStarState; + BOOL reportsCommentTokens; +} + + +@property (nonatomic) BOOL reportsCommentTokens; +@end diff --git a/test/.svn/text-base/TDSlashState.m.svn-base b/test/.svn/text-base/TDSlashState.m.svn-base new file mode 100644 index 0000000..728d706 --- /dev/null +++ b/test/.svn/text-base/TDSlashState.m.svn-base @@ -0,0 +1,59 @@ +// +// PKSlashState.m +// ParseKit +// +// Created by Todd Ditchendorf on 1/20/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import +#import +#import +#import + +@interface TDSlashState () +@property (nonatomic, retain) TDSlashSlashState *slashSlashState; +@property (nonatomic, retain) TDSlashStarState *slashStarState; +@end + +@implementation TDSlashState + +- (id)init { + if (self = [super init]) { + self.slashSlashState = [[[TDSlashSlashState alloc] init] autorelease]; + self.slashStarState = [[[TDSlashStarState alloc] init] autorelease]; + } + return self; +} + + +- (void)dealloc { + self.slashSlashState = nil; + self.slashStarState = nil; + [super dealloc]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + NSInteger c = [r read]; + if ('/' == c) { + return [slashSlashState nextTokenFromReader:r startingWith:c tokenizer:t]; + } else if ('*' == c) { + return [slashStarState nextTokenFromReader:r startingWith:c tokenizer:t]; + } else { + if (-1 != c) { + [r unread]; + } + return [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"/" floatValue:0.0]; + } +} + +@synthesize slashSlashState; +@synthesize slashStarState; +@synthesize reportsCommentTokens; +@end diff --git a/test/.svn/text-base/TDSlashStateTest.h.svn-base b/test/.svn/text-base/TDSlashStateTest.h.svn-base new file mode 100644 index 0000000..1184eab --- /dev/null +++ b/test/.svn/text-base/TDSlashStateTest.h.svn-base @@ -0,0 +1,17 @@ +// +// PKSlashStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDSlashStateTest : SenTestCase { + TDSlashState *slashState; + PKReader *r; + PKTokenizer *t; + NSString *s; +} +@end diff --git a/test/.svn/text-base/TDSlashStateTest.m.svn-base b/test/.svn/text-base/TDSlashStateTest.m.svn-base new file mode 100644 index 0000000..d707f2e --- /dev/null +++ b/test/.svn/text-base/TDSlashStateTest.m.svn-base @@ -0,0 +1,390 @@ +// +// PKSlashStateTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDSlashStateTest.h" + +@implementation TDSlashStateTest + +- (void)setUp { + r = [[PKReader alloc] init]; + t = [[PKTokenizer alloc] init]; + slashState = t.slashState; +} + + +- (void)tearDown { + [r release]; + [t release]; +} + + +- (void)testSpace { + s = @" "; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlash { + s = @"/"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlash { + s = @"/"; + r.string = s; + t.string = s; + + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashSlash { + s = @"//"; + r.string = s; + t.string = s; + + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, s); + TDTrue(tok.isComment); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashSlashFoo { + s = @"// foo"; + r.string = s; + t.string = s; + + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, s); + TDTrue(tok.isComment); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashAbc { + s = @"/abc"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testReportSlashAbc { + s = @"/abc"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSlashSpaceAbc { + s = @"/ abc"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testReportSlashSpaceAbc { + s = @"/ abc"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testSlashSlashAbc { + s = @"//abc"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashSlashAbc { + s = @"//abc"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashSlashSpaceAbc { + s = @"// abc"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashSlashSpaceAbc { + s = @"// abc"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcStarSlash { + s = @"/*abc*/"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbcStarSlash { + s = @"/*abc*/"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbcStarStar { + s = @"/*abc**"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAStarStarSpaceA { + s = @"/*a**/ a"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/*a**/"); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testReportSlashStarAbcStarStarSpaceA { + s = @"/*abc**/ a"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/*abc**/"); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testReportSlashStarStarSlash { + s = @"/**/"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarStarStarSlash { + s = @"/***/"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarStarSlashSpace { + s = @"/**/ "; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/**/"); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testReportSlashStarAbcStarSpaceStarSpaceA { + s = @"/*abc* */ a"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/*abc* */"); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testSlashStarAbc { + s = @"/*abc"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbc { + s = @"/*abc"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcStar { + s = @"/*abc*"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcStarSpace { + s = @"/*abc* "; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbcStarSpace { + s = @"/*abc* "; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcSlash { + s = @"/*abc/"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcSlashSpace { + s = @"/*abc/ "; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbcSlashSpace { + s = @"/*abc/ "; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcNewline { + s = @"/*abc\n"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbcNewline { + s = @"/*abc\n"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + +@end diff --git a/test/.svn/text-base/TDSpecificCharTest.h.svn-base b/test/.svn/text-base/TDSpecificCharTest.h.svn-base new file mode 100644 index 0000000..648d20c --- /dev/null +++ b/test/.svn/text-base/TDSpecificCharTest.h.svn-base @@ -0,0 +1,19 @@ +// +// PKSpecificCharTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + + +@interface TDSpecificCharTest : SenTestCase { + NSString *s; + PKCharacterAssembly *a; + PKChar *p; + PKAssembly *result; +} + +@end diff --git a/test/.svn/text-base/TDSpecificCharTest.m.svn-base b/test/.svn/text-base/TDSpecificCharTest.m.svn-base new file mode 100644 index 0000000..5ffe718 --- /dev/null +++ b/test/.svn/text-base/TDSpecificCharTest.m.svn-base @@ -0,0 +1,59 @@ +// +// PKSpecificCharTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/15/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDSpecificCharTest.h" + +@interface PKAssembly () +- (BOOL)hasMore; +@end + +@implementation TDSpecificCharTest + +- (void)test123 { + s = @"123"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^123", [a description]); + p = [PKSpecificChar specificCharWithChar:'1']; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[1]1^23", [result description]); + TDTrue([a hasMore]); +} + + +- (void)testAbc { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^abc", [a description]); + p = [PKSpecificChar specificCharWithChar:'1']; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDNil(result); + TDTrue([a hasMore]); +} + + +- (void)testRepetition { + s = @"aaa"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^aaa", [a description]); + p = [PKSpecificChar specificCharWithChar:'a']; + PKParser *r = [PKRepetition repetitionWithSubparser:p]; + + result = [r bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[a, a, a]aaa^", [result description]); + TDFalse([result hasMore]); +} + +@end diff --git a/test/.svn/text-base/TDSymbolStateTest.h.svn-base b/test/.svn/text-base/TDSymbolStateTest.h.svn-base new file mode 100644 index 0000000..c529b8f --- /dev/null +++ b/test/.svn/text-base/TDSymbolStateTest.h.svn-base @@ -0,0 +1,16 @@ +// +// PKSymbolStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/12/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDSymbolStateTest : SenTestCase { + PKSymbolState *symbolState; + PKReader *r; + NSString *s; +} +@end diff --git a/test/.svn/text-base/TDSymbolStateTest.m.svn-base b/test/.svn/text-base/TDSymbolStateTest.m.svn-base new file mode 100644 index 0000000..9202d6d --- /dev/null +++ b/test/.svn/text-base/TDSymbolStateTest.m.svn-base @@ -0,0 +1,572 @@ +// +// PKSymbolStateTestok.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/12/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDSymbolStateTest.h" + +@implementation TDSymbolStateTest + +- (void)setUp { + symbolState = [[PKSymbolState alloc] init]; +} + + +- (void)tearDown { + [symbolState release]; + [r release]; +} + + +- (void)testDot { + s = @"."; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testDotA { + s = @".a"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testDotSpace { + s = @". "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testDotDot { + s = @".."; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)'.', [r read]); +} + + + +- (void)testAddDotDot { + s = @".."; + [symbolState add:s]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"..", tok.stringValue); + TDEqualObjects(@"..", tok.value); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testAddDotDotSpace { + s = @".. "; + [symbolState add:@".."]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"..", tok.stringValue); + TDEqualObjects(@"..", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testAddColonEqual { + s = @":="; + [symbolState add:s]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@":=", tok.stringValue); + TDEqualObjects(@":=", tok.value); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testAddColonEqualSpace { + s = @":= "; + [symbolState add:@":="]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@":=", tok.stringValue); + TDEqualObjects(@":=", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testAddGtEqualLtSpace { + s = @">=< "; + [symbolState add:@">=<"]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testAddGtEqualLt { + s = @">=<"; + [symbolState add:s]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testTokenzierAddGtEqualLt { + s = @">=<"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:s]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddGtEqualLtSpaceFoo { + s = @">=< foo"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@">=<"]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + tok = [t nextToken]; + TDEqualObjects(@"foo", tok.stringValue); + TDEqualObjects(@"foo", tok.value); + TDTrue(tok.isWord); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddGtEqualLtFoo { + s = @">==<"]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + tok = [t nextToken]; + TDEqualObjects(@"foo", tok.stringValue); + TDEqualObjects(@"foo", tok.value); + TDTrue(tok.isWord); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddGtEqualLtDot { + s = @">=<."; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@">=<"]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddGtEqualLtSpaceDot { + s = @">=< ."; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@">=<"]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddGtEqualLtSpaceDotSpace { + s = @">=< . "; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@">=<"]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddLtBangDashDashSpaceDotSpace { + s = @""; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"-->"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"-->", tok.stringValue); + TDEqualObjects(@"-->", tok.value); + + tok = [t nextToken]; + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddDashDashGtSpaceDot { + s = @"--> ."; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"-->"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"-->", tok.stringValue); + TDEqualObjects(@"-->", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddDashDashGtSpaceDotSpace { + s = @"--> . "; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"-->"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"-->", tok.stringValue); + TDEqualObjects(@"-->", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddDashDash { + s = @"--"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"--"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"--", tok.stringValue); + TDEqualObjects(@"--", tok.value); + + tok = [t nextToken]; + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddDashDashSpaceDot { + s = @"-- ."; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"--"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"--", tok.stringValue); + TDEqualObjects(@"--", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddDashDashSpaceDotSpace { + s = @"-- . "; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"--"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"--", tok.stringValue); + TDEqualObjects(@"--", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualButNotEqual { + s = @"="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"==="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualButNotEqualEqual { + s = @"=="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"==="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualCompareEqualEqualEqualEqual { + s = @"===="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"==="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"===", tok.stringValue); + TDEqualObjects(@"===", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualCompareEqualEqualEqualEqualEqual { + s = @"====="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"==="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"===", tok.stringValue); + TDEqualObjects(@"===", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualCompareEqualEqualEqualEqualEqualSpaceEqual { + s = @"===== ="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"==="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"===", tok.stringValue); + TDEqualObjects(@"===", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualEqual { + s = @"===="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualColonEqualButNotEqualColon { + s = @"=:"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"=:="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@":", tok.stringValue); + TDEqualObjects(@":", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierRemoveEqualEqual { + s = @"=="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState remove:@"=="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierRemoveEqualEqualAddEqualEqual { + s = @"===="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState remove:@"=="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + [t.symbolState add:@"=="]; + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualColonEqualAndThenEqualColonEqualColon { + s = @"=:=:"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"=:="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=:=", tok.stringValue); + TDEqualObjects(@"=:=", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@":", tok.stringValue); + TDEqualObjects(@":", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTrickyCase { + s = @"+++\n+++-\n+++-+"; + + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"+++"]; + [t.symbolState add:@"+++-+"]; + + PKToken *eof = [PKToken EOFToken]; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+++"); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+++"); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+++-+"); + + tok = [t nextToken]; + TDEquals(eof, tok); +} + +@end diff --git a/test/.svn/text-base/TDSymbolTest.h.svn-base b/test/.svn/text-base/TDSymbolTest.h.svn-base new file mode 100644 index 0000000..a7c277b --- /dev/null +++ b/test/.svn/text-base/TDSymbolTest.h.svn-base @@ -0,0 +1,17 @@ +// +// PKSymbolTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDSymbolTest : SenTestCase { + PKParser *p; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDSymbolTest.m.svn-base b/test/.svn/text-base/TDSymbolTest.m.svn-base new file mode 100644 index 0000000..2f2e258 --- /dev/null +++ b/test/.svn/text-base/TDSymbolTest.m.svn-base @@ -0,0 +1,66 @@ +// +// PKSymbolTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDSymbolTest.h" + + +@implementation TDSymbolTest + +- (void)tearDown { +} + + +- (void)testDash { + s = @"-"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSymbol symbolWithString:s]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[-]-^", [result description]); +} + + +- (void)testFalseDash { + s = @"-"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSymbol symbolWithString:@"+"]; + + PKAssembly *result = [p bestMatchFor:a]; + TDNil(result); +} + + +- (void)testTrueDash { + s = @"-"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSymbol symbol]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[-]-^", [result description]); +} + + +- (void)testDiscardDash { + s = @"-"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [[PKSymbol symbolWithString:s] discard]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[]-^", [result description]); +} +@end diff --git a/test/.svn/text-base/TDSyntaxHighlighter.h.svn-base b/test/.svn/text-base/TDSyntaxHighlighter.h.svn-base new file mode 100644 index 0000000..05eda08 --- /dev/null +++ b/test/.svn/text-base/TDSyntaxHighlighter.h.svn-base @@ -0,0 +1,29 @@ +// +// PKSyntaxHighlighter.h +// HTTPClient +// +// Created by Todd Ditchendorf on 12/26/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class PKParser; +@class PKTokenizer; +@class PKParserFactory; +@class TDMiniCSSAssembler; +@class TDGenericAssembler; + +@interface TDSyntaxHighlighter : NSObject { + PKParserFactory *parserFactory; + PKParser *miniCSSParser; + TDMiniCSSAssembler *miniCSSAssembler; + TDGenericAssembler *genericAssembler; + BOOL cacheParsers; + NSMutableDictionary *parserCache; + NSMutableDictionary *tokenizerCache; +} +- (NSAttributedString *)highlightedStringForString:(NSString *)s ofGrammar:(NSString *)grammarName; + +@property (nonatomic) BOOL cacheParsers; // default is NO +@end diff --git a/test/.svn/text-base/TDSyntaxHighlighter.m.svn-base b/test/.svn/text-base/TDSyntaxHighlighter.m.svn-base new file mode 100644 index 0000000..4557ec8 --- /dev/null +++ b/test/.svn/text-base/TDSyntaxHighlighter.m.svn-base @@ -0,0 +1,168 @@ +// +// PKSyntaxHighlighter.m +// HTTPClient +// +// Created by Todd Ditchendorf on 12/26/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDSyntaxHighlighter.h" +#import +#import "PKParserFactory.h" +#import "TDMiniCSSAssembler.h" +#import "TDGenericAssembler.h" + +@interface TDSyntaxHighlighter () +- (NSMutableDictionary *)attributesForGrammarNamed:(NSString *)grammarName; +- (PKParser *)parserForGrammarNamed:(NSString *)grammarName; + +// all of the ivars for these properties are lazy loaded in the getters. +// thats so that if an application has syntax highlighting turned off, this class will +// consume much less memory/fewer resources. +@property (nonatomic, retain) PKParserFactory *parserFactory; +@property (nonatomic, retain) PKParser *miniCSSParser; +@property (nonatomic, retain) TDMiniCSSAssembler *miniCSSAssembler; +@property (nonatomic, retain) TDGenericAssembler *genericAssembler; +@property (nonatomic, retain) NSMutableDictionary *parserCache; +@property (nonatomic, retain) NSMutableDictionary *tokenizerCache; +@end + +@implementation TDSyntaxHighlighter + +- (id)init { + if (self = [super init]) { + + } + return self; +} + + +- (void)dealloc { + PKReleaseSubparserTree(miniCSSParser); + for (PKParser *p in parserCache) { + PKReleaseSubparserTree(p); + } + + self.parserFactory = nil; + self.miniCSSParser = nil; + self.miniCSSAssembler = nil; + self.genericAssembler = nil; + self.parserCache = nil; + self.tokenizerCache = nil; + [super dealloc]; +} + + +- (PKParserFactory *)parserFactory { + if (!parserFactory) { + self.parserFactory = [PKParserFactory factory]; + } + return parserFactory; +} + + +- (TDMiniCSSAssembler *)miniCSSAssembler { + if (!miniCSSAssembler) { + self.miniCSSAssembler = [[[TDMiniCSSAssembler alloc] init] autorelease]; + } + return miniCSSAssembler; +} + + +- (PKParser *)miniCSSParser { + if (!miniCSSParser) { + // create mini-css parser + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + NSString *grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + self.miniCSSParser = [self.parserFactory parserFromGrammar:grammarString assembler:self.miniCSSAssembler]; + } + return miniCSSParser; +} + + +- (TDGenericAssembler *)genericAssembler { + if (!genericAssembler) { + self.genericAssembler = [[[TDGenericAssembler alloc] init] autorelease]; + } + return genericAssembler; +} + + +- (NSMutableDictionary *)parserCache { + if (!parserCache) { + self.parserCache = [NSMutableDictionary dictionary]; + } + return parserCache; +} + + +- (NSMutableDictionary *)attributesForGrammarNamed:(NSString *)grammarName { + // parse CSS + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:grammarName ofType:@"css"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + [self.miniCSSParser bestMatchFor:a]; // produce dict of attributes from the CSS + return self.miniCSSAssembler.attributes; +} + + +- (PKParser *)parserForGrammarNamed:(NSString *)grammarName { + // create parser or the grammar requested or fetch parser from cache + PKParser *parser = nil; + if (cacheParsers) { + parser = [self.parserCache objectForKey:grammarName]; + } + + if (!parser) { + // get attributes from css && give to the generic assembler + parserFactory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnAll; + self.genericAssembler.attributes = [self attributesForGrammarNamed:grammarName]; + + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:grammarName ofType:@"grammar"]; + NSString *grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + // generate a parser for the requested grammar + parserFactory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnTerminals; + parser = [self.parserFactory parserFromGrammar:grammarString assembler:self.genericAssembler]; + + if (cacheParsers) { + [self.parserCache setObject:parser forKey:grammarName]; + [self.tokenizerCache setObject:parser.tokenizer forKey:grammarName]; + } + } + + return parser; +} + + +- (NSAttributedString *)highlightedStringForString:(NSString *)s ofGrammar:(NSString *)grammarName { + // create or fetch the parser & tokenizer for this grammar + PKParser *parser = [self parserForGrammarNamed:grammarName]; + + // parse the string. take care to preseve the whitespace and comments in the string + parser.tokenizer.string = s; + parser.tokenizer.whitespaceState.reportsWhitespaceTokens = YES; + parser.tokenizer.commentState.reportsCommentTokens = YES; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:parser.tokenizer]; + a.preservesWhitespaceTokens = YES; + + PKAssembly *resultAssembly = [parser completeMatchFor:a]; // finally, parse the input. stores attributed string in resultAssembly.target + + if (!cacheParsers) { + PKReleaseSubparserTree(parser); + } + + id result = [[resultAssembly.target copy] autorelease]; + return result; +} + +@synthesize parserFactory; +@synthesize miniCSSParser; +@synthesize miniCSSAssembler; +@synthesize genericAssembler; +@synthesize cacheParsers; +@synthesize parserCache; +@synthesize tokenizerCache; +@end diff --git a/test/.svn/text-base/TDTestScaffold.h.svn-base b/test/.svn/text-base/TDTestScaffold.h.svn-base new file mode 100644 index 0000000..d107ccf --- /dev/null +++ b/test/.svn/text-base/TDTestScaffold.h.svn-base @@ -0,0 +1,18 @@ +// +// PKTestScaffold.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import +#import + +#define TDTrue(e) STAssertTrue((e), @"") +#define TDFalse(e) STAssertFalse((e), @"") +#define TDNil(e) STAssertNil((e), @"") +#define TDNotNil(e) STAssertNotNil((e), @"") +#define TDEquals(e1, e2) STAssertEquals((e1), (e2), @"") +#define TDEqualObjects(e1, e2) STAssertEqualObjects((e1), (e2), @"") diff --git a/test/.svn/text-base/TDTestScaffold.m.svn-base b/test/.svn/text-base/TDTestScaffold.m.svn-base new file mode 100644 index 0000000..f6c701d --- /dev/null +++ b/test/.svn/text-base/TDTestScaffold.m.svn-base @@ -0,0 +1,153 @@ +// +// PKTestScaffold.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +#define RUN_ALL_TEST_CASES 1 +#define SOLO_TEST_CASE @"TDParserBlocksTest" + +@interface SenTestSuite (TDAdditions) +- (void)addSuitesForClassNames:(NSArray *)classNames; +@end + +SenTestSuite *TDSoloTestSuite() { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Solo Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObject:SOLO_TEST_CASE]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + +SenTestSuite *TDTokensTestSuite() { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Tokens Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDReaderTest", + @"TDTokenizerTest", + @"TDTokenizerTest", + @"TDNumberStateTest", + @"TDQuoteStateTest", + @"TDWhitespaceStateTest", + @"TDWordStateTest", + @"TDSlashStateTest", + @"TDSymbolStateTest", + @"TDCommentStateTest", + @"TDDelimitStateTest", + @"TDTokenizerStateTest", +#ifdef TARGET_OS_SNOW_LEOPARD + @"TDTokenizerBlocksTest", + @"TDParserBlocksTest", +#endif + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + +SenTestSuite *TDCharsTestSuite() { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Chars Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDCharacterAssemblyTest", + @"TDDigitTest", + @"TDCharTest", + @"TDLetterTest", + @"TDSpecificCharTest", + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + +SenTestSuite *TDParseTestSuite() { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Parse Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDParserTest", + @"TDTokenAssemblyTest", + @"TDLiteralTest", + @"TDPatternTest", + @"TDRepetitionTest", + @"TDSequenceTest", + @"TDAlternationTest", + @"TDSymbolTest", + @"TDRobotCommandTest", + @"TDXmlParserTest", + @"TDJsonParserTest", + @"TDFastJsonParserTest", + @"TDRegularParserTest", + @"SRGSParserTest", + @"EBNFParserTest", + @"TDPlistParserTest", + @"TDXmlNameTest", + @"XPathParserTest", + @"XMLReaderTest", + @"TDXmlTokenizerTest", + @"TDArithmeticParserTest", + @"TDScientificNumberStateTest", + @"TDTokenArraySourceTest", + @"TDDifferenceTest", + @"TDNegationTest", + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + +SenTestSuite *TDParserFactoryTestSuite() { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"ParserFactory Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDParserFactoryTest", + @"TDParserFactoryTest2", + @"TDParserFactoryPatternTest", + @"TDMiniCSSAssemblerTest", + @"TDPredicateEvaluatorTest", + @"TDNSPredicateEvaluatorTest", + @"TDNSPredicateBuilderTest", + @"TDJavaScriptParserTest", + @"TDXMLParserTest", + @"XPathParserGrammarTest", + @"ERBTest", + @"TDParseTreeTest", + @"SAXTest", + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + +@implementation SenTestSuite (TDAdditions) + ++ (id)testSuiteForBundlePath:(NSString *)path { + SenTestSuite *suite = nil; + +#if RUN_ALL_TEST_CASES + suite = [self defaultTestSuite]; +#else + suite = [self testSuiteWithName:@"My Tests"]; + // [suite addTest:TDCharsTestSuite()]; + // [suite addTest:TDTokensTestSuite()]; + // [suite addTest:TDParseTestSuite()]; + // [suite addTest:TDParserFactoryTestSuite()]; + [suite addTest:TDSoloTestSuite()]; +#endif + + return suite; +} + + +- (void)addSuitesForClassNames:(NSArray *)classNames { + for (NSString *className in classNames) { + SenTestSuite *suite = [SenTestSuite testSuiteForTestCaseWithName:className]; + [self addTest:suite]; + } +} + +@end \ No newline at end of file diff --git a/test/.svn/text-base/TDToken+Blob.h.svn-base b/test/.svn/text-base/TDToken+Blob.h.svn-base new file mode 100644 index 0000000..5e2a09a --- /dev/null +++ b/test/.svn/text-base/TDToken+Blob.h.svn-base @@ -0,0 +1,16 @@ +// +// PKToken+Blob.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +extern const NSInteger PKTokenTypeBlob; + +@interface PKToken (Blob) +- (BOOL)isBlob; +@end + diff --git a/test/.svn/text-base/TDToken+Blob.m.svn-base b/test/.svn/text-base/TDToken+Blob.m.svn-base new file mode 100644 index 0000000..dea88e7 --- /dev/null +++ b/test/.svn/text-base/TDToken+Blob.m.svn-base @@ -0,0 +1,20 @@ +// +// PKToken+Blob.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKToken+Blob.h" + +const NSInteger PKTokenTypeBlob = 200; + +@implementation PKToken (Blob) + +- (BOOL)isBlob { + return PKTokenTypeBlob == self.tokenType; +} + +@end + diff --git a/test/.svn/text-base/TDTokenArraySourceTest.h.svn-base b/test/.svn/text-base/TDTokenArraySourceTest.h.svn-base new file mode 100644 index 0000000..c0bf6b7 --- /dev/null +++ b/test/.svn/text-base/TDTokenArraySourceTest.h.svn-base @@ -0,0 +1,18 @@ +// +// PKTokenArraySourceTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDTokenArraySourceTest : SenTestCase { + PKTokenizer *t; + NSString *d; + NSString *s; + PKTokenArraySource *tas; +} + +@end diff --git a/test/.svn/text-base/TDTokenArraySourceTest.m.svn-base b/test/.svn/text-base/TDTokenArraySourceTest.m.svn-base new file mode 100644 index 0000000..b299c33 --- /dev/null +++ b/test/.svn/text-base/TDTokenArraySourceTest.m.svn-base @@ -0,0 +1,51 @@ +// +// PKTokenArraySourceTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTokenArraySourceTest.h" + +@implementation TDTokenArraySourceTest + +- (void)setUp { +} + + +- (void)testFoo { + d = @";"; + s = @"I came; I saw; I left in peace.;"; + t = [[[PKTokenizer alloc] initWithString:s] autorelease]; + tas = [[[PKTokenArraySource alloc] initWithTokenizer:t delimiter:d] autorelease]; + + TDTrue([tas hasMore]); + NSArray *a = [tas nextTokenArray]; + TDNotNil(a); + TDEquals((NSUInteger)2, [a count]); + TDEqualObjects(@"I", [[a objectAtIndex:0] stringValue]); + TDEqualObjects(@"came", [[a objectAtIndex:1] stringValue]); + + TDTrue([tas hasMore]); + a = [tas nextTokenArray]; + TDNotNil(a); + TDEquals((NSUInteger)2, [a count]); + TDEqualObjects(@"I", [[a objectAtIndex:0] stringValue]); + TDEqualObjects(@"saw", [[a objectAtIndex:1] stringValue]); + + TDTrue([tas hasMore]); + a = [tas nextTokenArray]; + TDNotNil(a); + TDEquals((NSUInteger)5, [a count]); + TDEqualObjects(@"I", [[a objectAtIndex:0] stringValue]); + TDEqualObjects(@"left", [[a objectAtIndex:1] stringValue]); + TDEqualObjects(@"in", [[a objectAtIndex:2] stringValue]); + TDEqualObjects(@"peace", [[a objectAtIndex:3] stringValue]); + TDEqualObjects(@".", [[a objectAtIndex:4] stringValue]); + + TDFalse([tas hasMore]); + a = [tas nextTokenArray]; + TDNil(a); +} +@end diff --git a/test/.svn/text-base/TDTokenAssemblyTest.h.svn-base b/test/.svn/text-base/TDTokenAssemblyTest.h.svn-base new file mode 100644 index 0000000..3b279a6 --- /dev/null +++ b/test/.svn/text-base/TDTokenAssemblyTest.h.svn-base @@ -0,0 +1,17 @@ +// +// PKTokenAssemblyTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDTokenAssemblyTest : SenTestCase { + PKAssembly *a; + NSString *s; + PKParser *p; +} + +@end diff --git a/test/.svn/text-base/TDTokenAssemblyTest.m.svn-base b/test/.svn/text-base/TDTokenAssemblyTest.m.svn-base new file mode 100644 index 0000000..c228447 --- /dev/null +++ b/test/.svn/text-base/TDTokenAssemblyTest.m.svn-base @@ -0,0 +1,292 @@ +// +// PKTokenAssemblyTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTokenAssemblyTest.h" + +@interface PKAssembly () +- (id)next; +- (BOOL)hasMore; +@property (nonatomic, readonly) NSUInteger length; +@property (nonatomic, readonly) NSUInteger objectsConsumed; +@property (nonatomic, readonly) NSUInteger objectsRemaining; +@end + +@implementation TDTokenAssemblyTest + +- (void)setUp { +} + + +- (void)tearDown { + [p release]; +} + + +#pragma mark - + +- (void)testWordOhSpaceHaiExclamation { + s = @"oh hai!"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)3, [a length]); + + TDEquals((NSUInteger)0, a.objectsConsumed); + TDEquals((NSUInteger)3, a.objectsRemaining); + TDEqualObjects(@"[]^oh/hai/!", [a description]); + TDTrue([a hasMore]); + TDEqualObjects(@"oh", [[a next] stringValue]); + + TDEquals((NSUInteger)1, a.objectsConsumed); + TDEquals((NSUInteger)2, a.objectsRemaining); + TDEqualObjects(@"[]oh^hai/!", [a description]); + TDTrue([a hasMore]); + TDEqualObjects(@"hai", [[a next] stringValue]); + + TDEquals((NSUInteger)2, a.objectsConsumed); + TDEquals((NSUInteger)1, a.objectsRemaining); + TDEqualObjects(@"[]oh/hai^!", [a description]); + TDTrue([a hasMore]); + TDEqualObjects(@"!", [[a next] stringValue]); + + TDEquals((NSUInteger)3, a.objectsConsumed); + TDEquals((NSUInteger)0, a.objectsRemaining); + TDEqualObjects(@"[]oh/hai/!^", [a description]); + TDFalse([a hasMore]); + TDNil([[a next] stringValue]); + + TDEquals((NSUInteger)3, a.objectsConsumed); + TDEquals((NSUInteger)0, a.objectsRemaining); + TDEqualObjects(@"[]oh/hai/!^", [a description]); + TDFalse([a hasMore]); + TDNil([[a next] stringValue]); + + TDEquals((NSUInteger)3, [a length]); +} + + +- (void)testBestMatchForWordFoobar { + s = @"foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^foobar", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[foobar]foobar^", [result description]); + TDFalse(result == a); + + + result = [p bestMatchFor:result]; + TDNil(result); +} + + +- (void)testCompleteMatchForWordFoobar { + s = @"foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^foobar", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDEqualObjects(@"[foobar]foobar^", [result description]); + TDFalse(result == a); +} + + +- (void)testBestMatchForWordFooSpaceBar { + s = @"foo bar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^foo/bar", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^bar", [result description]); + TDFalse(result == a); +} + + +- (void)testCompleteMatchForWordFooSpaceBar { + s = @"foo bar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^foo/bar", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testBestMatchForNumFoobar { + s = @"foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^foobar", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDNil(result); +} + + +- (void)testCompleteMatchForNumFoobar { + s = @"foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^foobar", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testBestMatchForWord123 { + s = @"123"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^123", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDNil(result); +} + + +- (void)testCompleteMatchForWord123 { + s = @"123"; + a = [PKTokenAssembly assemblyWithString:s]; + + + p = [[PKWord alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^123", [a description]); +} + + +- (void)testBestMatchForNum123 { + s = @"123"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^123", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[123]123^", [result description]); + TDFalse(result == a); +} + + +- (void)testCompleteMatchForNum123 { + s = @"123"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^123", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[123]123^", [result description]); + TDFalse(result == a); +} + + +- (void)testBestMatchForNum123Space456 { + s = @"123 456"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^123/456", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[123]123^456", [result description]); + TDFalse(result == a); +} + + +- (void)testCompleteMatchForNum123Space456 { + s = @"123 456"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^123/456", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testBestMatchForWordFoobarSpace123 { + s = @"foobar 123"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^foobar/123", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[foobar]foobar^123", [result description]); + TDFalse(result == a); +} + + +- (void)testCompleteMatchForWordFoobarSpace123 { + s = @"foobar 123"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^foobar/123", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testBestMatchForNum123Space456Foobar { + s = @"123 456 foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)3, [a length]); + TDEqualObjects(@"[]^123/456/foobar", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[123]123^456/foobar", [result description]); + TDFalse(result == a); +} + + +- (void)testCompleteMatchForNum123Space456Foobar { + s = @"123 456 foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)3, [a length]); + TDEqualObjects(@"[]^123/456/foobar", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + +@end + diff --git a/test/.svn/text-base/TDTokenTest.h.svn-base b/test/.svn/text-base/TDTokenTest.h.svn-base new file mode 100644 index 0000000..16e42af --- /dev/null +++ b/test/.svn/text-base/TDTokenTest.h.svn-base @@ -0,0 +1,15 @@ +// +// PKTokenTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/8/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDTokenTest : SenTestCase { + PKToken *eof; +} + +@end diff --git a/test/.svn/text-base/TDTokenTest.m.svn-base b/test/.svn/text-base/TDTokenTest.m.svn-base new file mode 100644 index 0000000..d3c7215 --- /dev/null +++ b/test/.svn/text-base/TDTokenTest.m.svn-base @@ -0,0 +1,88 @@ +// +// PKTokenTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/8/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTokenTest.h" + +@implementation TDTokenTest + +- (void)setUp { + eof = [PKToken EOFToken]; +} + + +- (void)testEOFTokenReleaseOnce1 { + TDNotNil(eof); + [eof release]; +} + + +- (void)testEOFTokenReleaseOnce2 { + TDNotNil(eof); + [eof release]; +} + + +- (void)testEOFTokenReleaseTwice1 { + TDNotNil(eof); + [eof release]; + TDNotNil(eof); + [eof release]; +} + + +- (void)testEOFTokenReleaseTwice2 { + TDNotNil(eof); + [eof release]; + TDNotNil(eof); + [eof release]; +} + + +- (void)testEOFTokenAutoreleaseOnce1 { + TDNotNil(eof); + [eof autorelease]; +} + + +- (void)testEOFTokenAutoreleaseOnce2 { + TDNotNil(eof); + [eof autorelease]; +} + + +- (void)testEOFTokenAutoreleaseTwice1 { + TDNotNil(eof); + [eof autorelease]; + TDNotNil(eof); + [eof autorelease]; +} + + +- (void)testEOFTokenAutoreleaseTwice2 { + TDNotNil(eof); + [eof autorelease]; + TDNotNil(eof); + [eof autorelease]; +} + + +- (void)testEOFTokenRetainCount { + TDTrue([eof retainCount] >= 17035104); + // NO IDEA WHY THIS WONT PASS + //TDEquals(UINT_MAX, [eof retainCount]); /*17035104 4294967295*/ +// TDEqualObjects([NSNumber numberWithUnsignedInt:4294967295], [NSNumber numberWithUnsignedInt:[eof retainCount]]); +} + + +- (void)testCopyIdentity { + id copy = [eof copy]; + TDTrue(copy == eof); + [copy release]; // appease clang sa +} + +@end diff --git a/test/.svn/text-base/TDTokenizer+BlobState.h.svn-base b/test/.svn/text-base/TDTokenizer+BlobState.h.svn-base new file mode 100644 index 0000000..fa2d019 --- /dev/null +++ b/test/.svn/text-base/TDTokenizer+BlobState.h.svn-base @@ -0,0 +1,15 @@ +// +// PKTokenizer+BlobState.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class TDBlobState; + +@interface PKTokenizer (BlobState) +- (TDBlobState *)blobState; +@end diff --git a/test/.svn/text-base/TDTokenizer+BlobState.m.svn-base b/test/.svn/text-base/TDTokenizer+BlobState.m.svn-base new file mode 100644 index 0000000..f880358 --- /dev/null +++ b/test/.svn/text-base/TDTokenizer+BlobState.m.svn-base @@ -0,0 +1,36 @@ +// +// PKTokenizer+BlobState.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKTokenizer+BlobState.h" +#import "TDBlobState.h" + +static NSMutableDictionary *sBlobCache = nil; + +@implementation PKTokenizer (BlobState) + +- (TDBlobState *)blobState { + TDBlobState *bs = nil; + + @synchronized (self) { + if (!sBlobCache) { + sBlobCache = [[NSMutableDictionary alloc] init]; + } + + NSString *key = [NSString stringWithFormat:@"%p", self]; + bs = [sBlobCache objectForKey:key]; + + if (!bs) { + bs = [[[TDBlobState alloc] init] autorelease]; + [sBlobCache setObject:bs forKey:key]; + } + } + + return bs; +} + +@end diff --git a/test/.svn/text-base/TDTokenizerBlocksTest.h.svn-base b/test/.svn/text-base/TDTokenizerBlocksTest.h.svn-base new file mode 100644 index 0000000..6c16a46 --- /dev/null +++ b/test/.svn/text-base/TDTokenizerBlocksTest.h.svn-base @@ -0,0 +1,18 @@ +// +// TDTokenizerBlocksTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 9/16/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@class PKTokenizer; + +@interface TDTokenizerBlocksTest : SenTestCase { + PKTokenizer *t; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDTokenizerBlocksTest.m.svn-base b/test/.svn/text-base/TDTokenizerBlocksTest.m.svn-base new file mode 100644 index 0000000..32e8529 --- /dev/null +++ b/test/.svn/text-base/TDTokenizerBlocksTest.m.svn-base @@ -0,0 +1,38 @@ +// +// TDTokenizerBlocksTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 9/16/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTokenizerBlocksTest.h" + +@implementation TDTokenizerBlocksTest + +- (void)setUp { +} + + +- (void)tearDown { +} + + +#ifdef TARGET_OS_SNOW_LEOPARD +- (void)testBlastOff { + s = @"\"It's 123 blast-off!\", she said, // watch out!\n" + @"and <= 3 'ticks' later /* wince */, it's blast-off!"; + t = [PKTokenizer tokenizerWithString:s]; + + NSLog(@"\n\n starting!!! \n\n"); + + [t enumerateTokensUsingBlock:^(PKToken *tok, BOOL *stop) { + NSLog(@"(%@)", tok.stringValue); + }]; + + + NSLog(@"\n\n done!!! \n\n"); +} +#endif + +@end diff --git a/test/.svn/text-base/TDTokenizerStateTest.h.svn-base b/test/.svn/text-base/TDTokenizerStateTest.h.svn-base new file mode 100644 index 0000000..cee1004 --- /dev/null +++ b/test/.svn/text-base/TDTokenizerStateTest.h.svn-base @@ -0,0 +1,17 @@ +// +// TDTokenizerStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/12/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDTokenizerStateTest : SenTestCase { + PKTokenizer *t; + NSString *s; + PKToken *tok; +} + +@end diff --git a/test/.svn/text-base/TDTokenizerStateTest.m.svn-base b/test/.svn/text-base/TDTokenizerStateTest.m.svn-base new file mode 100644 index 0000000..9616dea --- /dev/null +++ b/test/.svn/text-base/TDTokenizerStateTest.m.svn-base @@ -0,0 +1,172 @@ +// +// TDTokenizerStateTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/12/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTokenizerStateTest.h" + +@implementation TDTokenizerStateTest + +- (void)setUp { + t = [[PKTokenizer alloc] init]; +} + + +- (void)tearDown { + [t release]; +} + + +- (void)testFallbackStateCast { + [t setTokenizerState:t.symbolState from:'c' to:'c']; + [t.symbolState setFallbackState:t.wordState from:'c' to:'c']; + [t.symbolState add:@"cast"]; + + t.string = @"foo cast cat"; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"cast", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"c", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"at", tok.stringValue); + + tok = [t nextToken]; + TDEqualObjects(nil, tok.stringValue); + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testFallbackStateCastAs { + [t setTokenizerState:t.symbolState from:'c' to:'c']; + [t.symbolState setFallbackState:t.wordState from:'c' to:'c']; + [t.symbolState add:@"cast as"]; + + t.string = @"foo cast as cat"; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"cast as", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"c", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"at", tok.stringValue); + + tok = [t nextToken]; + TDEqualObjects(nil, tok.stringValue); + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testTrickyFwdSlash { + [t.delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:nil]; + + [t setTokenizerState:t.commentState from:'#' to:'#']; + [t setTokenizerState:t.commentState from:'/' to:'/']; + + [t.commentState addSingleLineStartMarker:@"##"]; + [t.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + t.commentState.fallbackState = t.symbolState; + [t.commentState setFallbackState:t.delimitState from:'/' to:'/']; + + t.string = @"foo /bar/ /*## */ # baz ## ja"; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(@"/bar/", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"#", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"baz", tok.stringValue); + + tok = [t nextToken]; + TDEqualObjects(nil, tok.stringValue); + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testTrickyFwdSlash2 { + [t.delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:nil]; + + [t setTokenizerState:t.commentState from:'#' to:'#']; + [t setTokenizerState:t.commentState from:'/' to:'/']; + + [t.commentState addSingleLineStartMarker:@"##"]; + [t.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + t.commentState.fallbackState = t.symbolState; + [t.commentState setFallbackState:t.delimitState from:'/' to:'/']; + + t.string = @"## ja"; + + tok = [t nextToken]; + TDEqualObjects(nil, tok.stringValue); + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testTrickyFwdSlash3 { + [t.delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:nil]; + + [t setTokenizerState:t.commentState from:'#' to:'#']; + [t setTokenizerState:t.commentState from:'/' to:'/']; + + [t.commentState addSingleLineStartMarker:@"##"]; + [t.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + t.commentState.fallbackState = t.delimitState; + [t.commentState setFallbackState:t.symbolState from:'#' to:'#']; + + t.string = @"foo /bar/ /*## */ # baz ## ja"; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(@"/bar/", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"#", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"baz", tok.stringValue); + + tok = [t nextToken]; + TDEqualObjects(nil, tok.stringValue); + TDTrue([PKToken EOFToken] == tok); +} + +@end diff --git a/test/.svn/text-base/TDTokenizerTest.h.svn-base b/test/.svn/text-base/TDTokenizerTest.h.svn-base new file mode 100644 index 0000000..e6bc1ba --- /dev/null +++ b/test/.svn/text-base/TDTokenizerTest.h.svn-base @@ -0,0 +1,18 @@ +// +// PKTokenizerTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@class PKTokenizer; + +@interface TDTokenizerTest : SenTestCase { + PKTokenizer *t; + NSString *s; +} + +@end diff --git a/test/.svn/text-base/TDTokenizerTest.m.svn-base b/test/.svn/text-base/TDTokenizerTest.m.svn-base new file mode 100644 index 0000000..ed1d1cb --- /dev/null +++ b/test/.svn/text-base/TDTokenizerTest.m.svn-base @@ -0,0 +1,621 @@ +// +// PKTokenizerTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 7/11/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTokenizerTest.h" +#import "ParseKit.h" + +@implementation TDTokenizerTest + +- (void)setUp { +} + + +- (void)tearDown { +} + + +- (void)testBlastOff { + s = @"\"It's 123 blast-off!\", she said, // watch out!\n" + @"and <= 3 'ticks' later /* wince */, it's blast-off!"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + //NSLog(@"\n\n starting!!! \n\n"); + while ((tok = [t nextToken]) != eof) { + //NSLog(@"(%@)", tok.stringValue); + } + //NSLog(@"\n\n done!!! \n\n"); + +} + +- (void)testStuff { + s = @"2 != 47. Blast-off!! 'Woo-hoo!'"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + while ((tok = [t nextToken]) != eof) { + //NSLog(@"(%@) (%.1f) : %@", tok.stringValue, tok.floatValue, [tok debugDescription]); + } +} + + +- (void)testStuff2 { + s = @"2 != 47. Blast-off!! 'Woo-hoo!'"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"2"); + TDEqualObjects(tok.value, [NSNumber numberWithFloat:2.0]); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"!="); + TDEqualObjects(tok.value, @"!="); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"47"); + TDEqualObjects(tok.value, [NSNumber numberWithFloat:47.0]); + TDEquals(tok.offset, (NSUInteger)5); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"."); + TDEqualObjects(tok.value, @"."); + TDEquals(tok.offset, (NSUInteger)7); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"Blast-off"); + TDEqualObjects(tok.value, @"Blast-off"); + TDEquals(tok.offset, (NSUInteger)9); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"!"); + TDEqualObjects(tok.value, @"!"); + TDEquals(tok.offset, (NSUInteger)18); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"!"); + TDEqualObjects(tok.value, @"!"); + TDEquals(tok.offset, (NSUInteger)19); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isQuotedString); + TDEqualObjects(tok.stringValue, @"'Woo-hoo!'"); + TDEqualObjects(tok.value, @"'Woo-hoo!'"); + TDEquals(tok.offset, (NSUInteger)21); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok == eof); + TDEquals(tok.offset, (NSUInteger)PKEOF); +} + + +- (void)testFortySevenDot { + s = @"47."; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"47"); + TDEqualObjects(tok.value, [NSNumber numberWithFloat:47.0]); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"."); + TDEqualObjects(tok.value, @"."); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok == eof); + TDEquals(tok.offset, (NSUInteger)PKEOF); +} + + +- (void)testFortySevenDotSpaceFoo { + s = @"47. foo"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"47"); + TDEqualObjects(tok.value, [NSNumber numberWithFloat:47.0]); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"."); + TDEqualObjects(tok.value, @"."); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEqualObjects(tok.value, @"foo"); + TDEquals(tok.offset, (NSUInteger)4); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok == eof); + TDEquals(tok.offset, (NSUInteger)PKEOF); +} + + +- (void)testDotOne { + s = @" .999"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + STAssertEqualsWithAccuracy((CGFloat)0.999, tok.floatValue, 0.01, @""); + TDTrue(tok.isNumber); + TDEquals(tok.offset, (NSUInteger)3); + +// if ([PKToken EOFToken] == token) break; + +} + + +- (void)testSpaceDotSpace { + s = @" . "; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)1); + + // if ([PKToken EOFToken] == token) break; + +} + + +- (void)testInitSig { + s = @"- (id)init {"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDEqualObjects(@"-", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(@"(", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)2); +} + + +- (void)testInitSig2 { + s = @"-(id)init {"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDEqualObjects(@"-", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(@"(", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)1); +} + + +- (void)testMinusSpaceTwo { + s = @"- 2"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDEqualObjects(@"-", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(@"2", tok.stringValue); + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEquals(tok.offset, (NSUInteger)2); +} + + +- (void)testMinusPlusTwo { + s = @"+2"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDEqualObjects(@"+", tok.stringValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2", tok.stringValue); + TDEquals(tok.offset, (NSUInteger)1); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testMinusPlusTwoCustom { + s = @"+2"; + t = [PKTokenizer tokenizerWithString:s]; + [t setTokenizerState:t.numberState from:'+' to:'+']; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+2", tok.stringValue); + TDEquals(tok.offset, (NSUInteger)0); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testSimpleAPIUsage { + s = @". , () 12.33333 .:= .456\n\n>=< 'boooo'fasa this should /* not*/ appear \r /*but */this should >==<"]; + + NSMutableArray *toks = [NSMutableArray array]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *token = nil; + while (token = [t nextToken]) { + if (eof == token) break; + + [toks addObject:token]; + + } + + //NSLog(@"\n\n\n\ntoks: %@\n\n\n\n", toks); +} + + +- (void)testKatakana1 { + s = @"ア"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = [t nextToken]; + + TDNotNil(tok); + TDTrue(tok.isWord); + TDEqualObjects(s, tok.stringValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(eof, tok); +} + + +- (void)testKatakana2 { + s = @"アア"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = [t nextToken]; + + TDNotNil(tok); + TDTrue(tok.isWord); + TDEqualObjects(s, tok.stringValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(eof, tok); +} + + +- (void)testKatakana3 { + s = @"アェ"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = [t nextToken]; + + TDNotNil(tok); + TDTrue(tok.isWord); + TDEqualObjects(s, tok.stringValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(eof, tok); +} + + +- (void)testParenStuff { + s = @"-(ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)4); + + tok = [t nextToken]; + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"5"); + TDEquals((CGFloat)5.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)5); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @")"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)6); +} + + +- (void)testParenStuff2 { + s = @"- (ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)3); +} + + +- (void)testParenStuff3 { + s = @"+(ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)4); + + tok = [t nextToken]; + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"5"); + TDEquals((CGFloat)5.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)5); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @")"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)6); +} + + +- (void)testParenStuff4 { + s = @"+ (ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)3); +} + + +- (void)testParenStuff5 { + s = @".(ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"."); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)4); + + tok = [t nextToken]; + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"5"); + TDEquals((CGFloat)5.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)5); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @")"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)6); +} + + +- (void)testParenStuff6 { + s = @". (ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"."); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)3); +} + + +- (void)testParenStuff7 { + s = @"-(ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + + NSMutableString *final = [NSMutableString string]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + while ((tok = [t nextToken]) != eof) { + [final appendString:[tok stringValue]]; + } + + TDNotNil(tok); + TDEqualObjects(final, s); + TDEqualObjects(eof, [t nextToken]); +} + +@end diff --git a/test/.svn/text-base/TDTrackTest.h.svn-base b/test/.svn/text-base/TDTrackTest.h.svn-base new file mode 100644 index 0000000..a27d572 --- /dev/null +++ b/test/.svn/text-base/TDTrackTest.h.svn-base @@ -0,0 +1,15 @@ +// +// PKTrackTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDTrackTest : SenTestCase { + +} + +@end diff --git a/test/.svn/text-base/TDTrackTest.m.svn-base b/test/.svn/text-base/TDTrackTest.m.svn-base new file mode 100644 index 0000000..66dfeed --- /dev/null +++ b/test/.svn/text-base/TDTrackTest.m.svn-base @@ -0,0 +1,112 @@ +// +// PKTrackTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTrackTest.h" +#import "ParseKit.h" + + +@implementation TDTrackTest + +// list = '(' contents ')' +// contents = empty | actualList +// actualList = Word (',' Word)* + + +- (PKParser *)listParser { + PKTrack *commaWord = [PKTrack track]; + [commaWord add:[[PKSymbol symbolWithString:@","] discard]]; + [commaWord add:[PKWord word]]; + + PKSequence *actualList = [PKSequence sequence]; + [actualList add:[PKWord word]]; + [actualList add:[PKRepetition repetitionWithSubparser:commaWord]]; + + PKAlternation *contents = [PKAlternation alternation]; + [contents add:[PKEmpty empty]]; + [contents add:actualList]; + + PKTrack *list = [PKTrack track]; + [list add:[[PKSymbol symbolWithString:@"("] discard]]; + [list add:contents]; + [list add:[[PKSymbol symbolWithString:@")"] discard]]; + + return list; +} + + +#ifndef TARGET_CPU_X86_64 +- (void)testTrack { + + PKParser *list = [self listParser]; + + NSArray *test = [NSArray arrayWithObjects: + @"()", + @"(pilfer)", + @"(pilfer, pinch)", + @"(pilfer, pinch, purloin)", + @"(pilfer, pinch,, purloin)", + @"(", + @"(pilfer", + @"(pilfer, ", + @"(, pinch, purloin)", + @"pilfer, pinch", + nil]; + + for (NSString *s in test) { + //NSLog(@"\n----testing: %@", s); + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + @try { + PKAssembly *result = [list completeMatchFor:a]; + if (!result) { + //NSLog(@"[list completeMatchFor:] returns nil"); + } else { + //NSString *stack = [[[list completeMatchFor:a] stack] description]; + //NSLog(@"OK stack is: %@", stack); + } + } @catch (PKTrackException *e) { + //NSLog(@"\n\n%@\n\n", [e reason]); + } + } + +} + + +- (void)testMissingParen { + PKParser *open = [PKSymbol symbolWithString:@"("]; + PKParser *close = [PKSymbol symbolWithString:@")"]; + PKTrack *track = [PKTrack trackWithSubparsers:open, close, nil]; + + PKAssembly *a = [PKTokenAssembly assemblyWithString:@"("]; + STAssertThrowsSpecificNamed([track completeMatchFor:a], PKTrackException, PKTrackExceptionName, @""); + + @try { + [track completeMatchFor:a]; + STAssertTrue(0, @"Should not be reached"); + } @catch (PKTrackException *e) { + TDEqualObjects([e class], [PKTrackException class]); + TDEqualObjects([e name], PKTrackExceptionName); + + NSDictionary *userInfo = e.userInfo; + TDNotNil(userInfo); + + NSString *after = [userInfo objectForKey:@"after"]; + NSString *expected = [userInfo objectForKey:@"expected"]; + NSString *found = [userInfo objectForKey:@"found"]; + + TDNotNil(after); + TDNotNil(expected); + TDNotNil(found); + + TDEqualObjects(after, @"("); + TDEqualObjects(expected, @"Symbol )"); + TDEqualObjects(found, @"-nothing-"); + } +} +#endif + +@end diff --git a/test/.svn/text-base/TDUppercaseWordTest.h.svn-base b/test/.svn/text-base/TDUppercaseWordTest.h.svn-base new file mode 100644 index 0000000..46c6a3c --- /dev/null +++ b/test/.svn/text-base/TDUppercaseWordTest.h.svn-base @@ -0,0 +1,15 @@ +// +// PKUppercaseWordTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDUppercaseWordTest : SenTestCase { + +} + +@end diff --git a/test/.svn/text-base/TDUppercaseWordTest.m.svn-base b/test/.svn/text-base/TDUppercaseWordTest.m.svn-base new file mode 100644 index 0000000..58d2009 --- /dev/null +++ b/test/.svn/text-base/TDUppercaseWordTest.m.svn-base @@ -0,0 +1,58 @@ +// +// PKUppercaseWordTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/13/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDUppercaseWordTest.h" +#import "ParseKit.h" + +@implementation TDUppercaseWordTest + +- (void)testFoobar { + NSString *s = @"Foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKUppercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[Foobar]Foobar^", [result description]); +} + + +- (void)testfoobar { + NSString *s = @"foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKUppercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + + +- (void)test123 { + NSString *s = @"123"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKUppercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + + +- (void)testPercentFoobar { + NSString *s = @"%Foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKUppercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + +@end diff --git a/test/.svn/text-base/TDWhitespaceStateTest.h.svn-base b/test/.svn/text-base/TDWhitespaceStateTest.h.svn-base new file mode 100644 index 0000000..210c614 --- /dev/null +++ b/test/.svn/text-base/TDWhitespaceStateTest.h.svn-base @@ -0,0 +1,16 @@ +// +// PKWhitespaceStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDWhitespaceStateTest : SenTestCase { + PKWhitespaceState *whitespaceState; + PKReader *r; + NSString *s; +} +@end diff --git a/test/.svn/text-base/TDWhitespaceStateTest.m.svn-base b/test/.svn/text-base/TDWhitespaceStateTest.m.svn-base new file mode 100644 index 0000000..a751dc8 --- /dev/null +++ b/test/.svn/text-base/TDWhitespaceStateTest.m.svn-base @@ -0,0 +1,324 @@ +// +// PKWhitespaceStateTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDWhitespaceStateTest.h" + + +@implementation TDWhitespaceStateTest + +- (void)setUp { + whitespaceState = [[PKWhitespaceState alloc] init]; +} + + +- (void)tearDown { + [whitespaceState release]; + [r release]; +} + + +- (void)testSpace { + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testTwoSpaces { + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testNil { + s = nil; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testNull { + s = NULL; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testEmptyString { + s = @""; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testTab { + s = @"\t"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testNewLine { + s = @"\n"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testCarriageReturn { + s = @"\r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSpaceCarriageReturn { + s = @" \r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSpaceTabNewLineSpace { + s = @" \t\n "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSpaceA { + s = @" a"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + +- (void)testSpaceASpace { + s = @" a "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testTabA { + s = @"\ta"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testNewLineA { + s = @"\na"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testCarriageReturnA { + s = @"\ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testNewLineSpaceCarriageReturnA { + s = @"\n \ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +#pragma mark - +#pragma mark Significant + +- (void)testSignificantSpace { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantTwoSpaces { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantEmptyString { + whitespaceState.reportsWhitespaceTokens = YES; + s = @""; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantTab { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\t"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantNewLine { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\n"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantCarriageReturn { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantSpaceCarriageReturn { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" \r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantSpaceTabNewLineSpace { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" \t\n "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantSpaceA { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" a"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@" ", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSignificantSpaceASpace { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" a "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@" ", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSignificantTabA { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\ta"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@"\t", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSignificantNewLineA { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\na"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@"\n", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSignificantCarriageReturnA { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@"\r", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSignificantNewLineSpaceCarriageReturnA { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\n \ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@"\n \r", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + +@end \ No newline at end of file diff --git a/test/.svn/text-base/TDWordOrReservedState.h.svn-base b/test/.svn/text-base/TDWordOrReservedState.h.svn-base new file mode 100644 index 0000000..9545ff0 --- /dev/null +++ b/test/.svn/text-base/TDWordOrReservedState.h.svn-base @@ -0,0 +1,25 @@ +// +// PKWordOrReservedState.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +#import + +/*! + @class TDWordOrReservedState + @brief Override PKWordState to return known reserved words as tokens of type TDTT_RESERVED. +*/ +@interface TDWordOrReservedState : PKWordState { + NSMutableSet *reservedWords; +} + +/*! + @brief Adds the specified string as a known reserved word. + @param s reserved word to add +*/ +- (void)addReservedWord:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDWordOrReservedState.m.svn-base b/test/.svn/text-base/TDWordOrReservedState.m.svn-base new file mode 100644 index 0000000..e61c42b --- /dev/null +++ b/test/.svn/text-base/TDWordOrReservedState.m.svn-base @@ -0,0 +1,42 @@ +// +// PKWordOrReservedState.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/14/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface TDWordOrReservedState () +@property (nonatomic, retain) NSMutableSet *reservedWords; +@end + +@implementation TDWordOrReservedState + +- (id)init { + if (self = [super init]) { + self.reservedWords = [NSMutableSet set]; + } + return self; +} + + +- (void)dealloc { + self.reservedWords = nil; + [super dealloc]; +} + + +- (void)addReservedWord:(NSString *)s { + [reservedWords addObject:s]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + return nil; +} + +@synthesize reservedWords; +@end diff --git a/test/.svn/text-base/TDWordStateTest.h.svn-base b/test/.svn/text-base/TDWordStateTest.h.svn-base new file mode 100644 index 0000000..8a31c15 --- /dev/null +++ b/test/.svn/text-base/TDWordStateTest.h.svn-base @@ -0,0 +1,16 @@ +// +// PKWordStateTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDWordStateTest : SenTestCase { + PKWordState *wordState; + PKReader *r; + NSString *s; +} +@end diff --git a/test/.svn/text-base/TDWordStateTest.m.svn-base b/test/.svn/text-base/TDWordStateTest.m.svn-base new file mode 100644 index 0000000..274c1e8 --- /dev/null +++ b/test/.svn/text-base/TDWordStateTest.m.svn-base @@ -0,0 +1,112 @@ +// +// PKWordStateTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDWordStateTest.h" + + +@implementation TDWordStateTest + +- (void)setUp { + wordState = [[PKWordState alloc] init]; +} + + +- (void)tearDown { + [wordState release]; + [r release]; +} + + +- (void)testA { + s = @"a"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"a", tok.stringValue); + TDEqualObjects(@"a", tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testASpace { + s = @"a "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"a", tok.stringValue); + TDEqualObjects(@"a", tok.value); + TDTrue(tok.isWord); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testAb { + s = @"ab"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testAbc { + s = @"abc"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testItApostropheS { + s = @"it's"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testTwentyDashFive { + s = @"twenty-five"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testTwentyUnderscoreFive { + s = @"twenty_five"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testNumber1 { + s = @"number1"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + +@end diff --git a/test/.svn/text-base/TDXMLParser.h.svn-base b/test/.svn/text-base/TDXMLParser.h.svn-base new file mode 100644 index 0000000..d7e944e --- /dev/null +++ b/test/.svn/text-base/TDXMLParser.h.svn-base @@ -0,0 +1,15 @@ +// +// PKXMLParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/19/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface TDXMLParser : NSObject { + +} + +@end diff --git a/test/.svn/text-base/TDXMLParser.m.svn-base b/test/.svn/text-base/TDXMLParser.m.svn-base new file mode 100644 index 0000000..f72a6ce --- /dev/null +++ b/test/.svn/text-base/TDXMLParser.m.svn-base @@ -0,0 +1,15 @@ +// +// PKXMLParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/19/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXMLParser.h" + +@implementation TDXMLParser + + + +@end diff --git a/test/.svn/text-base/TDXMLParserTest.h.svn-base b/test/.svn/text-base/TDXMLParserTest.h.svn-base new file mode 100644 index 0000000..41d88d6 --- /dev/null +++ b/test/.svn/text-base/TDXMLParserTest.h.svn-base @@ -0,0 +1,21 @@ +// +// PKXMLParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/19/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface TDXMLParserTest : SenTestCase { + NSString *s; + NSString *g; + PKParserFactory *factory; + PKTokenAssembly *a; + PKAssembly *res; + PKParser *p; + PKTokenizer *t; +} + +@end diff --git a/test/.svn/text-base/TDXMLParserTest.m.svn-base b/test/.svn/text-base/TDXMLParserTest.m.svn-base new file mode 100644 index 0000000..605667a --- /dev/null +++ b/test/.svn/text-base/TDXMLParserTest.m.svn-base @@ -0,0 +1,423 @@ +// +// PKXMLParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/19/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXMLParserTest.h" + +@implementation TDXMLParserTest + +- (void)setUp { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"xml" ofType:@"grammar"]; + g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + factory = [PKParserFactory factory]; + p = [factory parserFromGrammar:g assembler:self]; + t = p.tokenizer; +} + + +- (void)testSTag { + PKParser *sTag = [p parserNamed:@"sTag"]; + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, , >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, \t, >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, \n , >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, , bar, =, 'baz', >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, , bar, =, 'baz', , baz, =, 'bat', >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, , bar, =, 'baz', , baz, =, \t, 'bat', >]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + TDEqualObjects(@"[<, foo, />]^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, ]/^", [res description]); + + t.string = @" "; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, , ]/ /^", [res description]); + + t.string = @"&bar;"; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &, bar, ;, ]/&/bar/;/^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#, 20, ;, ]/&#/20/;/^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, ]/&#x/FF20/;/^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , ]/&#x/FF20/;/ /^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, , ]//^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , ]/&#x/FF20/;//^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , , ]/&#x/FF20/;/ //^", [res description]); +} + + +- (void)testSmallSTagGrammar { + g = @"@delimitState='<';@reportsWhitespaceTokens=YES;@start=sTag;sTag='<' name (S attribute)* S? '>';name=/[^-:\\.]\\w+/;attribute=name eq attValue;eq=S? '=' S?;attValue=QuotedString;"; + PKParser *sTag = [factory parserFromGrammar:g assembler:nil]; + t = sTag.tokenizer; + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [sTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, >]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [sTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, , >]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [sTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, \n, >]^", [res description]); + + t.string = @"< foo>"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [sTag bestMatchFor:a]; + TDNil(res); +} + + +- (void)testSmallETagGrammar { + g = @"@symbols = '&#' '&#x' '' '' nil; @delimitedString='' nil; @delimitedString='' nil;" + @"@reportsWhitespaceTokens = YES;" + @"@start = eTag;" + @"eTag='';" + @"name=/[^-:\\.]\\w+/;"; + + PKParser *eTag = [factory parserFromGrammar:g assembler:nil]; + t = eTag.tokenizer; + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eTag bestMatchFor:a]; + TDEqualObjects(@"[]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eTag bestMatchFor:a]; + TDEqualObjects(@"[]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eTag bestMatchFor:a]; + TDNil(res); + + t.string = @"< /foo>"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eTag bestMatchFor:a]; + TDNil(res); +} + + +- (void)testETag { + t.string = @""; + res = [[p parserNamed:@"eTag"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); +} + + +- (void)test1 { + t.string = @""; + res = [[p parserNamed:@"element"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, ]/^", [res description]); + + t.string = @""; + res = [[p parserNamed:@"emptyElemTag"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, />]^", [res description]); +} + + +- (void)testSmallEmptyElemTagGrammar { + g = @"@delimitState='<';@symbols='/>';@reportsWhitespaceTokens=YES;@start=emptyElemTag;emptyElemTag='<' name (S attribute)* S? '/>';name=/[^-:\\.]\\w+/;attribute=name eq attValue;eq=S? '=' S?;attValue=QuotedString;"; + PKParser *emptyElemTag = [factory parserFromGrammar:g assembler:nil]; + t = emptyElemTag.tokenizer; + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [emptyElemTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, />]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [emptyElemTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, , />]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [emptyElemTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, , bar, =, 'baz', />]^", [res description]); +} + + +- (void)testSmallCharDataGrammar { + g = @"@symbols = '&#' '&#x' '' '' nil '' nil '' nil;" + @"@reportsWhitespaceTokens = YES;" + @"@start = charData+;" + @"charData = /[^<\\&]+/ - (/[^\\]]*\\]\\]>[^<\\&]*/);"; + + PKParser *charData = [factory parserFromGrammar:g assembler:nil]; + t = charData.tokenizer; + + t.string = @" "; + res = [charData bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[ ] ^", [res description]); + + t.string = @"foo % 1"; + res = [charData bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo, , %, , 1]foo/ /%/ /1^", [res description]); + + t.string = @"foo & 1"; + res = [charData bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo, ]foo/ ^&/ /1", [res description]); +} + + +- (void)testSmallElementGrammar { + g = @"@symbols = '&#' '&#x' '' '' nil '' nil '' nil;" + @"@reportsWhitespaceTokens = YES;" + @"@start = element;" + @"element = emptyElemTag | sTag content eTag;" + @"eTag = '';" + @"sTag = '<' name (S attribute)* S? '>';" + @"emptyElemTag = '<' name (S attribute)* S? '/>';" + //@"content = Empty | (element | reference | cdSect | pi | comment | charData)+;" + @"content = Empty | (element | reference | cdSect | charData)+;" + @"name = /[^-:\\.]\\w+/;" + @"attribute = name eq attValue;" + @"eq=S? '=' S?;" + @"attValue = QuotedString;" + @"charData = /[^<\\&]+/ - (/[^\\]]*\\]\\]>[^<\\&]*/);" + @"reference = entityRef | charRef;" + @"entityRef = '&' name ';';" + @"charRef = '&#' /[0-9]+/ ';' | '&#x' /[0-9a-fA-F]+/ ';';" + @"cdSect = DelimitedString('');" + ; + + PKParser *element = [factory parserFromGrammar:g assembler:nil]; + t = element.tokenizer; + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [element bestMatchFor:a]; + TDEqualObjects(@"[<, foo, />]^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, ]/^", [res description]); + + t.string = @" "; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, , ]/ /^", [res description]); + + t.string = @"&bar;"; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &, bar, ;, ]/&/bar/;/^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#, 20, ;, ]/&#/20/;/^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, ]/&#x/FF20/;/^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , ]/&#x/FF20/;/ /^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, , ]//^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , ]/&#x/FF20/;//^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , , ]/&#x/FF20/;/ //^", [res description]); +} + + +// [1] +- (void)testDocument { + // xmlDecl = ''; + t.string = @""; + res = [[p parserNamed:@"document"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[, <, foo, >, ]//^", [res description]); + + // xmlDecl = ''; + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[, <, foo, >, ]//^", [res description]); + + // xmlDecl = ''; + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"xml"]; + t.string = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + NSDate *d = [NSDate date]; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + NSLog(@"time: %d", [d timeIntervalSinceNow]); + TDNotNil(res); + TDTrue([[res description] hasSuffix:@"^"]); +} + + +// [2] +- (void)test { + +} + + +// [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) +// charData = /[^<\&]+/ - (/[^\]]*\]\]>[^<\&]*/); +- (void)testCharData { + t.string = @"foo"; + res = [[p parserNamed:@"charData"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + t.string = @"fo' +// comment = DelimitedString(''); +- (void)testComment { + t.string = @""; + res = [[p parserNamed:@"comment"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + + +} + + +// [16] PI ::= '' Char*)))? '?>' +// [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) +// pi = '/* '?>'; +// piTarget = name - /xml/i; + +- (void)testPI { + NSString *gram = + @"@reportsWhitespaceTokens=YES;" + @"@symbols='';" + @"@symbolState = '<';" + @"name=/[^-:\\.]\\w+/;" + @"piTarget = name - /xml/i;" + @"@wordState = ':' '.' '-' '_';" + @"@wordChars = ':' '.' '-' '_';" + @"pi = '/* '?>';" + @"@start = pi;"; + PKParser *pi = [[PKParserFactory factory] parserFromGrammar:gram assembler:nil]; + pi.tokenizer.string = @""; + res = [pi bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:pi.tokenizer]]; + TDEqualObjects(@"[]^", [res description]); + + t.string = @""; + res = [[p parserNamed:@"pi"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + + t.string = @""; + res = [[p parserNamed:@"pi"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + +} + + +// [23] XMLDecl ::= '' +// xmlDecl = ''; +- (void)testXmlDecl { +// versionNum = /(['"])1\.[0-9]\1/; +// versionInfo = S 'version' eq versionNum; + + t.string = @" version='1.0'"; + res = [[p parserNamed:@"versionInfo"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[ , version, =, '1.0'] /version/=/'1.0'^", [res description]); + + // encodingDecl = S 'encoding' eq QuotedString; # TODO + t.string = @" encoding='UTF-8'"; + res = [[p parserNamed:@"encodingDecl"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[ , encoding, =, 'UTF-8'] /encoding/=/'UTF-8'^", [res description]); + + // sdDecl = S 'standalone' eq QuotedString; # /(["'])(yes|no)\1/; # TODO + t.string = @" standalone='no'"; + res = [[p parserNamed:@"sdDecl"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[ , standalone, =, 'no'] /standalone/=/'no'^", [res description]); + + t.string = @"'; + t.string = @""; + res = [[p parserNamed:@"xmlDecl"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + + // xmlDecl = ''; + t.string = @""; + res = [[p parserNamed:@"xmlDecl"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + + // xmlDecl = ''; + t.string = @""; + res = [[p parserNamed:@"xmlDecl"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + +} + + +@end diff --git a/test/.svn/text-base/TDXmlAttribute.h.svn-base b/test/.svn/text-base/TDXmlAttribute.h.svn-base new file mode 100644 index 0000000..a598664 --- /dev/null +++ b/test/.svn/text-base/TDXmlAttribute.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlAttribute.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlAttribute : TDXmlTerminal { + +} ++ (id)attribute; ++ (id)attributeWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlAttribute.m.svn-base b/test/.svn/text-base/TDXmlAttribute.m.svn-base new file mode 100644 index 0000000..428e380 --- /dev/null +++ b/test/.svn/text-base/TDXmlAttribute.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlAttribute.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlAttribute.h" +#import "TDXmlToken.h" + +@implementation TDXmlAttribute + ++ (id)attribute { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)attributeWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_ATTRIBUTE stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isAttribute; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlCdata.h.svn-base b/test/.svn/text-base/TDXmlCdata.h.svn-base new file mode 100644 index 0000000..2989542 --- /dev/null +++ b/test/.svn/text-base/TDXmlCdata.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlCdata.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlCdata : TDXmlTerminal { + +} ++ (id)cdata; ++ (id)cdataWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlCdata.m.svn-base b/test/.svn/text-base/TDXmlCdata.m.svn-base new file mode 100644 index 0000000..28d784c --- /dev/null +++ b/test/.svn/text-base/TDXmlCdata.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlCdata.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlCdata.h" +#import "TDXmlToken.h" + +@implementation TDXmlCdata + ++ (id)cdata { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)cdataWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_CDATA stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isCdata; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlComment.h.svn-base b/test/.svn/text-base/TDXmlComment.h.svn-base new file mode 100644 index 0000000..3333e09 --- /dev/null +++ b/test/.svn/text-base/TDXmlComment.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlComment.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlComment : TDXmlTerminal { + +} ++ (id)comment; ++ (id)commentWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlComment.m.svn-base b/test/.svn/text-base/TDXmlComment.m.svn-base new file mode 100644 index 0000000..4f71ab0 --- /dev/null +++ b/test/.svn/text-base/TDXmlComment.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlComment.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlComment.h" +#import "TDXmlToken.h" + +@implementation TDXmlComment + ++ (id)comment { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)commentWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_COMMENT stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isComment; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlDecl.h.svn-base b/test/.svn/text-base/TDXmlDecl.h.svn-base new file mode 100644 index 0000000..af2e19b --- /dev/null +++ b/test/.svn/text-base/TDXmlDecl.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlDecl.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlDecl : TDXmlTerminal { + +} ++ (id)xmlDecl; ++ (id)xmlDeclWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlDecl.m.svn-base b/test/.svn/text-base/TDXmlDecl.m.svn-base new file mode 100644 index 0000000..ac3655e --- /dev/null +++ b/test/.svn/text-base/TDXmlDecl.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlDecl.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlDecl.h" +#import "TDXmlToken.h" + +@implementation TDXmlDecl + ++ (id)xmlDecl { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)xmlDeclWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_XML_DECL stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isXmlDecl; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlDoctype.h.svn-base b/test/.svn/text-base/TDXmlDoctype.h.svn-base new file mode 100644 index 0000000..16692f8 --- /dev/null +++ b/test/.svn/text-base/TDXmlDoctype.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlDoctype.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlDoctype : TDXmlTerminal { + +} ++ (id)doctype; ++ (id)doctypeWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlDoctype.m.svn-base b/test/.svn/text-base/TDXmlDoctype.m.svn-base new file mode 100644 index 0000000..953e554 --- /dev/null +++ b/test/.svn/text-base/TDXmlDoctype.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlDoctype.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlDoctype.h" +#import "TDXmlToken.h" + +@implementation TDXmlDoctype + ++ (id)doctype { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)doctypeWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_DOCTYPE stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isDoctype; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlDocument.h.svn-base b/test/.svn/text-base/TDXmlDocument.h.svn-base new file mode 100644 index 0000000..9563da3 --- /dev/null +++ b/test/.svn/text-base/TDXmlDocument.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlDocument.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlDocument : TDXmlTerminal { + +} ++ (id)document; ++ (id)documentWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlDocument.m.svn-base b/test/.svn/text-base/TDXmlDocument.m.svn-base new file mode 100644 index 0000000..8b1d356 --- /dev/null +++ b/test/.svn/text-base/TDXmlDocument.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlDocument.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlDocument.h" +#import "TDXmlToken.h" + +@implementation TDXmlDocument + ++ (id)document { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)documentWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_DOCUMENT stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isDocument; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlEndEntity.h.svn-base b/test/.svn/text-base/TDXmlEndEntity.h.svn-base new file mode 100644 index 0000000..71362ac --- /dev/null +++ b/test/.svn/text-base/TDXmlEndEntity.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlEndEntity.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlEndEntity : TDXmlTerminal { + +} ++ (id)endEntity; ++ (id)endEntityWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlEndEntity.m.svn-base b/test/.svn/text-base/TDXmlEndEntity.m.svn-base new file mode 100644 index 0000000..aa49d32 --- /dev/null +++ b/test/.svn/text-base/TDXmlEndEntity.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlEndEntity.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlEndEntity.h" +#import "TDXmlToken.h" + +@implementation TDXmlEndEntity + ++ (id)endEntity { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)endEntityWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_END_ENTITY stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isEndEntity; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlEndTag.h.svn-base b/test/.svn/text-base/TDXmlEndTag.h.svn-base new file mode 100644 index 0000000..d48c90d --- /dev/null +++ b/test/.svn/text-base/TDXmlEndTag.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlEndTag.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlEndTag : TDXmlTerminal { + +} ++ (id)endTag; ++ (id)endTagWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlEndTag.m.svn-base b/test/.svn/text-base/TDXmlEndTag.m.svn-base new file mode 100644 index 0000000..436816b --- /dev/null +++ b/test/.svn/text-base/TDXmlEndTag.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlEndTag.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlEndTag.h" +#import "TDXmlToken.h" + +@implementation TDXmlEndTag + ++ (id)endTag { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)endTagWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_END_TAG stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isEndTag; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlEntity.h.svn-base b/test/.svn/text-base/TDXmlEntity.h.svn-base new file mode 100644 index 0000000..ea52efc --- /dev/null +++ b/test/.svn/text-base/TDXmlEntity.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlEntity.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlEntity : TDXmlTerminal { + +} ++ (id)entity; ++ (id)entityWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlEntity.m.svn-base b/test/.svn/text-base/TDXmlEntity.m.svn-base new file mode 100644 index 0000000..823e358 --- /dev/null +++ b/test/.svn/text-base/TDXmlEntity.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlEntity.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlEntity.h" +#import "TDXmlToken.h" + +@implementation TDXmlEntity + ++ (id)entity { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)entityWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_ENTITY stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isEntity; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlEntityRef.h.svn-base b/test/.svn/text-base/TDXmlEntityRef.h.svn-base new file mode 100644 index 0000000..b69bbba --- /dev/null +++ b/test/.svn/text-base/TDXmlEntityRef.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlEntityRef.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlEntityRef : TDXmlTerminal { + +} ++ (id)entityRef; ++ (id)entityRefWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlEntityRef.m.svn-base b/test/.svn/text-base/TDXmlEntityRef.m.svn-base new file mode 100644 index 0000000..f601ed5 --- /dev/null +++ b/test/.svn/text-base/TDXmlEntityRef.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlEntityRef.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlEntityRef.h" +#import "TDXmlToken.h" + +@implementation TDXmlEntityRef + ++ (id)entityRef { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)entityRefWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_ENTITY_REF stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isEntityRef; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlFragment.h.svn-base b/test/.svn/text-base/TDXmlFragment.h.svn-base new file mode 100644 index 0000000..0598d41 --- /dev/null +++ b/test/.svn/text-base/TDXmlFragment.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlFragment.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlFragment : TDXmlTerminal { + +} ++ (id)doctype; ++ (id)doctypeWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlFragment.m.svn-base b/test/.svn/text-base/TDXmlFragment.m.svn-base new file mode 100644 index 0000000..bddcd58 --- /dev/null +++ b/test/.svn/text-base/TDXmlFragment.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlFragment.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlFragment.h" +#import "TDXmlToken.h" + +@implementation TDXmlFragment + ++ (id)doctype { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)doctypeWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_FRAGMENT stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isFragment; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlName.h.svn-base b/test/.svn/text-base/TDXmlName.h.svn-base new file mode 100644 index 0000000..1d9d007 --- /dev/null +++ b/test/.svn/text-base/TDXmlName.h.svn-base @@ -0,0 +1,15 @@ +// +// PKXmlName.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKTerminal.h" + +@interface TDXmlName : PKTerminal { + +} ++ (id)name; +@end diff --git a/test/.svn/text-base/TDXmlName.m.svn-base b/test/.svn/text-base/TDXmlName.m.svn-base new file mode 100644 index 0000000..8a33fd2 --- /dev/null +++ b/test/.svn/text-base/TDXmlName.m.svn-base @@ -0,0 +1,33 @@ +// +// PKXmlName.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlName.h" +#import "PKToken.h" + +@implementation TDXmlName + ++ (id)name { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + if (!tok.isWord) { + return NO; + } + + //NSString *s = tok.stringValue; + if (YES) { + + } + + return YES; +} + +@end diff --git a/test/.svn/text-base/TDXmlNameState.h.svn-base b/test/.svn/text-base/TDXmlNameState.h.svn-base new file mode 100644 index 0000000..92c5ff2 --- /dev/null +++ b/test/.svn/text-base/TDXmlNameState.h.svn-base @@ -0,0 +1,15 @@ +// +// PKXmlNameState.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKTokenizerState.h" + +@interface TDXmlNameState : PKTokenizerState { + +} + +@end diff --git a/test/.svn/text-base/TDXmlNameState.m.svn-base b/test/.svn/text-base/TDXmlNameState.m.svn-base new file mode 100644 index 0000000..f3fe3ef --- /dev/null +++ b/test/.svn/text-base/TDXmlNameState.m.svn-base @@ -0,0 +1,81 @@ +// +// PKXmlNameState.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlNameState.h" +#import "PKTokenizer.h" +#import "PKReader.h" +#import "TDXmlToken.h" + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface TDXmlNameState () ++ (BOOL)isNameChar:(PKUniChar)c; ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c; ++ (BOOL)isValidNonStartSymbolChar:(PKUniChar)c; +@end + +//Name ::= (Letter | '_' | ':') (NameChar)* +@implementation TDXmlNameState + +//- (BOOL)isWhitespace:(PKUniChar)c { +// return (' ' == c || '\n' == c || '\r' == c || '\t' == c); +//} + + +// NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender ++ (BOOL)isNameChar:(PKUniChar)c { + if (isalpha(c)) { + return YES; + } else if (isdigit(c)) { + return YES; + } else if ([[self class] isValidNonStartSymbolChar:c]) { + return YES; + } + // TODO CombiningChar & Extender + return NO; +} + + ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c { + return ('_' == c || ':' == c); +} + + ++ (BOOL)isValidNonStartSymbolChar:(PKUniChar)c { + return ('_' == c || '.' == c || '-' == c || ':' == c); +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + [self resetWithReader:r]; + + NSInteger c = cin; + do { + [self append:c]; + c = [r read]; + } while ([[self class] isNameChar:c]); + + if (PKEOF != c) { + [r unread]; + } + + if ([[self bufferedString] length] == 1 && [[self class] isValidStartSymbolChar:cin]) { + return [t.symbolState nextTokenFromReader:r startingWith:cin tokenizer:t]; + } else { +// return [[[TDXmlToken alloc] initWithTokenType:TDTT_NAME +// stringValue:[[stringbuf copy] autorelease] +// floatValue:0.0] autorelease]; + return nil; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlNameTest.h.svn-base b/test/.svn/text-base/TDXmlNameTest.h.svn-base new file mode 100644 index 0000000..9401b9d --- /dev/null +++ b/test/.svn/text-base/TDXmlNameTest.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlNameTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +// + +@interface TDXmlNameTest : SenTestCase { + +} + +@end diff --git a/test/.svn/text-base/TDXmlNameTest.m.svn-base b/test/.svn/text-base/TDXmlNameTest.m.svn-base new file mode 100644 index 0000000..7daca57 --- /dev/null +++ b/test/.svn/text-base/TDXmlNameTest.m.svn-base @@ -0,0 +1,62 @@ +// +// PKXmlNameTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlNameTest.h" +#import "TDXmlNameState.h" +#import "TDXmlNmtokenState.h" +#import "TDXmlToken.h" + +@implementation TDXmlNameTest +// +//- (void)test { +// NSString *s = @"_foob?ar _foobar 2baz"; +// PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; +// +// //Name ::= (Letter | '_' | ':') (NameChar)* +// TDXmlNameState *nameState = [[[TDXmlNameState alloc] init] autorelease]; +// +// [t setTokenizerState:nameState from: '_' to: '_']; +// [t setTokenizerState:nameState from: ':' to: ':']; +// [t setTokenizerState:nameState from: 'a' to: 'z']; +// [t setTokenizerState:nameState from: 'A' to: 'Z']; +// [t setTokenizerState:nameState from:0xc0 to:0xff]; +// +// TDXmlNmtokenState *nmtokenState = [[[TDXmlNmtokenState alloc] init] autorelease]; +// [t setTokenizerState:nmtokenState from: '0' to: '9']; +// +// TDXmlToken *tok = nil; +// +// // _foob +// tok = (TDXmlToken *)[t nextToken]; +// TDNotNil(tok); +// TDTrue(tok.isName); +// +// // '?' +// tok = (TDXmlToken *)[t nextToken]; +// TDNotNil(tok); +// TDTrue(tok.isSymbol); +// +// // ar +// tok = (TDXmlToken *)[t nextToken]; +// TDNotNil(tok); +// TDTrue(tok.isName); +// +// // _foobar +// tok = (TDXmlToken *)[t nextToken]; +// TDNotNil(tok); +// TDTrue(tok.isName); +// +// // 2baz +// tok = (TDXmlToken *)[t nextToken]; +// TDNotNil(tok); +// TDTrue(tok.isNmtoken); +// NSLog(@"tok: %@", tok); +// +//} + +@end diff --git a/test/.svn/text-base/TDXmlNmtoken.h.svn-base b/test/.svn/text-base/TDXmlNmtoken.h.svn-base new file mode 100644 index 0000000..aa67c83 --- /dev/null +++ b/test/.svn/text-base/TDXmlNmtoken.h.svn-base @@ -0,0 +1,15 @@ +// +// PKXmlNmtoken.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKTerminal.h" + +@interface TDXmlNmtoken : PKTerminal { + +} ++ (id)nmtoken; +@end diff --git a/test/.svn/text-base/TDXmlNmtoken.m.svn-base b/test/.svn/text-base/TDXmlNmtoken.m.svn-base new file mode 100644 index 0000000..50cf4b1 --- /dev/null +++ b/test/.svn/text-base/TDXmlNmtoken.m.svn-base @@ -0,0 +1,24 @@ +// +// PKXmlNmtoken.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlNmtoken.h" +#import "TDXmlToken.h" + +@implementation TDXmlNmtoken + ++ (id)nmtoken { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +//- (BOOL)qualifies:(id)obj { +// TDXmlToken *tok = (TDXmlToken *)obj; +// return tok.isNmtoken; +//} + +@end diff --git a/test/.svn/text-base/TDXmlNmtokenState.h.svn-base b/test/.svn/text-base/TDXmlNmtokenState.h.svn-base new file mode 100644 index 0000000..2e57bb8 --- /dev/null +++ b/test/.svn/text-base/TDXmlNmtokenState.h.svn-base @@ -0,0 +1,15 @@ +// +// PKXmlNmtokenState.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlNameState.h" + +@interface TDXmlNmtokenState : TDXmlNameState { + +} + +@end diff --git a/test/.svn/text-base/TDXmlNmtokenState.m.svn-base b/test/.svn/text-base/TDXmlNmtokenState.m.svn-base new file mode 100644 index 0000000..7e7eb26 --- /dev/null +++ b/test/.svn/text-base/TDXmlNmtokenState.m.svn-base @@ -0,0 +1,59 @@ +// +// PKXmlNmtokenState.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlNmtokenState.h" +#import "PKTokenizer.h" +#import "PKReader.h" +#import "TDXmlToken.h" + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface TDXmlNameState () ++ (BOOL)isNameChar:(PKUniChar)c; ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c; +@end + +// NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender +@implementation TDXmlNmtokenState + ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c { + return ('_' == c || ':' == c || '-' == c || '.' == c); +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + [self resetWithReader:r]; + + NSInteger c = cin; + do { + [self append:c]; + c = [r read]; + } while ([[self class] isNameChar:c]); + + if (PKEOF != c) { + [r unread]; + } + + NSString *s = [self bufferedString]; + if ([s length] == 1 && [[self class] isValidStartSymbolChar:cin]) { + return [t.symbolState nextTokenFromReader:r startingWith:cin tokenizer:t]; + } else if ([s length] == 1 && isdigit(cin)) { + return [t.numberState nextTokenFromReader:r startingWith:cin tokenizer:t]; + } else { + return nil; +// return [[[TDXmlToken alloc] initWithTokenType:TDTT_NMTOKEN +// stringValue:[[stringbuf copy] autorelease] +// floatValue:0.0] autorelease]; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlNotation.h.svn-base b/test/.svn/text-base/TDXmlNotation.h.svn-base new file mode 100644 index 0000000..6b9c0dc --- /dev/null +++ b/test/.svn/text-base/TDXmlNotation.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlNotation.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlNotation : TDXmlTerminal { + +} ++ (id)notation; ++ (id)notationWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlNotation.m.svn-base b/test/.svn/text-base/TDXmlNotation.m.svn-base new file mode 100644 index 0000000..40e4b53 --- /dev/null +++ b/test/.svn/text-base/TDXmlNotation.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlNotation.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlNotation.h" +#import "TDXmlToken.h" + +@implementation TDXmlNotation + ++ (id)notation { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)notationWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_NOTATION stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isNotation; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlProcessingInstruction.h.svn-base b/test/.svn/text-base/TDXmlProcessingInstruction.h.svn-base new file mode 100644 index 0000000..ba6f73a --- /dev/null +++ b/test/.svn/text-base/TDXmlProcessingInstruction.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlProcessingInstruction.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlProcessingInstruction : TDXmlTerminal { + +} ++ (id)processingInstruction; ++ (id)processingInstructionWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlProcessingInstruction.m.svn-base b/test/.svn/text-base/TDXmlProcessingInstruction.m.svn-base new file mode 100644 index 0000000..fcc6e9e --- /dev/null +++ b/test/.svn/text-base/TDXmlProcessingInstruction.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlProcessingInstruction.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlProcessingInstruction.h" +#import "TDXmlToken.h" + +@implementation TDXmlProcessingInstruction + ++ (id)processingInstruction { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)processingInstructionWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_PROCESSING_INSTRUCTION stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isProcessingInstruction; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlSignificantWhitespace.h.svn-base b/test/.svn/text-base/TDXmlSignificantWhitespace.h.svn-base new file mode 100644 index 0000000..99af28c --- /dev/null +++ b/test/.svn/text-base/TDXmlSignificantWhitespace.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlSignificantWhitespace.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlSignificantWhitespace : TDXmlTerminal { + +} ++ (id)significantWhitespace; ++ (id)significantWhitespaceWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlSignificantWhitespace.m.svn-base b/test/.svn/text-base/TDXmlSignificantWhitespace.m.svn-base new file mode 100644 index 0000000..e1b4273 --- /dev/null +++ b/test/.svn/text-base/TDXmlSignificantWhitespace.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlSignificantWhitespace.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlSignificantWhitespace.h" +#import "TDXmlToken.h" + +@implementation TDXmlSignificantWhitespace + ++ (id)significantWhitespace { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)significantWhitespaceWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_SIGNIFICANT_WHITESPACE stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isSignificantWhitespace; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlStartTag.h.svn-base b/test/.svn/text-base/TDXmlStartTag.h.svn-base new file mode 100644 index 0000000..96a9e85 --- /dev/null +++ b/test/.svn/text-base/TDXmlStartTag.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlStartTag.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlStartTag : TDXmlTerminal { + +} ++ (id)startTag; ++ (id)startTagWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlStartTag.m.svn-base b/test/.svn/text-base/TDXmlStartTag.m.svn-base new file mode 100644 index 0000000..a2e67f8 --- /dev/null +++ b/test/.svn/text-base/TDXmlStartTag.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlStartTag.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlStartTag.h" +#import "TDXmlToken.h" + +@implementation TDXmlStartTag + ++ (id)startTag { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)startTagWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_START_TAG stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isStartTag; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlTerminal.h.svn-base b/test/.svn/text-base/TDXmlTerminal.h.svn-base new file mode 100644 index 0000000..05f5186 --- /dev/null +++ b/test/.svn/text-base/TDXmlTerminal.h.svn-base @@ -0,0 +1,17 @@ +// +// PKXmlTerminal.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class TDXmlToken; + +@interface TDXmlTerminal : PKTerminal { + TDXmlToken *tok; +} +@property (nonatomic, retain) TDXmlToken *tok; +@end diff --git a/test/.svn/text-base/TDXmlTerminal.m.svn-base b/test/.svn/text-base/TDXmlTerminal.m.svn-base new file mode 100644 index 0000000..4ae615c --- /dev/null +++ b/test/.svn/text-base/TDXmlTerminal.m.svn-base @@ -0,0 +1,20 @@ +// +// PKXmlTerminal.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" +#import "TDXmlToken.h" + +@implementation TDXmlTerminal + +- (void)dealloc { + self.tok = nil; + [super dealloc]; +} + +@synthesize tok; +@end diff --git a/test/.svn/text-base/TDXmlText.h.svn-base b/test/.svn/text-base/TDXmlText.h.svn-base new file mode 100644 index 0000000..c404139 --- /dev/null +++ b/test/.svn/text-base/TDXmlText.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlText.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlText : TDXmlTerminal { + +} ++ (id)text; ++ (id)textWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlText.m.svn-base b/test/.svn/text-base/TDXmlText.m.svn-base new file mode 100644 index 0000000..8975b40 --- /dev/null +++ b/test/.svn/text-base/TDXmlText.m.svn-base @@ -0,0 +1,51 @@ +// +// PKXmlText.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlText.h" +#import "TDXmlToken.h" + +@implementation TDXmlText + ++ (id)text { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)textWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + NSLog(@"%s", _cmd); + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_TEXT stringValue:s]; + NSLog(@"tok : %@", tok); + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + NSLog(@"%s obj: %@ isText: %d", _cmd, obj, other.isText); + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isText; + } +} + +@end diff --git a/test/.svn/text-base/TDXmlToken.h.svn-base b/test/.svn/text-base/TDXmlToken.h.svn-base new file mode 100644 index 0000000..5117523 --- /dev/null +++ b/test/.svn/text-base/TDXmlToken.h.svn-base @@ -0,0 +1,89 @@ +// +// PKXmlToken.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +typedef enum { + TDTT_XML_NONE = 0, + TDTT_XML_START_TAG = 1, + TDTT_XML_ATTRIBUTE = 2, + TDTT_XML_TEXT = 3, + TDTT_XML_CDATA = 4, + TDTT_XML_ENTITY_REF = 5, + TDTT_XML_ENTITY = 6, + TDTT_XML_PROCESSING_INSTRUCTION = 7, + TDTT_XML_COMMENT = 8, + TDTT_XML_DOCUMENT = 9, + TDTT_XML_DOCTYPE = 10, + TDTT_XML_FRAGMENT = 11, + TDTT_XML_NOTATION = 12, + TDTT_XML_WHITESPACE = 13, + TDTT_XML_SIGNIFICANT_WHITESPACE = 14, + TDTT_XML_END_TAG = 15, + TDTT_XML_END_ENTITY = 16, + TDTT_XML_XML_DECL = 17, + TDTT_XML_EOF = 18 +} TDXmlTokenType; + +@interface TDXmlToken : NSObject { + NSString *stringValue; + TDXmlTokenType tokenType; + + BOOL none; + BOOL startTag; + BOOL attribute; + BOOL text; + BOOL cdata; + BOOL entityRef; + BOOL entity; + BOOL processingInstruction; + BOOL comment; + BOOL document; + BOOL doctype; + BOOL fragment; + BOOL notation; + BOOL whitespace; + BOOL significantWhitespace; + BOOL endTag; + BOOL endEntity; + BOOL xmlDecl; + + id value; +} ++ (TDXmlToken *)EOFToken; ++ (id)tokenWithTokenType:(TDXmlTokenType)t stringValue:(NSString *)s; + +// designated initializer +- (id)initWithTokenType:(TDXmlTokenType)t stringValue:(NSString *)s; + +- (BOOL)isEqualIgnoringCase:(id)obj; + +- (NSString *)debugDescription; + +@property (nonatomic, readonly, getter=isNone) BOOL none; +@property (nonatomic, readonly, getter=isStartTag) BOOL startTag; +@property (nonatomic, readonly, getter=isAttribute) BOOL attribute; +@property (nonatomic, readonly, getter=isText) BOOL text; +@property (nonatomic, readonly, getter=isCdata) BOOL cdata; +@property (nonatomic, readonly, getter=isEntityRef) BOOL entityRef; +@property (nonatomic, readonly, getter=isEntity) BOOL entity; +@property (nonatomic, readonly, getter=isProcessingInstruction) BOOL processingInstruction; +@property (nonatomic, readonly, getter=isComment) BOOL comment; +@property (nonatomic, readonly, getter=isDocument) BOOL document; +@property (nonatomic, readonly, getter=isDoctype) BOOL doctype; +@property (nonatomic, readonly, getter=isFragment) BOOL fragment; +@property (nonatomic, readonly, getter=isNotation) BOOL notation; +@property (nonatomic, readonly, getter=isWhitespace) BOOL whitespace; +@property (nonatomic, readonly, getter=isSignificantWhitespace) BOOL significantWhitespace; +@property (nonatomic, readonly, getter=isEndTag) BOOL endTag; +@property (nonatomic, readonly, getter=isEndEntity) BOOL endEntity; +@property (nonatomic, readonly, getter=isXmlDecl) BOOL xmlDecl; +@property (nonatomic, readonly, copy) NSString *stringValue; +@property (nonatomic, readonly) TDXmlTokenType tokenType; +@property (nonatomic, readonly, copy) id value; +@end diff --git a/test/.svn/text-base/TDXmlToken.m.svn-base b/test/.svn/text-base/TDXmlToken.m.svn-base new file mode 100644 index 0000000..777d1be --- /dev/null +++ b/test/.svn/text-base/TDXmlToken.m.svn-base @@ -0,0 +1,203 @@ +// +// PKXmlToken.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlToken.h" + +@interface TDXmlTokenEOF : TDXmlToken {} +@end + +@implementation TDXmlTokenEOF +- (NSString *)description { + return [NSString stringWithFormat:@"", self]; +} +@end + +@interface TDXmlToken () +@property (nonatomic, readwrite, getter=isNone) BOOL none; +@property (nonatomic, readwrite, getter=isStartTag) BOOL startTag; +@property (nonatomic, readwrite, getter=isAttribute) BOOL attribute; +@property (nonatomic, readwrite, getter=isText) BOOL text; +@property (nonatomic, readwrite, getter=isCdata) BOOL cdata; +@property (nonatomic, readwrite, getter=isEntityRef) BOOL entityRef; +@property (nonatomic, readwrite, getter=isEntity) BOOL entity; +@property (nonatomic, readwrite, getter=isProcessingInstruction) BOOL processingInstruction; +@property (nonatomic, readwrite, getter=isComment) BOOL comment; +@property (nonatomic, readwrite, getter=isDocument) BOOL document; +@property (nonatomic, readwrite, getter=isDoctype) BOOL doctype; +@property (nonatomic, readwrite, getter=isFragment) BOOL fragment; +@property (nonatomic, readwrite, getter=isNotation) BOOL notation; +@property (nonatomic, readwrite, getter=isWhitespace) BOOL whitespace; +@property (nonatomic, readwrite, getter=isSignificantWhitespace) BOOL significantWhitespace; +@property (nonatomic, readwrite, getter=isEndTag) BOOL endTag; +@property (nonatomic, readwrite, getter=isEndEntity) BOOL endEntity; +@property (nonatomic, readwrite, getter=isXmlDecl) BOOL xmlDecl; +@property (nonatomic, readwrite, copy) NSString *stringValue; +@property (nonatomic, readwrite) TDXmlTokenType tokenType; +@property (nonatomic, readwrite, copy) id value; +@end + +@implementation TDXmlToken + ++ (TDXmlToken *)EOFToken { + static TDXmlToken *EOFToken = nil; + @synchronized (self) { + if (!EOFToken) { + EOFToken = [[TDXmlTokenEOF alloc] initWithTokenType:TDTT_XML_EOF stringValue:nil]; + } + } + return EOFToken; +} + + ++ (id)tokenWithTokenType:(TDXmlTokenType)t stringValue:(NSString *)s { + return [[[self alloc] initWithTokenType:t stringValue:s] autorelease]; +} + + +#pragma mark - + +// designated initializer +- (id)initWithTokenType:(TDXmlTokenType)t stringValue:(NSString *)s { + if (self = [super init]) { + self.tokenType = t; + self.stringValue = s; + + self.none = (TDTT_XML_NONE == t); + self.startTag = (TDTT_XML_START_TAG == t); + self.attribute = (TDTT_XML_ATTRIBUTE == t); + self.text = (TDTT_XML_TEXT == t); + self.cdata = (TDTT_XML_CDATA == t); + self.entityRef = (TDTT_XML_ENTITY_REF == t); + self.entity = (TDTT_XML_ENTITY == t); + self.processingInstruction = (TDTT_XML_PROCESSING_INSTRUCTION == t); + self.comment = (TDTT_XML_COMMENT == t); + self.document = (TDTT_XML_DOCUMENT == t); + self.doctype = (TDTT_XML_DOCTYPE == t); + self.fragment = (TDTT_XML_FRAGMENT == t); + self.notation = (TDTT_XML_NOTATION == t); + self.whitespace = (TDTT_XML_WHITESPACE == t); + self.significantWhitespace = (TDTT_XML_SIGNIFICANT_WHITESPACE == t); + self.endTag = (TDTT_XML_END_TAG == t); + self.endEntity = (TDTT_XML_END_ENTITY == t); + self.xmlDecl = (TDTT_XML_XML_DECL == t); + + self.value = stringValue; + } + return self; +} + + +- (void)dealloc { + self.stringValue = nil; + self.value = nil; + [super dealloc]; +} + + +- (NSUInteger)hash { + return [stringValue hash]; +} + + +- (BOOL)isEqual:(id)rhv { + if (![rhv isMemberOfClass:[TDXmlToken class]]) { + return NO; + } + + TDXmlToken *that = (TDXmlToken *)rhv; + if (tokenType != that.tokenType) { + return NO; + } + + return [stringValue isEqualToString:that.stringValue]; +} + + +- (BOOL)isEqualIgnoringCase:(id)rhv { + if (![rhv isMemberOfClass:[TDXmlToken class]]) { + return NO; + } + + TDXmlToken *that = (TDXmlToken *)rhv; + if (tokenType != that.tokenType) { + return NO; + } + + return [stringValue.lowercaseString isEqualToString:that.stringValue.lowercaseString]; +} + + +- (NSString *)debugDescription { + NSString *typeString = nil; + if (self.isNone) { + typeString = @"None"; + } else if (self.isStartTag) { + typeString = @"Start Tag"; + } else if (self.isAttribute) { + typeString = @"Attribute"; + } else if (self.isText) { + typeString = @"Text"; + } else if (self.isCdata) { + typeString = @"CData"; + } else if (self.isEntityRef) { + typeString = @"Entity Reference"; + } else if (self.isEntity) { + typeString = @"Entity"; + } else if (self.isProcessingInstruction) { + typeString = @"Processing Instruction"; + } else if (self.isComment) { + typeString = @"Comment"; + } else if (self.isDocument) { + typeString = @"Document"; + } else if (self.isDoctype) { + typeString = @"Doctype"; + } else if (self.isFragment) { + typeString = @"Fragment"; + } else if (self.isNotation) { + typeString = @"Notation"; + } else if (self.isWhitespace) { + typeString = @"Whitespace"; + } else if (self.isSignificantWhitespace) { + typeString = @"Significant Whitespace"; + } else if (self.isEndTag) { + typeString = @"End Tag"; + } else if (self.isEndEntity) { + typeString = @"End Entity"; + } else if (self.isXmlDecl) { + typeString = @"XML Declaration"; + } + return [NSString stringWithFormat:@"<%@ %C%@%C>", typeString, 0x00ab, self.value, 0x00bb]; +} + + +- (NSString *)description { + return [self debugDescription]; +} + +@synthesize none; +@synthesize startTag; +@synthesize attribute; +@synthesize text; +@synthesize cdata; +@synthesize entityRef; +@synthesize entity; +@synthesize processingInstruction; +@synthesize comment; +@synthesize document; +@synthesize doctype; +@synthesize fragment; +@synthesize notation; +@synthesize whitespace; +@synthesize significantWhitespace; +@synthesize endTag; +@synthesize endEntity; +@synthesize xmlDecl; +@synthesize stringValue; +@synthesize tokenType; +@synthesize value; +@end diff --git a/test/.svn/text-base/TDXmlTokenAssembly.h.svn-base b/test/.svn/text-base/TDXmlTokenAssembly.h.svn-base new file mode 100644 index 0000000..57533e1 --- /dev/null +++ b/test/.svn/text-base/TDXmlTokenAssembly.h.svn-base @@ -0,0 +1,18 @@ +// +// PKXmlTokenAssembly.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/21/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class TDXmlTokenizer; + +@interface TDXmlTokenAssembly : PKAssembly { + TDXmlTokenizer *tokenizer; + NSMutableArray *tokens; +} +@property (nonatomic, retain) TDXmlTokenizer *tokenizer; +@end diff --git a/test/.svn/text-base/TDXmlTokenAssembly.m.svn-base b/test/.svn/text-base/TDXmlTokenAssembly.m.svn-base new file mode 100644 index 0000000..380d0c2 --- /dev/null +++ b/test/.svn/text-base/TDXmlTokenAssembly.m.svn-base @@ -0,0 +1,150 @@ +// +// PKXmlTokenAssembly.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/21/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTokenAssembly.h" +#import "TDXmlTokenizer.h" +#import "TDXmlToken.h" + +@interface TDXmlTokenAssembly () +- (void)tokenize; + +@property (nonatomic, retain) NSMutableArray *tokens; +@end + +@implementation TDXmlTokenAssembly + +- (id)init { + return nil; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tokenizer = [[[TDXmlTokenizer alloc] initWithContentsOfFile:s] autorelease]; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.tokens = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + TDXmlTokenAssembly *a = (TDXmlTokenAssembly *)[super copyWithZone:zone]; + a->tokens = [self.tokens mutableCopy]; + return a; +} + + +- (NSMutableArray *)tokens { + if (!tokens) { + [self tokenize]; + } + return [[tokens retain] autorelease]; +} + + +- (void)setTokens:(NSMutableArray *)inArray { + if (inArray != tokens) { + [tokens autorelease]; + tokens = [inArray retain]; + } +} + + +- (void)tokenize { + self.tokens = [NSMutableArray array]; + + TDXmlToken *eof = [TDXmlToken EOFToken]; + TDXmlToken *tok = nil; + while ((tok = [tokenizer nextToken]) != eof) { + [tokens addObject:tok]; + } +} + + +- (id)peek { + if (index >= [self.tokens count]) { + return nil; + } + id tok = [self.tokens objectAtIndex:index]; + + return tok; +} + + +- (id)next { + id tok = [self peek]; + if (tok) { + index++; + } + return tok; +} + + +- (BOOL)hasMore { + return (index < [self.tokens count]); +} + + +- (NSUInteger)length { + return [self.tokens count]; +} + + +- (NSUInteger)consumedObjectCount { + return index; +} + + +- (NSUInteger)remainingObjectCount { + return ([self.tokens count] - index); +} + + +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter { + NSMutableString *s = [NSMutableString string]; + + NSInteger i = 0; + NSInteger len = self.consumedObjectCount; + + for ( ; i < len; i++) { + TDXmlToken *tok = [self.tokens objectAtIndex:i]; + [s appendString:tok.stringValue]; + if (i != len - 1) { + [s appendString:delimiter]; + } + } + + return [[s copy] autorelease]; +} + + +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter { + NSMutableString *s = [NSMutableString string]; + + NSInteger i = self.consumedObjectCount; + NSInteger len = [self length]; + + for ( ; i < len; i++) { + TDXmlToken *tok = [self.tokens objectAtIndex:i]; + [s appendString:tok.stringValue]; + if (i != len - 1) { + [s appendString:delimiter]; + } + } + return [[s copy] autorelease]; +} + +@synthesize tokenizer; +@end diff --git a/test/.svn/text-base/TDXmlTokenizer.h.svn-base b/test/.svn/text-base/TDXmlTokenizer.h.svn-base new file mode 100644 index 0000000..6a55b83 --- /dev/null +++ b/test/.svn/text-base/TDXmlTokenizer.h.svn-base @@ -0,0 +1,21 @@ +// +// PKXmlTokenizer.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class TDXmlToken; +@class XMLReader; + +@interface TDXmlTokenizer : NSObject { + XMLReader *reader; +} ++ (id)tokenizerWithContentsOfFile:(NSString *)path; + +- (id)initWithContentsOfFile:(NSString *)path; +- (TDXmlToken *)nextToken; +@end diff --git a/test/.svn/text-base/TDXmlTokenizer.m.svn-base b/test/.svn/text-base/TDXmlTokenizer.m.svn-base new file mode 100644 index 0000000..118bdec --- /dev/null +++ b/test/.svn/text-base/TDXmlTokenizer.m.svn-base @@ -0,0 +1,63 @@ +// +// PKXmlTokenizer.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTokenizer.h" +#import "XMLReader.h" +#import "TDXmlToken.h" + +@interface TDXmlTokenizer () +@property (nonatomic, retain) XMLReader *reader; +@end + +@implementation TDXmlTokenizer + ++ (id)tokenizerWithContentsOfFile:(NSString *)path { + return [[[self alloc] initWithContentsOfFile:path] autorelease]; +} + + +- (id)init { + return nil; +} + + +- (id)initWithContentsOfFile:(NSString *)path { + if (self = [super init]) { + self.reader = [[[XMLReader alloc] initWithContentsOfFile:path] autorelease]; + } + return self; +} + + +- (void)dealloc { + self.reader = nil; + [super dealloc]; +} + + +- (TDXmlToken *)nextToken { + TDXmlToken *tok = nil; + NSInteger ret = -1; + NSInteger nodeType = -1; + + do { + ret = [reader read]; + nodeType = reader.nodeType; + } while (nodeType == TDTT_XML_SIGNIFICANT_WHITESPACE || nodeType == TDTT_XML_WHITESPACE); + + if (ret <= 0) { + tok = [TDXmlToken EOFToken]; + } else { + tok = [TDXmlToken tokenWithTokenType:reader.nodeType stringValue:reader.name]; + } + + return tok; +} + +@synthesize reader; +@end diff --git a/test/.svn/text-base/TDXmlTokenizerTest.h.svn-base b/test/.svn/text-base/TDXmlTokenizerTest.h.svn-base new file mode 100644 index 0000000..e41411b --- /dev/null +++ b/test/.svn/text-base/TDXmlTokenizerTest.h.svn-base @@ -0,0 +1,17 @@ +// +// PKXmlTokenizerTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/21/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "TDXmlTokenizer.h" +#import "TDXmlToken.h" + +@interface TDXmlTokenizerTest : SenTestCase { + +} + +@end diff --git a/test/.svn/text-base/TDXmlTokenizerTest.m.svn-base b/test/.svn/text-base/TDXmlTokenizerTest.m.svn-base new file mode 100644 index 0000000..eac0d6b --- /dev/null +++ b/test/.svn/text-base/TDXmlTokenizerTest.m.svn-base @@ -0,0 +1,51 @@ +// +// PKXmlTokenizerTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/21/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTokenizerTest.h" +#import "TDXmlDecl.h" +#import "TDXmlStartTag.h" +#import "TDXmlEndTag.h" +#import "TDXmlText.h" +#import "TDXmlSignificantWhitespace.h" +#import "TDXmlTokenAssembly.h" + + +@implementation TDXmlTokenizerTest + +- (void)testFoo { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"xml"]; + + TDXmlTokenizer *t = [TDXmlTokenizer tokenizerWithContentsOfFile:path]; + NSLog(@"\n\n %@\n\n", t); + + TDXmlToken *eof = [TDXmlToken EOFToken]; + TDXmlToken *tok = nil; + + while ((tok = [t nextToken]) != eof) { + //NSLog(@" %@", [tok debugDescription]); + } +} + + +- (void)testAppleBoss { + PKSequence *s = [PKSequence sequence]; + s.name = @"parent sequence"; + [s add:[TDXmlStartTag startTagWithString:@"result"]]; + [s add:[TDXmlStartTag startTagWithString:@"url"]]; + [s add:[TDXmlText text]]; + [s add:[TDXmlEndTag endTagWithString:@"url"]]; + [s add:[TDXmlEndTag endTagWithString:@"result"]]; + + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"small-xml-file" ofType:@"xml"]; + TDXmlTokenAssembly *a = [TDXmlTokenAssembly assemblyWithString:path]; + + PKAssembly *result = [s bestMatchFor:a]; + NSLog(@"\n\n\n result: %@ \n\n\n", result); +} + +@end diff --git a/test/.svn/text-base/TDXmlWhitespace.h.svn-base b/test/.svn/text-base/TDXmlWhitespace.h.svn-base new file mode 100644 index 0000000..4e92513 --- /dev/null +++ b/test/.svn/text-base/TDXmlWhitespace.h.svn-base @@ -0,0 +1,16 @@ +// +// PKXmlWhitespace.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlTerminal.h" + +@interface TDXmlWhitespace : TDXmlTerminal { + +} ++ (id)whitespace; ++ (id)whitespaceWithString:(NSString *)s; +@end diff --git a/test/.svn/text-base/TDXmlWhitespace.m.svn-base b/test/.svn/text-base/TDXmlWhitespace.m.svn-base new file mode 100644 index 0000000..85b40ed --- /dev/null +++ b/test/.svn/text-base/TDXmlWhitespace.m.svn-base @@ -0,0 +1,48 @@ +// +// PKXmlWhitespace.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/20/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDXmlWhitespace.h" +#import "TDXmlToken.h" + +@implementation TDXmlWhitespace + ++ (id)whitespace { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)whitespaceWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_WHITESPACE stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isWhitespace; + } +} + +@end diff --git a/test/.svn/text-base/Tests-Info.plist.svn-base b/test/.svn/text-base/Tests-Info.plist.svn-base new file mode 100644 index 0000000..2e46062 --- /dev/null +++ b/test/.svn/text-base/Tests-Info.plist.svn-base @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.Tests + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSPrincipalClass + TDTestScaffold + + diff --git a/test/.svn/text-base/XMLReader.h.svn-base b/test/.svn/text-base/XMLReader.h.svn-base new file mode 100644 index 0000000..19cf8dd --- /dev/null +++ b/test/.svn/text-base/XMLReader.h.svn-base @@ -0,0 +1,245 @@ +// +// XMLReader.h +// XMLReader +// +// Created by Todd Ditchendorf on 6/5/06. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import +//#import +#import + +/** + * XMLReaderMode: + * + * Internal state values for the reader. + */ +typedef enum { + XMLReaderReadStateInitial = 0, + XMLReaderReadStateInteractive = 1, + XMLReaderReadStateError = 2, + XMLReaderReadStateEOF = 3, + XMLReaderReadStateClosed = 4, + XMLReaderReadStateReading = 5 +} XMLReaderReadState; + +/** + * xmlParserProperties: + * + * Some common options to use with xmlTextReaderSetParserProp, but it + * is better to use xmlParserOption and the xmlReaderNewxxx and + * xmlReaderForxxx APIs now. + * +typedef enum { + XML_PARSER_LOADDTD = 1, + XML_PARSER_DEFAULTATTRS = 2, + XML_PARSER_VALIDATE = 3, + XML_PARSER_SUBST_ENTITIES = 4 +} xmlParserProperties; +*/ + +/** + * xmlParserSeverities: + * + * How severe an error callback is when the per-reader error callback API + * is used. + */ +typedef enum { + XMLReaderSeverityValidityWarning = 1, + XMLReaderSeverityValidityError = 2, + XMLReaderSeverityWarning = 3, + XMLReaderSeverityError = 4 +} XMLReaderSeverity; + +/** + * XMLReaderNodeType: + * + * Predefined constants for the different types of nodes. + */ +typedef enum { + XMLReaderNodeTypeNone = 0, + XMLReaderNodeTypeElement = 1, + XMLReaderNodeTypeAttribute = 2, + XMLReaderNodeTypeText = 3, + XMLReaderNodeTypeCDATA = 4, + XMLReaderNodeTypeEntityReference = 5, + XMLReaderNodeTypeEntity = 6, + XMLReaderNodeTypeProcessingInstruction = 7, + XMLReaderNodeTypeComment = 8, + XMLReaderNodeTypeDocument = 9, + XMLReaderNodeTypeDocumentType = 10, + XMLReaderNodeTypeDocumentFragment = 11, + XMLReaderNodeTypeNotation = 12, + XMLReaderNodeTypeWhitespace = 13, + XMLReaderNodeTypeSignificantWhitespace = 14, + XMLReaderNodeTypeEndElement = 15, + XMLReaderNodeTypeEndEntity = 16, + XMLReaderNodeTypeXmlDeclaration = 17 +} XMLReaderNodeType; + + +@interface NSObject (XMLReaderErrorHandler) +- (void)validityWarning:(NSString *)msg lineNumber:(NSInteger)n; +- (void)validityError:(NSString *)msg lineNumber:(NSInteger)n; +- (void)warning:(NSString *)msg lineNumber:(NSInteger)n; +- (void)error:(NSString *)msg lineNumber:(NSInteger)n; +- (void)fatalError:(NSString *)msg lineNumber:(NSInteger)n; +@end + +@interface XMLReader : NSObject { + xmlTextReaderPtr _reader; + xmlRelaxNGPtr _schema; + NSString *path; + id errorHandler; + NSString *relaxNGSchemaPath; +} + ++ (id)parserWithContentsOfFile:(NSString *)newPath; +//+ (id)parserWithXMLString:(NSString *)XMLString; + +- (id)initWithContentsOfFile:(NSString *)path; +//- (id)initWithXMLString:(NSString *)XMLString; + +// Gets the number of attributes on the current node. +@property (nonatomic, readonly) NSInteger attributeCount; +//- (NSInteger)attributeCount; + +// Gets the base Uniform Resource Identifier (URI) of the current node. +@property (nonatomic, readonly, copy) NSString *baseURI; +//- (NSString *)baseURI; + +// Gets a value indicating whether this reader can parse and resolve entities. +//@property (nonatomic, readonly) BOOL canResolveEntity; +//- (BOOL)canResolveEntity; + +// Gets the depth of the current node in the XML document. +@property (nonatomic, readonly) NSInteger depth; +//- (NSInteger)depth; + +// Gets a value indicating whether the XMLReader.ReadState is ReadState.EndOfFile, signifying the reader is positioned at the end of the stream. +@property (nonatomic, readonly) BOOL isEOF; +//- (BOOL)isEOF; + +// Gets a value indicating whether the current node has any attributes. +@property (nonatomic, readonly) BOOL hasAttributes; +//- (BOOL)hasAttributes; + +// Gets a value indicating whether the current node can have an associated text value. +@property (nonatomic, readonly) BOOL hasValue; +//- (BOOL)hasValue; + +// Gets a value indicating whether the current node is an attribute that was generated from the default value defined in the DTD or schema. +@property (nonatomic, readonly) BOOL isDefault; +//- (BOOL)isDefault; + +// Gets a value indicating whether the current node is an empty element (for example, ). +@property (nonatomic, readonly) BOOL isEmptyElement; +//- (BOOL)isEmptyElement; + +// Gets the local name of the current node. +@property (nonatomic, readonly, copy) NSString *localName; +//- (NSString *)localName; + +// Gets the qualified name of the current node. +@property (nonatomic, readonly, copy) NSString *name; +//- (NSString *)name; + +// Gets the namespace URI associated with the node on which the reader is positioned. +@property (nonatomic, readonly, copy) NSString *namespaceURI; +//- (NSString *)namespaceURI; + +// Gets the name table used by the current instance to store and look up element and attribute names, prefixes, and namespaces. +//- (XmlNameTable)NameTable; + +// Gets the type of the current node. +@property (nonatomic, readonly) XMLReaderNodeType nodeType; +//- (XMLReaderNodeType)nodeType; + +// Gets the namespace prefix associated with the current node. +@property (nonatomic, readonly, copy) NSString *prefix; +//- (NSString *)prefix; + +// Gets the quotation mark character used to enclose the value of an attribute. +@property (nonatomic, readonly) char quoteChar; +//- (char)quoteChar; + +// Gets the read state of the reader. +@property (nonatomic, readonly) XMLReaderReadState readState; +//- (XMLReaderReadState)readState; + +// Gets the text value of the current node. +@property (nonatomic, readonly, copy) NSString *value; +//- (NSString *)value; + +// Gets the current xml:lang scope. +@property (nonatomic, readonly, copy) NSString *XMLLang; +//- (NSString *)XMLLang; + +// Gets the current xml:space scope. +//- (XMLSpace)XMLSpace; + +// Changes the XMLReader.ReadState to XMLReaderReadState.Closed. +- (void)close; + +// Returns the value of the attribute with the specified index relative to the containing element. +- (NSString *)attributeAtIndex:(NSInteger)index; + +// Returns the value of the attribute with the specified qualified name. +- (NSString *)attributeWithQName:(NSString *)qName; + +// Returns the value of the attribute with the specified local name and namespace URI. +- (NSString *)attributeWithLocalName:(NSString *)localName namespaceURI:(NSString *)nsURI; + +// Determines whether the specified string is a valid XML name. ++ (BOOL)isName:(NSString *)str; + +// Determines whether the specified string is a valid XML name token (Nmtoken). ++ (BOOL)isNameToken:(NSString *)str; + +// Resolves a namespace prefix in the scope of the current element. +- (NSString *)lookupNamespace:(NSString *)prefix; + +// Moves the position of the current instance to the attribute with the specified index relative to the containing element. +- (void)moveToAttributeAtIndex:(NSInteger)index; + +// Moves the position of the current instance to the attribute with the specified qualified name. +- (BOOL)moveToAttributeWithQName:(NSString *)qName; + +// Moves the position of the current instance to the attribute with the specified local name and namespace URI. +- (BOOL)moveToAttributeWithLocalName:(NSString *)localName namespaceURI:(NSString *)nsURI; + +// Moves the position of the current instance to the node that contains the current Attribute node. +- (BOOL)moveToElement; + +// Moves the position of the current instance to the first attribute associated with the current node. +- (BOOL)moveToFirstAttribute; + +// Moves the position of the current instance to the next attribute associated with the current node. +- (BOOL)moveToNextAttribute; + +// Moves the position of the current instance to the next node in the stream, exposing its properties. +- (BOOL)read; + +// Parses an attribute value into one or more Text, EntityReference, and EndEntity nodes. +- (BOOL)readAttributeValue; + +// Reads the contents of a text-only element. +- (NSString *)readElementString; + +// Reads the contents of the current node, including child nodes and markup. +- (NSString *)readInnerXML; + +// Reads the current node and its contents, including child nodes and markup. +- (NSString *)readOuterXML; + +// Reads the contents of an element or text node as a string. +- (NSString *)readString; + +// Skips over the current element and moves the position of the current instance to the next node in the stream. +- (void)skip; + +@property (nonatomic, copy) NSString *relaxNGSchemaPath; +@property (nonatomic, readonly) BOOL isValid; +@property (nonatomic, retain) id errorHandler; +@end diff --git a/test/.svn/text-base/XMLReader.m.svn-base b/test/.svn/text-base/XMLReader.m.svn-base new file mode 100644 index 0000000..2ae9812 --- /dev/null +++ b/test/.svn/text-base/XMLReader.m.svn-base @@ -0,0 +1,425 @@ + +#import "XMLReader.h" +//#import +#import + +@interface NSString (libxml2Support) ++ (id)stringWithXmlChar:(xmlChar *)xc; +- (xmlChar *)xmlChar; +@end + +@implementation NSString (libxml2Support) + ++ (id)stringWithXmlChar:(xmlChar *)xc { + if (!xc) { + return nil; + } + return [NSString stringWithUTF8String:(char *)xc]; +} + + +- (xmlChar *)xmlChar { + return (unsigned char *)[self UTF8String]; +} + +@end + + +@interface XMLReader () +@property (nonatomic, copy) NSString *path; +@end + + +@implementation XMLReader + +// don't know what this handles. can't get it to fire +static void readerErr(XMLReader *self, const char *msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator) { + NSString *str = [NSString stringWithUTF8String:msg]; + int line = xmlTextReaderLocatorLineNumber(locator); + NSLog(@"some kinda error! %s, severity: %i, line: %i", msg, severity, line); + + switch (severity) { + case XMLReaderSeverityValidityWarning: + [self.errorHandler validityWarning:str lineNumber:line]; + break; + case XMLReaderSeverityValidityError: + [self.errorHandler validityError:str lineNumber:line]; + break; + case XMLReaderSeverityWarning: + [self.errorHandler warning:str lineNumber:line]; + break; + case XMLReaderSeverityError: + [self.errorHandler error:str lineNumber:line]; + break; + } + +} + + +// handles well-formedness errors in instance document +// and handles validity errors in instance doc +static void structErr(XMLReader *self, xmlErrorPtr error) { + const char *msg = error->message; + int line = error->line; + int level = error->level; + + NSLog(@"Instance doc well-formedness or validity error, level: %i", level); + NSLog(@"message: = %s", msg); + NSLog(@"line: = %i", line); + + NSString *str = [NSString stringWithUTF8String:msg]; + + switch (level) { + case XML_ERR_WARNING: + [self.errorHandler warning:str lineNumber:line]; + break; + case XML_ERR_ERROR: + [self.errorHandler error:str lineNumber:line]; + break; + case XML_ERR_FATAL: + [self.errorHandler fatalError:str lineNumber:line]; + break; + } +} + + ++ (id)parserWithContentsOfFile:(NSString *)path { + return [[[XMLReader alloc] initWithContentsOfFile:path] autorelease]; +} + +/* ++ (id)parserWithXMLString:(NSString *)XMLString { + return [[[self alloc] initWithXMLString:XMLStirng] autorelease]; +} +*/ + +- (id)initWithContentsOfFile:(NSString *)newPath { + if (self = [super init]) { + self.path = newPath; + + _reader = xmlNewTextReaderFilename([path UTF8String]); + xmlTextReaderSetParserProp(_reader, XML_PARSE_RECOVER, 1); + xmlTextReaderSetParserProp(_reader, XML_PARSE_XINCLUDE, 1); + xmlTextReaderSetErrorHandler(_reader, (xmlTextReaderErrorFunc)readerErr, (void *)self); + xmlTextReaderSetStructuredErrorHandler(_reader, (xmlStructuredErrorFunc)structErr, (void *)self); + } + return self; +} + + +- (void)dealloc { + self.path = nil; + self.errorHandler = nil; + self.relaxNGSchemaPath = nil; + if (_reader) { + xmlFreeTextReader(_reader); + } + if (_schema) { + xmlRelaxNGFree(_schema); + } + [super dealloc]; +} + + +#pragma mark - +#pragma mark Properties + +- (NSInteger)attributeCount { + return xmlTextReaderAttributeCount(_reader); +} + + +- (NSString *)baseURI { + return [NSString stringWithXmlChar:xmlTextReaderBaseUri(_reader)]; +} + + +//- (BOOL)canResolveEntity { +// return YES; +//} + + +- (NSInteger)depth { + return xmlTextReaderDepth(_reader); +} + + +- (BOOL)isEOF { + return XMLReaderReadStateEOF == [self readState]; +} + + +- (BOOL)hasAttributes { + return xmlTextReaderHasAttributes(_reader); +} + + +- (BOOL)hasValue { + return xmlTextReaderHasValue(_reader); +} + + +- (BOOL)isDefault { + return xmlTextReaderIsDefault(_reader); +} + + +- (BOOL)isEmptyElement { + return xmlTextReaderIsEmptyElement(_reader); +} + + +- (NSString *)localName { + xmlChar *c = xmlTextReaderLocalName(_reader); + if (c) { + return [NSString stringWithXmlChar:c]; + } + return nil; +} + + +- (NSString *)name { + xmlChar *c = xmlTextReaderName(_reader); + if (c) { + return [NSString stringWithXmlChar:c]; + } + return nil; +} + + +- (NSString *)namespaceURI { + xmlChar *c = xmlTextReaderNamespaceUri(_reader); + if (c) { + return [NSString stringWithXmlChar:c]; + } + return nil; +} + + +#pragma mark - +#pragma mark Methods + +- (XMLReaderNodeType)nodeType { + return xmlTextReaderNodeType(_reader); +} + + +- (NSString *)prefix { + return [NSString stringWithXmlChar:xmlTextReaderPrefix(_reader)]; +} + + +- (char)quoteChar { + return xmlTextReaderQuoteChar(_reader); +} + + +- (XMLReaderReadState)readState { + return xmlTextReaderReadState(_reader); +} + + +- (NSString *)value { + return [NSString stringWithXmlChar:xmlTextReaderValue(_reader)]; +} + + +- (NSString *)XMLLang { + return [NSString stringWithXmlChar:xmlTextReaderXmlLang(_reader)]; +} + + +- (void)close { + xmlTextReaderClose(_reader); +} + + +- (NSString *)attributeAtIndex:(NSInteger)index { + return [NSString stringWithXmlChar:xmlTextReaderGetAttributeNo(_reader, index)]; +} + + +- (NSString *)attributeWithQName:(NSString *)qName { + return [NSString stringWithXmlChar:xmlTextReaderGetAttribute(_reader, [qName xmlChar])]; +} + + +- (NSString *)attributeWithLocalName:(NSString *)localName namespaceURI:(NSString *)nsURI { + return [NSString stringWithXmlChar:xmlTextReaderGetAttributeNs(_reader, [localName xmlChar], [nsURI xmlChar])]; +} + + ++ (BOOL)isName:(NSString *)str { + return YES; +} + + ++ (BOOL)isNameToken:(NSString *)str { + return YES; +} + + +- (NSString *)lookupNamespace:(NSString *)prefix { + return [NSString stringWithXmlChar:xmlTextReaderLookupNamespace(_reader, [prefix xmlChar])]; +} + + +- (void)moveToAttributeAtIndex:(NSInteger)index { + xmlTextReaderMoveToAttributeNo(_reader, index); +} + + +- (BOOL)moveToAttributeWithQName:(NSString *)qName { + return xmlTextReaderMoveToAttribute(_reader, [qName xmlChar]); +} + + +- (BOOL)moveToAttributeWithLocalName:(NSString *)localName namespaceURI:(NSString *)nsURI { + return xmlTextReaderMoveToAttributeNs(_reader, [localName xmlChar], [nsURI xmlChar]); +} + + +- (BOOL)moveToElement { + return xmlTextReaderMoveToElement(_reader); +} + + +- (BOOL)moveToFirstAttribute { + return xmlTextReaderMoveToFirstAttribute(_reader); +} + + +- (BOOL)moveToNextAttribute { + return xmlTextReaderMoveToNextAttribute(_reader); +} + + +- (BOOL)read { + return xmlTextReaderRead(_reader); +} + + +- (BOOL)readAttributeValue { + return xmlTextReaderReadAttributeValue(_reader); +} + + +- (NSString *)readElementString { + return [NSString stringWithXmlChar:xmlTextReaderReadString(_reader)]; +} + + +- (NSString *)readInnerXML { + return [NSString stringWithXmlChar:xmlTextReaderReadInnerXml(_reader)]; +} + + +- (NSString *)readOuterXML { + return [NSString stringWithXmlChar:xmlTextReaderReadOuterXml(_reader)]; +} + + +- (NSString *)readString { + return [NSString stringWithXmlChar:xmlTextReaderReadString(_reader)]; +} + + +- (void)skip { + xmlTextReaderNextSibling(_reader); +} + + +// handles warnings encountered while parsing RNG schema +static void rngWarn(XMLReader *self, const char *msg, ...) { + va_list ap; + va_start(ap, msg); + + NSMutableString *str = [NSMutableString stringWithFormat:[NSString stringWithUTF8String:msg], ap]; + NSLog(@"RELAX NG warn: %s", msg); + va_end(ap); + + [str replaceOccurrencesOfString:@"<" + withString:@"<" + options:0 + range:NSMakeRange(0, [str length])]; + + str = [NSString stringWithFormat:@"Warning while parsing RELAX NG schema: %s",msg]; + [self.errorHandler validityWarning:str lineNumber:-1]; +} + + +// handles errors encountered while parsing RNG schema +static void rngErr(XMLReader *self, const char *msg, ...) { + va_list ap; + va_start(ap, msg); + + NSMutableString *str = [NSMutableString stringWithFormat:[NSString stringWithUTF8String:msg], ap]; + NSLog(@"RELAX NG err %@",str); + va_end(ap); + + [str replaceOccurrencesOfString:@"<" + withString:@"<" + options:0 + range:NSMakeRange(0, [str length])]; + + str = [NSString stringWithFormat:@"Error while parsing RELAX NG schema:
%@
",str]; + [self.errorHandler validityError:str lineNumber:-1]; + +} + + +- (NSString *)relaxNGSchemaPath { + return [[relaxNGSchemaPath retain] autorelease]; +} + + +- (void)setRelaxNGSchemaPath:(NSString *)newPath { + if (relaxNGSchemaPath != newPath) { + [relaxNGSchemaPath autorelease]; + relaxNGSchemaPath = [newPath retain]; + + const char *schemafurl = [relaxNGSchemaPath UTF8String]; + + // RELAX NG Parser Context + xmlRelaxNGParserCtxtPtr ctxt = xmlRelaxNGNewParserCtxt(schemafurl); + xmlRelaxNGSetParserErrors(ctxt, + (xmlRelaxNGValidityErrorFunc)rngErr, + (xmlRelaxNGValidityWarningFunc)rngWarn, + (void *)self); + // xmlRelaxNGSetParserStructuredErrors(ctxt, (xmlStructuredErrorFunc)structErr, NULL); + + if (_schema) { + xmlRelaxNGFree(_schema); + _schema = NULL; + } + + NSLog(@"gonna parse schema"); + _schema = xmlRelaxNGParse(ctxt); + NSLog(@"did parse schema"); + xmlRelaxNGFreeParserCtxt(ctxt); + + if (_reader) { + xmlFreeTextReader(_reader); + } + _reader = xmlNewTextReaderFilename([path UTF8String]); + xmlTextReaderSetParserProp(_reader, XML_PARSE_RECOVER, 1); + xmlTextReaderSetParserProp(_reader, XML_PARSE_XINCLUDE, 1); + + xmlTextReaderRelaxNGSetSchema(_reader, _schema); + + xmlTextReaderSetErrorHandler(_reader, (xmlTextReaderErrorFunc)readerErr, (void *)self); + + xmlTextReaderSetStructuredErrorHandler(_reader, (xmlStructuredErrorFunc)structErr, (void *)self); + } + +} + + +- (BOOL)isValid { + return xmlTextReaderIsValid(_reader); +} + +@synthesize path; +@synthesize errorHandler; +@synthesize relaxNGSchemaPath; +@end diff --git a/test/.svn/text-base/XMLReaderTest.h.svn-base b/test/.svn/text-base/XMLReaderTest.h.svn-base new file mode 100644 index 0000000..ee45ee4 --- /dev/null +++ b/test/.svn/text-base/XMLReaderTest.h.svn-base @@ -0,0 +1,16 @@ +// +// XMLReaderTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/18/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" +#import "XMLReader.h" + +@interface XMLReaderTest : SenTestCase { + +} + +@end diff --git a/test/.svn/text-base/XMLReaderTest.m.svn-base b/test/.svn/text-base/XMLReaderTest.m.svn-base new file mode 100644 index 0000000..c2986bb --- /dev/null +++ b/test/.svn/text-base/XMLReaderTest.m.svn-base @@ -0,0 +1,27 @@ +// +// XMLReaderTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/18/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "XMLReaderTest.h" + +@implementation XMLReaderTest + +- (void)test { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"xml"]; + + NSLog(@"\n\npath: %@\n\n", path); + + XMLReader *p = [XMLReader parserWithContentsOfFile:path]; + NSInteger ret = [p read]; + while (ret == 1) { + //NSLog(@"nodeType: %d, name: %@", p.nodeType, p.name); + ret = [p read]; + + } +} + +@end diff --git a/test/.svn/text-base/XPathAssembler.h.svn-base b/test/.svn/text-base/XPathAssembler.h.svn-base new file mode 100644 index 0000000..09080d4 --- /dev/null +++ b/test/.svn/text-base/XPathAssembler.h.svn-base @@ -0,0 +1,19 @@ +// +// XPathAssembler.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/17/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class XPathContext; +@class PKReader; + +@interface XPathAssembler : NSObject { + XPathContext *context; +} +- (void)resetWithReader:(PKReader *)r; +@property (retain) XPathContext *context; +@end diff --git a/test/.svn/text-base/XPathAssembler.m.svn-base b/test/.svn/text-base/XPathAssembler.m.svn-base new file mode 100644 index 0000000..6246aaf --- /dev/null +++ b/test/.svn/text-base/XPathAssembler.m.svn-base @@ -0,0 +1,59 @@ +// +// XPathAssembler.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/17/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "XPathAssembler.h" +#import +#import "XPathContext.h" + +@implementation XPathAssembler + +- (id)init { + if (self = [super init]) { + self.context = [[[XPathContext alloc] init] autorelease]; + } + return self; +} + + +- (void)dealloc { + self.context = nil; + [super dealloc]; +} + + +- (void)resetWithReader:(PKReader *)r { + [context resetWithCurrentNode:nil]; +} + + +- (void)didMatchAxisSpecifier:(PKAssembly *)a { + //NSLog(@"\n\n %s\n\n %@ \n\n", _cmd, a); + + //PKToken *tok = [a pop]; + +} + + +- (void)didMatchNodeTest:(PKAssembly *)a { + //NSLog(@"\n\n %s\n\n %@ \n\n", _cmd, a); +} + + +- (void)didMatchPredicate:(PKAssembly *)a { + //NSLog(@"\n\n %s\n\n %@ \n\n", _cmd, a); +} + +// [4] Step ::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep +- (void)didMatchStep:(PKAssembly *)a { + //NSLog(@"\n\n %s\n\n %@ \n\n", _cmd, a); +} + + + +@synthesize context; +@end diff --git a/test/.svn/text-base/XPathContext.h.svn-base b/test/.svn/text-base/XPathContext.h.svn-base new file mode 100644 index 0000000..78ef26f --- /dev/null +++ b/test/.svn/text-base/XPathContext.h.svn-base @@ -0,0 +1,29 @@ +// +// XPathContext.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/17/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@interface XPathContext : NSObject { + // static context + NSString *baseURIString; + NSMutableDictionary *namespaces; + NSMutableDictionary *variables; + NSMutableDictionary *functions; + + // dynamic context + NSXMLNode *currentNode; + NSXMLNode *contextNode; + NSArray *contextNodeSet; + + // +} +- (void)resetWithCurrentNode:(NSXMLNode *)n; +@property (retain) NSXMLNode *currentNode; +@property (retain) NSXMLNode *contextNode; +@property (retain) NSArray *contextNodeSet; +@end diff --git a/test/.svn/text-base/XPathContext.m.svn-base b/test/.svn/text-base/XPathContext.m.svn-base new file mode 100644 index 0000000..2e4daee --- /dev/null +++ b/test/.svn/text-base/XPathContext.m.svn-base @@ -0,0 +1,37 @@ +// +// XPathContext.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/17/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "XPathContext.h" + +@implementation XPathContext + +- (id)init { + if (self = [super init]) { + } + return self; +} + + +- (void)resetWithCurrentNode:(NSXMLNode *)n { + self.currentNode = n; + self.contextNode = nil; + self.contextNodeSet = nil; +} + + +- (void)dealloc { + self.currentNode = nil; + self.contextNode = nil; + self.contextNodeSet = nil; + [super dealloc]; +} + +@synthesize currentNode; +@synthesize contextNode; +@synthesize contextNodeSet; +@end diff --git a/test/.svn/text-base/XPathParser.h.svn-base b/test/.svn/text-base/XPathParser.h.svn-base new file mode 100644 index 0000000..5ec6458 --- /dev/null +++ b/test/.svn/text-base/XPathParser.h.svn-base @@ -0,0 +1,96 @@ +// +// XPathParser.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class XPathAssembler; +@class PKAssembly; + +@interface XPathParser : PKSequence { + XPathAssembler *xpathAssembler; + PKCollectionParser *locationPath; + PKCollectionParser *absoluteLocationPath; + PKCollectionParser *relativeLocationPath; + PKCollectionParser *step; + PKCollectionParser *axisSpecifier; + PKCollectionParser *axisName; + PKCollectionParser *nodeTest; + PKCollectionParser *predicate; + PKCollectionParser *predicateExpr; + PKCollectionParser *abbreviatedAbsoluteLocationPath; + PKCollectionParser *abbreviatedRelativeLocationPath; + PKCollectionParser *abbreviatedStep; + PKCollectionParser *abbreviatedAxisSpecifier; + PKCollectionParser *expr; + PKCollectionParser *primaryExpr; + PKCollectionParser *functionCall; + PKCollectionParser *argument; + PKCollectionParser *unionExpr; + PKCollectionParser *pathExpr; + PKCollectionParser *filterExpr; + PKCollectionParser *orExpr; + PKCollectionParser *andExpr; + PKCollectionParser *equalityExpr; + PKCollectionParser *relationalExpr; + PKCollectionParser *additiveExpr; + PKCollectionParser *multiplicativeExpr; + PKCollectionParser *unaryExpr; + PKCollectionParser *exprToken; + PKParser *literal; + PKParser *number; + PKCollectionParser *operator; + PKCollectionParser *operatorName; + PKParser *multiplyOperator; + PKParser *functionName; + PKCollectionParser *variableReference; + PKCollectionParser *nameTest; + PKCollectionParser *nodeType; + PKCollectionParser *QName; +} +- (id)parse:(NSString *)s; +- (PKAssembly *)assemblyWithString:(NSString *)s; + +@property (retain) PKCollectionParser *locationPath; +@property (retain) PKCollectionParser *absoluteLocationPath; +@property (retain) PKCollectionParser *relativeLocationPath; +@property (retain) PKCollectionParser *step; +@property (retain) PKCollectionParser *axisSpecifier; +@property (retain) PKCollectionParser *axisName; +@property (retain) PKCollectionParser *nodeTest; +@property (retain) PKCollectionParser *predicate; +@property (retain) PKCollectionParser *predicateExpr; +@property (retain) PKCollectionParser *abbreviatedAbsoluteLocationPath; +@property (retain) PKCollectionParser *abbreviatedRelativeLocationPath; +@property (retain) PKCollectionParser *abbreviatedStep; +@property (retain) PKCollectionParser *abbreviatedAxisSpecifier; +@property (retain) PKCollectionParser *expr; +@property (retain) PKCollectionParser *primaryExpr; +@property (retain) PKCollectionParser *functionCall; +@property (retain) PKCollectionParser *argument; +@property (retain) PKCollectionParser *unionExpr; +@property (retain) PKCollectionParser *pathExpr; +@property (retain) PKCollectionParser *filterExpr; +@property (retain) PKCollectionParser *orExpr; +@property (retain) PKCollectionParser *andExpr; +@property (retain) PKCollectionParser *equalityExpr; +@property (retain) PKCollectionParser *relationalExpr; +@property (retain) PKCollectionParser *additiveExpr; +@property (retain) PKCollectionParser *multiplicativeExpr; +@property (retain) PKCollectionParser *unaryExpr; +@property (retain) PKCollectionParser *exprToken; +@property (retain) PKParser *literal; +@property (retain) PKParser *number; +@property (retain) PKCollectionParser *operator; +@property (retain) PKCollectionParser *operatorName; +@property (retain) PKParser *multiplyOperator; +@property (retain) PKParser *functionName; +@property (retain) PKCollectionParser *variableReference; +@property (retain) PKCollectionParser *nameTest; +@property (retain) PKCollectionParser *nodeType; +@property (retain) PKCollectionParser *QName; +@end diff --git a/test/.svn/text-base/XPathParser.m.svn-base b/test/.svn/text-base/XPathParser.m.svn-base new file mode 100644 index 0000000..2ab9f05 --- /dev/null +++ b/test/.svn/text-base/XPathParser.m.svn-base @@ -0,0 +1,973 @@ +// +// XPathParser.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "XPathParser.h" +//#import "TDNCName.h" + +#import "TDNCNameState.h" +#import "XPathAssembler.h" + +@interface XPathParser () +@property (retain) XPathAssembler *xpathAssembler; +@end + +@implementation XPathParser + +- (id)init { + if (self = [super init]) { + self.xpathAssembler = [[[XPathAssembler alloc] init] autorelease]; + [self add:self.locationPath]; + } + return self; +} + + +- (void)dealloc { + self.xpathAssembler = nil; + self.locationPath = nil; + self.absoluteLocationPath = nil; + self.relativeLocationPath = nil; + self.step = nil; + self.axisSpecifier = nil; + self.axisName = nil; + self.nodeTest = nil; + self.predicate = nil; + self.predicateExpr = nil; + self.abbreviatedAbsoluteLocationPath = nil; + self.abbreviatedRelativeLocationPath = nil; + self.abbreviatedStep = nil; + self.abbreviatedAxisSpecifier = nil; + self.expr = nil; + self.primaryExpr = nil; + self.functionCall = nil; + self.argument = nil; + self.unionExpr = nil; + self.pathExpr = nil; + self.filterExpr = nil; + self.orExpr = nil; + self.andExpr = nil; + self.equalityExpr = nil; + self.relationalExpr = nil; + self.additiveExpr = nil; + self.multiplicativeExpr = nil; + self.unaryExpr = nil; + self.exprToken = nil; + self.literal = nil; + self.number = nil; + self.operator = nil; + self.operatorName = nil; + self.multiplyOperator = nil; + self.functionName = nil; + self.variableReference = nil; + self.nameTest = nil; + self.nodeType = nil; + self.QName = nil; + [super dealloc]; +} + + +- (PKAssembly *)assemblyWithString:(NSString *)s { + PKTokenizer *t = [[[PKTokenizer alloc] initWithString:s] autorelease]; + [t.symbolState add:@"::"]; + [t.symbolState add:@"!="]; + [t.symbolState add:@"<="]; + [t.symbolState add:@">="]; + [t.symbolState add:@".."]; + [t.symbolState add:@"//"]; + [t setTokenizerState:t.wordState from: '_' to: '_']; +// [t setTokenizerState:NCNameState from: 'a' to: 'z']; +// [t setTokenizerState:NCNameState from: 'A' to: 'Z']; +// [t setTokenizerState:NCNameState from:0xc0 to:0xff]; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:t]; +// TDNCNameState *NCNameState = [[[TDNCNameState alloc] init] autorelease]; + + return a; +} + + +- (id)parse:(NSString *)s { + [xpathAssembler resetWithReader:nil]; + PKAssembly *a = [self assemblyWithString:s]; + id result = [self completeMatchFor:a]; + return result; +} + + +// [1] LocationPath ::= RelativeLocationPath | AbsoluteLocationPath +- (PKCollectionParser *)locationPath { + //NSLog(@"%s", _cmd); + if (!locationPath) { + self.locationPath = [PKAlternation alternation]; + locationPath.name = @"locationPath"; + + [locationPath add:self.relativeLocationPath]; + [locationPath add:self.absoluteLocationPath]; + } + return locationPath; +} + + +//[2] AbsoluteLocationPath ::= '/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath +- (PKCollectionParser *)absoluteLocationPath { + //NSLog(@"%s", _cmd); + if (!absoluteLocationPath) { + self.absoluteLocationPath = [PKAlternation alternation]; + absoluteLocationPath.name = @"absoluteLocationPath"; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.relativeLocationPath]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"/"]]; + [s add:a]; + + [absoluteLocationPath add:s]; + [absoluteLocationPath add:self.abbreviatedAbsoluteLocationPath]; + } + return absoluteLocationPath; +} + +#pragma mark - +#pragma mark left recursion + +//[3] RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath + +// avoiding left recursion by changing to this +//[3] RelativeLocationPath ::= Step SlashStep* | AbbreviatedRelativeLocationPath + +- (PKCollectionParser *)relativeLocationPath { + //NSLog(@"%s", _cmd); + if (!relativeLocationPath) { + self.relativeLocationPath = [PKAlternation alternation]; + relativeLocationPath.name = @"relativeLocationPath"; + + PKSequence *s = [PKSequence sequence]; + [s add:self.step]; + + PKSequence *slashStep = [PKSequence sequence]; + [slashStep add:[PKSymbol symbolWithString:@"/"]]; + [slashStep add:self.step]; + [s add:[PKRepetition repetitionWithSubparser:slashStep]]; + + [relativeLocationPath add:s]; + // TODO this is causing and infinite loop! +// [relativeLocationPath add:self.abbreviatedRelativeLocationPath]; + } + return relativeLocationPath; +} + + +// [4] Step ::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep +- (PKCollectionParser *)step { + NSLog(@"%s", _cmd); + if (!step) { + self.step = [PKAlternation alternation]; + step.name = @"step"; + + PKSequence *s = [PKSequence sequence]; + [s add:self.axisSpecifier]; + [s add:self.nodeTest]; + [s add:[PKRepetition repetitionWithSubparser:self.predicate]]; + + [step add:s]; + [step add:self.abbreviatedStep]; + + [step setAssembler:xpathAssembler selector:@selector(didMatchStep:)]; + } + return step; +} + + +// [5] AxisSpecifier ::= AxisName '::' | AbbreviatedAxisSpecifier +- (PKCollectionParser *)axisSpecifier { + //NSLog(@"%s", _cmd); + if (!axisSpecifier) { + self.axisSpecifier = [PKAlternation alternation]; + axisSpecifier.name = @"axisSpecifier"; + + PKSequence *s = [PKSequence sequence]; + [s add:self.axisName]; + [s add:[PKSymbol symbolWithString:@"::"]]; + + [axisSpecifier add:s]; + [axisSpecifier add:self.abbreviatedAxisSpecifier]; + [axisSpecifier setAssembler:xpathAssembler selector:@selector(didMatchAxisSpecifier:)]; + } + return axisSpecifier; +} + + +// [6] AxisName ::= 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' | 'descendant' | 'descendant-or-self' +// | 'following' | 'following-sibling' | 'namespace' | 'parent' | 'preceding' | 'preceding-sibling' | 'self' +- (PKCollectionParser *)axisName { + //NSLog(@"%s", _cmd); + if (!axisName) { + self.axisName = [PKAlternation alternation]; + axisName.name = @"axisName"; + [axisName add:[PKLiteral literalWithString:@"ancestor"]]; + [axisName add:[PKLiteral literalWithString:@"ancestor-or-self"]]; + [axisName add:[PKLiteral literalWithString:@"attribute"]]; + [axisName add:[PKLiteral literalWithString:@"child"]]; + [axisName add:[PKLiteral literalWithString:@"descendant"]]; + [axisName add:[PKLiteral literalWithString:@"descendant-or-self"]]; + [axisName add:[PKLiteral literalWithString:@"following"]]; + [axisName add:[PKLiteral literalWithString:@"following-sibling"]]; + [axisName add:[PKLiteral literalWithString:@"preceeding"]]; + [axisName add:[PKLiteral literalWithString:@"preceeding-sibling"]]; + [axisName add:[PKLiteral literalWithString:@"namespace"]]; + [axisName add:[PKLiteral literalWithString:@"parent"]]; + [axisName add:[PKLiteral literalWithString:@"self"]]; + } + return axisName; +} + + +// [7] NodeTest ::= NameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' +- (PKCollectionParser *)nodeTest { + //NSLog(@"%s", _cmd); + if (!nodeTest) { + self.nodeTest = [PKAlternation alternation]; + nodeTest.name = @"nodeTest"; + [nodeTest add:self.nameTest]; + + PKSequence *s = [PKSequence sequence]; + [s add:self.nodeType]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:[PKSymbol symbolWithString:@")"]]; + [nodeTest add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"processing-instruction"]]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:self.literal]; + [s add:[PKSymbol symbolWithString:@")"]]; + [nodeTest add:s]; + } + return nodeTest; +} + + +// [8] Predicate ::= '[' PredicateExpr ']' +- (PKCollectionParser *)predicate { + //NSLog(@"%s", _cmd); + if (!predicate) { + self.predicate = [PKSequence sequence]; + predicate.name = @"predicate"; + [predicate add:[PKSymbol symbolWithString:@"["]]; + [predicate add:self.predicateExpr]; + [predicate add:[PKSymbol symbolWithString:@"]"]]; + } + return predicate; +} + + +// [9] PredicateExpr ::= Expr +- (PKCollectionParser *)predicateExpr { + //NSLog(@"%s", _cmd); + if (!predicateExpr) { + self.predicateExpr = self.expr; + predicateExpr.name = @"predicateExpr"; + } + return predicateExpr; +} + + +// [10] AbbreviatedAbsoluteLocationPath ::= '//' RelativeLocationPath +- (PKCollectionParser *)abbreviatedAbsoluteLocationPath { + //NSLog(@"%s", _cmd); + if (!abbreviatedAbsoluteLocationPath) { + self.abbreviatedAbsoluteLocationPath = [PKSequence sequence]; + abbreviatedAbsoluteLocationPath.name = @"abbreviatedAbsoluteLocationPath"; + [abbreviatedAbsoluteLocationPath add:[PKSymbol symbolWithString:@"//"]]; + [abbreviatedAbsoluteLocationPath add:self.relativeLocationPath]; + } + return abbreviatedAbsoluteLocationPath; +} + + +// [11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step +- (PKCollectionParser *)abbreviatedRelativeLocationPath { + //NSLog(@"%s", _cmd); + if (!abbreviatedRelativeLocationPath) { + self.abbreviatedRelativeLocationPath = [PKSequence sequence]; + abbreviatedRelativeLocationPath.name = @"abbreviatedRelativeLocationPath"; + [abbreviatedRelativeLocationPath add:self.relativeLocationPath]; + [abbreviatedRelativeLocationPath add:[PKSymbol symbolWithString:@"//"]]; + [abbreviatedRelativeLocationPath add:self.step]; + } + return abbreviatedRelativeLocationPath; +} + + +// [12] AbbreviatedStep ::= '.' | '..' +- (PKCollectionParser *)abbreviatedStep { + //NSLog(@"%s", _cmd); + if (!abbreviatedStep) { + self.abbreviatedStep = [PKAlternation alternation]; + abbreviatedStep.name = @"abbreviatedStep"; + [abbreviatedStep add:[PKSymbol symbolWithString:@"."]]; + [abbreviatedStep add:[PKSymbol symbolWithString:@".."]]; + } + return abbreviatedStep; +} + + +// [13] AbbreviatedAxisSpecifier ::= '@'? +- (PKCollectionParser *)abbreviatedAxisSpecifier { + //NSLog(@"%s", _cmd); + if (!abbreviatedAxisSpecifier) { + self.abbreviatedAxisSpecifier = [PKAlternation alternation]; + abbreviatedAxisSpecifier.name = @"abbreviatedAxisSpecifier"; + [abbreviatedAxisSpecifier add:[PKEmpty empty]]; + [abbreviatedAxisSpecifier add:[PKSymbol symbolWithString:@"@"]]; + } + return abbreviatedAxisSpecifier; +} + + +// [14] Expr ::= OrExpr +- (PKCollectionParser *)expr { + //NSLog(@"%s", _cmd); + if (!expr) { + self.expr = self.orExpr; + expr.name = @"expr"; + } + return expr; +} + + +// [15] PrimaryExpr ::= VariableReference +// | '(' Expr ')' +// | Literal +// | Number +// | FunctionCall +- (PKCollectionParser *)primaryExpr { + //NSLog(@"%s", _cmd); + if (!primaryExpr) { + self.primaryExpr = [PKAlternation alternation]; + primaryExpr.name = @"primaryExpr"; + [primaryExpr add:self.variableReference]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:self.expr]; + [s add:[PKSymbol symbolWithString:@")"]]; + [primaryExpr add:s]; + + [primaryExpr add:self.literal]; + [primaryExpr add:self.number]; + [primaryExpr add:self.functionCall]; + } + return primaryExpr; +} + + +// [16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument )* )? ')' + +// commaArg ::= ',' Argument +// [16] FunctionCall ::= FunctionName '(' ( Argument commaArg* )? ')' +- (PKCollectionParser *)functionCall { + //NSLog(@"%s", _cmd); + if (!functionCall) { + self.functionCall = [PKSequence sequence]; + functionCall.name = @"functionCall"; + [functionCall add:self.functionName]; + [functionCall add:[PKSymbol symbolWithString:@"("]]; + + PKSequence *commaArg = [PKSequence sequence]; + [commaArg add:[PKSymbol symbolWithString:@","]]; + [commaArg add:self.argument]; + + PKSequence *args = [PKSequence sequence]; + [args add:self.argument]; + [args add:[PKRepetition repetitionWithSubparser:commaArg]]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:args]; + + [functionCall add:a]; + [functionCall add:[PKSymbol symbolWithString:@")"]]; + } + return functionCall; +} + + +// [17] Argument ::= Expr +- (PKCollectionParser *)argument { + //NSLog(@"%s", _cmd); + if (!argument) { + self.argument = self.expr; + argument.name = @"argument"; + } + return argument; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [18] UnionExpr ::= PathExpr | UnionExpr '|' PathExpr + +// pipePathExpr :: = | PathExpr +// [18] UnionExpr ::= PathExpr PipePathExpr* +- (PKCollectionParser *)unionExpr { + //NSLog(@"%s", _cmd); + if (!unionExpr) { + self.unionExpr = [PKSequence sequence]; + unionExpr.name = @"unionExpr"; + + PKSequence *pipePathExpr = [PKSequence sequence]; + [pipePathExpr add:[PKSymbol symbolWithString:@"|"]]; + [pipePathExpr add:self.pathExpr]; + + [unionExpr add:self.pathExpr]; + [unionExpr add:[PKRepetition repetitionWithSubparser:pipePathExpr]]; + } + return unionExpr; +} + + +//[19] PathExpr ::= LocationPath +// | FilterExpr +// | FilterExpr '/' RelativeLocationPath +// | FilterExpr '//' RelativeLocationPath +- (PKCollectionParser *)pathExpr { + //NSLog(@"%s", _cmd); + if (!pathExpr) { + self.pathExpr = [PKAlternation alternation]; + pathExpr.name = @"pathExpr"; + [pathExpr add:self.locationPath]; + [pathExpr add:self.filterExpr]; + + PKSequence *s = [PKSequence sequence]; + [s add:self.filterExpr]; + [s add:[PKSymbol symbolWithString:@"/"]]; + [s add:self.relativeLocationPath]; + [pathExpr add:s]; + + s = [PKSequence sequence]; + [s add:self.filterExpr]; + [s add:[PKSymbol symbolWithString:@"//"]]; + [s add:self.relativeLocationPath]; + [pathExpr add:s]; + } + return pathExpr; +} + + +#pragma mark - +#pragma mark Left Recursion???????????? + +// [20] FilterExpr ::= PrimaryExpr | FilterExpr Predicate + + +// [20] FilterExpr ::= PrimaryExpr Predicate? +- (PKCollectionParser *)filterExpr { + //NSLog(@"%s", _cmd); + if (!filterExpr) { + self.filterExpr = [PKSequence sequence]; + filterExpr.name = @"filterExpr"; + [filterExpr add:self.primaryExpr]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.predicate]; + [filterExpr add:a]; + } + return filterExpr; +} + + +#pragma mark - +#pragma mark Left Recursion +// [21] OrExpr ::= AndExpr | OrExpr 'or' AndExpr + +// orAndExpr ::= 'or' AndExpr +// me: AndExpr orAndExpr* +- (PKCollectionParser *)orExpr { + //NSLog(@"%s", _cmd); + if (!orExpr) { + self.orExpr = [PKSequence sequence]; + orExpr.name = @"orExpr"; + + [orExpr add:self.andExpr]; + + PKSequence *orAndExpr = [PKSequence sequence]; + [orAndExpr add:[PKLiteral literalWithString:@"or"]]; + [orAndExpr add:self.andExpr]; + + [orExpr add:[PKRepetition repetitionWithSubparser:orAndExpr]]; + } + return orExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [22] AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr + + +// andEqualityExpr +// EqualityExpr andEqualityExpr + +- (PKCollectionParser *)andExpr { + //NSLog(@"%s", _cmd); + if (!andExpr) { + self.andExpr = [PKSequence sequence]; + andExpr.name = @"andExpr"; + [andExpr add:self.equalityExpr]; + + PKSequence *andEqualityExpr = [PKSequence sequence]; + [andEqualityExpr add:[PKLiteral literalWithString:@"and"]]; + [andEqualityExpr add:self.equalityExpr]; + + [andExpr add:[PKRepetition repetitionWithSubparser:andEqualityExpr]]; + } + return andExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [23] EqualityExpr ::= RelationalExpr +// | EqualityExpr '=' RelationalExpr +// | EqualityExpr '!=' RelationalExpr + +// RelationalExpr (equalsRelationalExpr | notEqualsRelationalExpr)? + +- (PKCollectionParser *)equalityExpr { + //NSLog(@"%s", _cmd); + if (!equalityExpr) { + self.equalityExpr = [PKSequence sequence]; + equalityExpr.name = @"equalityExpr"; + [equalityExpr add:self.relationalExpr]; + + PKSequence *equalsRelationalExpr = [PKSequence sequence]; + [equalsRelationalExpr add:[PKSymbol symbolWithString:@"="]]; + [equalsRelationalExpr add:self.relationalExpr]; + + PKSequence *notEqualsRelationalExpr = [PKSequence sequence]; + [notEqualsRelationalExpr add:[PKSymbol symbolWithString:@"!="]]; + [notEqualsRelationalExpr add:self.relationalExpr]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:equalsRelationalExpr]; + [a add:notEqualsRelationalExpr]; + + PKAlternation *a1 = [PKAlternation alternation]; + [a1 add:[PKEmpty empty]]; + [a1 add:a]; + + [equalityExpr add:a1]; + } + return equalityExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [24] RelationalExpr ::= AdditiveExpr +// | RelationalExpr '<' AdditiveExpr +// | RelationalExpr '>' AdditiveExpr +// | RelationalExpr '<=' AdditiveExpr +// | RelationalExpr '>=' AdditiveExpr + +// RelationalExpr = AdditiveExpr (ltAdditiveExpr | gtAdditiveExpr | lteAdditiveExpr | gteAdditiveExpr)? +- (PKCollectionParser *)relationalExpr { + //NSLog(@"%s", _cmd); + if (!relationalExpr) { + + self.relationalExpr = [PKSequence sequence]; + relationalExpr.name = @"relationalExpr"; + [relationalExpr add:self.additiveExpr]; + + PKAlternation *a = [PKAlternation alternation]; + + PKSequence *ltAdditiveExpr = [PKSequence sequence]; + [ltAdditiveExpr add:[PKSymbol symbolWithString:@"<"]]; + [a add:ltAdditiveExpr]; + + PKSequence *gtAdditiveExpr = [PKSequence sequence]; + [gtAdditiveExpr add:[PKSymbol symbolWithString:@">"]]; + [a add:gtAdditiveExpr]; + + PKSequence *lteAdditiveExpr = [PKSequence sequence]; + [lteAdditiveExpr add:[PKSymbol symbolWithString:@"<="]]; + [a add:lteAdditiveExpr]; + + PKSequence *gteAdditiveExpr = [PKSequence sequence]; + [gteAdditiveExpr add:[PKSymbol symbolWithString:@">="]]; + [a add:gteAdditiveExpr]; + + PKAlternation *a1 = [PKAlternation alternation]; + [a1 add:[PKEmpty empty]]; + [a1 add:a]; + + [relationalExpr add:a1]; + } + return relationalExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [25] AdditiveExpr ::= MultiplicativeExpr +// | AdditiveExpr '+' MultiplicativeExpr +// | AdditiveExpr '-' MultiplicativeExpr + +// AdditiveExpr ::= MultiplicativeExpr (plusMultiplicativeExpr | minusMultiplicativeExpr)? +- (PKCollectionParser *)additiveExpr { + //NSLog(@"%s", _cmd); + if (!additiveExpr) { + self.additiveExpr = [PKSequence sequence]; + additiveExpr.name = @"additiveExpr"; + [additiveExpr add:self.multiplicativeExpr]; + + PKAlternation *a = [PKAlternation alternation]; + + PKSequence *plusMultiplicativeExpr = [PKSequence sequence]; + [plusMultiplicativeExpr add:[PKSymbol symbolWithString:@"+"]]; + [plusMultiplicativeExpr add:self.multiplicativeExpr]; + [a add:plusMultiplicativeExpr]; + + PKSequence *minusMultiplicativeExpr = [PKSequence sequence]; + [minusMultiplicativeExpr add:[PKSymbol symbolWithString:@"-"]]; + [minusMultiplicativeExpr add:self.multiplicativeExpr]; + [a add:minusMultiplicativeExpr]; + + PKAlternation *a1 = [PKAlternation alternation]; + [a1 add:[PKEmpty empty]]; + [a1 add:a]; + + [additiveExpr add:a1]; + } + return additiveExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [26] MultiplicativeExpr ::= UnaryExpr +// | MultiplicativeExpr MultiplyOperator UnaryExpr +// | MultiplicativeExpr 'div' UnaryExpr +// | MultiplicativeExpr 'mod' UnaryExpr + +// MultiplicativeExpr :: = UnaryExpr (multiplyUnaryExpr | divUnaryExpr | modUnaryExpr)? +- (PKCollectionParser *)multiplicativeExpr { + //NSLog(@"%s", _cmd); + if (!multiplicativeExpr) { + self.multiplicativeExpr = [PKSequence sequence]; + multiplicativeExpr.name = @"multiplicativeExpr"; + [multiplicativeExpr add:self.unaryExpr]; + + PKAlternation *a = [PKAlternation alternation]; + + PKSequence *multiplyUnaryExpr = [PKSequence sequence]; + [multiplyUnaryExpr add:self.multiplyOperator]; + [multiplyUnaryExpr add:self.unaryExpr]; + [a add:multiplyUnaryExpr]; + + PKSequence *divUnaryExpr = [PKSequence sequence]; + [divUnaryExpr add:[PKLiteral literalWithString:@"div"]]; + [divUnaryExpr add:self.unaryExpr]; + [a add:divUnaryExpr]; + + PKSequence *modUnaryExpr = [PKSequence sequence]; + [modUnaryExpr add:[PKLiteral literalWithString:@"mod"]]; + [modUnaryExpr add:self.unaryExpr]; + [a add:modUnaryExpr]; + + PKAlternation *a1 = [PKAlternation alternation]; + [a1 add:[PKEmpty empty]]; + [a1 add:a]; + + [multiplicativeExpr add:a1]; + } + return multiplicativeExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [27] UnaryExpr ::= UnionExpr | '-' UnaryExpr + +// UnaryExpr ::= '-'? UnionExpr +- (PKCollectionParser *)unaryExpr { + //NSLog(@"%s", _cmd); + if (!unaryExpr) { + self.unaryExpr = [PKSequence sequence]; + unaryExpr.name = @"unaryExpr"; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:[PKSymbol symbolWithString:@"-"]]; + + [unaryExpr add:a]; + [unaryExpr add:self.unionExpr]; + + // self.unaryExpr = [PKAlternation alternation]; +// [unaryExpr add:self.unionExpr]; +// +// PKSequence *s = [PKSequence sequence]; +// [s add:[PKSymbol symbolWithString:@"-"]]; +// [s add:unaryExpr]; +// [unionExpr add:s]; + } + return unaryExpr; +} + + +// [28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' +// | NameTest +// | NodeType +// | Operator +// | FunctionName +// | AxisName +// | Literal +// | Number +// | VariableReference +- (PKCollectionParser *)exprToken { + //NSLog(@"%s", _cmd); + if (!exprToken) { + self.exprToken = [PKAlternation alternation]; + exprToken.name = @"exprToken"; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKSymbol symbolWithString:@"("]]; + [a add:[PKSymbol symbolWithString:@")"]]; + [a add:[PKSymbol symbolWithString:@"["]]; + [a add:[PKSymbol symbolWithString:@"]"]]; + [a add:[PKSymbol symbolWithString:@"."]]; + [a add:[PKSymbol symbolWithString:@".."]]; + [a add:[PKSymbol symbolWithString:@"@"]]; + [a add:[PKSymbol symbolWithString:@","]]; + [a add:[PKSymbol symbolWithString:@"::"]]; + [exprToken add:a]; + + [exprToken add:self.nameTest]; + [exprToken add:self.nodeType]; + [exprToken add:self.operator]; + [exprToken add:self.functionName]; + [exprToken add:self.axisName]; + [exprToken add:self.literal]; + [exprToken add:self.number]; + [exprToken add:self.variableReference]; + } + return exprToken; +} + + +- (PKParser *)literal { + //NSLog(@"%s", _cmd); + if (!literal) { + self.literal = [PKQuotedString quotedString]; + literal.name = @"literal"; + } + return literal; +} + + +- (PKParser *)number { + //NSLog(@"%s", _cmd); + if (!number) { + self.number = [PKNumber number]; + number.name = @"number"; + } + return number; +} + + +// [32] Operator ::= OperatorName +// | MultiplyOperator +// | '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>=' +- (PKCollectionParser *)operator { + //NSLog(@"%s", _cmd); + if (!operator) { + self.operator = [PKAlternation alternation]; + operator.name = @"operator"; + [operator add:self.operatorName]; + [operator add:self.multiplyOperator]; + [operator add:[PKSymbol symbolWithString: @"/"]]; + [operator add:[PKSymbol symbolWithString:@"//"]]; + [operator add:[PKSymbol symbolWithString: @"|"]]; + [operator add:[PKSymbol symbolWithString: @"+"]]; + [operator add:[PKSymbol symbolWithString: @"-"]]; + [operator add:[PKSymbol symbolWithString: @"="]]; + [operator add:[PKSymbol symbolWithString:@"!="]]; + [operator add:[PKSymbol symbolWithString: @"<"]]; + [operator add:[PKSymbol symbolWithString:@"<="]]; + [operator add:[PKSymbol symbolWithString: @">"]]; + [operator add:[PKSymbol symbolWithString:@">="]]; + } + return operator; +} + + +// [33] OperatorName ::= 'and' | 'or' | 'mod' | 'div' +- (PKCollectionParser *)operatorName { + //NSLog(@"%s", _cmd); + if (!operatorName) { + self.operatorName = [PKAlternation alternation]; + operatorName.name = @"operatorName"; + [operatorName add:[PKLiteral literalWithString:@"and"]]; + [operatorName add:[PKLiteral literalWithString: @"or"]]; + [operatorName add:[PKLiteral literalWithString:@"mod"]]; + [operatorName add:[PKLiteral literalWithString:@"div"]]; + } + return operatorName; +} + + +// [34] MultiplyOperator ::= '*' +- (PKParser *)multiplyOperator { + //NSLog(@"%s", _cmd); + if (!multiplyOperator) { + self.multiplyOperator = [PKSymbol symbolWithString:@"*"]; + multiplyOperator.name = @"multiplyOperator"; + } + return multiplyOperator; +} + + +//[7] QName ::= PrefixedName| UnprefixedName +//[8] PrefixedName ::= Prefix ':' LocalPart +//[9] UnprefixedName ::= LocalPart +//[10] Prefix ::= NCName +//[11] LocalPart ::= NCName +- (PKCollectionParser *)QName { + //NSLog(@"%s", _cmd); + if (!QName) { + self.QName = [PKAlternation alternation]; + QName.name = @"QName"; + + PKParser *prefix = [PKWord word]; + PKParser *localPart = [PKWord word]; + PKParser *unprefixedName = localPart; + + PKSequence *prefixedName = [PKSequence sequence]; + [prefixedName add:prefix]; + [prefixedName add:[PKSymbol symbolWithString:@":"]]; + [prefixedName add:localPart]; + + [QName add:prefixedName]; + [QName add:unprefixedName]; + } + return QName; +} + + +// [35] FunctionName ::= QName - NodeType +- (PKParser *)functionName { + //NSLog(@"%s", _cmd); + if (!functionName) { + self.functionName = self.QName; // TODO QName - NodeType + functionName.name = @"functionName"; + } + return functionName; +} + + +// [36] VariableReference ::= '$' QName +- (PKCollectionParser *)variableReference { + //NSLog(@"%s", _cmd); + if (!variableReference) { + self.variableReference = [PKSequence sequence]; + variableReference.name = @"variableReference"; + [variableReference add:[PKSymbol symbolWithString:@"$"]]; + [variableReference add:self.QName]; + } + return variableReference; +} + + +// [37] NameTest ::= '*' | NCName ':' '*' | QName +- (PKCollectionParser *)nameTest { + //NSLog(@"%s", _cmd); + if (!nameTest) { + self.nameTest = [PKAlternation alternation]; + nameTest.name = @"nameTest"; + [nameTest add:[PKSymbol symbolWithString:@"*"]]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKWord word]]; + [s add:[PKSymbol symbolWithString:@":"]]; + [s add:[PKSymbol symbolWithString:@"*"]]; + [nameTest add:s]; + + [nameTest add:self.QName]; + } + return nameTest; +} + + +// [38] NodeType ::= 'comment' +// | 'text' +// | 'processing-instruction' +// | 'node' +- (PKCollectionParser *)nodeType { + //NSLog(@"%s", _cmd); + if (!nodeType) { + self.nodeType = [PKAlternation alternation]; + nodeType.name = @"nodeType"; + [nodeType add:[PKLiteral literalWithString:@"comment"]]; + [nodeType add:[PKLiteral literalWithString:@"text"]]; + [nodeType add:[PKLiteral literalWithString:@"processing-instruction"]]; + [nodeType add:[PKLiteral literalWithString:@"node"]]; + } + return nodeType; +} + +@synthesize xpathAssembler; +@synthesize locationPath; +@synthesize absoluteLocationPath; +@synthesize relativeLocationPath; +@synthesize step; +@synthesize axisSpecifier; +@synthesize axisName; +@synthesize nodeTest; +@synthesize predicate; +@synthesize predicateExpr; +@synthesize abbreviatedAbsoluteLocationPath; +@synthesize abbreviatedRelativeLocationPath; +@synthesize abbreviatedStep; +@synthesize abbreviatedAxisSpecifier; +@synthesize expr; +@synthesize primaryExpr; +@synthesize functionCall; +@synthesize argument; +@synthesize unionExpr; +@synthesize pathExpr; +@synthesize filterExpr; +@synthesize orExpr; +@synthesize andExpr; +@synthesize equalityExpr; +@synthesize relationalExpr; +@synthesize additiveExpr; +@synthesize multiplicativeExpr; +@synthesize unaryExpr; +@synthesize exprToken; +@synthesize literal; +@synthesize number; +@synthesize operator; +@synthesize operatorName; +@synthesize multiplyOperator; +@synthesize functionName; +@synthesize variableReference; +@synthesize nameTest; +@synthesize nodeType; +@synthesize QName; +@end diff --git a/test/.svn/text-base/XPathParserGrammarTest.h.svn-base b/test/.svn/text-base/XPathParserGrammarTest.h.svn-base new file mode 100644 index 0000000..3a5c6a2 --- /dev/null +++ b/test/.svn/text-base/XPathParserGrammarTest.h.svn-base @@ -0,0 +1,20 @@ +// +// XPathParserGrammarTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/28/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +@interface XPathParserGrammarTest : SenTestCase { + NSString *s; + PKParser *p; + PKTokenizer *t; + PKAssembly *a; + PKAssembly *res; + PKToken *tok; +} + +@end diff --git a/test/.svn/text-base/XPathParserGrammarTest.m.svn-base b/test/.svn/text-base/XPathParserGrammarTest.m.svn-base new file mode 100644 index 0000000..e59443f --- /dev/null +++ b/test/.svn/text-base/XPathParserGrammarTest.m.svn-base @@ -0,0 +1,286 @@ +// +// XPathParserGrammarTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/28/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "XPathParserGrammarTest.h" + +@implementation XPathParserGrammarTest + +- (void)setUp { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"xpath1_0" ofType:@"grammar"]; + NSString *g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + p = [[PKParserFactory factory] parserFromGrammar:g assembler:nil]; + t = p.tokenizer; +} + + +- (void)testFoo { + t.string = @"foo"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNotNil(res); + TDEqualObjects(@"[foo]foo^", [res description]); +} + + +- (void)test { + t.string = @"child::foo"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + // NSLog(@"\n\n res: %@ \n\n", res); + //TDEqualObjects(@"[/, foo]//foo^", [res description]); + + + t.string = @"/foo"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; +// NSLog(@"\n\n res: %@ \n\n", res); + TDEqualObjects(@"[/, foo]//foo^", [res description]); + + t.string = @"/foo/bar"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar]//foo///bar^", [res description]); + + t.string = @"/foo/bar/baz"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar, /, baz]//foo///bar///baz^", [res description]); + + t.string = @"/foo/bar[baz]"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar, [, baz, ]]//foo///bar/[/baz/]^", [res description]); + + t.string = @"/foo/bar[@baz]"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar, [, @, baz, ]]//foo///bar/[/@/baz/]^", [res description]); + + t.string = @"/foo/bar[@baz='foo']"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar, [, @, baz, =, 'foo', ]]//foo///bar/[/@/baz/=/'foo'/]^", [res description]); + + t.string = @"/foo/bar[baz]/foo"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar, [, baz, ], /, foo]//foo///bar/[/baz/]///foo^", [res description]); + + // not supported + t.string = @"//foo"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + NSLog(@"\n\n res: %@ \n\n", res); + TDEqualObjects(@"[//, foo]///foo^", [res description]); +} + + +- (void)testAxisName { + t.string = @"child"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"axisName"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[child]child^", [res description]); + + t.string = @"preceding-sibling"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"axisName"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[preceding-sibling]preceding-sibling^", [res description]); +} + + +- (void)testAxisSpecifier { + t.string = @"child::"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"axisSpecifier"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[child, ::]child/::^", [res description]); + t.string = @"preceding-sibling::"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"axisSpecifier"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[preceding-sibling, ::]preceding-sibling/::^", [res description]); +} + + +- (void)testQName { + t.string = @"foo:bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"qName"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, :, bar]foo/:/bar^", [res description]); + + t.string = @"foo:bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + //TDAssertThrowsSpecificNamed([p.QName bestMatchFor:a], [NSException class], @"PKTrackException"); +} + + +- (void)testNameTest { + t.string = @"foo:bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nameTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, :, bar]foo/:/bar^", [res description]); + + t.string = @"*"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nameTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[*]*^", [res description]); + + t.string = @"foo:*"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nameTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, :, *]foo/:/*^", [res description]); + + t.string = @"*:bar"; // NOT ALLOWED + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nameTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[*]*^:/bar", [res description]); + + t.string = @"foo"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nameTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo]foo^", [res description]); + + t.string = @"foo:bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + //TDAssertThrowsSpecificNamed([p.nameTest bestMatchFor:a], [NSException class], @"PKTrackException"); +} + + +- (void)testNodeType { + t.string = @"comment"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeType"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[comment]comment^", [res description]); + + t.string = @"node"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeType"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[node]node^", [res description]); + +} + + +- (void)testNodeTest { + t.string = @"comment()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[comment, (, )]comment/(/)^", [res description]); + + t.string = @"processing-instruction()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[processing-instruction, (, )]processing-instruction/(/)^", [res description]); + + t.string = @"processing-instruction('baz')"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[processing-instruction, (, 'baz', )]processing-instruction/(/'baz'/)^", [res description]); + + t.string = @"node()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[node, (, )]node/(/)^", [res description]); + + t.string = @"text()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[text, (, )]text/(/)^", [res description]); + + t.string = @"*"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[*]*^", [res description]); + + t.string = @"foo:*"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, :, *]foo/:/*^", [res description]); + + t.string = @"bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[bar]bar^", [res description]); +} + + +- (void)testVariableReference { + t.string = @"$foo"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + p = [p parserNamed:@"pathExpr"]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[$, foo]$/foo^", [res description]); + + t.string = @"$bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + p = [p parserNamed:@"pathExpr"]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[$, bar]$/bar^", [res description]); +} + + +- (void)testFunctionCall { + t.string = @"foo()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, (, )]foo/(/)^", [res description]); + + t.string = @"foo('bar')"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, (, 'bar', )]foo/(/'bar'/)^", [res description]); + + t.string = @"foo('bar', 'baz')"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, (, 'bar', ,, 'baz', )]foo/(/'bar'/,/'baz'/)^", [res description]); + + t.string = @"foo('bar', 1)"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, (, 'bar', ,, 1, )]foo/(/'bar'/,/1/)^", [res description]); +} + +- (void)testOrExpr { + t.string = @"foo or bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"orExpr"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, or, bar]foo/or/bar^", [res description]); +} + + +- (void)testAndExpr { + t.string = @"foo() and bar()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"andExpr"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, (, ), and, bar, (, )]foo/(/)/and/bar/(/)^", [res description]); + + t.string = @"foo and bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"andExpr"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, and, bar]foo/and/bar^", [res description]); +} + +@end diff --git a/test/.svn/text-base/XPathParserTest.h.svn-base b/test/.svn/text-base/XPathParserTest.h.svn-base new file mode 100644 index 0000000..a1686f5 --- /dev/null +++ b/test/.svn/text-base/XPathParserTest.h.svn-base @@ -0,0 +1,20 @@ +// +// XPathParserTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +#import "XPathParser.h" + +@interface XPathParserTest : SenTestCase { + NSString *s; + XPathParser *p; + PKAssembly *a; + PKAssembly *result; +} + +@end diff --git a/test/.svn/text-base/XPathParserTest.m.svn-base b/test/.svn/text-base/XPathParserTest.m.svn-base new file mode 100644 index 0000000..0333ce4 --- /dev/null +++ b/test/.svn/text-base/XPathParserTest.m.svn-base @@ -0,0 +1,303 @@ +// +// XPathParserTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 8/16/08. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "XPathParserTest.h" +#import "TDNCName.h" + +@implementation XPathParserTest + +- (void)setUp { + p = [[[XPathParser alloc] init] autorelease]; +} + +- (void)test { + s = @"child::foo"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; +// NSLog(@"\n\n result: %@ \n\n", result); + //TDEqualObjects(@"[/, foo]//foo^", [result description]); + + + s = @"/foo"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + NSLog(@"\n\n result: %@ \n\n", result); + TDEqualObjects(@"[/, foo]//foo^", [result description]); + + s = @"/foo/bar"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar]//foo///bar^", [result description]); + + s = @"/foo/bar/baz"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar, /, baz]//foo///bar///baz^", [result description]); + + s = @"/foo/bar[baz]"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar, [, baz, ]]//foo///bar/[/baz/]^", [result description]); + + s = @"/foo/bar[@baz]"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar, [, @, baz, ]]//foo///bar/[/@/baz/]^", [result description]); + + s = @"/foo/bar[@baz='foo']"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar, [, @, baz, =, 'foo', ]]//foo///bar/[/@/baz/=/'foo'/]^", [result description]); + + s = @"/foo/bar[baz]/foo"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar, [, baz, ], /, foo]//foo///bar/[/baz/]///foo^", [result description]); + + // not supported +// s = @"//foo"; +// a = [p assemblyWithString:s]; +// result = [p bestMatchFor:a]; +// NSLog(@"\n\n result: %@ \n\n", result); +// TDEqualObjects(@"[//, foo]///foo^", [result description]); +} + + +- (void)testAxisName { + s = @"child"; + a = [p assemblyWithString:s]; + NSLog(@"\n\n a: %@ \n\n", a); + result = [p.axisName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[child]child^", [result description]); + + s = @"preceeding-sibling"; + a = [p assemblyWithString:s]; + result = [p.axisName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[preceeding-sibling]preceeding-sibling^", [result description]); +} + + +- (void)testAxisSpecifier { + s = @"child::"; + a = [p assemblyWithString:s]; + result = [p.axisSpecifier bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[child, ::]child/::^", [result description]); + s = @"preceeding-sibling::"; + a = [p assemblyWithString:s]; + result = [p.axisSpecifier bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[preceeding-sibling, ::]preceeding-sibling/::^", [result description]); +} + + +- (void)testOperatorName { + s = @"and"; + a = [p assemblyWithString:s]; + result = [p.operatorName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[and]and^", [result description]); + + s = @"or"; + a = [p assemblyWithString:s]; + result = [p.operatorName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[or]or^", [result description]); +} + + +- (void)testQName { + s = @"foo:bar"; + a = [p assemblyWithString:s]; + result = [p.QName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, :, bar]foo/:/bar^", [result description]); + + s = @"foo:bar"; + a = [p assemblyWithString:s]; + //TDAssertThrowsSpecificNamed([p.QName bestMatchFor:a], [NSException class], @"PKTrackException"); +} + + +- (void)testNameTest { + s = @"foo:bar"; + a = [p assemblyWithString:s]; + result = [p.nameTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, :, bar]foo/:/bar^", [result description]); + + s = @"*"; + a = [p assemblyWithString:s]; + result = [p.nameTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[*]*^", [result description]); + + s = @"foo:*"; + a = [p assemblyWithString:s]; + result = [p.nameTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, :, *]foo/:/*^", [result description]); + + s = @"*:bar"; // NOT ALLOWED + a = [p assemblyWithString:s]; + result = [p.nameTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[*]*^:/bar", [result description]); + + s = @"foo"; + a = [p assemblyWithString:s]; + result = [p.nameTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo]foo^", [result description]); + + s = @"foo:bar"; + a = [p assemblyWithString:s]; + //TDAssertThrowsSpecificNamed([p.nameTest bestMatchFor:a], [NSException class], @"PKTrackException"); +} + + +- (void)testNodeType { + s = @"comment"; + a = [p assemblyWithString:s]; + result = [p.nodeType bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[comment]comment^", [result description]); + + s = @"node"; + a = [p assemblyWithString:s]; + result = [p.nodeType bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[node]node^", [result description]); + +} + + +- (void)testNodeTest { + s = @"comment()"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[comment, (, )]comment/(/)^", [result description]); + + s = @"processing-instruction()"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[processing-instruction, (, )]processing-instruction/(/)^", [result description]); + + s = @"processing-instruction('baz')"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[processing-instruction, (, 'baz', )]processing-instruction/(/'baz'/)^", [result description]); + + s = @"node()"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[node, (, )]node/(/)^", [result description]); + + s = @"text()"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[text, (, )]text/(/)^", [result description]); + + s = @"*"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[*]*^", [result description]); + + s = @"foo:*"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, :, *]foo/:/*^", [result description]); + + s = @"bar"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[bar]bar^", [result description]); +} + + +- (void)testVariableReference { + s = @"$foo"; + a = [p assemblyWithString:s]; + result = [p.variableReference bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[$, foo]$/foo^", [result description]); + + s = @"$bar"; + a = [p assemblyWithString:s]; + result = [p.variableReference bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[$, bar]$/bar^", [result description]); + + s = @"$foo:bar"; + a = [p assemblyWithString:s]; + result = [p.variableReference bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[$, foo, :, bar]$/foo/:/bar^", [result description]); +} + + +- (void)testFunctionCall { + s = @"foo()"; + a = [p assemblyWithString:s]; + result = [p.functionCall bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, (, )]foo/(/)^", [result description]); + + s = @"foo('bar')"; + a = [p assemblyWithString:s]; + result = [p.functionCall bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, (, 'bar', )]foo/(/'bar'/)^", [result description]); + + s = @"foo('bar', 'baz')"; + a = [p assemblyWithString:s]; + result = [p.functionCall bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, (, 'bar', ,, 'baz', )]foo/(/'bar'/,/'baz'/)^", [result description]); + + s = @"foo('bar', 1)"; + a = [p assemblyWithString:s]; + result = [p.functionCall bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, (, 'bar', ,, 1, )]foo/(/'bar'/,/1/)^", [result description]); +} + +- (void)testOrExpr { + s = @"foo or bar"; + a = [p assemblyWithString:s]; + result = [p.orExpr bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, or, bar]foo/or/bar^", [result description]); +} + + +- (void)testAndExpr { + s = @"foo() and bar()"; + a = [p assemblyWithString:s]; + result = [p.andExpr bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, (, ), and, bar, (, )]foo/(/)/and/bar/(/)^", [result description]); + + s = @"foo and bar"; + a = [p assemblyWithString:s]; + result = [p.andExpr bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, and, bar]foo/and/bar^", [result description]); +} + +@end diff --git a/test/.svn/tmp/tempfile.2.tmp b/test/.svn/tmp/tempfile.2.tmp new file mode 100644 index 0000000..be16b06 --- /dev/null +++ b/test/.svn/tmp/tempfile.2.tmp @@ -0,0 +1,2392 @@ +// +// TDJavaScriptParser.m +// TDParseKit +// +// Created by Todd Ditchendorf on 3/17/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "TDJavaScriptParser.h" + +@interface TDParser () +- (void)setTokenizer:(TDTokenizer *)t; +@end + +@interface TDJavaScriptParser () +- (TDAlternation *)zeroOrOne:(TDParser *)p; +- (TDAlternation *)oneOrMore:(TDParser *)p; +@end + +@implementation TDJavaScriptParser + +- (id)init { + if (self = [super initWithSubparser:self.elementParser]) { + self.tokenizer = [TDTokenizer tokenizer]; + + // JS supports scientific number notation (exponents like 4E+12 or 2.0e-42) + tokenizer.numberState = [[[TDScientificNumberState alloc] init] autorelease]; + + // Nums cannot end with '.' (e.g. 32. must be 32.0) + tokenizer.numberState.allowsTrailingDot = NO; + + [tokenizer setTokenizerState:tokenizer.numberState from:'-' to:'-']; + [tokenizer setTokenizerState:tokenizer.numberState from:'.' to:'.']; + [tokenizer setTokenizerState:tokenizer.numberState from:'0' to:'9']; + + // Words can start with '_' + [tokenizer setTokenizerState:tokenizer.wordState from:'_' to:'_']; + + // Words cannot contain '-' + [tokenizer.wordState setWordChars:NO from:'-' to:'-']; + + // Comments + tokenizer.commentState.reportsCommentTokens = YES; + [tokenizer setTokenizerState:tokenizer.commentState from:'/' to:'/']; + + // single-line Comments + [tokenizer.commentState addSingleLineStartMarker:@"//"]; + + // multi-line Comments + [tokenizer.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + [tokenizer.symbolState add:@"||"]; + [tokenizer.symbolState add:@"&&"]; + [tokenizer.symbolState add:@"!="]; + [tokenizer.symbolState add:@"!=="]; + [tokenizer.symbolState add:@"=="]; + [tokenizer.symbolState add:@"==="]; + [tokenizer.symbolState add:@"<="]; + [tokenizer.symbolState add:@">="]; + [tokenizer.symbolState add:@"++"]; + [tokenizer.symbolState add:@"--"]; + [tokenizer.symbolState add:@"+="]; + [tokenizer.symbolState add:@"-="]; + [tokenizer.symbolState add:@"*="]; + [tokenizer.symbolState add:@"/="]; + [tokenizer.symbolState add:@"%="]; + [tokenizer.symbolState add:@"<<"]; + [tokenizer.symbolState add:@">>"]; + [tokenizer.symbolState add:@">>>"]; + [tokenizer.symbolState add:@"<<="]; + [tokenizer.symbolState add:@">>="]; + [tokenizer.symbolState add:@">>>="]; + [tokenizer.symbolState add:@"&="]; + [tokenizer.symbolState add:@"^="]; + } + return self; +} + + +- (void)dealloc { + self.assignmentOpParser = nil; + self.relationalOpParser = nil; + self.equalityOpParser = nil; + self.shiftOpParser = nil; + self.incrementOpParser = nil; + self.unaryOpParser = nil; + self.multiplicativeOpParser = nil; + self.programParser = nil; + self.elementParser = nil; + self.funcParser = nil; + self.paramListOptParser = nil; + self.paramListParser = nil; + self.commaIdentifierParser = nil; + self.compoundStmtParser = nil; + self.stmtsParser = nil; + self.stmtParser = nil; + self.ifStmtParser = nil; + self.ifElseStmtParser = nil; + self.whileStmtParser = nil; + self.forParenStmtParser = nil; + self.forBeginStmtParser = nil; + self.forInStmtParser = nil; + self.breakStmtParser = nil; + self.continueStmtParser = nil; + self.withStmtParser = nil; + self.returnStmtParser = nil; + self.variablesOrExprStmtParser = nil; + self.conditionParser = nil; + self.forParenParser = nil; + self.forBeginParser = nil; + self.variablesOrExprParser = nil; + self.varVariablesParser = nil; + self.variablesParser = nil; + self.commaVariableParser = nil; + self.variableParser = nil; + self.assignmentParser = nil; + self.exprOptParser = nil; + self.exprParser = nil; + self.commaAssignmentExprParser = nil; + self.assignmentExprParser = nil; + self.assignmentOpConditionalExprParser = nil; + self.conditionalExprParser = nil; + self.ternaryExprParser = nil; + self.orExprParser = nil; + self.orAndExprParser = nil; + self.andExprParser = nil; + self.andBitwiseOrExprParser = nil; + self.bitwiseOrExprParser = nil; + self.pipeBitwiseXorExprParser = nil; + self.bitwiseXorExprParser = nil; + self.caretBitwiseAndExprParser = nil; + self.bitwiseAndExprParser = nil; + self.ampEqualityExprParser = nil; + self.equalityExprParser = nil; + self.equalityOpRelationalExprParser = nil; + self.relationalExprParser = nil; + self.relationalOpShiftExprParser = nil; + self.shiftExprParser = nil; + self.shiftOpAdditiveExprParser = nil; + self.additiveExprParser = nil; + self.plusOrMinusExprParser = nil; + self.plusExprParser = nil; + self.minusExprParser = nil; + self.multiplicativeExprParser = nil; + self.multiplicativeOpUnaryExprParser = nil; + self.unaryExprParser = nil; + self.unaryExpr1Parser = nil; + self.unaryExpr2Parser = nil; + self.unaryExpr3Parser = nil; + self.unaryExpr4Parser = nil; + self.unaryExpr5Parser = nil; + self.unaryExpr6Parser = nil; + self.constructorCallParser = nil; + self.parenArgListOptParenParser = nil; + self.memberExprParser = nil; + self.memberExprExtParser = nil; + self.dotMemberExprParser = nil; + self.bracketMemberExprParser = nil; + self.argListOptParser = nil; + self.argListParser = nil; + self.primaryExprParser = nil; + self.parenExprParenParser = nil; + + self.funcLiteralParser = nil; + self.arrayLiteralParser = nil; + self.objectLiteralParser = nil; + + self.identifierParser = nil; + self.stringParser = nil; + self.numberParser = nil; + + self.ifParser = nil; + self.elseParser = nil; + self.whileParser = nil; + self.forParser = nil; + self.inParser = nil; + self.breakParser = nil; + self.continueParser = nil; + self.withParser = nil; + self.returnParser = nil; + self.varParser = nil; + self.deleteParser = nil; + self.newParser = nil; + self.thisParser = nil; + self.falseParser = nil; + self.trueParser = nil; + self.nullParser = nil; + self.undefinedParser = nil; + self.voidParser = nil; + self.typeofParser = nil; + self.instanceofParser = nil; + self.functionParser = nil; + + self.orParser = nil; + self.andParser = nil; + self.neParser = nil; + self.isNotParser = nil; + self.eqParser = nil; + self.isParser = nil; + self.leParser = nil; + self.geParser = nil; + self.plusPlusParser = nil; + self.minusMinusParser = nil; + self.plusEqParser = nil; + self.minusEqParser = nil; + self.timesEqParser = nil; + self.divEqParser = nil; + self.modEqParser = nil; + self.shiftLeftParser = nil; + self.shiftRightParser = nil; + self.shiftRightExtParser = nil; + self.shiftLeftEqParser = nil; + self.shiftRightEqParser = nil; + self.shiftRightExtEqParser = nil; + self.andEqParser = nil; + self.xorEqParser = nil; + self.orEqParser = nil; + + self.openCurlyParser = nil; + self.closeCurlyParser = nil; + self.openParenParser = nil; + self.closeParenParser = nil; + self.openBracketParser = nil; + self.closeBracketParser = nil; + self.commaParser = nil; + self.dotParser = nil; + self.semiOptParser = nil; + self.semiParser = nil; + self.colonParser = nil; + self.equalsParser = nil; + self.notParser = nil; + self.ltParser = nil; + self.gtParser = nil; + self.ampParser = nil; + self.pipeParser = nil; + self.caretParser = nil; + self.tildeParser = nil; + self.questionParser = nil; + self.plusParser = nil; + self.minusParser = nil; + self.timesParser = nil; + self.divParser = nil; + self.modParser = nil; + + [super dealloc]; +} + + +- (TDAlternation *)zeroOrOne:(TDParser *)p { + TDAlternation *a = [TDAlternation alternation]; + [a add:[TDEmpty empty]]; + [a add:p]; + return a; +} + + +- (TDAlternation *)oneOrMore:(TDParser *)p { + TDAlternation *s = [TDSequence sequence]; + [s add:p]; + [s add:[TDRepetition repetitionWithSubparser:p]]; + return s; +} + + +// assignmentOperator = equals | plusEq | minusEq | timesEq | divEq | modEq | shiftLeftEq | shiftRightEq | shiftRightExtEq | andEq | xorEq | orEq; +- (TDCollectionParser *)assignmentOpParser { + if (!assignmentOpParser) { + self.assignmentOpParser = [TDAlternation alternation]; + assignmentOpParser.name = @"assignmentOperator"; + [assignmentOpParser add:self.equalsParser]; + [assignmentOpParser add:self.plusEqParser]; + [assignmentOpParser add:self.minusEqParser]; + [assignmentOpParser add:self.timesEqParser]; + [assignmentOpParser add:self.divEqParser]; + [assignmentOpParser add:self.modEqParser]; + [assignmentOpParser add:self.shiftLeftEqParser]; + [assignmentOpParser add:self.shiftRightEqParser]; + [assignmentOpParser add:self.shiftRightExtEqParser]; + [assignmentOpParser add:self.andEqParser]; + [assignmentOpParser add:self.orEqParser]; + [assignmentOpParser add:self.xorEqParser]; + } + return assignmentOpParser; +} + + +// relationalOperator = lt | gt | ge | le | instanceof; +- (TDCollectionParser *)relationalOpParser { + if (!relationalOpParser) { + self.relationalOpParser = [TDAlternation alternation]; + relationalOpParser.name = @"relationalOperator"; + [relationalOpParser add:self.ltParser]; + [relationalOpParser add:self.gtParser]; + [relationalOpParser add:self.geParser]; + [relationalOpParser add:self.leParser]; + [relationalOpParser add:self.instanceofParser]; + } + return relationalOpParser; +} + + +// equalityOp = eq | ne | is | isnot; +- (TDCollectionParser *)equalityOpParser { + if (!equalityOpParser) { + self.equalityOpParser = [TDAlternation alternation];; + equalityOpParser.name = @"equalityOp"; + [equalityOpParser add:self.eqParser]; + [equalityOpParser add:self.neParser]; + [equalityOpParser add:self.isParser]; + [equalityOpParser add:self.isNotParser]; + } + return equalityOpParser; +} + + +//shiftOp = shiftLeft | shiftRight | shiftRightExt; +- (TDCollectionParser *)shiftOpParser { + if (!shiftOpParser) { + self.shiftOpParser = [TDAlternation alternation]; + shiftOpParser.name = @"shiftOp"; + [shiftOpParser add:self.shiftLeftParser]; + [shiftOpParser add:self.shiftRightParser]; + [shiftOpParser add:self.shiftRightExtParser]; + } + return shiftOpParser; +} + + +//incrementOperator = plusPlus | minusMinus; +- (TDCollectionParser *)incrementOpParser { + if (!incrementOpParser) { + self.incrementOpParser = [TDAlternation alternation]; + incrementOpParser.name = @"incrementOp"; + [incrementOpParser add:self.plusPlusParser]; + [incrementOpParser add:self.minusMinusParser]; + } + return incrementOpParser; +} + + +//unaryOperator = tilde | delete | typeof | void; +- (TDCollectionParser *)unaryOpParser { + if (!unaryOpParser) { + self.unaryOpParser = [TDAlternation alternation]; + unaryOpParser.name = @"unaryOp"; + [unaryOpParser add:self.tildeParser]; + [unaryOpParser add:self.deleteParser]; + [unaryOpParser add:self.typeofParser]; + [unaryOpParser add:self.voidParser]; + } + return unaryOpParser; +} + + +// multiplicativeOperator = times | div | mod; +- (TDCollectionParser *)multiplicativeOpParser { + if (!multiplicativeOpParser) { + self.multiplicativeOpParser = [TDAlternation alternation]; + multiplicativeOpParser.name = @"multiplicativeOperator"; + [multiplicativeOpParser add:self.timesParser]; + [multiplicativeOpParser add:self.divParser]; + [multiplicativeOpParser add:self.modParser]; + } + return multiplicativeOpParser; +} + + + +// Program: +// empty +// Element Program +// +//program = element*; +- (TDCollectionParser *)programParser { + if (!programParser) { + self.programParser = [TDRepetition repetitionWithSubparser:self.elementParser]; + programParser.name = @"program"; + } + return programParser; +} + + +// Element: +// function Identifier ( ParameterListOpt ) CompoundStatement +// Statement +// +//element = func | stmt; +- (TDCollectionParser *)elementParser { + if (!elementParser) { + self.elementParser = [TDAlternation alternation]; + elementParser.name = @"element"; + [elementParser add:self.funcParser]; + [elementParser add:self.stmtParser]; + } + return elementParser; +} + + +//func = function identifier openParen paramListOpt closeParen compoundStmt; +- (TDCollectionParser *)funcParser { + if (!funcParser) { + self.funcParser = [TDSequence sequence]; + funcParser.name = @"func"; + [funcParser add:self.functionParser]; + [funcParser add:self.identifierParser]; + [funcParser add:self.openParenParser]; + [funcParser add:self.paramListOptParser]; + [funcParser add:self.closeParenParser]; + [funcParser add:self.compoundStmtParser]; + } + return funcParser; +} + + +// ParameterListOpt: +// empty +// ParameterList +// +//paramListOpt = Empty | paramList; +- (TDCollectionParser *)paramListOptParser { + if (!paramListOptParser) { + self.paramListOptParser = [TDAlternation alternation]; + paramListOptParser.name = @"paramListOpt"; + [paramListOptParser add:[self zeroOrOne:self.paramListParser]]; + } + return paramListOptParser; +} + + +// ParameterList: +// Identifier +// Identifier , ParameterList +// +//paramList = identifier commaIdentifier*; +- (TDCollectionParser *)paramListParser { + if (!paramListParser) { + self.paramListParser = [TDSequence sequence]; + paramListParser.name = @"paramList"; + [paramListParser add:self.identifierParser]; + [paramListParser add:[TDRepetition repetitionWithSubparser:self.commaIdentifierParser]]; + } + return paramListParser; +} + + +//commaIdentifier = comma identifier; +- (TDCollectionParser *)commaIdentifierParser { + if (!commaIdentifierParser) { + self.commaIdentifierParser = [TDSequence sequence]; + commaIdentifierParser.name = @"commaIdentifier"; + [commaIdentifierParser add:self.commaParser]; + [commaIdentifierParser add:self.identifierParser]; + } + return commaIdentifierParser; +} + + +// CompoundStatement: +// { Statements } +// +//compoundStmt = openCurly stmts closeCurly; +- (TDCollectionParser *)compoundStmtParser { + if (!compoundStmtParser) { + self.compoundStmtParser = [TDSequence sequence]; + compoundStmtParser.name = @"compoundStmt"; + [compoundStmtParser add:self.openCurlyParser]; + [compoundStmtParser add:self.stmtsParser]; + [compoundStmtParser add:self.closeCurlyParser]; + } + return compoundStmtParser; +} + + +// Statements: +// empty +// Statement Statements +// +//stmts = stmt*; +- (TDCollectionParser *)stmtsParser { + if (!stmtsParser) { + self.stmtsParser = [TDRepetition repetitionWithSubparser:self.stmtParser]; + stmtsParser.name = @"stmts"; + } + return stmtsParser; +} + + +// Statement: +// ; +// if Condition Statement +// if Condition Statement else Statement +// while Condition Statement +// ForParen ; ExpressionOpt ; ExpressionOpt ) Statement +// ForBegin ; ExpressionOpt ; ExpressionOpt ) Statement +// ForBegin in Expression ) Statement +// break ; +// continue ; +// with ( Expression ) Statement +// return ExpressionOpt ; +// CompoundStatement +// VariablesOrExpression ; +// +//stmt = semi | ifStmt | ifElseStmt | whileStmt | forParenStmt | forBeginStmt | forInStmt | breakStmt | continueStmt | withStmt | returnStmt | compoundStmt | variablesOrExprStmt; +- (TDCollectionParser *)stmtParser { + if (!stmtParser) { + self.stmtParser = [TDAlternation alternation]; + stmtParser.name = @"stmt"; + [stmtParser add:self.semiParser]; + [stmtParser add:self.ifStmtParser]; + [stmtParser add:self.ifElseStmtParser]; + [stmtParser add:self.whileStmtParser]; + [stmtParser add:self.forParenStmtParser]; + [stmtParser add:self.forBeginStmtParser]; + [stmtParser add:self.forInStmtParser]; + [stmtParser add:self.breakStmtParser]; + [stmtParser add:self.continueStmtParser]; + [stmtParser add:self.withStmtParser]; + [stmtParser add:self.returnStmtParser]; + [stmtParser add:self.compoundStmtParser]; + [stmtParser add:self.variablesOrExprStmtParser]; + } + return stmtParser; +} + + +// if Condition Statement +//ifStmt = if condition stmt; +- (TDCollectionParser *)ifStmtParser { + if (!ifStmtParser) { + self.ifStmtParser = [TDSequence sequence]; + ifStmtParser.name = @"ifStmt"; + [ifStmtParser add:self.ifParser]; + [ifStmtParser add:self.conditionParser]; + [ifStmtParser add:self.stmtParser]; + } + return ifStmtParser; +} + + +// if Condition Statement else Statement +//ifElseStmt = if condition stmt else stmt; +- (TDCollectionParser *)ifElseStmtParser { + if (!ifElseStmtParser) { + self.ifElseStmtParser = [TDSequence sequence]; + ifElseStmtParser.name = @"ifElseStmt"; + [ifElseStmtParser add:self.ifParser]; + [ifElseStmtParser add:self.conditionParser]; + [ifElseStmtParser add:self.stmtParser]; + [ifElseStmtParser add:self.elseParser]; + [ifElseStmtParser add:self.stmtParser]; + } + return ifElseStmtParser; +} + + +// while Condition Statement +//whileStmt = while condition stmt; +- (TDCollectionParser *)whileStmtParser { + if (!whileStmtParser) { + self.whileStmtParser = [TDSequence sequence]; + whileStmtParser.name = @"whileStmt"; + [whileStmtParser add:self.whileParser]; + [whileStmtParser add:self.conditionParser]; + [whileStmtParser add:self.stmtParser]; + } + return whileStmtParser; +} + + +// ForParen ; ExpressionOpt ; ExpressionOpt ) Statement +//forParenStmt = forParen semi exprOpt semi exprOpt closeParen stmt; +- (TDCollectionParser *)forParenStmtParser { + if (!forParenStmtParser) { + self.forParenStmtParser = [TDSequence sequence]; + forParenStmtParser.name = @"forParenStmt"; + [forParenStmtParser add:self.forParenParser]; + [forParenStmtParser add:self.semiParser]; + [forParenStmtParser add:self.exprOptParser]; + [forParenStmtParser add:self.semiParser]; + [forParenStmtParser add:self.exprOptParser]; + [forParenStmtParser add:self.closeParenParser]; + [forParenStmtParser add:self.stmtParser]; + } + return forParenStmtParser; +} + + +// ForBegin ; ExpressionOpt ; ExpressionOpt ) Statement +//forBeginStmt = forBegin semi exprOpt semi exprOpt closeParen stmt; +- (TDCollectionParser *)forBeginStmtParser { + if (!forBeginStmtParser) { + self.forBeginStmtParser = [TDSequence sequence]; + forBeginStmtParser.name = @"forBeginStmt"; + [forBeginStmtParser add:self.forBeginParser]; + [forBeginStmtParser add:self.semiParser]; + [forBeginStmtParser add:self.exprOptParser]; + [forBeginStmtParser add:self.semiParser]; + [forBeginStmtParser add:self.exprOptParser]; + [forBeginStmtParser add:self.closeParenParser]; + [forBeginStmtParser add:self.stmtParser]; + } + return forBeginStmtParser; +} + + +// ForBegin in Expression ) Statement +//forInStmt = forBegin in expr closeParen stmt; +- (TDCollectionParser *)forInStmtParser { + if (!forInStmtParser) { + self.forInStmtParser = [TDSequence sequence]; + forInStmtParser.name = @"forInStmt"; + [forInStmtParser add:self.forBeginParser]; + [forInStmtParser add:self.inParser]; + [forInStmtParser add:self.exprParser]; + [forInStmtParser add:self.closeParenParser]; + [forInStmtParser add:self.stmtParser]; + } + return forInStmtParser; +} + + +// break ; +//breakStmt = break semi; +- (TDCollectionParser *)breakStmtParser { + if (!breakStmtParser) { + self.breakStmtParser = [TDSequence sequence]; + breakStmtParser.name = @"breakStmt"; + [breakStmtParser add:self.breakParser]; + [breakStmtParser add:self.semiOptParser]; + } + return breakStmtParser; +} + + +//continueStmt = continue semi; +- (TDCollectionParser *)continueStmtParser { + if (!continueStmtParser) { + self.continueStmtParser = [TDSequence sequence]; + continueStmtParser.name = @"continueStmt"; + [continueStmtParser add:self.continueParser]; + [continueStmtParser add:self.semiOptParser]; + } + return continueStmtParser; +} + + +// with ( Expression ) Statement +//withStmt = with openParen expr closeParen stmt; +- (TDCollectionParser *)withStmtParser { + if (!withStmtParser) { + self.withStmtParser = [TDSequence sequence]; + withStmtParser.name = @"withStmt"; + [withStmtParser add:self.withParser]; + [withStmtParser add:self.openParenParser]; + [withStmtParser add:self.exprParser]; + [withStmtParser add:self.closeParenParser]; + [withStmtParser add:self.stmtParser]; + } + return withStmtParser; +} + + +// return ExpressionOpt ; +//returnStmt = return exprOpt semi; +- (TDCollectionParser *)returnStmtParser { + if (!returnStmtParser) { + self.returnStmtParser = [TDSequence sequence]; + returnStmtParser.name = @"returnStmt"; + [returnStmtParser add:self.returnParser]; + [returnStmtParser add:self.exprOptParser]; + [returnStmtParser add:self.semiOptParser]; + } + return returnStmtParser; +} + + +// VariablesOrExpression ; +//variablesOrExprStmt = variablesOrExpr semi; +- (TDCollectionParser *)variablesOrExprStmtParser { + if (!variablesOrExprStmtParser) { + self.variablesOrExprStmtParser = [TDSequence sequence]; + variablesOrExprStmtParser.name = @"variablesOrExprStmt"; + [variablesOrExprStmtParser add:self.variablesOrExprParser]; + [variablesOrExprStmtParser add:self.semiOptParser]; + } + return variablesOrExprStmtParser; +} + + +// Condition: +// ( Expression ) +// +//condition = openParen expr closeParen; +- (TDCollectionParser *)conditionParser { + if (!conditionParser) { + self.conditionParser = [TDSequence sequence]; + conditionParser.name = @"condition"; + [conditionParser add:self.openParenParser]; + [conditionParser add:self.exprParser]; + [conditionParser add:self.closeParenParser]; + } + return conditionParser; +} + + +// ForParen: +// for ( +// +//forParen = for openParen; +- (TDCollectionParser *)forParenParser { + if (!forParenParser) { + self.forParenParser = [TDSequence sequence]; + forParenParser.name = @"forParen"; + [forParenParser add:self.forParser]; + [forParenParser add:self.openParenParser]; + } + return forParenParser; +} + + +// ForBegin: +// ForParen VariablesOrExpression +// +//forBegin = forParen variablesOrExpr; +- (TDCollectionParser *)forBeginParser { + if (!forBeginParser) { + self.forBeginParser = [TDSequence sequence]; + forBeginParser.name = @"forBegin"; + [forBeginParser add:self.forParenParser]; + [forBeginParser add:self.variablesOrExprParser]; + } + return forBeginParser; +} + + +// VariablesOrExpression: +// var Variables +// Expression +// +//variablesOrExpr = varVariables | expr; +- (TDCollectionParser *)variablesOrExprParser { + if (!variablesOrExprParser) { + self.variablesOrExprParser = [TDAlternation alternation]; + variablesOrExprParser.name = @"variablesOrExpr"; + [variablesOrExprParser add:self.varVariablesParser]; + [variablesOrExprParser add:self.exprParser]; + } + return variablesOrExprParser; +} + + +//varVariables = var variables; +- (TDCollectionParser *)varVariablesParser { + if (!varVariablesParser) { + self.varVariablesParser = [TDSequence sequence]; + varVariablesParser.name = @"varVariables"; + [varVariablesParser add:self.varParser]; + [varVariablesParser add:self.variablesParser]; + } + return varVariablesParser; +} + + +// Variables: +// Variable +// Variable , Variables +// +//variables = variable commaVariable*; +- (TDCollectionParser *)variablesParser { + if (!variablesParser) { + self.variablesParser = [TDSequence sequence]; + variablesParser.name = @"variables"; + [variablesParser add:self.variableParser]; + [variablesParser add:[TDRepetition repetitionWithSubparser:self.commaVariableParser]]; + } + return variablesParser; +} + + +//commaVariable = comma variable; +- (TDCollectionParser *)commaVariableParser { + if (!commaVariableParser) { + self.commaVariableParser = [TDSequence sequence]; + commaVariableParser.name = @"commaVariable"; + [commaVariableParser add:self.commaParser]; + [commaVariableParser add:self.variableParser]; + } + return commaVariableParser; +} + + +// Variable: +// Identifier +// Identifier = AssignmentExpression +// +//variable = identifier assignment?; +- (TDCollectionParser *)variableParser { + if (!variableParser) { + self.variableParser = [TDSequence sequence]; + variableParser.name = @"variableParser"; + [variableParser add:self.identifierParser]; + [variableParser add:[self zeroOrOne:self.assignmentParser]]; + } + return variableParser; +} + + +//assignment = equals assignmentExpr; +- (TDCollectionParser *)assignmentParser { + if (!assignmentParser) { + self.assignmentParser = [TDSequence sequence]; + assignmentParser.name = @"assignment"; + [assignmentParser add:self.equalsParser]; + [assignmentParser add:self.assignmentExprParser]; + } + return assignmentParser; +} + + +// ExpressionOpt: +// empty +// Expression +// +// exprOpt = Empty | expr; +- (TDCollectionParser *)exprOptParser { + if (!exprOptParser) { + self.exprOptParser = [self zeroOrOne:self.exprParser]; + exprOptParser.name = @"exprOpt"; + } + return exprOptParser; +} + + +// Expression: +// AssignmentExpression +// AssignmentExpression , Expression +// +//expr = assignmentExpr commaAssignmentExpr*; +- (TDCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [TDSequence sequence]; + exprParser.name = @"exprParser"; + [exprParser add:self.assignmentExprParser]; + [exprParser add:[TDRepetition repetitionWithSubparser:self.commaAssignmentExprParser]]; + } + return exprParser; +} + + +//commaAssignmentExpr = comma assignmentExpr; +- (TDCollectionParser *)commaAssignmentExprParser { + if (!commaAssignmentExprParser) { + self.commaAssignmentExprParser = [TDSequence sequence]; + commaAssignmentExprParser.name = @"commaAssignmentExpr"; + [commaAssignmentExprParser add:self.commaParser]; + [commaAssignmentExprParser add:self.assignmentExprParser]; + } + return commaAssignmentExprParser; +} + + +// AssignmentExpression: +// ConditionalExpression +// ConditionalExpression AssignmentOperator AssignmentExpression +// +// assignmentExpr = conditionalExpr assignmentOpConditionalExpr*; +- (TDCollectionParser *)assignmentExprParser { + if (!assignmentExprParser) { + self.assignmentExprParser = [TDSequence sequence]; + assignmentExprParser.name = @"assignmentExpr"; + [assignmentExprParser add:self.conditionalExprParser]; + [assignmentExprParser add:[TDRepetition repetitionWithSubparser:self.assignmentOpConditionalExprParser]]; + } + return assignmentExprParser; +} + + +// assignmentOpConditionalExpr = assignmentOperator conditionalExpr; +- (TDCollectionParser *)assignmentOpConditionalExprParser { + if (!assignmentOpConditionalExprParser) { + self.assignmentOpConditionalExprParser = [TDSequence sequence]; + assignmentOpConditionalExprParser.name = @"assignmentOpConditionalExpr"; + [assignmentOpConditionalExprParser add:self.assignmentOpParser]; + [assignmentOpConditionalExprParser add:self.conditionalExprParser]; + } + return assignmentOpConditionalExprParser; +} + + +// ConditionalExpression: +// OrExpression +// OrExpression ? AssignmentExpression : AssignmentExpression +// +// conditionalExpr = orExpr ternaryExpr?; +- (TDCollectionParser *)conditionalExprParser { + if (!conditionalExprParser) { + self.conditionalExprParser = [TDSequence sequence]; + conditionalExprParser.name = @"conditionalExpr"; + [conditionalExprParser add:self.orExprParser]; + [conditionalExprParser add:[self zeroOrOne:self.ternaryExprParser]]; + } + return conditionalExprParser; +} + + +// ternaryExpr = question assignmentExpr colon assignmentExpr; +- (TDCollectionParser *)ternaryExprParser { + if (!ternaryExprParser) { + self.ternaryExprParser = [TDSequence sequence]; + ternaryExprParser.name = @"ternaryExpr"; + [ternaryExprParser add:self.questionParser]; + [ternaryExprParser add:self.assignmentExprParser]; + [ternaryExprParser add:self.colonParser]; + [ternaryExprParser add:self.assignmentExprParser]; + } + return ternaryExprParser; +} + + +// OrExpression: +// AndExpression +// AndExpression || OrExpression +// +// orExpr = andExpr orAndExpr*; +- (TDCollectionParser *)orExprParser { + if (!orExprParser) { + self.orExprParser = [TDSequence sequence]; + orExprParser.name = @"orExpr"; + [orExprParser add:self.andExprParser]; + [orExprParser add:[TDRepetition repetitionWithSubparser:self.orAndExprParser]]; + } + return orExprParser; +} + + +// orAndExpr = or andExpr; +- (TDCollectionParser *)orAndExprParser { + if (!orAndExprParser) { + self.orAndExprParser = [TDSequence sequence]; + orAndExprParser.name = @"orAndExpr"; + [orAndExprParser add:self.orParser]; + [orAndExprParser add:self.andExprParser]; + } + return orAndExprParser; +} + + +// AndExpression: +// BitwiseOrExpression +// BitwiseOrExpression && AndExpression +// +// andExpr = bitwiseOrExpr andBitwiseOrExprParser*; +- (TDCollectionParser *)andExprParser { + if (!andExprParser) { + self.andExprParser = [TDSequence sequence]; + andExprParser.name = @"andExpr"; + [andExprParser add:self.bitwiseOrExprParser]; + [andExprParser add:[TDRepetition repetitionWithSubparser:self.andBitwiseOrExprParser]]; + } + return andExprParser; +} + + +// andBitwiseOrExprParser = and bitwiseOrExpr; +- (TDCollectionParser *)andBitwiseOrExprParser { + if (!andBitwiseOrExprParser) { + self.andBitwiseOrExprParser = [TDSequence sequence]; + andBitwiseOrExprParser.name = @"andBitwiseOrExpr"; + [andBitwiseOrExprParser add:self.andParser]; + [andBitwiseOrExprParser add:self.bitwiseOrExprParser]; + } + return andBitwiseOrExprParser; +} + + +// BitwiseOrExpression: +// BitwiseXorExpression +// BitwiseXorExpression | BitwiseOrExpression +// +// bitwiseOrExpr = bitwiseXorExpr pipeBitwiseXorExpr*; +- (TDCollectionParser *)bitwiseOrExprParser { + if (!bitwiseOrExprParser) { + self.bitwiseOrExprParser = [TDSequence sequence]; + bitwiseOrExprParser.name = @"bitwiseOrExpr"; + [bitwiseOrExprParser add:self.bitwiseXorExprParser]; + [bitwiseOrExprParser add:[TDRepetition repetitionWithSubparser:self.pipeBitwiseXorExprParser]]; + } + return bitwiseOrExprParser; +} + + +// pipeBitwiseXorExprParser = pipe bitwiseXorExpr; +- (TDCollectionParser *)pipeBitwiseXorExprParser { + if (!pipeBitwiseXorExprParser) { + self.pipeBitwiseXorExprParser = [TDSequence sequence]; + pipeBitwiseXorExprParser.name = @"pipeBitwiseXorExpr"; + [pipeBitwiseXorExprParser add:self.pipeParser]; + [pipeBitwiseXorExprParser add:self.bitwiseXorExprParser]; + } + return pipeBitwiseXorExprParser; +} + + +// BitwiseXorExpression: +// BitwiseAndExpression +// BitwiseAndExpression ^ BitwiseXorExpression +// +// bitwiseXorExpr = bitwiseAndExpr caretBitwiseAndExpr*; +- (TDCollectionParser *)bitwiseXorExprParser { + if (!bitwiseXorExprParser) { + self.bitwiseXorExprParser = [TDSequence sequence]; + bitwiseXorExprParser.name = @"bitwiseXorExpr"; + [bitwiseXorExprParser add:self.bitwiseAndExprParser]; + [bitwiseXorExprParser add:[TDRepetition repetitionWithSubparser:self.caretBitwiseAndExprParser]]; + } + return bitwiseXorExprParser; +} + + +// caretBitwiseAndExpr = caret bitwiseAndExpr; +- (TDCollectionParser *)caretBitwiseAndExprParser { + if (!caretBitwiseAndExprParser) { + self.caretBitwiseAndExprParser = [TDSequence sequence]; + caretBitwiseAndExprParser.name = @"caretBitwiseAndExpr"; + [caretBitwiseAndExprParser add:self.caretParser]; + [caretBitwiseAndExprParser add:self.bitwiseAndExprParser]; + } + return caretBitwiseAndExprParser; +} + + +// BitwiseAndExpression: +// EqualityExpression +// EqualityExpression & BitwiseAndExpression +// +// bitwiseAndExpr = equalityExpr ampEqualityExpr*; +- (TDCollectionParser *)bitwiseAndExprParser { + if (!bitwiseAndExprParser) { + self.bitwiseAndExprParser = [TDSequence sequence]; + bitwiseAndExprParser.name = @"bitwiseAndExpr"; + [bitwiseAndExprParser add:self.equalityExprParser]; + [bitwiseAndExprParser add:[TDRepetition repetitionWithSubparser:self.ampEqualityExprParser]]; + } + return bitwiseAndExprParser; +} + + +// ampEqualityExpression = amp equalityExpression; +- (TDCollectionParser *)ampEqualityExprParser { + if (!ampEqualityExprParser) { + self.ampEqualityExprParser = [TDSequence sequence]; + ampEqualityExprParser.name = @"ampEqualityExpr"; + [ampEqualityExprParser add:self.ampParser]; + [ampEqualityExprParser add:self.equalityExprParser]; + } + return ampEqualityExprParser; +} + + +// EqualityExpression: +// RelationalExpression +// RelationalExpression EqualityualityOperator EqualityExpression +// +// equalityExpr = relationalExpr equalityOpRelationalExpr*; +- (TDCollectionParser *)equalityExprParser { + if (!equalityExprParser) { + self.equalityExprParser = [TDSequence sequence]; + equalityExprParser.name = @"equalityExpr"; + [equalityExprParser add:self.relationalExprParser]; + [equalityExprParser add:[TDRepetition repetitionWithSubparser:self.equalityOpRelationalExprParser]]; + } + return equalityExprParser; +} + + +// equalityOpRelationalExpr = equalityOp relationalExpr; +- (TDCollectionParser *)equalityOpRelationalExprParser { + if (!equalityOpRelationalExprParser) { + self.equalityOpRelationalExprParser = [TDSequence sequence]; + equalityOpRelationalExprParser.name = @"equalityOpRelationalExpr"; + [equalityOpRelationalExprParser add:self.equalityOpParser]; + [equalityOpRelationalExprParser add:self.relationalExprParser]; + } + return equalityOpRelationalExprParser; +} + + +// RelationalExpression: +// ShiftExpression +// RelationalExpression RelationalationalOperator ShiftExpression +// + +// relationalExpr = shiftExpr relationalOpShiftExpr*; /// TODO ???? +- (TDCollectionParser *)relationalExprParser { + if (!relationalExprParser) { + self.relationalExprParser = [TDSequence sequence]; + relationalExprParser.name = @"relationalExpr"; + [relationalExprParser add:self.shiftExprParser]; + [relationalExprParser add:[TDRepetition repetitionWithSubparser:self.relationalOpShiftExprParser]]; + } + return relationalExprParser; +} + + +// relationalOpShiftExpr = relationalOperator shiftExpr; +- (TDCollectionParser *)relationalOpShiftExprParser { + if (!relationalOpShiftExprParser) { + self.relationalOpShiftExprParser = [TDSequence sequence]; + relationalOpShiftExprParser.name = @"relationalOpShiftExpr"; + [relationalOpShiftExprParser add:self.relationalOpParser]; + [relationalOpShiftExprParser add:self.shiftExprParser]; + } + return relationalOpShiftExprParser; +} + + +// ShiftExpression: +// AdditiveExpression +// AdditiveExpression ShiftOperator ShiftExpression +// +// shiftExpr = additiveExpr shiftOpAdditiveExpr?; +- (TDCollectionParser *)shiftExprParser { + if (!shiftExprParser) { + self.shiftExprParser = [TDSequence sequence]; + shiftExprParser.name = @"shiftExpr"; + [shiftExprParser add:self.additiveExprParser]; + [shiftExprParser add:[TDRepetition repetitionWithSubparser:self.shiftOpAdditiveExprParser]]; + } + return shiftExprParser; +} + + +// shiftOpShiftExpr = shiftOp additiveExpr; +- (TDCollectionParser *)shiftOpAdditiveExprParser { + if (!shiftOpAdditiveExprParser) { + self.shiftOpAdditiveExprParser = [TDSequence sequence]; + shiftOpAdditiveExprParser.name = @"shiftOpShiftExpr"; + [shiftOpAdditiveExprParser add:self.shiftOpParser]; + [shiftOpAdditiveExprParser add:self.additiveExprParser]; + } + return shiftOpAdditiveExprParser; +} + + +// AdditiveExpression: +// MultiplicativeExpression +// MultiplicativeExpression + AdditiveExpression +// MultiplicativeExpression - AdditiveExpression +// +// additiveExpr = multiplicativeExpr plusOrMinusExpr*; +- (TDCollectionParser *)additiveExprParser { + if (!additiveExprParser) { + self.additiveExprParser = [TDSequence sequence]; + additiveExprParser.name = @"additiveExpr"; + [additiveExprParser add:self.multiplicativeExprParser]; + [additiveExprParser add:[TDRepetition repetitionWithSubparser:self.plusOrMinusExprParser]]; + } + return additiveExprParser; +} + + +// plusOrMinusExpr = plusExpr | minusExpr; +- (TDCollectionParser *)plusOrMinusExprParser { + if (!plusOrMinusExprParser) { + self.plusOrMinusExprParser = [TDAlternation alternation]; + plusOrMinusExprParser.name = @"plusOrMinusExpr"; + [plusOrMinusExprParser add:self.plusExprParser]; + [plusOrMinusExprParser add:self.minusExprParser]; + } + return plusOrMinusExprParser; +} + + +// plusExpr = plus multiplicativeExprParser; +- (TDCollectionParser *)plusExprParser { + if (!plusExprParser) { + self.plusExprParser = [TDSequence sequence]; + plusExprParser.name = @"plusExpr"; + [plusExprParser add:self.plusParser]; + [plusExprParser add:self.multiplicativeExprParser]; + } + return plusExprParser; +} + + +// minusExpr = minus multiplicativeExprParser; +- (TDCollectionParser *)minusExprParser { + if (!minusExprParser) { + self.minusExprParser = [TDSequence sequence]; + minusExprParser.name = @"minusExpr"; + [minusExprParser add:self.minusParser]; + [minusExprParser add:self.multiplicativeExprParser]; + } + return minusExprParser; +} + + +// MultiplicativeExpression: +// UnaryExpression +// UnaryExpression MultiplicativeOperator MultiplicativeExpression +// +// multiplicativeExpr = unaryExpr multiplicativeOpUnaryExpr*; +- (TDCollectionParser *)multiplicativeExprParser { + if (!multiplicativeExprParser) { + self.multiplicativeExprParser = [TDSequence sequence]; + multiplicativeExprParser.name = @"multiplicativeExpr"; + [multiplicativeExprParser add:self.unaryExprParser]; + [multiplicativeExprParser add:[TDRepetition repetitionWithSubparser:self.multiplicativeOpUnaryExprParser]]; + } + return multiplicativeExprParser; +} + + +// multiplicativeOpUnaryExpr = multiplicativeOp unaryExpr; +- (TDCollectionParser *)multiplicativeOpUnaryExprParser { + if (!multiplicativeOpUnaryExprParser) { + self.multiplicativeOpUnaryExprParser = [TDSequence sequence]; + multiplicativeOpUnaryExprParser.name = @"multiplicativeOpUnaryExpr"; + [multiplicativeOpUnaryExprParser add:self.multiplicativeOpParser]; + [multiplicativeOpUnaryExprParser add:self.unaryExprParser]; + } + return multiplicativeOpUnaryExprParser; +} + + +// UnaryExpression: +// MemberExpression +// UnaryOperator UnaryExpression +// - UnaryExpression +// IncrementOperator MemberExpression +// MemberExpression IncrementOperator +// new Constructor +// delete MemberExpression +// +// unaryExpr = memberExpr | unaryExpr1 | unaryExpr2 | unaryExpr3 | unaryExpr4 | unaryExpr5 | unaryExpr6; +- (TDCollectionParser *)unaryExprParser { + if (!unaryExprParser) { + self.unaryExprParser = [TDAlternation alternation]; + unaryExprParser.name = @"unaryExpr"; + [unaryExprParser add:self.memberExprParser]; + [unaryExprParser add:self.unaryExpr1Parser]; + [unaryExprParser add:self.unaryExpr2Parser]; + [unaryExprParser add:self.unaryExpr3Parser]; + [unaryExprParser add:self.unaryExpr4Parser]; + [unaryExprParser add:self.unaryExpr5Parser]; + [unaryExprParser add:self.unaryExpr6Parser]; + } + return unaryExprParser; +} + + +// unaryExpr1 = unaryOperator unaryExpr; +- (TDCollectionParser *)unaryExpr1Parser { + if (!unaryExpr1Parser) { + self.unaryExpr1Parser = [TDSequence sequence]; + unaryExpr1Parser.name = @"unaryExpr1"; + [unaryExpr1Parser add:self.unaryOpParser]; + [unaryExpr1Parser add:self.unaryExprParser]; + } + return unaryExpr1Parser; +} + + +// unaryExpr2 = minus unaryExpr; +- (TDCollectionParser *)unaryExpr2Parser { + if (!unaryExpr2Parser) { + self.unaryExpr2Parser = [TDSequence sequence]; + unaryExpr2Parser.name = @"unaryExpr2"; + [unaryExpr2Parser add:self.minusParser]; + [unaryExpr2Parser add:self.unaryExprParser]; + } + return unaryExpr2Parser; +} + + +// unaryExpr3 = incrementOperator memberExpr; +- (TDCollectionParser *)unaryExpr3Parser { + if (!unaryExpr3Parser) { + self.unaryExpr3Parser = [TDSequence sequence]; + unaryExpr3Parser.name = @"unaryExpr3"; + [unaryExpr3Parser add:self.incrementOpParser]; + [unaryExpr3Parser add:self.memberExprParser]; + } + return unaryExpr3Parser; +} + + +// unaryExpr4 = memberExpr incrementOperator; +- (TDCollectionParser *)unaryExpr4Parser { + if (!unaryExpr4Parser) { + self.unaryExpr4Parser = [TDSequence sequence]; + unaryExpr4Parser.name = @"unaryExpr4"; + [unaryExpr4Parser add:self.memberExprParser]; + [unaryExpr4Parser add:self.incrementOpParser]; + } + return unaryExpr4Parser; +} + + +// unaryExpr5 = new constructor; +- (TDCollectionParser *)unaryExpr5Parser { + if (!unaryExpr5Parser) { + self.unaryExpr5Parser = [TDSequence sequence]; + unaryExpr5Parser.name = @"unaryExpr5"; + [unaryExpr5Parser add:self.newParser]; + [unaryExpr5Parser add:self.constructorCallParser]; + } + return unaryExpr5Parser; +} + + +// unaryExpr6 = delete memberExpr; +- (TDCollectionParser *)unaryExpr6Parser { + if (!unaryExpr6Parser) { + self.unaryExpr6Parser = [TDSequence sequence]; + unaryExpr6Parser.name = @"unaryExpr6"; + [unaryExpr6Parser add:self.deleteParser]; + [unaryExpr6Parser add:self.memberExprParser]; + } + return unaryExpr6Parser; +} + + +// ConstructorCall: +// Identifier +// Identifier ( ArgumentListOpt ) +// Identifier . ConstructorCall +// + +// constructorCall = identifier parentArgListOptParent? memberExprExt* +- (TDCollectionParser *)constructorCallParser { + if (!constructorCallParser) { + self.constructorCallParser = [TDSequence sequence]; + constructorCallParser.name = @"constructorCall"; + [constructorCallParser add:self.identifierParser]; + [constructorCallParser add:[self zeroOrOne:self.parenArgListOptParenParser]]; + [constructorCallParser add:[TDRepetition repetitionWithSubparser:self.memberExprExtParser]]; + } + return constructorCallParser; +} + + +// parenArgListParen = openParen argListOpt closeParen; +- (TDCollectionParser *)parenArgListOptParenParser { + if (!parenArgListOptParenParser) { + self.parenArgListOptParenParser = [TDSequence sequence]; + parenArgListOptParenParser.name = @"parenArgListParen"; + [parenArgListOptParenParser add:self.openParenParser]; + [parenArgListOptParenParser add:self.argListOptParser]; + [parenArgListOptParenParser add:self.closeParenParser]; + } + return parenArgListOptParenParser; +} + + +// MemberExpression: +// PrimaryExpression +// PrimaryExpression . MemberExpression +// PrimaryExpression [ Expression ] +// PrimaryExpression ( ArgumentListOpt ) +// +// memberExpr = primaryExpr memberExprExt?; // TODO ?????? +- (TDCollectionParser *)memberExprParser { + if (!memberExprParser) { + self.memberExprParser = [TDSequence sequence]; + memberExprParser.name = @"memberExpr"; + [memberExprParser add:self.primaryExprParser]; + [memberExprParser add:[TDRepetition repetitionWithSubparser:self.memberExprExtParser]]; + } + return memberExprParser; +} + + +// memberExprExt = dotMemberExpr | bracketMemberExpr | parenMemberExpr; +- (TDCollectionParser *)memberExprExtParser { + if (!memberExprExtParser) { + self.memberExprExtParser = [TDAlternation alternation]; + memberExprExtParser.name = @"memberExprExt"; + [memberExprExtParser add:self.dotMemberExprParser]; + [memberExprExtParser add:self.bracketMemberExprParser]; + [memberExprExtParser add:self.parenArgListOptParenParser]; + } + return memberExprExtParser; +} + + +// dotMemberExpr = dot memberExpr; +- (TDCollectionParser *)dotMemberExprParser { + if (!dotMemberExprParser) { + self.dotMemberExprParser = [TDSequence sequence]; + dotMemberExprParser.name = @"dotMemberExpr"; + [dotMemberExprParser add:self.dotParser]; + [dotMemberExprParser add:self.memberExprParser]; + } + return dotMemberExprParser; +} + + +// bracketMemberExpr = openBracket expr closeBracket; +- (TDCollectionParser *)bracketMemberExprParser { + if (!bracketMemberExprParser) { + self.bracketMemberExprParser = [TDSequence sequence]; + bracketMemberExprParser.name = @"bracketMemberExpr"; + [bracketMemberExprParser add:self.openBracketParser]; + [bracketMemberExprParser add:self.exprParser]; + [bracketMemberExprParser add:self.closeBracketParser]; + } + return bracketMemberExprParser; +} + + +// ArgumentListOpt: +// empty +// ArgumentList +// +// argListOpt = argList?; +- (TDCollectionParser *)argListOptParser { + if (!argListOptParser) { + self.argListOptParser = [self zeroOrOne:self.argListParser]; + argListOptParser.name = @"argListOpt"; + } + return argListOptParser; +} + + +// ArgumentList: +// AssignmentExpression +// AssignmentExpression , ArgumentList +// +// argList = assignmentExpr commaAssignmentExpr*; +- (TDCollectionParser *)argListParser { + if (!argListParser) { + self.argListParser = [TDSequence sequence]; + argListParser.name = @"argList"; + [argListParser add:self.assignmentExprParser]; + [argListParser add:[TDRepetition repetitionWithSubparser:self.commaAssignmentExprParser]]; + } + return argListParser; +} + + + // PrimaryExpression: + // ( Expression ) + // funcLiteral + // arrayLiteral + // Identifier + // IntegerLiteral + // FloatingPointLiteral + // StringLiteral + // false + // true + // null + // this +// primaryExpr = parenExprParen | funcLiteral | arrayLiteral | identifier | Num | QuotedString | false | true | null | undefined | this; +- (TDCollectionParser *)primaryExprParser { + if (!primaryExprParser) { + self.primaryExprParser = [TDAlternation alternation]; + primaryExprParser.name = @"primaryExpr"; + [primaryExprParser add:self.parenExprParenParser]; + [primaryExprParser add:self.funcLiteralParser]; + [primaryExprParser add:self.arrayLiteralParser]; + [primaryExprParser add:self.objectLiteralParser]; + [primaryExprParser add:self.identifierParser]; + [primaryExprParser add:self.numberParser]; + [primaryExprParser add:self.stringParser]; + [primaryExprParser add:self.trueParser]; + [primaryExprParser add:self.falseParser]; + [primaryExprParser add:self.nullParser]; + [primaryExprParser add:self.undefinedParser]; // TODO ?? + [primaryExprParser add:self.thisParser]; + } + return primaryExprParser; +} + + + +// parenExprParen = openParen expr closeParen; +- (TDCollectionParser *)parenExprParenParser { + if (!parenExprParenParser) { + self.parenExprParenParser = [TDSequence sequence]; + parenExprParenParser.name = @"parenExprParen"; + [parenExprParenParser add:self.openParenParser]; + [parenExprParenParser add:self.exprParser]; + [parenExprParenParser add:self.closeParenParser]; + } + return parenExprParenParser; +} + + +//funcLiteral = function openParen paramListOpt closeParen compoundStmt; +- (TDCollectionParser *)funcLiteralParser { + if (!funcLiteralParser) { + self.funcLiteralParser = [TDSequence sequence]; + funcLiteralParser.name = @"funcLiteral"; + [funcLiteralParser add:self.functionParser]; + [funcLiteralParser add:self.openParenParser]; + [funcLiteralParser add:self.paramListOptParser]; + [funcLiteralParser add:self.closeParenParser]; + [funcLiteralParser add:self.compoundStmtParser]; + } + return funcLiteralParser; +} + + +//arrayLiteral = '[' arrayContents ']'; +- (TDCollectionParser *)arrayLiteralParser { + if (!arrayLiteralParser) { + self.arrayLiteralParser = [TDTrack track]; + arrayLiteralParser.name = @"arrayLiteralParser"; + + TDSequence *commaPrimaryExpr = [TDSequence sequence]; + [commaPrimaryExpr add:self.commaParser]; + [commaPrimaryExpr add:self.primaryExprParser]; + + TDSequence *arrayContents = [TDSequence sequence]; + [arrayContents add:self.primaryExprParser]; + [arrayContents add:[TDRepetition repetitionWithSubparser:commaPrimaryExpr]]; + + TDAlternation *arrayContentsOpt = [TDAlternation alternation]; + [arrayContentsOpt add:[TDEmpty empty]]; + [arrayContentsOpt add:arrayContents]; + + [arrayLiteralParser add:self.openBracketParser]; + [arrayLiteralParser add:arrayContentsOpt]; + [arrayLiteralParser add:self.closeBracketParser]; + } + return arrayLiteralParser; +} + + +//objectLiteral = '{' objectContentsOpt '}'; +- (TDCollectionParser *)objectLiteralParser { + if (!objectLiteralParser) { + self.objectLiteralParser = [TDSequence sequence]; + objectLiteralParser.name = @"objectLiteralParser"; + + TDSequence *member = [TDSequence sequence]; + [member add:self.identifierParser]; + [member add:self.colonParser]; + [member add:self.primaryExprParser]; + + TDSequence *commaMember = [TDSequence sequence]; + [commaMember add:self.commaParser]; + [commaMember add:member]; + + TDSequence *objectContents = [TDSequence sequence]; + [objectContents add:member]; + [objectContents add:[TDRepetition repetitionWithSubparser:commaMember]]; + + TDAlternation *objectContentsOpt = [TDAlternation alternation]; + [objectContentsOpt add:[TDEmpty empty]]; + [objectContentsOpt add:objectContents]; + + [objectLiteralParser add:self.openCurlyParser]; + [objectLiteralParser add:objectContentsOpt]; + [objectLiteralParser add:self.closeCurlyParser]; + } + return objectLiteralParser; +} + + +// identifier = Word; +- (TDParser *)identifierParser { + if (!identifierParser) { + self.identifierParser = [TDWord word]; + identifierParser.name = @"identifier"; + } + return identifierParser; +} + + +- (TDParser *)stringParser { + if (!stringParser) { + self.stringParser = [TDQuotedString quotedString]; + stringParser.name = @"string"; + } + return stringParser; +} + + +- (TDParser *)numberParser { + if (!numberParser) { + self.numberParser = [TDNum num]; + numberParser.name = @"number"; + } + return numberParser; +} + + +#pragma mark - +#pragma mark keywords + +- (TDParser *)ifParser { + if (!ifParser) { + self.ifParser = [TDLiteral literalWithString:@"if"]; + ifParser.name = @"if"; + } + return ifParser; +} + + +- (TDParser *)elseParser { + if (!elseParser) { + self.elseParser = [TDLiteral literalWithString:@"else"]; + elseParser.name = @"else"; + } + return elseParser; +} + + +- (TDParser *)whileParser { + if (!whileParser) { + self.whileParser = [TDLiteral literalWithString:@"while"]; + whileParser.name = @"while"; + } + return whileParser; +} + + +- (TDParser *)forParser { + if (!forParser) { + self.forParser = [TDLiteral literalWithString:@"for"]; + forParser.name = @"for"; + } + return forParser; +} + + +- (TDParser *)inParser { + if (!inParser) { + self.inParser = [TDLiteral literalWithString:@"in"]; + inParser.name = @"in"; + } + return inParser; +} + + +- (TDParser *)breakParser { + if (!breakParser) { + self.breakParser = [TDLiteral literalWithString:@"break"]; + breakParser.name = @"break"; + } + return breakParser; +} + + +- (TDParser *)continueParser { + if (!continueParser) { + self.continueParser = [TDLiteral literalWithString:@"continue"]; + continueParser.name = @"continue"; + } + return continueParser; +} + + +- (TDParser *)withParser { + if (!withParser) { + self.withParser = [TDLiteral literalWithString:@"with"]; + withParser.name = @"with"; + } + return withParser; +} + + +- (TDParser *)returnParser { + if (!returnParser) { + self.returnParser = [TDLiteral literalWithString:@"return"]; + returnParser.name = @"return"; + } + return returnParser; +} + + +- (TDParser *)varParser { + if (!varParser) { + self.varParser = [TDLiteral literalWithString:@"var"]; + varParser.name = @"var"; + } + return varParser; +} + + +- (TDParser *)deleteParser { + if (!deleteParser) { + self.deleteParser = [TDLiteral literalWithString:@"delete"]; + deleteParser.name = @"delete"; + } + return deleteParser; +} + + +- (TDParser *)newParser { + if (!newParser) { + self.newParser = [TDLiteral literalWithString:@"new"]; + newParser.name = @"new"; + } + return newParser; +} + + +- (TDParser *)thisParser { + if (!thisParser) { + self.thisParser = [TDLiteral literalWithString:@"this"]; + thisParser.name = @"this"; + } + return thisParser; +} + + +- (TDParser *)falseParser { + if (!falseParser) { + self.falseParser = [TDLiteral literalWithString:@"false"]; + falseParser.name = @"false"; + } + return falseParser; +} + + +- (TDParser *)trueParser { + if (!trueParser) { + self.trueParser = [TDLiteral literalWithString:@"true"]; + trueParser.name = @"true"; + } + return trueParser; +} + + +- (TDParser *)nullParser { + if (!nullParser) { + self.nullParser = [TDLiteral literalWithString:@"null"]; + nullParser.name = @"null"; + } + return nullParser; +} + + +- (TDParser *)undefinedParser { + if (!undefinedParser) { + self.undefinedParser = [TDLiteral literalWithString:@"undefined"]; + undefinedParser.name = @"undefined"; + } + return undefinedParser; +} + + +- (TDParser *)voidParser { + if (!voidParser) { + self.voidParser = [TDLiteral literalWithString:@"void"]; + voidParser.name = @"void"; + } + return voidParser; +} + + +- (TDParser *)typeofParser { + if (!typeofParser) { + self.typeofParser = [TDLiteral literalWithString:@"typeof"]; + typeofParser.name = @"typeof"; + } + return typeofParser; +} + + +- (TDParser *)instanceofParser { + if (!instanceofParser) { + self.instanceofParser = [TDLiteral literalWithString:@"instanceof"]; + instanceofParser.name = @"instanceof"; + } + return instanceofParser; +} + + +- (TDParser *)functionParser { + if (!functionParser) { + self.functionParser = [TDLiteral literalWithString:@"function"]; + functionParser.name = @"function"; + } + return functionParser; +} + + +#pragma mark - +#pragma mark single-char symbols + +- (TDParser *)orParser { + if (!orParser) { + self.orParser = [TDSymbol symbolWithString:@"||"]; + orParser.name = @"or"; + } + return orParser; +} + + +- (TDParser *)andParser { + if (!andParser) { + self.andParser = [TDSymbol symbolWithString:@"&&"]; + andParser.name = @"and"; + } + return andParser; +} + + +- (TDParser *)neParser { + if (!neParser) { + self.neParser = [TDSymbol symbolWithString:@"!="]; + neParser.name = @"ne"; + } + return neParser; +} + + +- (TDParser *)isNotParser { + if (!isNotParser) { + self.isNotParser = [TDSymbol symbolWithString:@"!=="]; + isNotParser.name = @"isNot"; + } + return isNotParser; +} + + +- (TDParser *)eqParser { + if (!eqParser) { + self.eqParser = [TDSymbol symbolWithString:@"=="]; + eqParser.name = @"eq"; + } + return eqParser; +} + + +- (TDParser *)isParser { + if (!isParser) { + self.isParser = [TDSymbol symbolWithString:@"==="]; + isParser.name = @"is"; + } + return isParser; +} + + +- (TDParser *)leParser { + if (!leParser) { + self.leParser = [TDSymbol symbolWithString:@"<="]; + leParser.name = @"le"; + } + return leParser; +} + + +- (TDParser *)geParser { + if (!geParser) { + self.geParser = [TDSymbol symbolWithString:@">="]; + geParser.name = @"ge"; + } + return geParser; +} + + +- (TDParser *)plusPlusParser { + if (!plusPlusParser) { + self.plusPlusParser = [TDSymbol symbolWithString:@"++"]; + plusPlusParser.name = @"plusPlus"; + } + return plusPlusParser; +} + + +- (TDParser *)minusMinusParser { + if (!minusMinusParser) { + self.minusMinusParser = [TDSymbol symbolWithString:@"--"]; + minusMinusParser.name = @"minusMinus"; + } + return minusMinusParser; +} + + +- (TDParser *)plusEqParser { + if (!plusEqParser) { + self.plusEqParser = [TDSymbol symbolWithString:@"+="]; + plusEqParser.name = @"plusEq"; + } + return plusEqParser; +} + + +- (TDParser *)minusEqParser { + if (!minusEqParser) { + self.minusEqParser = [TDSymbol symbolWithString:@"-="]; + minusEqParser.name = @"minusEq"; + } + return minusEqParser; +} + + +- (TDParser *)timesEqParser { + if (!timesEqParser) { + self.timesEqParser = [TDSymbol symbolWithString:@"*="]; + timesEqParser.name = @"timesEq"; + } + return timesEqParser; +} + + +- (TDParser *)divEqParser { + if (!divEqParser) { + self.divEqParser = [TDSymbol symbolWithString:@"/="]; + divEqParser.name = @"divEq"; + } + return divEqParser; +} + + +- (TDParser *)modEqParser { + if (!modEqParser) { + self.modEqParser = [TDSymbol symbolWithString:@"%="]; + modEqParser.name = @"modEq"; + } + return modEqParser; +} + + +- (TDParser *)shiftLeftParser { + if (!shiftLeftParser) { + self.shiftLeftParser = [TDSymbol symbolWithString:@"<<"]; + shiftLeftParser.name = @"shiftLeft"; + } + return shiftLeftParser; +} + + +- (TDParser *)shiftRightParser { + if (!shiftRightParser) { + self.shiftRightParser = [TDSymbol symbolWithString:@">>"]; + shiftRightParser.name = @"shiftRight"; + } + return shiftRightParser; +} + + +- (TDParser *)shiftRightExtParser { + if (!shiftRightExtParser) { + self.shiftRightExtParser = [TDSymbol symbolWithString:@">>>"]; + shiftRightExtParser.name = @"shiftRightExt"; + } + return shiftRightExtParser; +} + + +- (TDParser *)shiftLeftEqParser { + if (!shiftLeftEqParser) { + self.shiftLeftEqParser = [TDSymbol symbolWithString:@"<<="]; + shiftLeftEqParser.name = @"shiftLeftEq"; + } + return shiftLeftEqParser; +} + + +- (TDParser *)shiftRightEqParser { + if (!shiftRightEqParser) { + self.shiftRightEqParser = [TDSymbol symbolWithString:@">>="]; + shiftRightEqParser.name = @"shiftRightEq"; + } + return shiftRightEqParser; +} + + +- (TDParser *)shiftRightExtEqParser { + if (!shiftRightExtEqParser) { + self.shiftRightExtEqParser = [TDSymbol symbolWithString:@">>>="]; + shiftRightExtEqParser.name = @"shiftRightExtEq"; + } + return shiftRightExtEqParser; +} + + +- (TDParser *)andEqParser { + if (!andEqParser) { + self.andEqParser = [TDSymbol symbolWithString:@"&="]; + andEqParser.name = @"andEq"; + } + return andEqParser; +} + + +- (TDParser *)xorEqParser { + if (!xorEqParser) { + self.xorEqParser = [TDSymbol symbolWithString:@"^="]; + xorEqParser.name = @"xorEq"; + } + return xorEqParser; +} + + +- (TDParser *)orEqParser { + if (!orEqParser) { + self.orEqParser = [TDSymbol symbolWithString:@"|="]; + orEqParser.name = @"orEq"; + } + return orEqParser; +} + + +#pragma mark - +#pragma mark single-char symbols + +- (TDParser *)openCurlyParser { + if (!openCurlyParser) { + self.openCurlyParser = [TDSymbol symbolWithString:@"{"]; + openCurlyParser.name = @"openCurly"; + } + return openCurlyParser; +} + + +- (TDParser *)closeCurlyParser { + if (!closeCurlyParser) { + self.closeCurlyParser = [TDSymbol symbolWithString:@"}"]; + closeCurlyParser.name = @"closeCurly"; + } + return closeCurlyParser; +} + + +- (TDParser *)openParenParser { + if (!openParenParser) { + self.openParenParser = [TDSymbol symbolWithString:@"("]; + openParenParser.name = @"openParen"; + } + return openParenParser; +} + + +- (TDParser *)closeParenParser { + if (!closeParenParser) { + self.closeParenParser = [TDSymbol symbolWithString:@")"]; + closeParenParser.name = @"closeParen"; + } + return closeParenParser; +} + + +- (TDParser *)openBracketParser { + if (!openBracketParser) { + self.openBracketParser = [TDSymbol symbolWithString:@"["]; + openBracketParser.name = @"openBracket"; + } + return openBracketParser; +} + + +- (TDParser *)closeBracketParser { + if (!closeBracketParser) { + self.closeBracketParser = [TDSymbol symbolWithString:@"]"]; + closeBracketParser.name = @"closeBracket"; + } + return closeBracketParser; +} + + +- (TDParser *)commaParser { + if (!commaParser) { + self.commaParser = [TDSymbol symbolWithString:@","]; + commaParser.name = @"comma"; + } + return commaParser; +} + + +- (TDParser *)dotParser { + if (!dotParser) { + self.dotParser = [TDSymbol symbolWithString:@"."]; + dotParser.name = @"dot"; + } + return dotParser; +} + + +- (TDParser *)semiOptParser { + if (!semiOptParser) { + self.semiOptParser = [self zeroOrOne:self.semiParser]; + semiOptParser.name = @"semiOpt"; + } + return semiOptParser; +} + + +- (TDParser *)semiParser { + if (!semiParser) { + self.semiParser = [TDSymbol symbolWithString:@";"]; + semiParser.name = @"semi"; + } + return semiParser; +} + + +- (TDParser *)colonParser { + if (!colonParser) { + self.colonParser = [TDSymbol symbolWithString:@":"]; + colonParser.name = @"colon"; + } + return colonParser; +} + + +- (TDParser *)equalsParser { + if (!equalsParser) { + self.equalsParser = [TDSymbol symbolWithString:@"="]; + equalsParser.name = @"equals"; + } + return equalsParser; +} + + +- (TDParser *)notParser { + if (!notParser) { + self.notParser = [TDSymbol symbolWithString:@"!"]; + notParser.name = @"not"; + } + return notParser; +} + + +- (TDParser *)ltParser { + if (!ltParser) { + self.ltParser = [TDSymbol symbolWithString:@"<"]; + ltParser.name = @"lt"; + } + return ltParser; +} + + +- (TDParser *)gtParser { + if (!gtParser) { + self.gtParser = [TDSymbol symbolWithString:@">"]; + gtParser.name = @"gt"; + } + return gtParser; +} + + +- (TDParser *)ampParser { + if (!ampParser) { + self.ampParser = [TDSymbol symbolWithString:@"&"]; + ampParser.name = @"amp"; + } + return ampParser; +} + + +- (TDParser *)pipeParser { + if (!pipeParser) { + self.pipeParser = [TDSymbol symbolWithString:@"|"]; + pipeParser.name = @"pipe"; + } + return pipeParser; +} + + +- (TDParser *)caretParser { + if (!caretParser) { + self.caretParser = [TDSymbol symbolWithString:@"^"]; + caretParser.name = @"caret"; + } + return caretParser; +} + + +- (TDParser *)tildeParser { + if (!tildeParser) { + self.tildeParser = [TDSymbol symbolWithString:@"~"]; + tildeParser.name = @"tilde"; + } + return tildeParser; +} + + +- (TDParser *)questionParser { + if (!questionParser) { + self.questionParser = [TDSymbol symbolWithString:@"?"]; + questionParser.name = @"question"; + } + return questionParser; +} + + +- (TDParser *)plusParser { + if (!plusParser) { + self.plusParser = [TDSymbol symbolWithString:@"+"]; + plusParser.name = @"plus"; + } + return plusParser; +} + + +- (TDParser *)minusParser { + if (!minusParser) { + self.minusParser = [TDSymbol symbolWithString:@"-"]; + minusParser.name = @"minus"; + } + return minusParser; +} + + +- (TDParser *)timesParser { + if (!timesParser) { + self.timesParser = [TDSymbol symbolWithString:@"x"]; + timesParser.name = @"times"; + } + return timesParser; +} + + +- (TDParser *)divParser { + if (!divParser) { + self.divParser = [TDSymbol symbolWithString:@"/"]; + divParser.name = @"div"; + } + return divParser; +} + + +- (TDParser *)modParser { + if (!modParser) { + self.modParser = [TDSymbol symbolWithString:@"%"]; + modParser.name = @"mod"; + } + return modParser; +} + +@synthesize assignmentOpParser; +@synthesize relationalOpParser; +@synthesize equalityOpParser; +@synthesize shiftOpParser; +@synthesize incrementOpParser; +@synthesize unaryOpParser; +@synthesize multiplicativeOpParser; + +@synthesize programParser; +@synthesize elementParser; +@synthesize funcParser; +@synthesize paramListOptParser; +@synthesize paramListParser; +@synthesize commaIdentifierParser; +@synthesize compoundStmtParser; +@synthesize stmtsParser; +@synthesize stmtParser; +@synthesize ifStmtParser; +@synthesize ifElseStmtParser; +@synthesize whileStmtParser; +@synthesize forParenStmtParser; +@synthesize forBeginStmtParser; +@synthesize forInStmtParser; +@synthesize breakStmtParser; +@synthesize continueStmtParser; +@synthesize withStmtParser; +@synthesize returnStmtParser; +@synthesize variablesOrExprStmtParser; +@synthesize conditionParser; +@synthesize forParenParser; +@synthesize forBeginParser; +@synthesize variablesOrExprParser; +@synthesize varVariablesParser; +@synthesize variablesParser; +@synthesize commaVariableParser; +@synthesize variableParser; +@synthesize assignmentParser; +@synthesize exprOptParser; +@synthesize exprParser; +@synthesize commaAssignmentExprParser; +@synthesize assignmentExprParser; +@synthesize assignmentOpConditionalExprParser; +@synthesize conditionalExprParser; +@synthesize ternaryExprParser; +@synthesize orExprParser; +@synthesize orAndExprParser; +@synthesize andExprParser; +@synthesize andBitwiseOrExprParser; +@synthesize bitwiseOrExprParser; +@synthesize pipeBitwiseXorExprParser; +@synthesize bitwiseXorExprParser; +@synthesize caretBitwiseAndExprParser; +@synthesize bitwiseAndExprParser; +@synthesize ampEqualityExprParser; +@synthesize equalityExprParser; +@synthesize equalityOpRelationalExprParser; +@synthesize relationalExprParser; +@synthesize relationalOpShiftExprParser; +@synthesize shiftExprParser; +@synthesize shiftOpAdditiveExprParser; +@synthesize additiveExprParser; +@synthesize plusOrMinusExprParser; +@synthesize plusExprParser; +@synthesize minusExprParser; +@synthesize multiplicativeExprParser; +@synthesize multiplicativeOpUnaryExprParser; +@synthesize unaryExprParser; +@synthesize unaryExpr1Parser; +@synthesize unaryExpr2Parser; +@synthesize unaryExpr3Parser; +@synthesize unaryExpr4Parser; +@synthesize unaryExpr5Parser; +@synthesize unaryExpr6Parser; +@synthesize constructorCallParser; +@synthesize parenArgListOptParenParser; +@synthesize memberExprParser; +@synthesize memberExprExtParser; +@synthesize dotMemberExprParser; +@synthesize bracketMemberExprParser; +@synthesize argListOptParser; +@synthesize argListParser; +@synthesize primaryExprParser; +@synthesize parenExprParenParser; + +@synthesize funcLiteralParser; +@synthesize arrayLiteralParser; +@synthesize objectLiteralParser; + +@synthesize identifierParser; +@synthesize stringParser; +@synthesize numberParser; + +@synthesize ifParser; +@synthesize elseParser; +@synthesize whileParser; +@synthesize forParser; +@synthesize inParser; +@synthesize breakParser; +@synthesize continueParser; +@synthesize withParser; +@synthesize returnParser; +@synthesize varParser; +@synthesize deleteParser; +@synthesize newParser; +@synthesize thisParser; +@synthesize falseParser; +@synthesize trueParser; +@synthesize nullParser; +@synthesize undefinedParser; +@synthesize voidParser; +@synthesize typeofParser; +@synthesize instanceofParser; +@synthesize functionParser; + +@synthesize orParser; +@synthesize andParser; +@synthesize neParser; +@synthesize isNotParser; +@synthesize eqParser; +@synthesize isParser; +@synthesize leParser; +@synthesize geParser; +@synthesize plusPlusParser; +@synthesize minusMinusParser; +@synthesize plusEqParser; +@synthesize minusEqParser; +@synthesize timesEqParser; +@synthesize divEqParser; +@synthesize modEqParser; +@synthesize shiftLeftParser; +@synthesize shiftRightParser; +@synthesize shiftRightExtParser; +@synthesize shiftLeftEqParser; +@synthesize shiftRightEqParser; +@synthesize shiftRightExtEqParser; +@synthesize andEqParser; +@synthesize xorEqParser; +@synthesize orEqParser; + +@synthesize openCurlyParser; +@synthesize closeCurlyParser; +@synthesize openParenParser; +@synthesize closeParenParser; +@synthesize openBracketParser; +@synthesize closeBracketParser; +@synthesize commaParser; +@synthesize dotParser; +@synthesize semiOptParser; +@synthesize semiParser; +@synthesize colonParser; +@synthesize equalsParser; +@synthesize notParser; +@synthesize ltParser; +@synthesize gtParser; +@synthesize ampParser; +@synthesize pipeParser; +@synthesize caretParser; +@synthesize tildeParser; +@synthesize questionParser; +@synthesize plusParser; +@synthesize minusParser; +@synthesize timesParser; +@synthesize divParser; +@synthesize modParser; +@end diff --git a/test/.svn/tmp/tempfile.3.tmp b/test/.svn/tmp/tempfile.3.tmp new file mode 100644 index 0000000..d16fef1 --- /dev/null +++ b/test/.svn/tmp/tempfile.3.tmp @@ -0,0 +1,1183 @@ +// +// TDParserFactory.m +// TDParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2008 Todd Ditchendorf All rights reserved. +// + +#import "TDParserFactory.h" +#import +#import "NSString+TDParseKitAdditions.h" +#import "NSArray+TDParseKitAdditions.h" + +@interface TDParser (TDParserFactoryAdditionsFriend) +- (void)setTokenizer:(TDTokenizer *)t; +@end + +@interface TDCollectionParser () +@property (nonatomic, readwrite, retain) NSMutableArray *subparsers; +@end + +@interface TDRepetition () +@property (nonatomic, readwrite, retain) TDParser *subparser; +@end + +void TDReleaseSubparserTree(TDParser *p) { + if ([p isKindOfClass:[TDCollectionParser class]]) { + TDCollectionParser *c = (TDCollectionParser *)p; + NSArray *subs = c.subparsers; + if (subs) { + [subs retain]; + c.subparsers = nil; + for (TDParser *s in subs) { + TDReleaseSubparserTree(s); + } + [subs release]; + } + } else if ([p isMemberOfClass:[TDRepetition class]]) { + TDRepetition *r = (TDRepetition *)p; + TDParser *sub = r.subparser; + if (sub) { + [sub retain]; + r.subparser = nil; + TDReleaseSubparserTree(sub); + [sub release]; + } + } +} + +@interface TDParserFactory () +- (id)parserTokensTableFromParsingStatementsInString:(NSString *)s; +- (void)gatherParserClassNamesFromTokens; +- (NSString *)parserClassNameFromTokenArray:(NSArray *)toks; + +- (TDTokenizer *)tokenizerFromGrammarSettings; +- (BOOL)boolForTokenForKey:(NSString *)key; +- (void)setTokenizerState:(TDTokenizerState *)state onTokenizer:(TDTokenizer *)t forTokensForKey:(NSString *)key; + +- (id)expandParser:(TDParser *)p fromTokenArray:(NSArray *)toks; +- (TDParser *)expandedParserForName:(NSString *)parserName; +- (void)setAssemblerForParser:(TDParser *)p; +- (NSString *)defaultAssemblerSelectorNameForParserName:(NSString *)parserName; + +// this is only for unit tests? can it go away? +- (TDSequence *)parserFromExpression:(NSString *)s; + +- (TDAlternation *)zeroOrOne:(TDParser *)p; +- (TDSequence *)oneOrMore:(TDParser *)p; + +- (void)workOnStatementAssembly:(TDAssembly *)a; +- (NSString *)defaultAssemblerSelectorNameForParserName:(NSString *)parserName; +- (void)workOnCallbackAssembly:(TDAssembly *)a; +- (void)workOnExpressionAssembly:(TDAssembly *)a; +- (void)workOnLiteralAssembly:(TDAssembly *)a; +- (void)workOnVariableAssembly:(TDAssembly *)a; +- (void)workOnConstantAssembly:(TDAssembly *)a; +- (void)workOnNumAssembly:(TDAssembly *)a; +- (void)workOnStarAssembly:(TDAssembly *)a; +- (void)workOnPlusAssembly:(TDAssembly *)a; +- (void)workOnQuestionAssembly:(TDAssembly *)a; +- (void)workOnPhraseCardinalityAssembly:(TDAssembly *)a; +- (void)workOnCardinalityAssembly:(TDAssembly *)a; +- (void)workOnOrAssembly:(TDAssembly *)a; + +@property (nonatomic, assign) id assembler; +@property (nonatomic, retain) NSMutableDictionary *parserTokensTable; +@property (nonatomic, retain) NSMutableDictionary *parserClassTable; +@property (nonatomic, retain) NSMutableDictionary *selectorTable; +@property (nonatomic, retain) TDToken *equals; +@property (nonatomic, retain) TDToken *curly; +@property (nonatomic, retain) TDToken *paren; +@property (nonatomic, retain) TDToken *caret; +@property (nonatomic, retain) TDCollectionParser *statementParser; +@property (nonatomic, retain) TDCollectionParser *declarationParser; +@property (nonatomic, retain) TDCollectionParser *callbackParser; +@property (nonatomic, retain) TDCollectionParser *selectorParser; +@property (nonatomic, retain) TDCollectionParser *expressionParser; +@property (nonatomic, retain) TDCollectionParser *termParser; +@property (nonatomic, retain) TDCollectionParser *orTermParser; +@property (nonatomic, retain) TDCollectionParser *factorParser; +@property (nonatomic, retain) TDCollectionParser *nextFactorParser; +@property (nonatomic, retain) TDCollectionParser *phraseParser; +@property (nonatomic, retain) TDCollectionParser *phraseStarParser; +@property (nonatomic, retain) TDCollectionParser *phrasePlusParser; +@property (nonatomic, retain) TDCollectionParser *phraseQuestionParser; +@property (nonatomic, retain) TDCollectionParser *phraseCardinalityParser; +@property (nonatomic, retain) TDCollectionParser *cardinalityParser; +@property (nonatomic, retain) TDCollectionParser *atomicValueParser; +@property (nonatomic, retain) TDCollectionParser *discardParser; +@property (nonatomic, retain) TDParser *patternParser; +@property (nonatomic, retain) TDParser *literalParser; +@property (nonatomic, retain) TDParser *variableParser; +@property (nonatomic, retain) TDParser *constantParser; +@property (nonatomic, retain) TDCollectionParser *delimitedStringParser; +@end + +@implementation TDParserFactory + ++ (id)factory { + return [[[TDParserFactory alloc] init] autorelease]; +} + + +- (id)init { + if (self = [super init]) { + self.equals = [TDToken tokenWithTokenType:TDTokenTypeSymbol stringValue:@"=" floatValue:0.0]; + self.curly = [TDToken tokenWithTokenType:TDTokenTypeSymbol stringValue:@"{" floatValue:0.0]; + self.paren = [TDToken tokenWithTokenType:TDTokenTypeSymbol stringValue:@"(" floatValue:0.0]; + self.caret = [TDToken tokenWithTokenType:TDTokenTypeSymbol stringValue:@"^" floatValue:0.0]; + self.assemblerSettingBehavior = TDParserFactoryAssemblerSettingBehaviorOnAll; + } + return self; +} + + +- (void)dealloc { + assembler = nil; // appease clang static analyzer + + TDReleaseSubparserTree(statementParser); + TDReleaseSubparserTree(expressionParser); + + self.parserTokensTable = nil; + self.parserClassTable = nil; + self.selectorTable = nil; + self.equals = nil; + self.curly = nil; + self.paren = nil; + self.caret = nil; + self.statementParser = nil; + self.declarationParser = nil; + self.callbackParser = nil; + self.selectorParser = nil; + self.expressionParser = nil; + self.termParser = nil; + self.orTermParser = nil; + self.factorParser = nil; + self.nextFactorParser = nil; + self.phraseParser = nil; + self.phraseStarParser = nil; + self.phrasePlusParser = nil; + self.phraseQuestionParser = nil; + self.phraseCardinalityParser = nil; + self.cardinalityParser = nil; + self.atomicValueParser = nil; + self.patternParser = nil; + self.discardParser = nil; + self.literalParser = nil; + self.variableParser = nil; + self.constantParser = nil; + self.delimitedStringParser = nil; + [super dealloc]; +} + + +- (TDParser *)parserFromGrammar:(NSString *)s assembler:(id)a { + self.assembler = a; + self.selectorTable = [NSMutableDictionary dictionary]; + self.parserClassTable = [NSMutableDictionary dictionary]; + self.parserTokensTable = [self parserTokensTableFromParsingStatementsInString:s]; + + TDTokenizer *t = [self tokenizerFromGrammarSettings]; + + [self gatherParserClassNamesFromTokens]; + + TDParser *start = [self expandedParserForName:@"@start"]; + + assembler = nil; + self.selectorTable = nil; + self.parserClassTable = nil; + self.parserTokensTable = nil; + + if (start && [start isKindOfClass:[TDParser class]]) { + start.tokenizer = t; + return start; + } else { + [NSException raise:@"GrammarException" format:@"The provided language grammar was invalid"]; + return nil; + } +} + + +- (id)parserTokensTableFromParsingStatementsInString:(NSString *)s { + TDTokenizer *t = [TDTokenizer tokenizerWithString:s]; + + // customize tokenizer to find tokenizer customization directives + [t setTokenizerState:t.wordState from:'@' to:'@']; + + // customize tokenizer for Pattern regexes + [t setTokenizerState:t.delimitState from:'/' to:'/']; + [t.delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:[[NSCharacterSet whitespaceCharacterSet] invertedSet]]; + + // customize tokenizer for comments + [t setTokenizerState:t.commentState from:'#' to:'#']; + [t setTokenizerState:t.commentState from:'"' to:'"']; + [t.commentState removeSingleLineStartMarker:@"//"]; + [t.commentState removeMultiLineStartMarker:@"/*"]; + [t.commentState addSingleLineStartMarker:@"#"]; + [t.commentState addMultiLineStartMarker:@"\"\"\"" endMarker:@"\"\"\""]; + + TDTokenArraySource *src = [[TDTokenArraySource alloc] initWithTokenizer:t delimiter:@";"]; + id target = [NSMutableDictionary dictionary]; // setup the variable lookup table + + while ([src hasMore]) { + NSArray *toks = [src nextTokenArray]; + TDAssembly *a = [TDTokenAssembly assemblyWithTokenArray:toks]; + a.target = target; + a = [self.statementParser completeMatchFor:a]; + target = a.target; + } + + [src release]; + + return target; +} + + +- (void)gatherParserClassNamesFromTokens { + isGatheringClasses = YES; + // discover the actual parser class types + for (NSString *parserName in parserTokensTable) { + NSString *className = [self parserClassNameFromTokenArray:[parserTokensTable objectForKey:parserName]]; + NSAssert(className.length, @""); + [parserClassTable setObject:className forKey:parserName]; + } + isGatheringClasses = NO; +} + + +- (NSString *)parserClassNameFromTokenArray:(NSArray *)toks { + TDAssembly *a = [TDTokenAssembly assemblyWithTokenArray:toks]; + a.target = parserTokensTable; + a = [self.expressionParser completeMatchFor:a]; + TDParser *res = [a pop]; + a.target = nil; + return [res className]; +} + + +- (TDTokenizer *)tokenizerFromGrammarSettings { + TDTokenizer *t = [TDTokenizer tokenizer]; + [t.commentState removeSingleLineStartMarker:@"//"]; + [t.commentState removeMultiLineStartMarker:@"/*"]; + + t.whitespaceState.reportsWhitespaceTokens = [self boolForTokenForKey:@"@reportsWhitespaceTokens"]; + t.commentState.reportsCommentTokens = [self boolForTokenForKey:@"@reportsCommentTokens"]; + t.commentState.balancesEOFTerminatedComments = [self boolForTokenForKey:@"balancesEOFTerminatedComments"]; + t.quoteState.balancesEOFTerminatedQuotes = [self boolForTokenForKey:@"@balancesEOFTerminatedQuotes"]; + t.delimitState.balancesEOFTerminatedStrings = [self boolForTokenForKey:@"@balancesEOFTerminatedStrings"]; + t.numberState.allowsTrailingDot = [self boolForTokenForKey:@"@allowsTrailingDot"]; + + [self setTokenizerState:t.wordState onTokenizer:t forTokensForKey:@"@wordState"]; + [parserTokensTable removeObjectForKey:@"@wordState"]; + [self setTokenizerState:t.numberState onTokenizer:t forTokensForKey:@"@numberState"]; + [parserTokensTable removeObjectForKey:@"@numberState"]; + [self setTokenizerState:t.quoteState onTokenizer:t forTokensForKey:@"@quoteState"]; + [parserTokensTable removeObjectForKey:@"@quoteState"]; + [self setTokenizerState:t.delimitState onTokenizer:t forTokensForKey:@"@delimitState"]; + [parserTokensTable removeObjectForKey:@"@delimitState"]; + [self setTokenizerState:t.symbolState onTokenizer:t forTokensForKey:@"@symbolState"]; + [parserTokensTable removeObjectForKey:@"@symbolState"]; + [self setTokenizerState:t.commentState onTokenizer:t forTokensForKey:@"@commentState"]; + [parserTokensTable removeObjectForKey:@"@commentState"]; + [self setTokenizerState:t.whitespaceState onTokenizer:t forTokensForKey:@"@whitespaceState"]; + [parserTokensTable removeObjectForKey:@"@shitespaceState"]; + + NSArray *toks = nil; + + // muli-char symbols + toks = [parserTokensTable objectForKey:@"@symbols"]; + for (TDToken *tok in toks) { + if (tok.isQuotedString) { + [t.symbolState add:[tok.stringValue stringByTrimmingQuotes]]; + } + } + [parserTokensTable removeObjectForKey:@"@symbols"]; + + + // wordChars + toks = [parserTokensTable objectForKey:@"@wordChars"]; + for (TDToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + if (s.length) { + NSInteger c = [s characterAtIndex:0]; + [t.wordState setWordChars:YES from:c to:c]; + } + } + } + [parserTokensTable removeObjectForKey:@"@wordChars"]; + + // whitespaceChars + toks = [parserTokensTable objectForKey:@"@whitespaceChars"]; + for (TDToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + if (s.length) { + NSInteger c = [s characterAtIndex:0]; + [t.whitespaceState setWhitespaceChars:YES from:c to:c]; + } + } + } + [parserTokensTable removeObjectForKey:@"whitespaceChars"]; + + // single-line comments + toks = [parserTokensTable objectForKey:@"@singleLineComments"]; + for (TDToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + [t.commentState addSingleLineStartMarker:s]; + [t.symbolState add:s]; + } + } + [parserTokensTable removeObjectForKey:@"singleLineComments"]; + + // multi-line comments + toks = [parserTokensTable objectForKey:@"@multiLineComments"]; + if (toks.count > 1) { + NSInteger i = 0; + for ( ; i < toks.count - 1; i++) { + TDToken *startTok = [toks objectAtIndex:i]; + TDToken *endTok = [toks objectAtIndex:++i]; + if (startTok.isQuotedString && endTok.isQuotedString) { + NSString *start = [startTok.stringValue stringByTrimmingQuotes]; + NSString *end = [endTok.stringValue stringByTrimmingQuotes]; + [t.commentState addMultiLineStartMarker:start endMarker:end]; + [t.symbolState add:start]; + [t.symbolState add:end]; + } + } + } + [parserTokensTable removeObjectForKey:@"multiLineComments"]; + + // delimited strings + toks = [parserTokensTable objectForKey:@"@delimitedStrings"]; + NSAssert(0 == toks.count % 3, @"@delimitedStrings must be specified as quoted strings in multiples of 3"); + if (toks.count > 1) { + NSInteger i = 0; + for ( ; i < toks.count - 2; i++) { + TDToken *startTok = [toks objectAtIndex:i]; + TDToken *endTok = [toks objectAtIndex:++i]; + TDToken *charSetTok = [toks objectAtIndex:++i]; + if (startTok.isQuotedString && endTok.isQuotedString) { + NSString *start = [startTok.stringValue stringByTrimmingQuotes]; + NSString *end = [endTok.stringValue stringByTrimmingQuotes]; + NSCharacterSet *charSet = nil; + if (charSetTok.isQuotedString) { + charSet = [NSCharacterSet characterSetWithCharactersInString:[charSetTok.stringValue stringByTrimmingQuotes]]; + } + [t.delimitState addStartMarker:start endMarker:end allowedCharacterSet:charSet]; + } + } + } + [parserTokensTable removeObjectForKey:@"@delimitedStrings"]; + + return t; +} + + +- (BOOL)boolForTokenForKey:(NSString *)key { + BOOL result = NO; + NSArray *toks = [parserTokensTable objectForKey:key]; + if (toks.count) { + TDToken *tok = [toks objectAtIndex:0]; + if (tok.isWord && [tok.stringValue isEqualToString:@"YES"]) { + result = YES; + } + } + return result; +} + + +- (void)setTokenizerState:(TDTokenizerState *)state onTokenizer:(TDTokenizer *)t forTokensForKey:(NSString *)key { + NSArray *toks = [parserTokensTable objectForKey:key]; + for (TDToken *tok in toks) { + if (tok.isQuotedString) { + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + if (1 == s.length) { + NSInteger c = [s characterAtIndex:0]; + [t setTokenizerState:state from:c to:c]; + } + } + } +} + + +- (TDParser *)expandedParserForName:(NSString *)parserName { + id obj = [parserTokensTable objectForKey:parserName]; + if ([obj isKindOfClass:[TDParser class]]) { + return obj; + } else { + // prevent infinite loops by creating a parser of the correct type first, and putting it in the table + NSString *className = [parserClassTable objectForKey:parserName]; + + TDParser *p = [[NSClassFromString(className) alloc] init]; + [parserTokensTable setObject:p forKey:parserName]; + [p release]; + + p = [self expandParser:p fromTokenArray:obj]; + p.name = parserName; + + [self setAssemblerForParser:p]; + + [parserTokensTable setObject:p forKey:parserName]; + return p; + } +} + + +- (void)setAssemblerForParser:(TDParser *)p { + NSString *parserName = p.name; + NSString *selName = [selectorTable objectForKey:parserName]; + + BOOL setOnAll = (assemblerSettingBehavior & TDParserFactoryAssemblerSettingBehaviorOnAll); + + if (setOnAll) { + // continue + } else { + BOOL setOnExplicit = (assemblerSettingBehavior & TDParserFactoryAssemblerSettingBehaviorOnExplicit); + if (setOnExplicit && selName) { + // continue + } else { + BOOL isTerminal = [p isKindOfClass:[TDTerminal class]]; + if (!isTerminal && !setOnExplicit) return; + + BOOL setOnTerminals = (assemblerSettingBehavior & TDParserFactoryAssemblerSettingBehaviorOnTerminals); + if (setOnTerminals && isTerminal) { + // continue + } else { + return; + } + } + } + + if (!selName) { + selName = [self defaultAssemblerSelectorNameForParserName:parserName]; + } + + SEL sel = NSSelectorFromString(selName); + if (assembler && [assembler respondsToSelector:sel]) { + [p setAssembler:assembler selector:sel]; + } +} + + +- (id)expandParser:(TDParser *)p fromTokenArray:(NSArray *)toks { + TDAssembly *a = [TDTokenAssembly assemblyWithTokenArray:toks]; + a.target = parserTokensTable; + a = [self.expressionParser completeMatchFor:a]; + TDParser *res = [a pop]; + if ([p isKindOfClass:[TDCollectionParser class]]) { + TDCollectionParser *cp = (TDCollectionParser *)p; + [cp add:res]; + return cp; + } else { + return res; + } +} + + +// this is just a utility for unit-testing +- (TDSequence *)parserFromExpression:(NSString *)s { + TDTokenizer *t = [TDTokenizer tokenizerWithString:s]; + TDAssembly *a = [TDTokenAssembly assemblyWithTokenizer:t]; + a.target = [NSMutableDictionary dictionary]; // setup the variable lookup table + a = [self.expressionParser completeMatchFor:a]; + return [a pop]; +} + + +- (TDAlternation *)zeroOrOne:(TDParser *)p { + TDAlternation *a = [TDAlternation alternation]; + [a add:[TDEmpty empty]]; + [a add:p]; + return a; +} + + +- (TDSequence *)oneOrMore:(TDParser *)p { + TDSequence *s = [TDSequence sequence]; + [s add:p]; + [s add:[TDRepetition repetitionWithSubparser:p]]; + return s; +} + + +// @start = statement* +// satement = declaration '=' expression +// declaration = Word callback? +// callback = '(' selector ')' +// selector = Word ':' +// expression = term orTerm* +// term = factor nextFactor* +// orTerm = '|' term +// factor = phrase | phraseStar | phrasePlus | phraseQuestion | phraseCardinality +// nextFactor = factor +// phrase = atomicValue | '(' expression ')' +// phraseStar = phrase '*' +// phrasePlus = phrase '+' +// phraseQuestion = phrase '?' +// phraseCardinality = phrase cardinality +// cardinality = '{' Num '}' +// atomicValue = discard? (literal | variable | constant | pattern | delimitedString) +// discard = '^' +// literal = QuotedString +// variable = LowercaseWord +// constant = UppercaseWord +// pattern = DelimitedString('/', '/') + + +// satement = declaration '=' expression +- (TDCollectionParser *)statementParser { + if (!statementParser) { + self.statementParser = [TDTrack track]; + statementParser.name = @"statement"; + [statementParser add:self.declarationParser]; + [statementParser add:[TDSymbol symbolWithString:@"="]]; + + // accept any tokens in the parser expr the first time around. just gather tokens for later + [statementParser add:[self oneOrMore:[TDAny any]]]; + [statementParser setAssembler:self selector:@selector(workOnStatementAssembly:)]; + } + return statementParser; +} + + +// declaration = productionName callback? +- (TDCollectionParser *)declarationParser { + if (!declarationParser) { + self.declarationParser = [TDTrack track]; + declarationParser.name = @"declaration"; + [declarationParser add:[TDWord word]]; + [declarationParser add:[self zeroOrOne:self.callbackParser]]; + } + return declarationParser; +} + + +// callback = '(' selector ')' +- (TDCollectionParser *)callbackParser { + if (!callbackParser) { + self.callbackParser = [TDTrack track]; + callbackParser.name = @"callback"; + [callbackParser add:[[TDSymbol symbolWithString:@"("] discard]]; + [callbackParser add:self.selectorParser]; + [callbackParser add:[[TDSymbol symbolWithString:@")"] discard]]; + [callbackParser setAssembler:self selector:@selector(workOnCallbackAssembly:)]; + } + return callbackParser; +} + + +// selector = Word ':' +- (TDCollectionParser *)selectorParser { + if (!selectorParser) { + self.selectorParser = [TDTrack track]; + selectorParser.name = @"selector"; + [selectorParser add:[TDLowercaseWord word]]; + [selectorParser add:[[TDSymbol symbolWithString:@":"] discard]]; + } + return selectorParser; +} + + +// expression = term orTerm* +- (TDCollectionParser *)expressionParser { + if (!expressionParser) { + self.expressionParser = [TDSequence sequence]; + expressionParser.name = @"expression"; + [expressionParser add:self.termParser]; + [expressionParser add:[TDRepetition repetitionWithSubparser:self.orTermParser]]; + [expressionParser setAssembler:self selector:@selector(workOnExpressionAssembly:)]; + } + return expressionParser; +} + + +// term = factor nextFactor* +- (TDCollectionParser *)termParser { + if (!termParser) { + self.termParser = [TDSequence sequence]; + termParser.name = @"term"; + [termParser add:self.factorParser]; + [termParser add:[TDRepetition repetitionWithSubparser:self.nextFactorParser]]; + [termParser setAssembler:self selector:@selector(workOnAndAssembly:)]; + } + return termParser; +} + + +// orTerm = '|' term +- (TDCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [TDTrack track]; + orTermParser.name = @"orTerm"; + [orTermParser add:[TDSymbol symbolWithString:@"|"]]; // preserve as fence + [orTermParser add:self.termParser]; + [orTermParser setAssembler:self selector:@selector(workOnOrAssembly:)]; + } + return orTermParser; +} + + +// factor = phrase | phraseStar | phrasePlus | phraseQuestion | phraseCardinality +- (TDCollectionParser *)factorParser { + if (!factorParser) { + self.factorParser = [TDAlternation alternation]; + factorParser.name = @"factor"; + [factorParser add:self.phraseParser]; + [factorParser add:self.phraseStarParser]; + [factorParser add:self.phrasePlusParser]; + [factorParser add:self.phraseQuestionParser]; + [factorParser add:self.phraseCardinalityParser]; + } + return factorParser; +} + + +// nextFactor = factor +- (TDCollectionParser *)nextFactorParser { + if (!nextFactorParser) { + self.nextFactorParser = [TDAlternation alternation]; + nextFactorParser.name = @"nextFactor"; + [nextFactorParser add:self.phraseParser]; + [nextFactorParser add:self.phraseStarParser]; + [nextFactorParser add:self.phrasePlusParser]; + [nextFactorParser add:self.phraseQuestionParser]; + [nextFactorParser add:self.phraseCardinalityParser]; + } + return nextFactorParser; +} + + +// phrase = atomicValue | '(' expression ')' +- (TDCollectionParser *)phraseParser { + if (!phraseParser) { + self.phraseParser = [TDAlternation alternation]; + phraseParser.name = @"phrase"; + [phraseParser add:self.atomicValueParser]; + + TDSequence *s = [TDSequence sequence]; + [s add:[TDSymbol symbolWithString:@"("]]; + [s add:self.expressionParser]; + [s add:[[TDSymbol symbolWithString:@")"] discard]]; + + [phraseParser add:s]; + } + return phraseParser; +} + + +// phraseStar = phrase '*' +- (TDCollectionParser *)phraseStarParser { + if (!phraseStarParser) { + self.phraseStarParser = [TDSequence sequence]; + phraseStarParser.name = @"phraseStar"; + [phraseStarParser add:self.phraseParser]; + [phraseStarParser add:[[TDSymbol symbolWithString:@"*"] discard]]; + [phraseStarParser setAssembler:self selector:@selector(workOnStarAssembly:)]; + } + return phraseStarParser; +} + + +// phrasePlus = phrase '+' +- (TDCollectionParser *)phrasePlusParser { + if (!phrasePlusParser) { + self.phrasePlusParser = [TDSequence sequence]; + phrasePlusParser.name = @"phrasePlus"; + [phrasePlusParser add:self.phraseParser]; + [phrasePlusParser add:[[TDSymbol symbolWithString:@"+"] discard]]; + [phrasePlusParser setAssembler:self selector:@selector(workOnPlusAssembly:)]; + } + return phrasePlusParser; +} + + +// phraseQuestion = phrase '?' +- (TDCollectionParser *)phraseQuestionParser { + if (!phraseQuestionParser) { + self.phraseQuestionParser = [TDSequence sequence]; + phraseQuestionParser.name = @"phraseQuestion"; + [phraseQuestionParser add:self.phraseParser]; + [phraseQuestionParser add:[[TDSymbol symbolWithString:@"?"] discard]]; + [phraseQuestionParser setAssembler:self selector:@selector(workOnQuestionAssembly:)]; + } + return phraseQuestionParser; +} + + +// phraseCardinality = phrase cardinality +- (TDCollectionParser *)phraseCardinalityParser { + if (!phraseCardinalityParser) { + self.phraseCardinalityParser = [TDSequence sequence]; + phraseCardinalityParser.name = @"phraseCardinality"; + [phraseCardinalityParser add:self.phraseParser]; + [phraseCardinalityParser add:self.cardinalityParser]; + [phraseCardinalityParser setAssembler:self selector:@selector(workOnPhraseCardinalityAssembly:)]; + } + return phraseCardinalityParser; +} + + +// cardinality = '{' Num '}' +- (TDCollectionParser *)cardinalityParser { + if (!cardinalityParser) { + self.cardinalityParser = [TDTrack track]; + cardinalityParser.name = @"cardinality"; + + TDTrack *commaNum = [TDTrack track]; + [commaNum add:[[TDSymbol symbolWithString:@","] discard]]; + [commaNum add:[TDNum num]]; + + [cardinalityParser add:[TDSymbol symbolWithString:@"{"]]; // serves as fence. dont discard + [cardinalityParser add:[TDNum num]]; + [cardinalityParser add:[self zeroOrOne:commaNum]]; + [cardinalityParser add:[[TDSymbol symbolWithString:@"}"] discard]]; + [cardinalityParser setAssembler:self selector:@selector(workOnCardinalityAssembly:)]; + } + return cardinalityParser; +} + + +// atomicValue = (pattern | literal | variable | constant | delimitedString) discard? +- (TDCollectionParser *)atomicValueParser { + if (!atomicValueParser) { + self.atomicValueParser = [TDSequence sequence]; + atomicValueParser.name = @"atomicValue"; + + [atomicValueParser add:[self zeroOrOne:self.discardParser]]; + + TDAlternation *a = [TDAlternation alternation]; + [a add:self.patternParser]; + [a add:self.literalParser]; + [a add:self.variableParser]; + [a add:self.constantParser]; + [a add:self.delimitedStringParser]; + [atomicValueParser add:a]; + } + return atomicValueParser; +} + + +// discard = '^' +- (TDCollectionParser *)discardParser { + if (!discardParser) { + self.discardParser = [TDTrack track]; + discardParser.name = @"discardParser"; + [discardParser add:[TDSymbol symbolWithString:@"^"]]; // preserve + } + return discardParser; +} + + +// pattern = DelimitedString('/', '/'); +- (TDParser *)patternParser { + if (!patternParser) { + patternParser.name = @"pattern"; + self.patternParser = [TDDelimitedString delimitedStringWithStartMarker:@"/" endMarker:@"/"]; + [patternParser setAssembler:self selector:@selector(workOnPatternAssembly:)]; + } + return patternParser; +} + + +// literal = QuotedString +- (TDParser *)literalParser { + if (!literalParser) { + self.literalParser = [TDQuotedString quotedString]; + [literalParser setAssembler:self selector:@selector(workOnLiteralAssembly:)]; + } + return literalParser; +} + + +// variable = LowercaseWord +- (TDParser *)variableParser { + if (!variableParser) { + self.variableParser = [TDLowercaseWord word]; + variableParser.name = @"variable"; + [variableParser setAssembler:self selector:@selector(workOnVariableAssembly:)]; + } + return variableParser; +} + + +// constant = UppercaseWord +- (TDParser *)constantParser { + if (!constantParser) { + self.constantParser = [TDUppercaseWord word]; + constantParser.name = @"constant"; + [constantParser setAssembler:self selector:@selector(workOnConstantAssembly:)]; + } + return constantParser; +} + + +// delimitedString = 'DelimitedString' '(' QuotedString (',' QuotedString)? ')' +- (TDCollectionParser *)delimitedStringParser { + if (!delimitedStringParser) { + self.delimitedStringParser = [TDTrack track]; + delimitedStringParser.name = @"delimitedString"; + + TDSequence *secondArg = [TDTrack track]; + [secondArg add:[[TDSymbol symbolWithString:@","] discard]]; + [secondArg add:[TDQuotedString quotedString]]; // endMarker + + [delimitedStringParser add:[[TDLiteral literalWithString:@"DelimitedString"] discard]]; + [delimitedStringParser add:[TDSymbol symbolWithString:@"("]]; // preserve as fence + [delimitedStringParser add:[TDQuotedString quotedString]]; // startMarker + [delimitedStringParser add:[self zeroOrOne:secondArg]]; + [delimitedStringParser add:[[TDSymbol symbolWithString:@")"] discard]]; + + [delimitedStringParser setAssembler:self selector:@selector(workOnDelimitedStringAssembly:)]; + } + return delimitedStringParser; +} + + +- (BOOL)shouldDiscard:(TDAssembly *)a { + if (![a isStackEmpty]) { + id obj = [a pop]; + if ([obj isEqual:caret]) { + return YES; + } else { + [a push:obj]; + } + } + return NO; +} + + +- (void)workOnStatementAssembly:(TDAssembly *)a { + NSArray *toks = [[a objectsAbove:equals] reversedArray]; + [a pop]; // discard '=' tok + + NSString *parserName = nil; + NSString *selName = nil; + id obj = [a pop]; + if ([obj isKindOfClass:[NSString class]]) { // a callback was provided + selName = obj; + parserName = [[a pop] stringValue]; + } else { + parserName = [obj stringValue]; + } + + if (selName) { + NSAssert(selName.length, @""); + [selectorTable setObject:selName forKey:parserName]; + } + NSMutableDictionary *d = a.target; + NSAssert(toks.count, @""); + [d setObject:toks forKey:parserName]; +} + + +- (NSString *)defaultAssemblerSelectorNameForParserName:(NSString *)parserName { + NSString *prefix = nil; + if ([parserName hasPrefix:@"@"]) { + parserName = [parserName substringFromIndex:1]; + prefix = @"workOn_"; + } else { + prefix = @"workOn"; + } + NSString *s = [NSString stringWithFormat:@"%@%@", [[parserName substringToIndex:1] uppercaseString], [parserName substringFromIndex:1]]; + return [NSString stringWithFormat:@"%@%@Assembly:", prefix, s]; +} + + +- (void)workOnCallbackAssembly:(TDAssembly *)a { + TDToken *selNameTok = [a pop]; + NSString *selName = [NSString stringWithFormat:@"%@:", selNameTok.stringValue]; + [a push:selName]; +} + + +- (void)workOnExpressionAssembly:(TDAssembly *)a { + NSArray *objs = [a objectsAbove:paren]; + NSAssert(objs.count, @""); + + [a pop]; // pop '(' + if (objs.count > 1) { + TDSequence *seq = [TDSequence sequence]; + for (id obj in [objs reverseObjectEnumerator]) { + [seq add:obj]; + } + [a push:seq]; + } else if (objs.count) { + [a push:[objs objectAtIndex:0]]; + } +} + + +- (void)workOnPatternAssembly:(TDAssembly *)a { + TDToken *tok = [a pop]; + NSAssert(tok.isDelimitedString, @""); + + NSString *s = tok.stringValue; + NSAssert(s.length > 2, @""); + + NSAssert([s hasPrefix:@"/"], @""); + NSAssert([s hasSuffix:@"/"], @""); + + NSString *re = [s stringByTrimmingQuotes]; + + TDPatternOptions opts = TDPatternOptionsNone; +// if (NSNotFound != [optsString rangeOfString:@"i"].location) { +// opts |= TDPatternOptionsIgnoreCase; +// } +// if (NSNotFound != [optsString rangeOfString:@"m"].location) { +// opts |= TDPatternOptionsMultiline; +// } +// if (NSNotFound != [optsString rangeOfString:@"x"].location) { +// opts |= TDPatternOptionsComments; +// } +// if (NSNotFound != [optsString rangeOfString:@"s"].location) { +// opts |= TDPatternOptionsDotAll; +// } +// if (NSNotFound != [optsString rangeOfString:@"w"].location) { +// opts |= TDPatternOptionsUnicodeWordBoundaries; +// } + + TDTerminal *t = [TDPattern patternWithString:re options:opts tokenType:TDTokenTypeAny]; + + if ([self shouldDiscard:a]) { + [t discard]; + } + + [a push:t]; +} + + +- (void)workOnLiteralAssembly:(TDAssembly *)a { + TDToken *tok = [a pop]; + + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + TDTerminal *t = [TDCaseInsensitiveLiteral literalWithString:s]; + + if ([self shouldDiscard:a]) { + [t discard]; + } + + [a push:t]; +} + + +- (void)workOnVariableAssembly:(TDAssembly *)a { + TDToken *tok = [a pop]; + NSString *parserName = tok.stringValue; + TDParser *p = nil; + if (isGatheringClasses) { + // lookup the actual possible parser. + // if its not there, or still a token array, just spoof it with a sequence + NSMutableDictionary *d = a.target; + p = [d objectForKey:parserName]; + if (![p isKindOfClass:[TDParser parser]]) { + p = [TDSequence sequence]; + } + } else { + if ([parserTokensTable objectForKey:parserName]) { + p = [self expandedParserForName:parserName]; + } + } + [a push:p]; +} + + +- (void)workOnConstantAssembly:(TDAssembly *)a { + TDToken *tok = [a pop]; + NSString *s = tok.stringValue; + id p = nil; + if ([s isEqualToString:@"Word"]) { + p = [TDWord word]; + } else if ([s isEqualToString:@"LowercaseWord"]) { + p = [TDLowercaseWord word]; + } else if ([s isEqualToString:@"UppercaseWord"]) { + p = [TDUppercaseWord word]; + } else if ([s isEqualToString:@"Num"]) { + p = [TDNum num]; + } else if ([s isEqualToString:@"S"]) { + p = [TDWhitespace whitespace]; + } else if ([s isEqualToString:@"QuotedString"]) { + p = [TDQuotedString quotedString]; + } else if ([s isEqualToString:@"Symbol"]) { + p = [TDSymbol symbol]; + } else if ([s isEqualToString:@"Comment"]) { + p = [TDComment comment]; + } else if ([s isEqualToString:@"Any"]) { + p = [TDAny any]; + } else if ([s isEqualToString:@"Empty"]) { + p = [TDEmpty empty]; + } else if ([s isEqualToString:@"Pattern"]) { + p = tok; + } else if ([s isEqualToString:@"DelimitedString"]) { + p = tok; + } else if ([s isEqualToString:@"YES"] || [s isEqualToString:@"NO"]) { + p = tok; + } else { + [NSException raise:@"Grammar Exception" format: + @"User Grammar referenced a constant parser name (uppercase word) which is not supported: %@. Must be one of: Word, LowercaseWord, UppercaseWord, QuotedString, Num, Symbol, Empty.", s]; + } + + if ([p isKindOfClass:[TDTerminal class]] && [self shouldDiscard:a]) { + TDTerminal *t = (TDTerminal *)p; + [t discard]; + } + + [a push:p]; +} + + +- (void)workOnDelimitedStringAssembly:(TDAssembly *)a { + NSArray *toks = [a objectsAbove:paren]; + [a pop]; // discard '(' fence + + NSAssert(toks.count > 0 && toks.count < 3, @""); + NSString *start = [[[toks lastObject] stringValue] stringByTrimmingQuotes]; + NSString *end = nil; + if (toks.count > 1) { + end = [[[toks objectAtIndex:0] stringValue] stringByTrimmingQuotes]; + } + + TDTerminal *t = [TDDelimitedString delimitedStringWithStartMarker:start endMarker:end]; + + if ([self shouldDiscard:a]) { + [t discard]; + } + + [a push:t]; +} + + +- (void)workOnNumAssembly:(TDAssembly *)a { + TDToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)workOnStarAssembly:(TDAssembly *)a { + id top = [a pop]; + TDRepetition *rep = [TDRepetition repetitionWithSubparser:top]; + [a push:rep]; +} + + +- (void)workOnPlusAssembly:(TDAssembly *)a { + id top = [a pop]; + [a push:[self oneOrMore:top]]; +} + + +- (void)workOnQuestionAssembly:(TDAssembly *)a { + id top = [a pop]; + [a push:[self zeroOrOne:top]]; +} + + +- (void)workOnPhraseCardinalityAssembly:(TDAssembly *)a { + NSRange r = [[a pop] rangeValue]; + TDParser *p = [a pop]; + TDSequence *s = [TDSequence sequence]; + + NSInteger start = r.location; + NSInteger end = r.length; + + NSInteger i = 0; + for ( ; i < start; i++) { + [s add:p]; + } + + for ( ; i < end; i++) { + [s add:[self zeroOrOne:p]]; + } + + [a push:s]; +} + + +- (void)workOnCardinalityAssembly:(TDAssembly *)a { + NSArray *toks = [a objectsAbove:self.curly]; + [a pop]; // discard '{' tok + + NSAssert(toks.count > 0, @""); + + CGFloat start = [[toks lastObject] floatValue]; + CGFloat end = start; + if (toks.count > 1) { + end = [[toks objectAtIndex:0] floatValue]; + } + + NSAssert(start <= end, @""); + + NSRange r = NSMakeRange(start, end); + [a push:[NSValue valueWithRange:r]]; +} + + +- (void)workOnOrAssembly:(TDAssembly *)a { + id second = [a pop]; + [a pop]; // pop '|' + id first = [a pop]; + TDAlternation *p = [TDAlternation alternation]; + [p add:first]; + [p add:second]; + [a push:p]; +} + + +- (void)workOnAndAssembly:(TDAssembly *)a { + NSMutableArray *parsers = [NSMutableArray array]; + while (![a isStackEmpty]) { + id obj = [a pop]; + if ([obj isKindOfClass:[TDParser class]]) { + [parsers addObject:obj]; + } else { + [a push:obj]; + break; + } + } + + if (parsers.count > 1) { + TDSequence *seq = [TDSequence sequence]; + for (TDParser *p in [parsers reverseObjectEnumerator]) { + [seq add:p]; + } + + [a push:seq]; + } else if (1 == parsers.count) { + [a push:[parsers objectAtIndex:0]]; + } +} + +@synthesize assembler; +@synthesize parserTokensTable; +@synthesize parserClassTable; +@synthesize selectorTable; +@synthesize equals; +@synthesize curly; +@synthesize paren; +@synthesize caret; +@synthesize statementParser; +@synthesize declarationParser; +@synthesize callbackParser; +@synthesize selectorParser; +@synthesize expressionParser; +@synthesize termParser; +@synthesize orTermParser; +@synthesize factorParser; +@synthesize nextFactorParser; +@synthesize phraseParser; +@synthesize phraseStarParser; +@synthesize phrasePlusParser; +@synthesize phraseQuestionParser; +@synthesize phraseCardinalityParser; +@synthesize cardinalityParser; +@synthesize atomicValueParser; +@synthesize discardParser; +@synthesize patternParser; +@synthesize literalParser; +@synthesize variableParser; +@synthesize constantParser; +@synthesize delimitedStringParser; +@synthesize assemblerSettingBehavior; +@end diff --git a/test/.svn/tmp/tempfile.tmp b/test/.svn/tmp/tempfile.tmp new file mode 100644 index 0000000..393dccc --- /dev/null +++ b/test/.svn/tmp/tempfile.tmp @@ -0,0 +1,130 @@ +// +// TDTestScaffold.m +// TDParseKit +// +// Created by Todd Ditchendorf on 7/13/08. +// Copyright 2008 Todd Ditchendorf. All rights reserved. +// + +#import "TDTestScaffold.h" + +#define RUN_ALL_TEST_CASES 1 +#define SOLO_TEST_CASE @"TDPlistParserTest" + +@interface SenTestSuite (TDAdditions) +- (void)addSuitesForClassNames:(NSArray *)classNames; +@end + +@implementation SenTestSuite (TDAdditions) + +- (void)addSuitesForClassNames:(NSArray *)classNames { + for (NSString *className in classNames) { + SenTestSuite *suite = [SenTestSuite testSuiteForTestCaseWithName:className]; + [self addTest:suite]; + } +} + +@end + +@implementation TDTestScaffold + ++ (void)load { + [self poseAsClass:[SenTestSuite class]]; +} + + ++ (SenTestSuite *)soloTestSuite { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Solo Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObject:SOLO_TEST_CASE]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + + ++ (SenTestSuite *)tokensTestSuite { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Tokens Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDReaderTest", + @"TDTokenizerTest", + @"TDTokenizerTest", + @"TDNumberStateTest", + @"TDQuoteStateTest", + @"TDWhitespaceStateTest", + @"TDWordStateTest", + @"TDSlashStateTest", + @"TDSymbolStateTest", + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + + ++ (SenTestSuite *)charsTestSuite { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Chars Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDCharacterAssemblyTest", + @"TDDigitTest", + @"TDCharTest", + @"TDLetterTest", + @"TDSpecificCharTest", + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + + ++ (SenTestSuite *)parseTestSuite { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Parse Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDParserTest", + @"TDTokenAssemblyTest", + @"TDLiteralTest", + @"TDRepetitionTest", + @"TDSequenceTest", + @"TDAlternationTest", + @"TDSymbolTest", + @"TDRobotCommandTest", + @"TDXmlParserTest", + @"TDJsonParserTest", + @"TDFastJsonParserTest", + @"TDRegularParserTest", + @"SRGSParserTest", + @"EBNFParserTest", + @"TDPlistParserTest", + @"TDXmlNameTest", + @"XPathParserTest", + @"XMLReaderTest", + @"TDXmlTokenizerTest", + @"TDArithmeticParserTest", + @"TDScientificNumberStateTest", + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + + ++ (id)testSuiteForBundlePath:(NSString *) bundlePath { + SenTestSuite *suite = nil; + +#if RUN_ALL_TEST_CASES + suite = [super defaultTestSuite]; +#else + suite = [SenTestSuite testSuiteWithName:@"My Tests"]; +// [suite addTest:[self charsTestSuite]]; +// [suite addTest:[self tokensTestSuite]]; +// [suite addTest:[self parseTestSuite]]; + [suite addTest:[self soloTestSuite]]; +#endif + + return suite; +} + +@end \ No newline at end of file diff --git a/test/EBNFParser.h b/test/EBNFParser.h new file mode 100644 index 0000000..1ae1dba --- /dev/null +++ b/test/EBNFParser.h @@ -0,0 +1,51 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface EBNFParser : PKRepetition { + PKCollectionParser *statementParser; + PKCollectionParser *exprOrAssignmentParser; + PKCollectionParser *assignmentParser; + PKCollectionParser *declarationParser; + PKCollectionParser *variableParser; + PKCollectionParser *expressionParser; + PKCollectionParser *termParser; + PKCollectionParser *orTermParser; + PKCollectionParser *factorParser; + PKCollectionParser *nextFactorParser; + PKCollectionParser *phraseParser; + PKCollectionParser *phraseStarParser; + PKCollectionParser *phraseQuestionParser; + PKCollectionParser *phrasePlusParser; + PKCollectionParser *atomicValueParser; +} +- (id)parse:(NSString *)s; + +@property (nonatomic, retain) PKCollectionParser *statementParser; +@property (nonatomic, retain) PKCollectionParser *exprOrAssignmentParser; +@property (nonatomic, retain) PKCollectionParser *assignmentParser; +@property (nonatomic, retain) PKCollectionParser *declarationParser; +@property (nonatomic, retain) PKCollectionParser *variableParser; +@property (nonatomic, retain) PKCollectionParser *expressionParser; +@property (nonatomic, retain) PKCollectionParser *termParser; +@property (nonatomic, retain) PKCollectionParser *orTermParser; +@property (nonatomic, retain) PKCollectionParser *factorParser; +@property (nonatomic, retain) PKCollectionParser *nextFactorParser; +@property (nonatomic, retain) PKCollectionParser *phraseParser; +@property (nonatomic, retain) PKCollectionParser *phraseStarParser; +@property (nonatomic, retain) PKCollectionParser *phraseQuestionParser; +@property (nonatomic, retain) PKCollectionParser *phrasePlusParser; +@property (nonatomic, retain) PKCollectionParser *atomicValueParser; +@end diff --git a/test/EBNFParser.m b/test/EBNFParser.m new file mode 100644 index 0000000..c5d8e91 --- /dev/null +++ b/test/EBNFParser.m @@ -0,0 +1,433 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "EBNFParser.h" +#import "NSString+ParseKitAdditions.h" + +/* + statement = exprOrAssignment ';' + exprOrAssignment = expression | assigment + assigment = declaration '=' expression + declaration = '$' Word + variable = '$' Word + expression = term orTerm* + term = factor nextFactor* + orTerm = '|' term + factor = phrase | phraseStar | phraseQuestion | phrasePlus + nextFactor = factor + phrase = atomicValue | '(' expression ')' + phraseStar = phrase '*' + phraseQuestion = phrase '?' + phrasePlus = phrase '+' + atomicValue = Word | Number | QuotedString | variable +*/ + +static NSString * const kEBNFEqualsString = @"="; +static NSString * const kEBNFVariablePrefix = @"$"; +static NSString * const kEBNFVariableSuffix = @""; + +@interface PKParser (PKParserFactoryAdditionsFriend) +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@interface EBNFParser () +- (void)addSymbolString:(NSString *)s toTokenizer:(PKTokenizer *)t; + +- (void)didMatchWord:(PKAssembly *)a; +- (void)didMatchNum:(PKAssembly *)a; +- (void)didMatchQuotedString:(PKAssembly *)a; +- (void)didMatchStar:(PKAssembly *)a; +- (void)didMatchQuestion:(PKAssembly *)a; +- (void)didMatchPlus:(PKAssembly *)a; +- (void)didMatchAnd:(PKAssembly *)a; +- (void)didMatchOr:(PKAssembly *)a; +- (void)didMatchAssignment:(PKAssembly *)a; +- (void)didMatchVariable:(PKAssembly *)a; +@end + +@implementation EBNFParser + +- (id)init { + if ([super initWithSubparser:self.statementParser]) { + self.tokenizer = [PKTokenizer tokenizer]; + [self addSymbolString:kEBNFEqualsString toTokenizer:self.tokenizer]; + [self addSymbolString:kEBNFVariablePrefix toTokenizer:self.tokenizer]; + [self addSymbolString:kEBNFVariableSuffix toTokenizer:self.tokenizer]; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.statementParser = nil; + self.exprOrAssignmentParser = nil; + self.assignmentParser = nil; + self.declarationParser = nil; + self.variableParser = nil; + self.expressionParser = nil; + self.termParser = nil; + self.orTermParser = nil; + self.factorParser = nil; + self.nextFactorParser = nil; + self.phraseParser = nil; + self.phraseStarParser = nil; + self.phraseQuestionParser = nil; + self.phrasePlusParser = nil; + self.atomicValueParser = nil; + [super dealloc]; +} + + +- (id)parse:(NSString *)s { + self.tokenizer.string = s; + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:self.tokenizer]; + PKAssembly *result = [self completeMatchFor:a]; + return [result pop]; +} + + +- (void)addSymbolString:(NSString *)s toTokenizer:(PKTokenizer *)t { + if ([s length]) { + NSInteger c = [s characterAtIndex:0]; + [t setTokenizerState:t.symbolState from:c to:c]; + [t.symbolState add:s]; + } +} + + +// statement = exprOrAssignment ';' +- (PKCollectionParser *)statementParser { + if (!statementParser) { + self.statementParser = [PKTrack track]; + [statementParser add:self.exprOrAssignmentParser]; + [statementParser add:[[PKSymbol symbolWithString:@";"] discard]]; + } + return statementParser; +} + + +// exprOrAssignmentParser = expression | assignment +- (PKCollectionParser *)exprOrAssignmentParser { + if (!exprOrAssignmentParser) { + self.exprOrAssignmentParser = [PKAlternation alternation]; + [exprOrAssignmentParser add:self.expressionParser]; + [exprOrAssignmentParser add:self.assignmentParser]; + } + return exprOrAssignmentParser; +} + + +// declaration = variable '=' expression +- (PKCollectionParser *)assignmentParser { + if (!assignmentParser) { + self.assignmentParser = [PKTrack track]; + [assignmentParser add:self.declarationParser]; + [assignmentParser add:[[PKSymbol symbolWithString:kEBNFEqualsString] discard]]; + [assignmentParser add:self.expressionParser]; + [assignmentParser setAssembler:self selector:@selector(didMatchAssignment:)]; + } + return assignmentParser; +} + + +// declaration = '$' Word +- (PKCollectionParser *)declarationParser { + if (!declarationParser) { + self.declarationParser = [PKTrack track]; + [declarationParser add:[[PKSymbol symbolWithString:kEBNFVariablePrefix] discard]]; + [declarationParser add:[PKWord word]]; + if ([kEBNFVariableSuffix length]) { + [declarationParser add:[[PKSymbol symbolWithString:kEBNFVariableSuffix] discard]]; + } + } + return declarationParser; +} + + +// variable = '$' Word +- (PKCollectionParser *)variableParser { + if (!variableParser) { + self.variableParser = [PKTrack track]; + [variableParser add:[[PKSymbol symbolWithString:kEBNFVariablePrefix] discard]]; + [variableParser add:[PKWord word]]; + if ([kEBNFVariableSuffix length]) { + [variableParser add:[[PKSymbol symbolWithString:kEBNFVariableSuffix] discard]]; + } + } + return variableParser; +} + + +// expression = term orTerm* +- (PKCollectionParser *)expressionParser { + if (!expressionParser) { + self.expressionParser = [PKSequence sequence]; + [expressionParser add:self.termParser]; + [expressionParser add:[PKRepetition repetitionWithSubparser:self.orTermParser]]; + } + return expressionParser; +} + + +// term = factor nextFactor* +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + [termParser add:self.factorParser]; + [termParser add:[PKRepetition repetitionWithSubparser:self.nextFactorParser]]; + } + return termParser; +} + + +// orTerm = '|' term +- (PKCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [PKTrack track]; + [orTermParser add:[[PKSymbol symbolWithString:@"|"] discard]]; + [orTermParser add:self.termParser]; + [orTermParser setAssembler:self selector:@selector(didMatchOr:)]; + } + return orTermParser; +} + + +// factor = phrase | phraseStar | phraseQuestion | phrasePlus +- (PKCollectionParser *)factorParser { + if (!factorParser) { + self.factorParser = [PKAlternation alternation]; + [factorParser add:self.phraseParser]; + [factorParser add:self.phraseStarParser]; + [factorParser add:self.phraseQuestionParser]; + [factorParser add:self.phrasePlusParser]; + } + return factorParser; +} + + +// nextFactor = factor +- (PKCollectionParser *)nextFactorParser { + if (!nextFactorParser) { + self.nextFactorParser = [PKAlternation alternation]; + [nextFactorParser add:self.phraseParser]; + [nextFactorParser add:self.phraseStarParser]; + [nextFactorParser add:self.phraseQuestionParser]; + [nextFactorParser add:self.phrasePlusParser]; + [nextFactorParser setAssembler:self selector:@selector(didMatchAnd:)]; + } + return nextFactorParser; +} + + +// phrase = atomicValue | '(' expression ')' +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + PKSequence *s = [PKTrack track]; + [s add:[[PKSymbol symbolWithString:@"("] discard]]; + [s add:self.expressionParser]; + [s add:[[PKSymbol symbolWithString:@")"] discard]]; + + self.phraseParser = [PKAlternation alternation]; + [phraseParser add:self.atomicValueParser]; + [phraseParser add:s]; + } + return phraseParser; +} + + +// phraseStar = phrase '*' +- (PKCollectionParser *)phraseStarParser { + if (!phraseStarParser) { + self.phraseStarParser = [PKSequence sequence]; + [phraseStarParser add:self.phraseParser]; + [phraseStarParser add:[[PKSymbol symbolWithString:@"*"] discard]]; + [phraseStarParser setAssembler:self selector:@selector(didMatchStar:)]; + } + return phraseStarParser; +} + + +// phraseQuestion = phrase '?' +- (PKCollectionParser *)phraseQuestionParser { + if (!phraseQuestionParser) { + self.phraseQuestionParser = [PKSequence sequence]; + [phraseQuestionParser add:self.phraseParser]; + [phraseQuestionParser add:[[PKSymbol symbolWithString:@"?"] discard]]; + [phraseQuestionParser setAssembler:self selector:@selector(didMatchQuestion:)]; + } + return phraseQuestionParser; +} + + +// phrasePlus = phrase '+' +- (PKCollectionParser *)phrasePlusParser { + if (!phrasePlusParser) { + self.phrasePlusParser = [PKSequence sequence]; + [phrasePlusParser add:self.phraseParser]; + [phrasePlusParser add:[[PKSymbol symbolWithString:@"+"] discard]]; + [phrasePlusParser setAssembler:self selector:@selector(didMatchPlus:)]; + } + return phrasePlusParser; +} + + +// atomicValue = Word | Number | QuotedString | Variable +- (PKCollectionParser *)atomicValueParser { + if (!atomicValueParser) { + self.atomicValueParser = [PKAlternation alternation]; + + PKParser *p = [PKWord word]; + [p setAssembler:self selector:@selector(didMatchWord:)]; + [atomicValueParser add:p]; + + p = [PKNumber number]; + [p setAssembler:self selector:@selector(didMatchNum:)]; + [atomicValueParser add:p]; + + p = [PKQuotedString quotedString]; + [p setAssembler:self selector:@selector(didMatchQuotedString:)]; + [atomicValueParser add:p]; + + p = self.variableParser; + [p setAssembler:self selector:@selector(didMatchVariable:)]; + [atomicValueParser add:p]; + } + return atomicValueParser; +} + + +- (void)didMatchWord:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + [a push:[PKLiteral literalWithString:tok.stringValue]]; +} + + +- (void)didMatchNum:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + [a push:[PKLiteral literalWithString:tok.stringValue]]; +} + + +- (void)didMatchQuotedString:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + + PKSequence *p = [PKSequence sequence]; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKToken *eof = [PKToken EOFToken]; + while (eof != (tok = [t nextToken])) { + [p add:[PKLiteral literalWithString:tok.stringValue]]; + } + + [a push:p]; +} + + +- (void)didMatchStar:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + PKRepetition *p = [PKRepetition repetitionWithSubparser:[a pop]]; + [a push:p]; +} + + +- (void)didMatchQuestion:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + PKAlternation *p = [PKAlternation alternation]; + [p add:[a pop]]; + [p add:[PKEmpty empty]]; + [a push:p]; +} + + +- (void)didMatchPlus:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + PKSequence *p = [PKSequence sequence]; + [p add:top]; + [p add:[PKRepetition repetitionWithSubparser:top]]; + [a push:p]; +} + + +- (void)didMatchAnd:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + PKSequence *p = [PKSequence sequence]; + [p add:[a pop]]; + [p add:top]; + [a push:p]; +} + + +- (void)didMatchOr:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + // NSLog(@"top: %@", top); + // NSLog(@"top class: %@", [top class]); + PKAlternation *p = [PKAlternation alternation]; + [p add:[a pop]]; + [p add:top]; + [a push:p]; +} + + +- (void)didMatchAssignment:(PKAssembly *)a { + NSLog(@"%s", _cmd); + NSLog(@"a: %@", a); + id val = [a pop]; + PKToken *keyTok = [a pop]; + NSMutableDictionary *table = [NSMutableDictionary dictionaryWithDictionary:a.target]; + [table setObject:val forKey:keyTok.stringValue]; + a.target = table; +} + + +- (void)didMatchVariable:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKToken *keyTok = [a pop]; + id val = [a.target objectForKey:keyTok.stringValue]; + if (val) { + [a push:val]; + } +} + +@synthesize statementParser; +@synthesize exprOrAssignmentParser; +@synthesize assignmentParser; +@synthesize declarationParser; +@synthesize variableParser; +@synthesize expressionParser; +@synthesize termParser; +@synthesize orTermParser; +@synthesize factorParser; +@synthesize nextFactorParser; +@synthesize phraseParser; +@synthesize phraseStarParser; +@synthesize phraseQuestionParser; +@synthesize phrasePlusParser; +@synthesize atomicValueParser; +@end \ No newline at end of file diff --git a/test/EBNFParserTest.h b/test/EBNFParserTest.h new file mode 100644 index 0000000..6d6ec54 --- /dev/null +++ b/test/EBNFParserTest.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface EBNFParserTest : SenTestCase { + +} + +@end diff --git a/test/EBNFParserTest.m b/test/EBNFParserTest.m new file mode 100644 index 0000000..17160c6 --- /dev/null +++ b/test/EBNFParserTest.m @@ -0,0 +1,43 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "EBNFParserTest.h" +#import "EBNFParser.h" + +@implementation EBNFParserTest + +- (void)test { + //NSString *s = @"foo (bar|baz)*;"; + NSString *s = @"$baz = bar; ($baz|foo)*;"; + //NSString *s = @"foo;"; + EBNFParser *p = [[[EBNFParser alloc] init] autorelease]; + + // PKAssembly *a = [p bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + // NSLog(@"a: %@", a); + // NSLog(@"a.target: %@", a.target); + + PKParser *res = [p parse:s]; + // NSLog(@"res: %@", res); + // NSLog(@"res: %@", res.string); + // NSLog(@"res.subparsers: %@", res.subparsers); + // NSLog(@"res.subparsers 0: %@", [[res.subparsers objectAtIndex:0] string]); + // NSLog(@"res.subparsers 1: %@", [[res.subparsers objectAtIndex:1] string]); + + s = @"bar foo bar foo"; + PKAssembly *a = [res completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + NSLog(@"\n\na: %@\n\n", a); + +} + +@end diff --git a/test/ERBTest.h b/test/ERBTest.h new file mode 100644 index 0000000..4e750c9 --- /dev/null +++ b/test/ERBTest.h @@ -0,0 +1,28 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" + +@interface ERBTest : SenTestCase { + NSString *g; + NSString *s; + PKAssembly *res; + PKParser *lp; // language parser + PKTokenizer *t; + PKToken *tok; + PKToken *startPrintMarker; +} + +@end diff --git a/test/ERBTest.m b/test/ERBTest.m new file mode 100644 index 0000000..7b4b1e7 --- /dev/null +++ b/test/ERBTest.m @@ -0,0 +1,72 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "ERBTest.h" + +@interface ERBAssembler : NSObject { + +} + +@end + +@implementation ERBAssembler + +- (id)provideValueForKey:(NSString *)k { + return @"hai"; +} + + +- (void)didMatchEndMarker:(PKAssembly *)a { + [a pop]; // '@>' + NSString *k = [a pop]; + [a pop]; // discard '<@=' + [a push:[self provideValueForKey:k]]; +} + + +- (void)didMatchDotWord:(PKAssembly *)a { + PKToken *lastPart = [a pop]; + [a pop]; // '.' + PKToken *firstPart = [a pop]; + + NSString *keyPath = [NSString stringWithFormat:@"%@.%@", + firstPart, lastPart]; + [a push:keyPath]; + // do something with the keyPath +} + +@end + + +@implementation ERBTest + +- (void)setUp { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"erb" ofType:@"grammar"]; + g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + lp = [[PKParserFactory factory] parserFromGrammar:g assembler:[[[ERBAssembler alloc] init] autorelease]]; + t = lp.tokenizer; +// startPrintMarker = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"<@=" floatValue:0]; +} + + +- (void)testFoo { + t.string = @"oh <@= foo.bar @> !"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; +// TDEqualObjects([res description], @"[oh, hai, !]oh/<@=/foo/./bar/@>/!^"); + +} + +@end + diff --git a/test/PKAST.h b/test/PKAST.h new file mode 100644 index 0000000..1690bf1 --- /dev/null +++ b/test/PKAST.h @@ -0,0 +1,33 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKToken; + +@interface PKAST : NSObject { + PKToken *token; + NSMutableArray *children; +} + ++ (id)ASTWithToken:(PKToken *)tok; + +- (id)initWithToken:(PKToken *)tok; + +- (NSInteger)type; + +- (void)addChild:(PKAST *)c; +- (BOOL)isNil; + +@end diff --git a/test/PKAST.m b/test/PKAST.m new file mode 100644 index 0000000..f12946f --- /dev/null +++ b/test/PKAST.m @@ -0,0 +1,102 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKAST.h" + +@interface PKAST () +@property (nonatomic, retain) PKToken *token; +@property (nonatomic, retain) NSMutableArray *children; +@end + +@implementation PKAST + ++ (id)ASTWithToken:(PKToken *)tok { + return [[[self alloc] initWithToken:tok] autorelease]; +} + + +- (id)init { + return [self initWithToken:nil]; +} + + +- (id)initWithToken:(PKToken *)tok { + if (self = [super init]) { + self.token = tok; + } + return self; +} + + +- (void)dealloc { + self.token = nil; + self.children = nil; + [super dealloc]; +} + + +- (NSString *)description { + return [token stringValue]; +} + + +- (NSString *)treeDescription { + if (![children count]) { + return [self description]; + } + + NSMutableString *ms = [NSMutableString string]; + + if (![self isNil]) { + [ms appendFormat:@"(%@ ", [self description]]; + } + + NSInteger i = 0; + for (PKAST *child in children) { + if (i++) { + [ms appendFormat:@" %@", child]; + } else { + [ms appendFormat:@"%@", child]; + } + } + + if (![self isNil]) { + [ms appendString:@")"]; + } + + return [[ms copy] autorelease]; +} + + +- (NSInteger)type { + NSAssert2(0, @"%s is an abastract method. Must be overridden in %@", __PRETTY_FUNCTION__, NSStringFromClass([self class])); + return -1; +} + + +- (void)addChild:(PKAST *)c { + if (!children) { + self.children = [NSMutableArray array]; + } + [children addObject:c]; +} + + +- (BOOL)isNil { + return !token; +} + +@synthesize token; +@synthesize children; +@end diff --git a/test/PKExclusion.h b/test/PKExclusion.h new file mode 100644 index 0000000..f7ef9b2 --- /dev/null +++ b/test/PKExclusion.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface PKExclusion : PKCollectionParser { + +} + ++ (id)exclusion; +@end diff --git a/test/PKExclusion.m b/test/PKExclusion.m new file mode 100644 index 0000000..9dec1e0 --- /dev/null +++ b/test/PKExclusion.m @@ -0,0 +1,82 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKExclusion.h" +#import + +@interface NSMutableSet (PKExclusionAdditions) +- (void)exclusiveSetTestingEquality:(NSSet *)s; +@end + +@implementation NSMutableSet (PKExclusionAdditions) + +- (void)exclusiveSetTestingEquality:(NSSet *)s { + for (id a1 in self) { + BOOL found = NO; + for (id a2 in s) { + if ([a1 isEqual:a2 ]) { + found = YES; + break; + } + } + if (found) { + [self removeObject:a1]; + } + } + + for (id a2 in s) { + BOOL found = NO; + for (id a1 in self) { + if ([a2 isEqual:a1]) { + found = YES; + break; + } + } + if (!found) { + [self addObject:a2]; + } + } +} + +@end + +@interface PKParser () +- (NSSet *)matchAndAssemble:(NSSet *)inAssemblies; +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@implementation PKExclusion + ++ (id)exclusion { + return [[[self alloc] init] autorelease]; +} + + +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies { + NSParameterAssert(inAssemblies); + NSMutableSet *outAssemblies = [NSMutableSet set]; + + NSInteger i = 0; + for (PKParser *p in subparsers) { + if (0 == i++) { + outAssemblies = [[[p matchAndAssemble:inAssemblies] mutableCopy] autorelease]; + } else { + [outAssemblies exclusiveSetTestingEquality:[p allMatchesFor:inAssemblies]]; + } + } + + return outAssemblies; +} + +@end diff --git a/test/PKNumberState.h b/test/PKNumberState.h new file mode 100644 index 0000000..84b0a22 --- /dev/null +++ b/test/PKNumberState.h @@ -0,0 +1,38 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class PKNumberState + @brief A number state returns a number from a reader. + @details This state's idea of a number allows an optional, initial minus sign, followed by one or more digits. A decimal point and another string of digits may follow these digits. + If allowsScientificNotation is true (the default) this state allows 'e' or 'E' followed by an (optionally explicityly positive or negative) integer to represent 10 to the indicated power. For example, this state will recognize 1e2 as equaling 100.

+*/ +@interface PKNumberState : PKTokenizerState { + BOOL allowsTrailingDot; + BOOL gotADigit; + BOOL negative; + PKUniChar c; + CGFloat floatValue; +} + +/*! + @property allowsTrailingDot + @brief If true, numbers are allowed to end with a trialing dot, e.g. 42. + @details false by default. +*/ +@property (nonatomic) BOOL allowsTrailingDot; +@end diff --git a/test/PKNumberState.m b/test/PKNumberState.m new file mode 100644 index 0000000..71921e3 --- /dev/null +++ b/test/PKNumberState.m @@ -0,0 +1,151 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import +#import + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface PKNumberState () +- (CGFloat)absorbDigitsFromReader:(PKReader *)r isFraction:(BOOL)fraction; +- (CGFloat)value; +- (void)parseLeftSideFromReader:(PKReader *)r; +- (void)parseRightSideFromReader:(PKReader *)r; +- (void)reset:(PKUniChar)cin; +@end + +@implementation PKNumberState + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + [self resetWithReader:r]; + negative = NO; + PKUniChar originalCin = cin; + + if ('-' == cin) { + negative = YES; + cin = [r read]; + [self append:'-']; + } else if ('+' == cin) { + cin = [r read]; + [self append:'+']; + } + + [self reset:cin]; + if ('.' == c) { + [self parseRightSideFromReader:r]; + } else { + [self parseLeftSideFromReader:r]; + [self parseRightSideFromReader:r]; + } + + // erroneous ., +, or - + if (!gotADigit) { + if (negative && PKEOF != c) { // ?? + [r unread]; + } + return [t.symbolState nextTokenFromReader:r startingWith:originalCin tokenizer:t]; + } + + if (PKEOF != c) { + [r unread]; + } + + if (negative) { + floatValue = -floatValue; + } + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:[self bufferedString] floatValue:[self value]]; + tok.offset = offset; + return tok; +} + + +- (CGFloat)value { + return floatValue; +} + + +- (CGFloat)absorbDigitsFromReader:(PKReader *)r isFraction:(BOOL)isFraction { + CGFloat divideBy = 1.0; + CGFloat v = 0.0; + + while (1) { + if (isdigit(c)) { + [self append:c]; + gotADigit = YES; + v = v * 10.0 + (c - '0'); + c = [r read]; + if (isFraction) { + divideBy *= 10.0; + } + } else { + break; + } + } + + if (isFraction) { + v = v / divideBy; + } + + return (CGFloat)v; +} + + +- (void)parseLeftSideFromReader:(PKReader *)r { + floatValue = [self absorbDigitsFromReader:r isFraction:NO]; +} + + +- (void)parseRightSideFromReader:(PKReader *)r { + if ('.' == c) { + PKUniChar n = [r read]; + BOOL nextIsDigit = isdigit(n); + if (PKEOF != n) { + [r unread]; + } + + if (nextIsDigit || allowsTrailingDot) { + [self append:'.']; + if (nextIsDigit) { + c = [r read]; + floatValue += [self absorbDigitsFromReader:r isFraction:YES]; + } + } + } +} + + +- (void)reset:(PKUniChar)cin { + gotADigit = NO; + floatValue = 0.0; + c = cin; +} + +@synthesize allowsTrailingDot; +@end diff --git a/test/PKParseTree.h b/test/PKParseTree.h new file mode 100644 index 0000000..2a5b0e1 --- /dev/null +++ b/test/PKParseTree.h @@ -0,0 +1,37 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKRuleNode; +@class PKTokenNode; +@class PKToken; + +@interface PKParseTree : NSObject { + PKParseTree *parent; + NSMutableArray *children; + id userInfo; + BOOL matched; +} ++ (id)parseTree; + +- (PKRuleNode *)addChildRule:(NSString *)name; +- (PKTokenNode *)addChildToken:(PKToken *)tok; +- (void)addChild:(PKParseTree *)tr; + +@property (nonatomic, assign, readonly) PKParseTree *parent; // weak ref +@property (nonatomic, retain, readonly) NSMutableArray *children; +@property (nonatomic, retain) id userInfo; +@property (nonatomic, getter=isMatched) BOOL matched; +@end diff --git a/test/PKParseTree.m b/test/PKParseTree.m new file mode 100644 index 0000000..79d527f --- /dev/null +++ b/test/PKParseTree.m @@ -0,0 +1,96 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKParseTree.h" +#import "PKRuleNode.h" +#import "PKTokenNode.h" + +@interface PKParseTree () +@property (nonatomic, assign, readwrite) PKParseTree *parent; +@property (nonatomic, retain, readwrite) NSMutableArray *children; +@end + +@implementation PKParseTree + ++ (id)parseTree { + return [[[self alloc] init] autorelease]; +} + + +- (void)dealloc { + self.parent = nil; + self.children = nil; + self.userInfo = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + PKParseTree *t = [[[self class] allocWithZone:zone] init]; + + // assign parent + if (parent) { + t->parent = parent; + + // put new copy in new parent's children array + NSInteger i = [[parent children] indexOfObject:self]; + if (NSNotFound != i) { + [[t->parent children] replaceObjectAtIndex:i withObject:t]; + } + } + + // copy children + if (children) { + t->children = [children mutableCopyWithZone:zone]; + } + return t; +} + + +- (PKRuleNode *)addChildRule:(NSString *)name { + NSParameterAssert([name length]); + PKRuleNode *n = [PKRuleNode ruleNodeWithName:name]; + [self addChild:n]; + return n; +} + + +- (PKTokenNode *)addChildToken:(PKToken *)tok { + NSParameterAssert([[tok stringValue] length]); + PKTokenNode *n = [PKTokenNode tokenNodeWithToken:tok]; + [self addChild:n]; + return n; +} + + +- (void)addChild:(PKParseTree *)tr { + NSParameterAssert(tr); + if (!children) { + self.children = [NSMutableArray array]; + } + tr.parent = self; + [children addObject:tr]; +} + + +- (NSString *)description { + return [NSString stringWithFormat:@"", children]; +} + +@synthesize parent; +@synthesize children; +@synthesize userInfo; +@synthesize matched; +@end + diff --git a/test/PKParseTreeAssembler.h b/test/PKParseTreeAssembler.h new file mode 100644 index 0000000..15dde9b --- /dev/null +++ b/test/PKParseTreeAssembler.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface PKParseTreeAssembler : NSObject { + NSMutableDictionary *ruleNames; + NSString *preassemblerPrefix; + NSString *assemblerPrefix; + NSString *suffix; +} + +@end diff --git a/test/PKParseTreeAssembler.m b/test/PKParseTreeAssembler.m new file mode 100644 index 0000000..0802853 --- /dev/null +++ b/test/PKParseTreeAssembler.m @@ -0,0 +1,181 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKParseTreeAssembler.h" +#import +#import "PKParseTree.h" +#import "PKRuleNode.h" +#import "PKTokenNode.h" + +@interface PKParseTreeAssembler () +- (NSString *)ruleNameForSelName:(NSString *)selName withPrefix:(NSString *)pre; +- (void)didMatchRuleNamed:(NSString *)name assembly:(PKAssembly *)a; +- (void)willMatchRuleNamed:(NSString *)name assembly:(PKAssembly *)a; +- (void)didMatchToken:(PKAssembly *)a; +- (PKParseTree *)currentFrom:(PKAssembly *)a; +- (void)removeUnmatchedChildrenFrom:(PKParseTree *)n; + +@property (nonatomic, retain) NSMutableDictionary *ruleNames; +@property (nonatomic, copy) NSString *assemblerPrefix; +@property (nonatomic, copy) NSString *preassemblerPrefix; +@property (nonatomic, copy) NSString *suffix; +@end + +@implementation PKParseTreeAssembler + +- (id)init { + if (self = [super init]) { + self.ruleNames = [NSMutableDictionary dictionary]; + self.preassemblerPrefix = @"willMatch"; + self.assemblerPrefix = @"didMatch"; + self.suffix = @":"; + } + return self; +} + + +- (void)dealloc { + self.ruleNames = nil; + self.preassemblerPrefix = nil; + self.assemblerPrefix = nil; + self.suffix = nil; + [super dealloc]; +} + + +- (BOOL)respondsToSelector:(SEL)sel { + return YES; + if ([super respondsToSelector:sel]) { + return YES; + } else { + NSString *selName = NSStringFromSelector(sel); + if ([selName hasPrefix:assemblerPrefix] && [selName hasSuffix:suffix]) { + return YES; + } + } + return NO; +} + + +- (id)performSelector:(SEL)sel withObject:(id)obj { + NSString *selName = NSStringFromSelector(sel); + + if ([selName hasPrefix:assemblerPrefix] && [selName hasSuffix:suffix]) { + [self didMatchRuleNamed:[self ruleNameForSelName:selName withPrefix:assemblerPrefix] assembly:obj]; + } else if ([selName hasPrefix:preassemblerPrefix] && [selName hasSuffix:suffix]) { + [self willMatchRuleNamed:[self ruleNameForSelName:selName withPrefix:preassemblerPrefix] assembly:obj]; + } else if ([super respondsToSelector:sel]) { + return [super performSelector:sel withObject:obj]; + } else { + NSAssert(0, @""); + } + return nil; +} + + +- (NSString *)ruleNameForSelName:(NSString *)selName withPrefix:(NSString *)prefix { + NSString *ruleName = [ruleNames objectForKey:selName]; + + if (!ruleName) { + NSUInteger prefixLen = [prefix length]; + NSInteger c = ((NSInteger)[selName characterAtIndex:prefixLen]) + 32; // lowercase + NSRange r = NSMakeRange(prefixLen + 1, [selName length] - (prefixLen + [suffix length] + 1 /*:*/)); + ruleName = [NSString stringWithFormat:@"%C%@", c, [selName substringWithRange:r]]; + [ruleNames setObject:ruleName forKey:selName]; + } + + return ruleName; +} + + +- (void)willMatchRuleNamed:(NSString *)name assembly:(PKAssembly *)a { + PKParseTree *current = [self currentFrom:a]; + [self didMatchToken:a]; + current = [current addChildRule:name]; + a.target = current; +} + + +- (void)didMatchRuleNamed:(NSString *)name assembly:(PKAssembly *)a { + PKParseTree *current = [self currentFrom:a]; + + NSArray *origChildren = [[[current children] mutableCopy] autorelease]; + + PKParseTree *oldCurrent = nil; + while ([current isKindOfClass:[PKRuleNode class]] && ![[(id)current name] isEqualToString:name]) { + oldCurrent = [[current retain] autorelease]; + a.target = [current parent]; + current = [self currentFrom:a]; + [self didMatchToken:a]; + } + + if (oldCurrent && ![oldCurrent isMatched]) { + [(id)[current children] addObjectsFromArray:origChildren]; + } + + [self didMatchToken:a]; + current = [self currentFrom:a]; + + [self removeUnmatchedChildrenFrom:current]; + [current setMatched:YES]; + a.target = [current parent]; +} + + +- (void)removeUnmatchedChildrenFrom:(PKParseTree *)n { + NSMutableArray *remove = [NSMutableArray array]; + for (id child in [n children]) { + if (![child isMatched]) { + [remove addObject:child]; + } + } + + for (id child in remove) { + [(id)[n children] removeObject:child]; + } +} + + +- (PKParseTree *)currentFrom:(PKAssembly *)a { + PKParseTree *current = a.target; + if (!current) { + current = [PKParseTree parseTree]; + a.target = current; + } + return current; +} + + +- (void)didMatchToken:(PKAssembly *)a { + PKParseTree *current = [self currentFrom:a]; + if ([current isMatched]) return; + + NSMutableArray *toks = [NSMutableArray arrayWithCapacity:[a.stack count]]; + while (![a isStackEmpty]) { + id tok = [a pop]; + NSAssert([tok isKindOfClass:[PKToken class]], @""); + [toks addObject:tok]; + } + + for (id tok in [toks reverseObjectEnumerator]) { + PKTokenNode *n = [current addChildToken:tok]; + [n setMatched:YES]; + } +} + +@synthesize ruleNames; +@synthesize preassemblerPrefix; +@synthesize assemblerPrefix; +@synthesize suffix; +@end diff --git a/test/PKRuleNode.h b/test/PKRuleNode.h new file mode 100644 index 0000000..ec9d51f --- /dev/null +++ b/test/PKRuleNode.h @@ -0,0 +1,27 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKParseTree.h" + +@interface PKRuleNode : PKParseTree { + NSString *name; +} + ++ (id)ruleNodeWithName:(NSString *)s; + +// designated initializer +- (id)initWithName:(NSString *)s; + +@property (nonatomic, copy, readonly) NSString *name; +@end diff --git a/test/PKRuleNode.m b/test/PKRuleNode.m new file mode 100644 index 0000000..c748ac2 --- /dev/null +++ b/test/PKRuleNode.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKRuleNode.h" + +@interface PKRuleNode () +@property (nonatomic, copy, readwrite) NSString *name; +@end + +@implementation PKRuleNode + ++ (id)ruleNodeWithName:(NSString *)s { + return [[[self alloc] initWithName:s] autorelease]; +} + + +- (id)initWithName:(NSString *)s { + if (self = [super init]) { + self.name = s; + } + return self; +} + + +- (void)dealloc { + self.name = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + PKRuleNode *n = [super copyWithZone:zone]; + n->name = [name copyWithZone:zone]; + return n; +} + + +- (NSString *)description { + return [NSString stringWithFormat:@"", name, children]; +} + +@synthesize name; +@end diff --git a/test/PKScientificNumberState.h b/test/PKScientificNumberState.h new file mode 100644 index 0000000..90c0a65 --- /dev/null +++ b/test/PKScientificNumberState.h @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +/*! + @class PKScientificNumberState + @brief A PKScientificNumberState object returns a number from a reader. + @details

This state's idea of a number expands on its superclass, allowing an 'e' followed by an integer to represent 10 to the indicated power. For example, this state will recognize 1e2 as equaling 100.

+

This class exists primarily to show how to introduce a new tokenizing state.

+*/ +@interface PKScientificNumberState : PKNumberState { + BOOL allowsScientificNotation; + CGFloat exp; + BOOL negativeExp; +} + +@property (nonatomic) BOOL allowsScientificNotation; +@end diff --git a/test/PKScientificNumberState.m b/test/PKScientificNumberState.m new file mode 100644 index 0000000..e29421d --- /dev/null +++ b/test/PKScientificNumberState.m @@ -0,0 +1,99 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKScientificNumberState.h" +#import +#import + +@interface PKTokenizerState () +- (void)append:(PKUniChar)c; +@end + +@interface PKNumberState () +- (CGFloat)absorbDigitsFromReader:(PKReader *)r isFraction:(BOOL)isFraction; +- (void)parseRightSideFromReader:(PKReader *)r; +- (void)reset:(PKUniChar)cin; +- (CGFloat)value; +@end + +@implementation PKScientificNumberState + +- (id)init { + if (self = [super init]) { + self.allowsScientificNotation = YES; + } + return self; +} + + +- (void)parseRightSideFromReader:(PKReader *)r { + NSParameterAssert(r); + [super parseRightSideFromReader:r]; + if (!allowsScientificNotation) { + return; + } + + if ('e' == c || 'E' == c) { + PKUniChar e = c; + c = [r read]; + + BOOL hasExp = isdigit(c); + negativeExp = ('-' == c); + BOOL positiveExp = ('+' == c); + + if (!hasExp && (negativeExp || positiveExp)) { + c = [r read]; + hasExp = isdigit(c); + } + if (PKEOF != c) { + [r unread]; + } + if (hasExp) { + [self append:e]; + if (negativeExp) { + [self append:'-']; + } else if (positiveExp) { + [self append:'+']; + } + c = [r read]; + exp = [super absorbDigitsFromReader:r isFraction:NO]; + } + } +} + + +- (void)reset:(PKUniChar)cin { + [super reset:cin]; + exp = (CGFloat)0.0; + negativeExp = NO; +} + + +- (CGFloat)value { + CGFloat result = (CGFloat)floatValue; + + NSUInteger i = 0; + for ( ; i < exp; i++) { + if (negativeExp) { + result /= (CGFloat)10.0; + } else { + result *= (CGFloat)10.0; + } + } + + return (CGFloat)result; +} + +@synthesize allowsScientificNotation; +@end diff --git a/test/PKTokenNode.h b/test/PKTokenNode.h new file mode 100644 index 0000000..25be566 --- /dev/null +++ b/test/PKTokenNode.h @@ -0,0 +1,29 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKParseTree.h" + +@class PKToken; + +@interface PKTokenNode : PKParseTree { + PKToken *token; +} + ++ (id)tokenNodeWithToken:(PKToken *)tok; + +// designated initializer +- (id)initWithToken:(PKToken *)tok; + +@property (nonatomic, retain, readonly) PKToken *token; +@end diff --git a/test/PKTokenNode.m b/test/PKTokenNode.m new file mode 100644 index 0000000..4d7f081 --- /dev/null +++ b/test/PKTokenNode.m @@ -0,0 +1,55 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKTokenNode.h" +#import + +@interface PKTokenNode () +@property (nonatomic, retain, readwrite) PKToken *token; +@end + +@implementation PKTokenNode + ++ (id)tokenNodeWithToken:(PKToken *)s { + return [[[self alloc] initWithToken:s] autorelease]; +} + + +- (id)initWithToken:(PKToken *)s { + if (self = [super init]) { + self.token = s; + } + return self; +} + + +- (void)dealloc { + self.token = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + PKTokenNode *n = [super copyWithZone:zone]; + n->token = [token copyWithZone:zone]; + return n; +} + + +- (NSString *)description { + return [NSString stringWithFormat:@"", token]; +} + +@synthesize token; +@end diff --git a/test/RelaxParser.h b/test/RelaxParser.h new file mode 100644 index 0000000..723f66a --- /dev/null +++ b/test/RelaxParser.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface RelaxParser : PKSequence { + PKTokenizer *tokenizer; +} + +@end diff --git a/test/RelaxParser.m b/test/RelaxParser.m new file mode 100644 index 0000000..4cc0b57 --- /dev/null +++ b/test/RelaxParser.m @@ -0,0 +1,624 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "RelaxParser.h" + +@implementation RelaxParser + +- (PKTokenizer *)tokenizer { + if (!tokenizer) { + self.tokenizer = [PKTokenizer tokenizer]; + [tokenizer.symbolState add:@"|="]; + [tokenizer.symbolState add:@"&="]; + } + return tokenizer; +} + +// topLevel ::= decl* (pattern | grammarContent*) +- (PKCollectionParser *)topLevelParser { + if (!topLevelParser) { + self.topLevelParser = [PKSequence sequence]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.declParser]; + [topLevelParser add:a]; + + a = [PKAlternation alternation]; + [a add:self.patternParser]; + [a add:[PKRepetition repetitionWithSubparser:self.grammarContentParser]]; + [topLevelParser add:a]; + } + return topLevelParser; +} + +// decl ::= "namespace" identifierOrKeyword "=" namespaceURILiteral +// | "default" "namespace" [identifierOrKeyword] "=" namespaceURILiteral +// | "datatypes" identifierOrKeyword "=" literal +- (PKCollectionParser *)declParser { + if (!declParser) { + self.declParser = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"namespace"]]; + [s add:self.identifierOrKeywordParser]; + [s add:[PKSymbol symbolWithString:@"="]]; + [a add:self.namespaceURILiteralParser]; + [declParser add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"default"]]; + [s add:[PKLiteral literalWithString:@"namespace"]]; + [s add:self.identifierOrKeywordParser]; + [s add:[PKSymbol symbolWithString:@"="]]; + [a add:self.namespaceURILiteralParser]; + [declParser add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"datatypes"]]; + [s add:self.identifierOrKeywordParser]; + [s add:[PKSymbol symbolWithString:@"="]]; + [a add:[PKQuotedString quotedString]]; + [declParser add:s]; + } + return declParser; +} + + +- (PKCollectionParser *)atLeastOneOf:(PKParser *)p { + PKSequence *s = [PKSequence sequence]; + [s add:p]; + [s add:[PKRepetition repetitionWithSubparser:p]]; + return s; +} + +// pattern ::= +// elementPattern +// | attributePattern +// | pattern commaPattern+ +// | pattern andPattern+ +// | pattern orPattern+ +// | patternQuestion +// | patternStar +// | patternPlus +// | listPattern +// | mixedPattern +// | identifier +// | parent +// | emptyKeyword +// | textKeyword +// | [datatypeName] datatypeValue +// | datatypeName ["{" param* "}"] [exceptPattern] +// | "notAllowed" +// | "external" anyURILiteral [inherit] +// | "grammar" "{" grammarContent* "}" +// | "(" pattern ")" +- (PKCollectionParser *)patternParser { + if (!patternParser) { + self.patternParser = [PKAlternation alternation]; + [patternParser add:self.elementPatternParser]; + [patternParser add:self.attributePatternParser]; + [patternParser add:[self atLeastOneOf:self.commaPatternParser]]; + [patternParser add:[self atLeastOneOf:self.andPatternParser]]; + [patternParser add:[self atLeastOneOf:self.orPatternParser]]; + [patternParser add:[self atLeastOneOf:self.patternQuestionParser]]; + [patternParser add:[self atLeastOneOf:self.patternStarParser]]; + [patternParser add:[self atLeastOneOf:self.patternPlusParser]]; + [patternParser add:self.listPatternParser]; + [patternParser add:self.mixedPatternParser]; + [patternParser add:self.identifierParser]; + [patternParser add:self.parentParser]; + [patternParser add:self.emptyKeywordParser]; + [patternParser add:self.textKeywordParser]; + + + + + s = [PKSequence sequence]; + [s add:patternParser]; + + } +} + +// elementPattern := "element" nameClass "{" pattern "}" +- (PKCollectionParser *)elementPatternParser { + if (!elementPatternParser) { + self.elementPatternParser = [PKSequence sequence]; + [elementPatternParser add:[PKLiteral literalWithString:@"element"]]; + [elementPatternParser add:self.nameClass]; + [elementPatternParser add:[PKSymbol symbolWithString:@"{"]]; + [elementPatternParser add:patternParser]; + [elementPatternParser add:[PKSymbol symbolWithString:@"}"]]; + } + return elementPatternParser; +} + + +// attributePattern := "attribute" nameClass "{" pattern "}" +- (PKCollectionParser *)attributePatternParser { + if (!attributePatternParser) { + attributePatternParser = [PKSequence sequence]; + [attributePatternParser add:[PKLiteral literalWithString:@"attribute"]]; + [attributePatternParser add:self.nameClass]; + [attributePatternParser add:[PKSymbol symbolWithString:@"{"]]; + [attributePatternParser add:patternParser]; + [attributePatternParser add:[PKSymbol symbolWithString:@"}"]]; + } + return attributePatternParser; +} + + +// commaPattern := "," pattern +- (PKCollectionParser *)commaPatternParser { + if (!commaPatternParser) { + self.commaPatternParser = [PKSequence sequence]; + [commaPatternParser add:[PKSymbol symbolWithString:@","]]; + [commaPatternParser add:self.patternParser]; + } + return commaPatternParser; +} + + +// andPattern := "&" pattern +- (PKCollectionParser *)andPatternParser { + if (!andPatternParser) { + self.andPatternParser = [PKSequence sequence]; + [andPatternParser add:[PKSymbol symbolWithString:@"&"]]; + [andPatternParser add:self.patternParser]; + } + return andPatternParser; +} + + +// orPattern := "|" pattern +- (PKCollectionParser *)orPatternParser { + if (!orPatternParser) { + self.orPatternParser = [PKSequence sequence]; + [orPatternParser add:[PKSymbol symbolWithString:@"|"]]; + [orPatternParser add:self.patternParser]; + } + return orPatternParser; +} + + +// patternQuestion := pattern "?" +- (PKCollectionParser *)patternQuestionParser { + if (!patternQuestionParser) { + self.patternQuestionParser = [PKSequence sequence]; + [patternQuestionParser add:self.patternParser]; + [patternQuestionParser add:[PKSymbol symbolWithString:@"?"]]; + } + return patternQuestionParser; +} + + +// patternQuestion := pattern "*" +- (PKCollectionParser *)patternStarParser { + if (!patternStarParser) { + self.patternStarParser = [PKSequence sequence]; + [patternStarParser add:self.patternParser]; + [patternStarParser add:[PKSymbol symbolWithString:@"*"]]; + } + return patternStarParser; +} + + +// patternQuestion := pattern "+" +- (PKCollectionParser *)patternPlusParser { + if (!patternPlusParser) { + self.patternPlusParser = [PKSequence sequence]; + [patternPlusParser add:self.patternParser]; + [patternPlusParser add:[PKSymbol symbolWithString:@"+"]]; + } + return patternPlusParser; +} + +// | "list" "{" pattern "}" +- (PKCollectionParser *)listPatternParser { + if (!listPatternParser) { + self.listPatternParser = [PKSequence sequence]; + [listPatternParser add:[PKLiteral literalWithString:@"list"]]; + [listPatternParser add:[PKSymbol symbolWithString:@"{"]]; + [listPatternParser add:patternParser]; + [listPatternParser add:[PKSymbol symbolWithString:@"}"]]; + } + return listPatternParser; +} + +// | "mixed" "{" pattern "}" +- (PKCollectionParser *)mixedPatternParser { + if (!mixedPatternParser) { + self.mixedPatternParser = [PKSequence sequence]; + [mixedPatternParser add:[PKLiteral literalWithString:@"mixed"]]; + [mixedPatternParser add:[PKSymbol symbolWithString:@"{"]]; + [mixedPatternParser add:patternParser]; + [mixedPatternParser add:[PKSymbol symbolWithString:@"}"]]; + } + return mixedPatternParser; +} + +// | "parent" identifier +- (PKCollectionParser *)parentParser { + if (!parentParser) { + self.parentParser = [PKSequence sequence]; + [parentParser add:[PKLiteral literalWithString:@"parent"]]; + [parentParser add:self.identifierParser]; + } + return parentParser; +} + + +// param ::= identifierOrKeyword "=" literal +- (PKCollectionParser *)paramParser { + if (!paramParser) { + self.paramParser = [PKSequence sequence]; + [paramParser add:self.identifierOrKeywordParser]; + [paramParser add:[PKSymbol symbolWithString:@"="]]; + [paramParser add:self.literalParser]; + } + return paramParser; +} + +// exceptPattern ::= "-" pattern +- (PKCollectionParser *)exceptPatternParser { + if (!exceptPattern) { + self.exceptPattern = [PKSequence sequence]; + [exceptPattern add:[PKSymbol symbolWithString:@"-"]]; + [exceptPattern add:self.patternParser]; + } + return exceptPattern; +} + + +// grammarContent ::= start | define | "element" "{" grammarContent* "}" | "include" anyURILiteral [inherit] ["{" includeContent* "}"] +// +// includeContent ::= define | start | elementIncludeContent +- (PKCollectionParser *)includeContentParser { + if (!includeContentParser) { + self.includeContentParser = [PKAlternation alternation]; + [includeContentParser add:self.defineParser]; + [includeContentParser add:self.startParser]; + [includeContentParser add:self.elementIncludeContentParser]; + } + return includeContentParser; +} + +// elementIncludeContent ::= "element" "{" includeContent* "}" +- (PKCollectionParser *)elementIncludeContentParser { + if (!elementIncludeContentParser) { + self.elementIncludeContentParser = [PKSequence sequence]; + [s add:self.elementKeywordParser]; + [s add:[PKSymbol symbolWithString:@"{"]]; + [s add:[PKRepetition repetitionWithSubparser:self.includeContentParser]] + [s add:[PKSymbol symbolWithString:@"}"]]; + + [elementIncludeContentParser add:s]; + } + return elementIncludeContentParser; +} + + +// +// start ::= "start" assignMethod pattern +- (PKCollectionParser *)startParser { + if (!startParser) { + self.startParser = [PKSequence sequence]; + [startParser add:self.startKeywordParser]; + [startParser add:self.assignMethodParser]; + [startParser add:self.patternParser]; + } + return startParser; +} + + +// +// define ::= identifier assignMethod pattern +- (PKCollectionParser *)defineParser { + if (!defineParser) { + self.defineParser = [PKSequence sequence]; + [defineParser add:self.identifierParser]; + [defineParser add:self.assignMethodParser]; + [defineParser add:self.patternParser]; + } + return defineParser; +} + + +// +// assignMethod ::= "=" | "|=" | "&=" +- (PKCollectionParser *)assignMethodParser { + if (!assignMethodParser) { + self.assignMethodParser = [PKAlternation alternation]; + [assignMethodParser add:[PKSymbol symbolWithString:@"="]]; + [assignMethodParser add:[PKSymbol symbolWithString:@"|="]]; + [assignMethodParser add:[PKSymbol symbolWithString:@"&="]]; + } + return assignMethodParser; +} + +// +// nameClass ::= name +// | nsName [exceptNameClass] +// | anyName [exceptNameClass] +// | nameClass "|" nameClass +// | "(" nameClass ")" +// +// name ::= identifierOrKeyword | CName +- (PKCollectionParser *)nameParser { + if (!nameParser) { + self.nameParser = [PKAlternation alternation]; + [nameParser add:self.identifierOrKeywordParser]; + [nameParser add:self.CNameParser]; + } + return nameParser; +} + +// +// exceptNameClass ::= "-" nameClass +- (PKCollectionParser *)exceptNameClassParser { + if (!exceptNameClassParser) { + self.exceptNameClassParser = [PKSequence sequence]; + [nameParser add:[PKSymbol symbolWithString:@"-"]]; + [nameParser add:self.nameClassParser]; + } + return nameParser; +} + +// +// datatypeName ::= CName | "string" | "token" +- (PKCollectionParser *)datatypeNameParser { + if (!datatypeNameParser) { + self.datatypeNameParser = [PKAlternation alternation]; + [datatypeNameParser add:self.CNameParser]; + [datatypeNameParser add:self.stringKeywordParser]; + [datatypeNameParser add:self.tokenKeywordParser]; + } + return datatypeNameParser; +} + + +// +// datatypeValue ::= literal +- (PKCollectionParser *)datatypeValueParser { + if (!datatypeValueParser) { + self.datatypeValueParser = self.literalParser; + } + return datatypeValueParser; +} + + +// +// anyURILiteral ::= literal +- (PKCollectionParser *)anyURILiteralParser { + if (!anyURILiteralParser) { + self.anyURILiteralParser = self.literalParser; + } + return anyURILiteralParser; +} + + +// +// namespaceURILiteral ::= literal | "inherit" +// +// inherit ::= "inherit" "=" identifierOrKeyword +// +// identifierOrKeyword ::= identifier | keyword +// +// identifier ::= (NCName - keyword) | quotedIdentifier +// +// quotedIdentifier ::= "\" NCName +// +// CName ::= NCName ":" NCName +// +// nsName ::= NCName ":*" +// +// anyName ::= "*" +// +// literal ::= literalSegment ("~" literalSegment)+ +// +// literalSegment ::= '"' (Char - ('"' | newline))* '"' +// | "'" (Char - ("'" | newline))* "'" +// | '"""' (['"'] ['"'] (Char - '"'))* '"""' +// | "'''" (["'"] ["'"] (Char - "'"))* "'''" + + +// keyword ::= "attribute" +// | "default" +// | "datatypes" +// | "element" +// | "empty" +// | "external" +// | "grammar" +// | "include" +// | "inherit" +// | "list" +// | "mixed" +// | "namespace" +// | "notAllowed" +// | "parent" +// | "start" +// | "string" +// | "text" +// | "token" +// +- (PKParser *)keywordParser { + if (!keywordParser) { + self.keywordParser = [PKAlternation alternation]; + [keywordParser add:self.attributeKeywordParser]; + [keywordParser add:self.defaultKeywordParser]; + [keywordParser add:self.datatypesKeywordParser]; + [keywordParser add:self.elementKeywordParser]; + [keywordParser add:self.emptyKeywordParser]; + [keywordParser add:self.externalKeywordParser]; + [keywordParser add:self.grammarKeywordParser]; + [keywordParser add:self.includeKeywordParser]; + [keywordParser add:self.inheritKeywordParser]; + [keywordParser add:self.listKeywordParser]; + [keywordParser add:self.mixedKeywordParser]; + [keywordParser add:self.namespaceKeywordParser]; + [keywordParser add:self.notAllowedKeywordParser]; + [keywordParser add:self.parentKeywordParser]; + [keywordParser add:self.startKeywordParser]; + [keywordParser add:self.stringKeywordParser]; + [keywordParser add:self.textParser]; + [keywordParser add:self.tokenKeywordParser]; + } + return keywordParser; +} + + +- (PKParser *)attributeKeywordParser { + if (!attributeKeywordParser) { + self.attributeKeywordParser = [PKLiteral literalWithString:@"attribute"]; + } + return attributeKeywordParser; +} + + +- (PKParser *)defaultKeywordParser { + if (!defaultKeywordParser) { + self.defaultKeywordParser = [PKLiteral literalWithString:@"default"]; + } + return defaultKeywordParser; +} + + +- (PKParser *)datatypesKeywordParser { + if (!datatypesKeywordParser) { + self.datatypesKeywordParser = [PKLiteral literalWithString:@"datatypes"]; + } + return datatypesKeywordParser; +} + + +- (PKParser *)elementKeywordParser { + if (!elementKeywordParser) { + self.elementKeywordParser = [PKLiteral literalWithString:@"element"]; + } + return elementKeywordParser; +} + + +- (PKParser *)emptyKeywordParser { + if (!emptyKeywordParser) { + self.emptyKeywordParser = [PKLiteral literalWithString:@"empty"]; + } + return emptyKeywordParser; +} + + +- (PKParser *)externalKeywordParser { + if (!externalKeywordParser) { + self.externalKeywordParser = [PKLiteral literalWithString:@"external"]; + } + return externalKeywordParser; +} + + +- (PKParser *)grammarKeywordParser { + if (!grammarKeywordParser) { + self.grammarKeywordParser = [PKLiteral literalWithString:@"grammar"]; + } + return grammarKeywordParser; +} + + +- (PKParser *)includeKeywordParser { + if (!includeKeywordParser) { + self.includeKeywordParser = [PKLiteral literalWithString:@"include"]; + } + return includeKeywordParser; +} + + +- (PKParser *)inheritKeywordParser { + if (!inheritKeywordParser) { + self.inheritKeywordParser = [PKLiteral literalWithString:@"inherit"]; + } + return inheritKeywordParser; +} + + +- (PKParser *)listKeywordParser { + if (!listKeywordParser) { + self.listKeywordParser = [PKLiteral literalWithString:@"list"]; + } + return listKeywordParser; +} + + +- (PKParser *)mixedKeywordParser { + if (!mixedKeywordParser) { + self.mixedKeywordParser = [PKLiteral literalWithString:@"mixed"]; + } + return mixedKeywordParser; +} + + +- (PKParser *)namespaceKeywordParser { + if (!namespaceKeywordParser) { + self.namespaceKeywordParser = [PKLiteral literalWithString:@"namespace"]; + } + return namespaceKeywordParser; +} + + +- (PKParser *)notAllowedKeywordParser { + if (!notAllowedKeywordParser) { + self.notAllowedKeywordParser = [PKLiteral literalWithString:@"notAllowed"]; + } + return notAllowedKeywordParser; +} + + +- (PKParser *)parentKeywordParser { + if (!parentKeywordParser) { + self.parentKeywordParser = [PKLiteral literalWithString:@"parent"]; + } + return parentKeywordParser; +} + + +- (PKParser *)startKeywordParser { + if (!startKeywordParser) { + self.startKeywordParser = [PKLiteral literalWithString:@"start"]; + } + return startKeywordParser; +} + + +- (PKParser *)stringKeywordParser { + if (!stringKeywordParser) { + self.stringKeywordParser = [PKLiteral literalWithString:@"string"]; + } + return stringKeywordParser; +} + + +- (PKParser *)textKeywordParser { + if (!textKeywordParser) { + self.textKeywordParser = [PKLiteral literalWithString:@"text"]; + } + return textKeywordParser; +} + + +- (PKParser *)tokenKeywordParser { + if (!tokenKeywordParser) { + self.tokenKeywordParser = [PKLiteral literalWithString:@"token"]; + } + return tokenKeywordParser; +} + +@end diff --git a/test/SAXAssembler.h b/test/SAXAssembler.h new file mode 100644 index 0000000..b3f185a --- /dev/null +++ b/test/SAXAssembler.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface SAXAssembler : NSObject { + +} + +@end diff --git a/test/SAXAssembler.m b/test/SAXAssembler.m new file mode 100644 index 0000000..3d24354 --- /dev/null +++ b/test/SAXAssembler.m @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "SAXAssembler.h" +#import + +@implementation SAXAssembler + +- (void)didMatchSTag:(PKAssembly *)a { + +} + +@end diff --git a/test/SAXTest.h b/test/SAXTest.h new file mode 100644 index 0000000..a27b07a --- /dev/null +++ b/test/SAXTest.h @@ -0,0 +1,27 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface SAXTest : SenTestCase { + NSString *s; + NSString *g; + PKParserFactory *factory; + PKTokenAssembly *a; + PKAssembly *res; + PKParser *p; + PKTokenizer *t; +} + +@end diff --git a/test/SAXTest.m b/test/SAXTest.m new file mode 100644 index 0000000..58c20a8 --- /dev/null +++ b/test/SAXTest.m @@ -0,0 +1,33 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "SAXTest.h" + +@implementation SAXTest + +- (void)setUp { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"xml" ofType:@"grammar"]; + g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + factory = [PKParserFactory factory]; + p = [factory parserFromGrammar:g assembler:self]; + t = p.tokenizer; +} + + +- (void)testSTag { + //PKParser *sTag = [p parserNamed:@"sTag"]; + +} + +@end diff --git a/test/SRGSParser.h b/test/SRGSParser.h new file mode 100644 index 0000000..9770e0e --- /dev/null +++ b/test/SRGSParser.h @@ -0,0 +1,94 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface SRGSParser : PKSequence { + PKCollectionParser *selfIdentHeader; + PKCollectionParser *ruleName; + PKCollectionParser *tagFormat; + PKCollectionParser *lexiconURI; + PKCollectionParser *weight; + PKCollectionParser *repeat; + PKCollectionParser *probability; + PKCollectionParser *externalRuleRef; + PKCollectionParser *token; + PKCollectionParser *languageAttachment; + PKCollectionParser *tag; + PKCollectionParser *grammar; + PKCollectionParser *declaration; + PKCollectionParser *baseDecl; + PKCollectionParser *languageDecl; + PKCollectionParser *modeDecl; + PKCollectionParser *rootRuleDecl; + PKCollectionParser *tagFormatDecl; + PKCollectionParser *lexiconDecl; + PKCollectionParser *metaDecl; + PKCollectionParser *tagDecl; + PKCollectionParser *ruleDefinition; + PKCollectionParser *scope; + PKCollectionParser *ruleExpansion; + PKCollectionParser *ruleAlternative; + PKCollectionParser *sequenceElement; + PKCollectionParser *subexpansion; + PKCollectionParser *ruleRef; + PKCollectionParser *localRuleRef; + PKCollectionParser *specialRuleRef; + PKCollectionParser *repeatOperator; + + PKCollectionParser *baseURI; + PKCollectionParser *languageCode; + PKCollectionParser *ABNF_URI; + PKCollectionParser *ABNF_URI_with_Media_Type; +} +- (id)parse:(NSString *)s; +- (PKAssembly *)assemblyWithString:(NSString *)s; + +@property (nonatomic, retain) PKCollectionParser *selfIdentHeader; +@property (nonatomic, retain) PKCollectionParser *ruleName; +@property (nonatomic, retain) PKCollectionParser *tagFormat; +@property (nonatomic, retain) PKCollectionParser *lexiconURI; +@property (nonatomic, retain) PKCollectionParser *weight; +@property (nonatomic, retain) PKCollectionParser *repeat; +@property (nonatomic, retain) PKCollectionParser *probability; +@property (nonatomic, retain) PKCollectionParser *externalRuleRef; +@property (nonatomic, retain) PKCollectionParser *token; +@property (nonatomic, retain) PKCollectionParser *languageAttachment; +@property (nonatomic, retain) PKCollectionParser *tag; +@property (nonatomic, retain) PKCollectionParser *grammar; +@property (nonatomic, retain) PKCollectionParser *declaration; +@property (nonatomic, retain) PKCollectionParser *baseDecl; +@property (nonatomic, retain) PKCollectionParser *languageDecl; +@property (nonatomic, retain) PKCollectionParser *modeDecl; +@property (nonatomic, retain) PKCollectionParser *rootRuleDecl; +@property (nonatomic, retain) PKCollectionParser *tagFormatDecl; +@property (nonatomic, retain) PKCollectionParser *lexiconDecl; +@property (nonatomic, retain) PKCollectionParser *metaDecl; +@property (nonatomic, retain) PKCollectionParser *tagDecl; +@property (nonatomic, retain) PKCollectionParser *ruleDefinition; +@property (nonatomic, retain) PKCollectionParser *scope; +@property (nonatomic, retain) PKCollectionParser *ruleExpansion; +@property (nonatomic, retain) PKCollectionParser *ruleAlternative; +@property (nonatomic, retain) PKCollectionParser *sequenceElement; +@property (nonatomic, retain) PKCollectionParser *subexpansion; +@property (nonatomic, retain) PKCollectionParser *ruleRef; +@property (nonatomic, retain) PKCollectionParser *localRuleRef; +@property (nonatomic, retain) PKCollectionParser *specialRuleRef; +@property (nonatomic, retain) PKCollectionParser *repeatOperator; + +@property (nonatomic, retain) PKCollectionParser *baseURI; +@property (nonatomic, retain) PKCollectionParser *languageCode; +@property (nonatomic, retain) PKCollectionParser *ABNF_URI; +@property (nonatomic, retain) PKCollectionParser *ABNF_URI_with_Media_Type; +@end diff --git a/test/SRGSParser.m b/test/SRGSParser.m new file mode 100644 index 0000000..0e36d23 --- /dev/null +++ b/test/SRGSParser.m @@ -0,0 +1,792 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "SRGSParser.h" +#import "NSString+ParseKitAdditions.h" + +@interface SRGSParser () +- (void)didMatchWord:(PKAssembly *)a; +- (void)didMatchNum:(PKAssembly *)a; +- (void)didMatchQuotedString:(PKAssembly *)a; +- (void)didMatchStar:(PKAssembly *)a; +- (void)didMatchQuestion:(PKAssembly *)a; +- (void)didMatchAnd:(PKAssembly *)a; +- (void)didMatchOr:(PKAssembly *)a; +- (void)didMatchAssignment:(PKAssembly *)a; +- (void)didMatchVariable:(PKAssembly *)a; +@end + +@implementation SRGSParser + +- (id)init { + if (self = [super init]) { + [self add:self.grammar]; + } + return self; +} + + +- (void)dealloc { + self.selfIdentHeader = nil; + self.ruleName = nil; + self.tagFormat = nil; + self.lexiconURI = nil; + self.weight = nil; + self.repeat = nil; + self.probability = nil; + self.externalRuleRef = nil; + self.token = nil; + self.languageAttachment = nil; + self.tag = nil; + self.grammar = nil; + self.declaration = nil; + self.baseDecl = nil; + self.languageDecl = nil; + self.modeDecl = nil; + self.rootRuleDecl = nil; + self.tagFormatDecl = nil; + self.lexiconDecl = nil; + self.metaDecl = nil; + self.tagDecl = nil; + self.ruleDefinition = nil; + self.scope = nil; + self.ruleExpansion = nil; + self.ruleAlternative = nil; + self.sequenceElement = nil; + self.subexpansion = nil; + self.ruleRef = nil; + self.localRuleRef = nil; + self.specialRuleRef = nil; + self.repeatOperator = nil; + + self.baseURI = nil; + self.languageCode = nil; + self.ABNF_URI = nil; + self.ABNF_URI_with_Media_Type = nil; + [super dealloc]; +} + + +- (id)parse:(NSString *)s { + PKAssembly *a = [self assemblyWithString:s]; + a = [self completeMatchFor:a]; + return [a pop]; +} + + +- (PKAssembly *)assemblyWithString:(NSString *)s { + PKTokenizer *t = [[[PKTokenizer alloc] initWithString:s] autorelease]; + [t setTokenizerState:t.symbolState from: '-' to: '-']; + [t setTokenizerState:t.symbolState from: '.' to: '.']; + //[t.wordState setWordChars:YES from:'-' to:'-']; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:t]; + // TDNCNameState *NCNameState = [[[TDNCNameState alloc] init] autorelease]; + return a; +} + + +//selfIdentHeader ::= '#ABNF' #x20 VersionNumber (#x20 CharEncoding)? ';' +//VersionNumber ::= '1.0' +//CharEncoding ::= Nmtoken +- (PKCollectionParser *)selfIdentHeader { + if (!selfIdentHeader) { + self.selfIdentHeader = [PKSequence sequence]; + selfIdentHeader.name = @"selfIdentHeader"; + + [selfIdentHeader add:[PKSymbol symbolWithString:@"#"]]; + [selfIdentHeader add:[PKLiteral literalWithString:@"ABNF"]]; + [selfIdentHeader add:[PKNumber number]]; // VersionNumber + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:[PKWord word]]; // CharEncoding + + [selfIdentHeader add:a]; + [selfIdentHeader add:[PKSymbol symbolWithString:@";"]]; + } + return selfIdentHeader; +} + + +//RuleName ::= '$' ConstrainedName +//ConstrainedName ::= Name - (Char* ('.' | ':' | '-') Char*) +- (PKCollectionParser *)ruleName { + if (!ruleName) { + self.ruleName = [PKSequence sequence]; + [ruleName add:[PKSymbol symbolWithString:@"$"]]; + [ruleName add:[PKWord word]]; // TODO: ConstrainedName + } + return ruleName; +} + +//TagFormat ::= ABNF_URI +- (PKCollectionParser *)tagFormat { + if (!tagFormat) { + self.tagFormat = self.ABNF_URI; + } + return tagFormat; +} + + +//LexiconURI ::= ABNF_URI | ABNF_URI_with_Media_Type +- (PKCollectionParser *)lexiconURI { + if (!lexiconURI) { + self.lexiconURI = [PKAlternation alternation]; + [lexiconURI add:self.ABNF_URI]; + [lexiconURI add:self.ABNF_URI_with_Media_Type]; + } + return lexiconURI; +} + + +//Weight ::= '/' Number '/' +- (PKCollectionParser *)weight { + if (!weight) { + self.weight = [PKSequence sequence]; + [weight add:[PKSymbol symbolWithString:@"/"]]; + [weight add:[PKNumber number]]; + [weight add:[PKSymbol symbolWithString:@"/"]]; + } + return weight; +} + + +//Repeat ::= [0-9]+ ('-' [0-9]*)? +- (PKCollectionParser *)repeat { + if (!repeat) { + self.repeat = [PKSequence sequence]; + [repeat add:[PKNumber number]]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"-"]]; + [s add:[PKNumber number]]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:s]; + + [repeat add:a]; + } + return repeat; +} + + +//Probability ::= '/' Number '/' +- (PKCollectionParser *)probability { + if (!probability) { + self.probability = [PKSequence sequence]; + [probability add:[PKSymbol symbolWithString:@"/"]]; + [probability add:[PKNumber number]]; + [probability add:[PKSymbol symbolWithString:@"/"]]; + } + return probability; +} + + + +//ExternalRuleRef ::= '$' ABNF_URI | '$' ABNF_URI_with_Media_Type +- (PKCollectionParser *)externalRuleRef { + if (!externalRuleRef) { + self.externalRuleRef = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"$"]]; + [s add:self.ABNF_URI]; + [externalRuleRef add:s]; + + s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"$"]]; + [s add:self.ABNF_URI_with_Media_Type]; + [externalRuleRef add:s]; + } + return externalRuleRef; +} + + +//Token ::= Nmtoken | DoubleQuotedCharacters +- (PKCollectionParser *)token { + if (!token) { + self.token = [PKAlternation alternation]; + [token add:[PKWord word]]; + [token add:[PKQuotedString quotedString]]; + } + return token; +} + + +//LanguageAttachment ::= '!' LanguageCode +- (PKCollectionParser *)languageAttachment { + if (!languageAttachment) { + self.languageAttachment = [PKSequence sequence]; + [languageAttachment add:[PKSymbol symbolWithString:@"!"]]; + [languageAttachment add:self.languageCode]; + } + return languageAttachment; +} + + +//Tag ::= '{' [^}]* '}' | '{!{' (Char* - (Char* '}!}' Char*)) '}!}' +- (PKCollectionParser *)tag { + if (!tag) { + self.tag = [PKAlternation alternation]; + + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"{"]]; + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKWord word]]; + [a add:[PKNumber number]]; + [a add:[PKSymbol symbol]]; + [a add:[PKQuotedString quotedString]]; + [s add:[PKRepetition repetitionWithSubparser:a]]; + [s add:[PKSymbol symbolWithString:@"}"]]; + [tag add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"{!{"]]; + a = [PKAlternation alternation]; + [a add:[PKWord word]]; + [a add:[PKNumber number]]; + [a add:[PKSymbol symbol]]; + [a add:[PKQuotedString quotedString]]; + [s add:[PKRepetition repetitionWithSubparser:a]]; + [s add:[PKLiteral literalWithString:@"}!}"]]; + [tag add:s]; + } + return tag; +} + + +#pragma mark - +#pragma mark Grammar + +// grammar ::= selfIdentHeader declaration* ruleDefinition* +- (PKCollectionParser *)grammar { + if (!grammar) { + self.grammar = [PKSequence sequence]; + [grammar add:self.selfIdentHeader]; + [grammar add:[PKRepetition repetitionWithSubparser:self.declaration]]; + [grammar add:[PKRepetition repetitionWithSubparser:self.ruleDefinition]]; + } + return grammar; +} + +// declaration ::= baseDecl | languageDecl | modeDecl | rootRuleDecl | tagFormatDecl | lexiconDecl | metaDecl | tagDecl +- (PKCollectionParser *)declaration { + if (!declaration) { + self.declaration = [PKAlternation alternation]; + [declaration add:self.baseDecl]; + [declaration add:self.languageDecl]; + [declaration add:self.modeDecl]; + [declaration add:self.rootRuleDecl]; + [declaration add:self.tagFormatDecl]; + [declaration add:self.lexiconDecl]; + [declaration add:self.tagDecl]; + } + return declaration; +} + +// baseDecl ::= 'base' BaseURI ';' +- (PKCollectionParser *)baseDecl { + if (!baseDecl) { + self.baseDecl = [PKSequence sequence]; + [baseDecl add:[PKLiteral literalWithString:@"base"]]; + [baseDecl add:self.baseURI]; + [baseDecl add:[PKSymbol symbolWithString:@";"]]; + } + return baseDecl; +} + +// languageDecl ::= 'language' LanguageCode ';' +- (PKCollectionParser *)languageDecl { + if (!languageDecl) { + self.languageDecl = [PKSequence sequence]; + [languageDecl add:[PKLiteral literalWithString:@"language"]]; + [languageDecl add:self.languageCode]; + [languageDecl add:[PKSymbol symbolWithString:@";"]]; + } + return languageDecl; +} + + + +// modeDecl ::= 'mode' 'voice' ';' | 'mode' 'dtmf' ';' +- (PKCollectionParser *)modeDecl { + if (!modeDecl) { + self.modeDecl = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"mode"]]; + [s add:[PKLiteral literalWithString:@"voice"]]; + [s add:[PKSymbol symbolWithString:@";"]]; + [modeDecl add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"mode"]]; + [s add:[PKLiteral literalWithString:@"dtmf"]]; + [s add:[PKSymbol symbolWithString:@";"]]; + [modeDecl add:s]; + } + return modeDecl; +} + + +// rootRuleDecl ::= 'root' RuleName ';' +- (PKCollectionParser *)rootRuleDecl { + if (!rootRuleDecl) { + self.rootRuleDecl = [PKSequence sequence]; + [rootRuleDecl add:[PKLiteral literalWithString:@"root"]]; + [rootRuleDecl add:self.ruleName]; + [rootRuleDecl add:[PKSymbol symbolWithString:@";"]]; + } + return rootRuleDecl; +} + + +// tagFormatDecl ::= 'tag-format' TagFormat ';' +- (PKCollectionParser *)tagFormatDecl { + if (!tagFormatDecl) { + self.tagFormatDecl = [PKSequence sequence]; + [tagFormatDecl add:[PKLiteral literalWithString:@"tag-format"]]; + [tagFormatDecl add:self.tagFormat]; + [tagFormatDecl add:[PKSymbol symbolWithString:@";"]]; + } + return tagFormatDecl; +} + + + +// lexiconDecl ::= 'lexicon' LexiconURI ';' +- (PKCollectionParser *)lexiconDecl { + if (!lexiconDecl) { + self.lexiconDecl = [PKSequence sequence]; + [lexiconDecl add:[PKLiteral literalWithString:@"lexicon"]]; + [lexiconDecl add:self.lexiconURI]; + [lexiconDecl add:[PKSymbol symbolWithString:@";"]]; + } + return lexiconDecl; +} + + +// metaDecl ::= +// 'http-equiv' QuotedCharacters 'is' QuotedCharacters ';' +// | 'meta' QuotedCharacters 'is' QuotedCharacters ';' +- (PKCollectionParser *)metaDecl { + if (!metaDecl) { + self.metaDecl = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"http-equiv"]]; + [s add:[PKQuotedString quotedString]]; + [s add:[PKLiteral literalWithString:@"is"]]; + [s add:[PKQuotedString quotedString]]; + [s add:[PKSymbol symbolWithString:@";"]]; + [metaDecl add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"meta"]]; + [s add:[PKQuotedString quotedString]]; + [s add:[PKLiteral literalWithString:@"is"]]; + [s add:[PKQuotedString quotedString]]; + [s add:[PKSymbol symbolWithString:@";"]]; + [metaDecl add:s]; + } + return metaDecl; +} + + + +// tagDecl ::= Tag ';' +- (PKCollectionParser *)tagDecl { + if (!tagDecl) { + self.tagDecl = [PKSequence sequence]; + [tagDecl add:self.tag]; + [tagDecl add:[PKSymbol symbolWithString:@";"]]; + } + return tagDecl; +} + + +// ruleDefinition ::= scope? RuleName '=' ruleExpansion ';' +- (PKCollectionParser *)ruleDefinition { + if (!ruleDefinition) { + self.ruleDefinition = [PKSequence sequence]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.scope]; + + [ruleDefinition add:a]; + [ruleDefinition add:self.ruleName]; + [ruleDefinition add:[PKSymbol symbolWithString:@"="]]; + [ruleDefinition add:self.ruleExpansion]; + [ruleDefinition add:[PKSymbol symbolWithString:@";"]]; + } + return ruleDefinition; +} + +// scope ::= 'private' | 'public' +- (PKCollectionParser *)scope { + if (!scope) { + self.scope = [PKAlternation alternation]; + [scope add:[PKLiteral literalWithString:@"private"]]; + [scope add:[PKLiteral literalWithString:@"public"]]; + } + return scope; +} + + +// ruleExpansion ::= ruleAlternative ( '|' ruleAlternative )* +- (PKCollectionParser *)ruleExpansion { + if (!ruleExpansion) { + self.ruleExpansion = [PKSequence sequence]; + [ruleExpansion add:self.ruleAlternative]; + + PKSequence *pipeRuleAlternative = [PKSequence sequence]; + [pipeRuleAlternative add:[PKSymbol symbolWithString:@"|"]]; + [pipeRuleAlternative add:self.ruleAlternative]; + [ruleExpansion add:[PKRepetition repetitionWithSubparser:pipeRuleAlternative]]; + } + return ruleExpansion; +} + + +// ruleAlternative ::= Weight? sequenceElement+ +- (PKCollectionParser *)ruleAlternative { + if (!ruleAlternative) { + self.ruleAlternative = [PKSequence sequence]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.weight]; + + [ruleAlternative add:a]; + [ruleAlternative add:self.sequenceElement]; + [ruleAlternative add:[PKRepetition repetitionWithSubparser:self.sequenceElement]]; + } + return ruleAlternative; +} + +// sequenceElement ::= subexpansion | subexpansion repeatOperator + +// me: changing to: +// sequenceElement ::= subexpansion repeatOperator? +- (PKCollectionParser *)sequenceElement { + if (!sequenceElement) { +// self.sequenceElement = [PKAlternation alternation]; +// [sequenceElement add:self.subexpansion]; +// +// PKSequence *s = [PKSequence sequence]; +// [s add:self.subexpansion]; +// [s add:self.repeatOperator]; +// +// [sequenceElement add:s]; + + self.sequenceElement = [PKSequence sequence]; + [sequenceElement add:self.subexpansion]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.repeatOperator]; + + [sequenceElement add:a]; + } + return sequenceElement; +} + +// subexpansion ::= +// Token LanguageAttachment? +// | ruleRef +// | Tag +// | '(' ')' +// | '(' ruleExpansion ')' LanguageAttachment? +// | '[' ruleExpansion ']' LanguageAttachment? +- (PKCollectionParser *)subexpansion { + if (!subexpansion) { + self.subexpansion = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:self.token]; + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.languageAttachment]; + [s add:a]; + [subexpansion add:s]; + + [subexpansion add:self.ruleRef]; + [subexpansion add:self.tag]; + + s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:[PKSymbol symbolWithString:@")"]]; + [subexpansion add:s]; + + s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:self.ruleExpansion]; + [s add:[PKSymbol symbolWithString:@")"]]; + a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.languageAttachment]; + [s add:a]; + [subexpansion add:s]; + + s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"["]]; + [s add:self.ruleExpansion]; + [s add:[PKSymbol symbolWithString:@"]"]]; + a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.languageAttachment]; + [s add:a]; + [subexpansion add:s]; + } + return subexpansion; +} + + +// ruleRef ::= localRuleRef | ExternalRuleRef | specialRuleRef +- (PKCollectionParser *)ruleRef { + if (!ruleRef) { + self.ruleRef = [PKAlternation alternation]; + [ruleRef add:self.localRuleRef]; + [ruleRef add:self.externalRuleRef]; + [ruleRef add:self.specialRuleRef]; + } + return ruleRef; +} + +// localRuleRef ::= RuleName +- (PKCollectionParser *)localRuleRef { + if (!localRuleRef) { + self.localRuleRef = self.ruleName; + } + return localRuleRef; +} + + +// specialRuleRef ::= '$NULL' | '$VOID' | '$GARBAGE' +- (PKCollectionParser *)specialRuleRef { + if (!specialRuleRef) { + self.specialRuleRef = [PKAlternation alternation]; + [specialRuleRef add:[PKLiteral literalWithString:@"$NULL"]]; + [specialRuleRef add:[PKLiteral literalWithString:@"$VOID"]]; + [specialRuleRef add:[PKLiteral literalWithString:@"$GARBAGE"]]; + } + return specialRuleRef; +} + + +// repeatOperator ::='<' Repeat Probability? '>' +- (PKCollectionParser *)repeatOperator { + if (!repeatOperator) { + self.repeatOperator = [PKSequence sequence]; + [repeatOperator add:[PKSymbol symbolWithString:@"<"]]; + [repeatOperator add:self.repeat]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.probability]; + [repeatOperator add:a]; + + [repeatOperator add:[PKSymbol symbolWithString:@">"]]; + } + return repeatOperator; +} + + +//BaseURI ::= ABNF_URI +- (PKCollectionParser *)baseURI { + if (!baseURI) { + self.baseURI = [PKWord word]; + } + return baseURI; +} + + +//LanguageCode ::= Nmtoken +- (PKCollectionParser *)languageCode { + if (!languageCode) { + self.languageCode = [PKSequence sequence]; + [languageCode add:[PKWord word]]; +// [languageCode add:[PKSymbol symbolWithString:@"-"]]; +// [languageCode add:[PKWord word]]; + } + return languageCode; +} + + +- (PKCollectionParser *)ABNF_URI { + if (!ABNF_URI) { + self.ABNF_URI = [PKWord word]; + } + return ABNF_URI; +} + + +- (PKCollectionParser *)ABNF_URI_with_Media_Type { + if (!ABNF_URI_with_Media_Type) { + self.ABNF_URI_with_Media_Type = [PKWord word]; + } + return ABNF_URI_with_Media_Type; +} + + + +#pragma mark - +#pragma mark Assembler Methods + +- (void)didMatchWord:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + [a push:[PKLiteral literalWithString:tok.stringValue]]; +} + + +- (void)didMatchNum:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + [a push:[PKLiteral literalWithString:tok.stringValue]]; +} + + +- (void)didMatchQuotedString:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKToken *tok = [a pop]; + NSString *s = [tok.stringValue stringByTrimmingQuotes]; + + PKSequence *p = [PKSequence sequence]; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKToken *eof = [PKToken EOFToken]; + while (eof != (tok = [t nextToken])) { + [p add:[PKLiteral literalWithString:tok.stringValue]]; + } + + [a push:p]; +} + + +- (void)didMatchStar:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKRepetition *p = [PKRepetition repetitionWithSubparser:[a pop]]; + [a push:p]; +} + + +- (void)didMatchQuestion:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKAlternation *p = [PKAlternation alternation]; + [p add:[a pop]]; + [p add:[PKEmpty empty]]; + [a push:p]; +} + + +- (void)didMatchAnd:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + id top = [a pop]; + PKSequence *p = [PKSequence sequence]; + [p add:[a pop]]; + [p add:top]; + [a push:p]; +} + + +- (void)didMatchOr:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + id top = [a pop]; +// NSLog(@"top: %@", top); +// NSLog(@"top class: %@", [top class]); + PKAlternation *p = [PKAlternation alternation]; + [p add:[a pop]]; + [p add:top]; + [a push:p]; +} + + +- (void)didMatchAssignment:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + id val = [a pop]; + PKToken *keyTok = [a pop]; + + NSMutableDictionary *table = [NSMutableDictionary dictionaryWithDictionary:a.target]; + [table setObject:val forKey:keyTok.stringValue]; + a.target = table; +} + + +- (void)didMatchVariable:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + PKToken *keyTok = [a pop]; + id val = [a.target objectForKey:keyTok.stringValue]; + +// PKParser *p = nil; +// if (valTok.isWord) { +// p = [PKWord wordWithString:valTok.value]; +// } else if (valTok.isQuotedString) { +// p = [PKQuotedString quotedStringWithString:valTok.value]; +// } else if (valTok.isNumber) { +// p = [PKNum numWithString:valTok.stringValue]; +// } + + [a push:val]; +} + +@synthesize selfIdentHeader; +@synthesize ruleName; +@synthesize tagFormat; +@synthesize lexiconURI; +@synthesize weight; +@synthesize repeat; +@synthesize probability; +@synthesize externalRuleRef; +@synthesize token; +@synthesize languageAttachment; +@synthesize tag; +@synthesize grammar; +@synthesize declaration; +@synthesize baseDecl; +@synthesize languageDecl; +@synthesize modeDecl; +@synthesize rootRuleDecl; +@synthesize tagFormatDecl; +@synthesize lexiconDecl; +@synthesize metaDecl; +@synthesize tagDecl; +@synthesize ruleDefinition; +@synthesize scope; +@synthesize ruleExpansion; +@synthesize ruleAlternative; +@synthesize sequenceElement; +@synthesize subexpansion; +@synthesize ruleRef; +@synthesize localRuleRef; +@synthesize specialRuleRef; +@synthesize repeatOperator; + +@synthesize baseURI; +@synthesize languageCode; +@synthesize ABNF_URI; +@synthesize ABNF_URI_with_Media_Type; +@end \ No newline at end of file diff --git a/test/SRGSParserTest.h b/test/SRGSParserTest.h new file mode 100644 index 0000000..3908fb3 --- /dev/null +++ b/test/SRGSParserTest.h @@ -0,0 +1,26 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +#import "SRGSParser.h" + +@interface SRGSParserTest : SenTestCase { + NSString *s; + SRGSParser *p; + PKAssembly *a; + PKAssembly *result; +} + +@end diff --git a/test/SRGSParserTest.m b/test/SRGSParserTest.m new file mode 100644 index 0000000..482ab06 --- /dev/null +++ b/test/SRGSParserTest.m @@ -0,0 +1,202 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "SRGSParserTest.h" + +@implementation SRGSParserTest + +- (void)setUp { + p = [[[SRGSParser alloc] init] autorelease]; +} + + +- (void)test { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"example1" ofType:@"srgs"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDNotNil(result); + NSLog(@"\n\n\n result: %@ \n\n\n", result); +// TDEqualObjects(@"[#, ABNF, 1.0, ;]#/ABNF/1.0/;^", [result description]); +} + +- (void)testSelfIdentHeader { + s = @"#ABNF 1.0;"; + a = [p assemblyWithString:s]; + result = [p.selfIdentHeader bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[#, ABNF, 1.0, ;]#/ABNF/1.0/;^", [result description]); + + s = @"#ABNF 1.0 UTF;"; + a = [p assemblyWithString:s]; + result = [p.selfIdentHeader bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[#, ABNF, 1.0, UTF, ;]#/ABNF/1.0/UTF/;^", [result description]); +} + + +- (void)testRuleName { + s = @"$foobar"; + a = [p assemblyWithString:s]; + result = [p.ruleName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[$, foobar]$/foobar^", [result description]); +} + + +- (void)testWeight { + s = @"/4.0/"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [p.weight bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[/, 4.0, /]//4.0//^", [result description]); +} + + +- (void)testProbability { + s = @"/4.0/"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [p.probability bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[/, 4.0, /]//4.0//^", [result description]); +} + + +- (void)testRepeat { + s = @"1 - 4"; + a = [p assemblyWithString:s]; + result = [p.repeat bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[1, -, 4]1/-/4^", [result description]); + + s = @"1-4"; + a = [p assemblyWithString:s]; + result = [p.repeat bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[1, -, 4]1/-/4^", [result description]); +} + + +- (void)testToken { + s = @"foobar"; + a = [p assemblyWithString:s]; + result = [p.token bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foobar]foobar^", [result description]); + + s = @"'foobar'"; + a = [p assemblyWithString:s]; + result = [p.token bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"['foobar']'foobar'^", [result description]); +} + + +- (void)testTag { + s = @"{foobar}"; + a = [p assemblyWithString:s]; + result = [p.tag bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[{, foobar, }]{/foobar/}^", [result description]); + + s = @"{bar baz}"; + a = [p assemblyWithString:s]; + result = [p.tag bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[{, bar, baz, }]{/bar/baz/}^", [result description]); + + s = @"{bar 1.2 baz}"; + a = [p assemblyWithString:s]; + result = [p.tag bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[{, bar, 1.2, baz, }]{/bar/1.2/baz/}^", [result description]); + + s = @"{!{'foobar'}!}"; + a = [p assemblyWithString:s]; + result = [p.tag bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[{, !, {, 'foobar', }, !, }]{/!/{/'foobar'/}/!/}^", [result description]); + + s = @"{!{'foobar' baz}!}"; + a = [p assemblyWithString:s]; + result = [p.tag bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[{, !, {, 'foobar', baz, }, !, }]{/!/{/'foobar'/baz/}/!/}^", [result description]); +} + + +- (void)testBaseDecl { + s = @"base url-goes-here;"; + a = [p assemblyWithString:s]; + result = [p.baseDecl bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[base, url-goes-here, ;]base/url-goes-here/;^", [result description]); +} + + +- (void)testLanguageDecl { + s = @"language en-us;"; + a = [p assemblyWithString:s]; + result = [p.languageDecl bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[language, en-us, ;]language/en-us/;^", [result description]); +} + + +- (void)testModeDecl { + s = @"mode voice;"; + a = [p assemblyWithString:s]; + result = [p.modeDecl bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[mode, voice, ;]mode/voice/;^", [result description]); + + s = @"mode dtmf;"; + a = [p assemblyWithString:s]; + result = [p.modeDecl bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[mode, dtmf, ;]mode/dtmf/;^", [result description]); +} + + +- (void)testRootRuleDecl { + s = @"root $foobar;"; + a = [p assemblyWithString:s]; + result = [p.rootRuleDecl bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[root, $, foobar, ;]root/$/foobar/;^", [result description]); +} + + +- (void)testLanguageAttachment { + s = @"!en-us"; + a = [p assemblyWithString:s]; + result = [p.languageAttachment bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[!, en-us]!/en-us^", [result description]); +} + + +- (void)testRepeatOperator { + s = @"<0-2 /0.6/>"; + a = [p assemblyWithString:s]; + result = [p.repeatOperator bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[<, 0, -, 2, /, 0.6, /, >]^", [result description]); +} + + + + +@end diff --git a/test/TDAlternationTest.h b/test/TDAlternationTest.h new file mode 100644 index 0000000..02de3e0 --- /dev/null +++ b/test/TDAlternationTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDAlternationTest : SenTestCase { + PKCollectionParser *p; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/TDAlternationTest.m b/test/TDAlternationTest.m new file mode 100644 index 0000000..1a1a303 --- /dev/null +++ b/test/TDAlternationTest.m @@ -0,0 +1,103 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDAlternationTest.h" + +@implementation TDAlternationTest + +- (void)tearDown { + [a release]; +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz { + s = @"foo baz bar"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKAlternation alternation]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"bar"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo]foo^baz/bar", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz1 { + s = @"123 baz bar"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKAlternation alternation]; + [p add:[PKLiteral literalWithString:@"bar"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + [p add:[PKNumber number]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123]123^baz/bar", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz2 { + s = @"123 baz bar"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + PKParser *w = [PKWord word]; + PKParser *baz = [PKLiteral literalWithString:@"baz"]; + PKParser *n = [PKNumber number]; + p = [PKAlternation alternationWithSubparsers:w, baz, n, nil]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123]123^baz/bar", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz3 { + s = @"123 baz bar"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKAlternation alternation]; + [p add:[PKWord word]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKNumber number]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123]123^baz/bar", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz4 { + s = @"123 baz bar"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKAlternation alternation]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + [p add:[PKNumber number]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123]123^baz/bar", [result description]); +} + +@end diff --git a/test/TDArithmeticAssembler.h b/test/TDArithmeticAssembler.h new file mode 100644 index 0000000..4cac6d5 --- /dev/null +++ b/test/TDArithmeticAssembler.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface TDArithmeticAssembler : NSObject { + +} + +@end diff --git a/test/TDArithmeticAssembler.m b/test/TDArithmeticAssembler.m new file mode 100644 index 0000000..330a304 --- /dev/null +++ b/test/TDArithmeticAssembler.m @@ -0,0 +1,64 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDArithmeticAssembler.h" +#import + +@implementation TDArithmeticAssembler + +- (void)didMatchPlus:(PKAssembly *)a { + PKToken *tok2 = [a pop]; + PKToken *tok1 = [a pop]; + [a push:[NSNumber numberWithDouble:tok1.floatValue + tok2.floatValue]]; +} + + +- (void)didMatchMinus:(PKAssembly *)a { + PKToken *tok2 = [a pop]; + PKToken *tok1 = [a pop]; + [a push:[NSNumber numberWithDouble:tok1.floatValue - tok2.floatValue]]; +} + + +- (void)didMatchTimes:(PKAssembly *)a { + PKToken *tok2 = [a pop]; + PKToken *tok1 = [a pop]; + [a push:[NSNumber numberWithDouble:tok1.floatValue * tok2.floatValue]]; +} + + +- (void)didMatchDivide:(PKAssembly *)a { + PKToken *tok2 = [a pop]; + PKToken *tok1 = [a pop]; + [a push:[NSNumber numberWithDouble:tok1.floatValue / tok2.floatValue]]; +} + + +- (void)didMatchExp:(PKAssembly *)a { + PKToken *tok2 = [a pop]; + PKToken *tok1 = [a pop]; + + CGFloat n1 = tok1.floatValue; + CGFloat n2 = tok2.floatValue; + + CGFloat res = n1; + NSUInteger i = 1; + for ( ; i < n2; i++) { + res *= n1; + } + + [a push:[NSNumber numberWithDouble:res]]; +} + +@end diff --git a/test/TDArithmeticParser.h b/test/TDArithmeticParser.h new file mode 100644 index 0000000..54ff67a --- /dev/null +++ b/test/TDArithmeticParser.h @@ -0,0 +1,39 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface TDArithmeticParser : PKSequence { + PKCollectionParser *exprParser; + PKCollectionParser *termParser; + PKCollectionParser *plusTermParser; + PKCollectionParser *minusTermParser; + PKCollectionParser *factorParser; + PKCollectionParser *timesFactorParser; + PKCollectionParser *divFactorParser; + PKCollectionParser *exponentFactorParser; + PKCollectionParser *phraseParser; +} +- (double)parse:(NSString *)s; + +@property (retain) PKCollectionParser *exprParser; +@property (retain) PKCollectionParser *termParser; +@property (retain) PKCollectionParser *plusTermParser; +@property (retain) PKCollectionParser *minusTermParser; +@property (retain) PKCollectionParser *factorParser; +@property (retain) PKCollectionParser *timesFactorParser; +@property (retain) PKCollectionParser *divFactorParser; +@property (retain) PKCollectionParser *exponentFactorParser; +@property (retain) PKCollectionParser *phraseParser; +@end diff --git a/test/TDArithmeticParser.m b/test/TDArithmeticParser.m new file mode 100644 index 0000000..6fb8240 --- /dev/null +++ b/test/TDArithmeticParser.m @@ -0,0 +1,253 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDArithmeticParser.h" + +/* + expr = term (plusTerm | minusTerm)* + term = factor (timesFactor | divFactor)* + plusTerm = '+' term + minusTerm = '-' term + factor = phrase exponentFactor | phrase + timesFactor = '*' factor + divFactor = '/' factor + exponentFactor = '^' factor + phrase = '(' expr ')' | Number +*/ + +@implementation TDArithmeticParser + +- (id)init { + if (self = [super init]) { + [self add:self.exprParser]; + } + return self; +} + + +- (void)dealloc { + self.exprParser = nil; + self.termParser = nil; + self.plusTermParser = nil; + self.minusTermParser = nil; + self.factorParser = nil; + self.timesFactorParser = nil; + self.divFactorParser = nil; + self.exponentFactorParser = nil; + self.phraseParser = nil; + [super dealloc]; +} + + +- (double)parse:(NSString *)s { + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + a = [self completeMatchFor:a]; +// NSLog(@"\n\na: %@\n\n", a); + NSNumber *n = [a pop]; + double f = [n doubleValue]; + return f; +} + + +// expr = term (plusTerm | minusTerm)* +- (PKCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [PKSequence sequence]; + [exprParser add:self.termParser]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:self.plusTermParser]; + [a add:self.minusTermParser]; + + [exprParser add:[PKRepetition repetitionWithSubparser:a]]; + } + return exprParser; +} + + +// term = factor (timesFactor | divFactor)* +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + [termParser add:self.factorParser]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:self.timesFactorParser]; + [a add:self.divFactorParser]; + + [termParser add:[PKRepetition repetitionWithSubparser:a]]; + } + return termParser; +} + + +// plusTerm = '+' term +- (PKCollectionParser *)plusTermParser { + if (!plusTermParser) { + self.plusTermParser = [PKSequence sequence]; + [plusTermParser add:[[PKSymbol symbolWithString:@"+"] discard]]; + [plusTermParser add:self.termParser]; + [plusTermParser setAssembler:self selector:@selector(didMatchPlus:)]; + } + return plusTermParser; +} + + +// minusTerm = '-' term +- (PKCollectionParser *)minusTermParser { + if (!minusTermParser) { + self.minusTermParser = [PKSequence sequence]; + [minusTermParser add:[[PKSymbol symbolWithString:@"-"] discard]]; + [minusTermParser add:self.termParser]; + [minusTermParser setAssembler:self selector:@selector(didMatchMinus:)]; + } + return minusTermParser; +} + + +// factor = phrase exponentFactor | phrase +- (PKCollectionParser *)factorParser { + if (!factorParser) { + self.factorParser = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:self.phraseParser]; + [s add:self.exponentFactorParser]; + + [factorParser add:s]; + [factorParser add:self.phraseParser]; + } + return factorParser; +} + + +// timesFactor = '*' factor +- (PKCollectionParser *)timesFactorParser { + if (!timesFactorParser) { + self.timesFactorParser = [PKSequence sequence]; + [timesFactorParser add:[[PKSymbol symbolWithString:@"*"] discard]]; + [timesFactorParser add:self.factorParser]; + [timesFactorParser setAssembler:self selector:@selector(didMatchTimes:)]; + } + return timesFactorParser; +} + + +// divFactor = '/' factor +- (PKCollectionParser *)divFactorParser { + if (!divFactorParser) { + self.divFactorParser = [PKSequence sequence]; + [divFactorParser add:[[PKSymbol symbolWithString:@"/"] discard]]; + [divFactorParser add:self.factorParser]; + [divFactorParser setAssembler:self selector:@selector(didMatchDivide:)]; + } + return divFactorParser; +} + + +// exponentFactor = '^' factor +- (PKCollectionParser *)exponentFactorParser { + if (!exponentFactorParser) { + self.exponentFactorParser = [PKSequence sequence]; + [exponentFactorParser add:[[PKSymbol symbolWithString:@"^"] discard]]; + [exponentFactorParser add:self.factorParser]; + [exponentFactorParser setAssembler:self selector:@selector(didMatchExp:)]; + } + return exponentFactorParser; +} + + +// phrase = '(' expr ')' | Number +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + self.phraseParser = [PKAlternation alternation]; + + PKSequence *s = [PKSequence sequence]; + [s add:[[PKSymbol symbolWithString:@"("] discard]]; + [s add:self.exprParser]; + [s add:[[PKSymbol symbolWithString:@")"] discard]]; + + [phraseParser add:s]; + + PKNumber *n = [PKNumber number]; + [n setAssembler:self selector:@selector(didMatchNumber:)]; + [phraseParser add:n]; + } + return phraseParser; +} + + +#pragma mark - +#pragma mark Assembler + +- (void)didMatchNumber:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithDouble:tok.floatValue]]; +} + + +- (void)didMatchPlus:(PKAssembly *)a { + NSNumber *n2 = [a pop]; + NSNumber *n1 = [a pop]; + [a push:[NSNumber numberWithDouble:[n1 doubleValue] + [n2 doubleValue]]]; +} + + +- (void)didMatchMinus:(PKAssembly *)a { + NSNumber *n2 = [a pop]; + NSNumber *n1 = [a pop]; + [a push:[NSNumber numberWithDouble:[n1 doubleValue] - [n2 doubleValue]]]; +} + + +- (void)didMatchTimes:(PKAssembly *)a { + NSNumber *n2 = [a pop]; + NSNumber *n1 = [a pop]; + [a push:[NSNumber numberWithDouble:[n1 doubleValue] * [n2 doubleValue]]]; +} + + +- (void)didMatchDivide:(PKAssembly *)a { + NSNumber *n2 = [a pop]; + NSNumber *n1 = [a pop]; + [a push:[NSNumber numberWithDouble:[n1 doubleValue] / [n2 doubleValue]]]; +} + + +- (void)didMatchExp:(PKAssembly *)a { + NSNumber *n2 = [a pop]; + NSNumber *n1 = [a pop]; + + double d1 = [n1 doubleValue]; + double d2 = [n2 doubleValue]; + + double res = d1; + NSUInteger i = 1; + for ( ; i < d2; i++) { + res *= d1; + } + + [a push:[NSNumber numberWithDouble:res]]; +} + +@synthesize exprParser; +@synthesize termParser; +@synthesize plusTermParser; +@synthesize minusTermParser; +@synthesize factorParser; +@synthesize timesFactorParser; +@synthesize divFactorParser; +@synthesize exponentFactorParser; +@synthesize phraseParser; +@end diff --git a/test/TDArithmeticParserTest.h b/test/TDArithmeticParserTest.h new file mode 100644 index 0000000..c8a8389 --- /dev/null +++ b/test/TDArithmeticParserTest.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "TDArithmeticParser.h" + +@interface TDArithmeticParserTest : SenTestCase { + NSString *s; + TDArithmeticParser *p; + double result; +} + +@end diff --git a/test/TDArithmeticParserTest.m b/test/TDArithmeticParserTest.m new file mode 100644 index 0000000..8f9da90 --- /dev/null +++ b/test/TDArithmeticParserTest.m @@ -0,0 +1,348 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDArithmeticParserTest.h" + +@implementation TDArithmeticParserTest + +- (void)setUp { + p = [TDArithmeticParser parser]; +} + + +- (void)testOne { + s = @"1"; + result = [p parse:s]; + TDEquals((double)1.0, result); +} + + +- (void)testFortySeven { + s = @"47"; + result = [p parse:s]; + TDEquals((double)47.0, result); +} + + +- (void)testNegativeZero { + s = @"-0"; + result = [p parse:s]; + TDEquals((double)-0.0, result); +} + + +- (void)testNegativeOne { + s = @"-1"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testOnePlusOne { + s = @"1 + 1"; + result = [p parse:s]; + TDEquals((double)2.0, result); +} + + +- (void)testOnePlusNegativeOne { + s = @"1 + -1"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testNegativeOnePlusOne { + s = @"-1 + 1"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testOneHundredPlusZero { + s = @"100 + 0"; + result = [p parse:s]; + TDEquals((double)100.0, result); +} + + +- (void)testNegativeOnePlusZero { + s = @"-1 + 0"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testNegativeZeroPlusZero { + s = @"-0 + 0"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testNegativeZeroPlusNegativeZero { + s = @"-0 + -0"; + result = [p parse:s]; + TDEquals((double)-0.0, result); +} + + +- (void)testOneMinusOne { + s = @"1 - 1"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testOneMinusNegativeOne { + s = @"1 - -1"; + result = [p parse:s]; + TDEquals((double)2.0, result); +} + + +- (void)testNegativeOneMinusOne { + s = @"-1 - 1"; + result = [p parse:s]; + TDEquals((double)-2.0, result); +} + + +- (void)testOneHundredMinusZero { + s = @"100 - 0"; + result = [p parse:s]; + TDEquals((double)100.0, result); +} + + +- (void)testNegativeOneMinusZero { + s = @"-1 - 0"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testNegativeZeroMinusZero { + s = @"-0 - 0"; + result = [p parse:s]; + TDEquals((double)-0.0, result); +} + + +- (void)testNegativeZeroMinusNegativeZero { + s = @"-0 - -0"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testOneTimesOne { + s = @"1 * 1"; + result = [p parse:s]; + TDEquals((double)1.0, result); +} + + +- (void)testTwoTimesFour { + s = @"2 * 4"; + result = [p parse:s]; + TDEquals((double)8.0, result); +} + + +- (void)testOneTimesNegativeOne { + s = @"1 * -1"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testNegativeOneTimesOne { + s = @"-1 * 1"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testOneHundredTimesZero { + s = @"100 * 0"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testNegativeOneTimesZero { + s = @"-1 * 0"; + result = [p parse:s]; + TDEquals((double)-0.0, result); +} + + +- (void)testNegativeZeroTimesZero { + s = @"-0 * 0"; + result = [p parse:s]; + TDEquals((double)-0.0, result); +} + + +- (void)testNegativeZeroTimesNegativeZero { + s = @"-0 * -0"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)testOneDivOne { + s = @"1 / 1"; + result = [p parse:s]; + TDEquals((double)1.0, result); +} + + +- (void)testTwoDivFour { + s = @"2 / 4"; + result = [p parse:s]; + TDEquals((double)0.5f, result); +} + + +- (void)testFourDivTwo { + s = @"4 / 2"; + result = [p parse:s]; + TDEquals((double)2.0, result); +} + + +- (void)testOneDivNegativeOne { + s = @"1 / -1"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testNegativeOneDivOne { + s = @"-1 / 1"; + result = [p parse:s]; + TDEquals((double)-1.0, result); +} + + +- (void)testOneHundredDivZero { + s = @"100 / 0"; + result = [p parse:s]; + TDEquals((double)INFINITY, result); +} + + +- (void)testNegativeOneDivZero { + s = @"-1 / 0"; + result = [p parse:s]; + TDEquals((double)-INFINITY, result); +} + + +- (void)testNegativeZeroDivZero { + s = @"-0 / 0"; + result = [p parse:s]; + TDEquals((double)NAN, result); +} + + +- (void)testNegativeZeroDivNegativeZero { + s = @"-0 / -0"; + result = [p parse:s]; + TDEquals((double)NAN, result); +} + + +- (void)test1Exp1 { + s = @"1 ^ 1"; + result = [p parse:s]; + TDEquals((double)1.0, result); +} + + +- (void)test1Exp2 { + s = @"1 ^ 2"; + result = [p parse:s]; + TDEquals((double)1.0, result); +} + + +- (void)test9Exp2 { + s = @"9 ^ 2"; + result = [p parse:s]; + TDEquals((double)81.0, result); +} + + +- (void)test9ExpNegative2 { + s = @"9 ^ -2"; + result = [p parse:s]; + TDEquals((double)9.0, result); +} + + +#pragma mark - +#pragma mark Associativity + +- (void)test7minus3minus1 { // minus associativity + s = @"7 - 3 - 1"; + result = [p parse:s]; + TDEquals((double)3.0, (double)result); +} + + +- (void)test9exp2minus81 { // exp associativity + s = @"9^2 - 81"; + result = [p parse:s]; + TDEquals((double)0.0, result); +} + + +- (void)test2exp1exp4 { // exp + s = @"2 ^ 1 ^ 4"; + result = [p parse:s]; + TDEquals((double)2.0, result); +} + + +- (void)test100minus5exp2times3 { // exp + s = @"100 - 5^2*3"; + result = [p parse:s]; + TDEquals((double)25.0, result); +} + + +- (void)test100minus25times3 { // precedence + s = @"100 - 25*3"; + result = [p parse:s]; + STAssertEqualsWithAccuracy((double)25.0, result, 1.0, @""); +} + + +- (void)test100minus25times3Parens { // precedence + s = @"(100 - 25)*3"; + result = [p parse:s]; + TDEquals((double)225.0, result); +} + + +- (void)test100minus5exp2times3Parens { // precedence + s = @"(100 - 5^2)*3"; + result = [p parse:s]; + TDEquals((double)225.0, result); +} + +@end diff --git a/test/TDBlob.h b/test/TDBlob.h new file mode 100644 index 0000000..4fd9f5d --- /dev/null +++ b/test/TDBlob.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface TDBlob : PKTerminal { + +} ++ (id)blob; + ++ (id)blobWithStartMarker:(NSString *)s; +@end diff --git a/test/TDBlob.m b/test/TDBlob.m new file mode 100644 index 0000000..bd7dcba --- /dev/null +++ b/test/TDBlob.m @@ -0,0 +1,40 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDBlob.h" +#import +#import "PKToken+Blob.h" + +@implementation TDBlob + ++ (id)blob { + return [self blobWithStartMarker:nil]; +} + + ++ (id)blobWithStartMarker:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + BOOL result = tok.isBlob; + if (self.string) { + result = [tok.stringValue hasPrefix:self.string]; + } + return result; +} + +@end diff --git a/test/TDBlobState.h b/test/TDBlobState.h new file mode 100644 index 0000000..a1c07f0 --- /dev/null +++ b/test/TDBlobState.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface TDBlobState : PKTokenizerState { + +} + +@end diff --git a/test/TDBlobState.m b/test/TDBlobState.m new file mode 100644 index 0000000..3560258 --- /dev/null +++ b/test/TDBlobState.m @@ -0,0 +1,51 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDBlobState.h" +#import +#import +#import "PKToken+Blob.h" + +@interface PKToken () +@property (nonatomic, readwrite) NSUInteger offset; +@end + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@implementation TDBlobState + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + [self resetWithReader:r]; + + PKUniChar c = cin; + do { + [self append:c]; + c = [r read]; + } while (PKEOF != c && !isspace(c)); + + if (PKEOF != c) { + [r unread]; + } + + PKToken *tok = [PKToken tokenWithTokenType:PKTokenTypeBlob stringValue:[self bufferedString] floatValue:0.0]; + tok.offset = offset; + return tok; +} + +@end diff --git a/test/TDCharTest.h b/test/TDCharTest.h new file mode 100644 index 0000000..29288d0 --- /dev/null +++ b/test/TDCharTest.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + + +@interface TDCharTest : SenTestCase { + NSString *s; + PKCharacterAssembly *a; + PKChar *p; + PKAssembly *result; +} + +@end diff --git a/test/TDCharTest.m b/test/TDCharTest.m new file mode 100644 index 0000000..8655c8f --- /dev/null +++ b/test/TDCharTest.m @@ -0,0 +1,65 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDCharTest.h" + +@interface PKAssembly () +- (BOOL)hasMore; +@end + +@implementation TDCharTest + +- (void)test123 { + s = @"123"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^123", [a description]); + p = [PKChar char]; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[1]1^23", [result description]); + TDTrue([a hasMore]); +} + + +- (void)testAbc { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^abc", [a description]); + p = [PKChar char]; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[a]a^bc", [result description]); + TDTrue([a hasMore]); +} + +- (void)testRepetition { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^abc", [a description]); + p = [PKChar char]; + PKParser *r = [PKRepetition repetitionWithSubparser:p]; + + result = [r bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[a, b, c]abc^", [result description]); + TDFalse([result hasMore]); +} + + +@end diff --git a/test/TDCharacterAssemblyTest.h b/test/TDCharacterAssemblyTest.h new file mode 100644 index 0000000..ff8d0a2 --- /dev/null +++ b/test/TDCharacterAssemblyTest.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + + +@interface TDCharacterAssemblyTest : SenTestCase { + NSString *s; + PKCharacterAssembly *a; + PKAssembly *result; +} + +@end diff --git a/test/TDCharacterAssemblyTest.m b/test/TDCharacterAssemblyTest.m new file mode 100644 index 0000000..48118c3 --- /dev/null +++ b/test/TDCharacterAssemblyTest.m @@ -0,0 +1,65 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDCharacterAssemblyTest.h" + +@interface PKAssembly () +- (id)next; +- (BOOL)hasMore; +@property (nonatomic, readonly) NSUInteger objectsConsumed; +@property (nonatomic, readonly) NSUInteger objectsRemaining; +@end + +@implementation TDCharacterAssemblyTest + +- (void)testAbc { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDNotNil(a); + TDEquals((NSUInteger)3, [s length]); + TDEquals((NSUInteger)0, a.objectsConsumed); + TDEquals((NSUInteger)3, a.objectsRemaining); + TDEquals(YES, [a hasMore]); + + id obj = [a next]; + TDEqualObjects(obj, [NSNumber numberWithInteger:'a']); + TDEquals((NSUInteger)3, [s length]); + TDEquals((NSUInteger)1, a.objectsConsumed); + TDEquals((NSUInteger)2, a.objectsRemaining); + TDEquals(YES, [a hasMore]); + + obj = [a next]; + TDEqualObjects(obj, [NSNumber numberWithInteger:'b']); + TDEquals((NSUInteger)3, [s length]); + TDEquals((NSUInteger)2, a.objectsConsumed); + TDEquals((NSUInteger)1, a.objectsRemaining); + TDEquals(YES, [a hasMore]); + + obj = [a next]; + TDEqualObjects(obj, [NSNumber numberWithInteger:'c']); + TDEquals((NSUInteger)3, [s length]); + TDEquals((NSUInteger)3, a.objectsConsumed); + TDEquals((NSUInteger)0, a.objectsRemaining); + TDEquals(NO, [a hasMore]); + + obj = [a next]; + TDNil(obj); + TDEquals((NSUInteger)3, [s length]); + TDEquals((NSUInteger)3, a.objectsConsumed); + TDEquals((NSUInteger)0, a.objectsRemaining); + TDEquals(NO, [a hasMore]); +} + +@end diff --git a/test/TDCommentStateTest.h b/test/TDCommentStateTest.h new file mode 100644 index 0000000..7f4d89d --- /dev/null +++ b/test/TDCommentStateTest.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDCommentStateTest : SenTestCase { + PKCommentState *commentState; + PKReader *r; + PKTokenizer *t; + NSString *s; + PKToken *tok; +} + +@end diff --git a/test/TDCommentStateTest.m b/test/TDCommentStateTest.m new file mode 100644 index 0000000..90c96a7 --- /dev/null +++ b/test/TDCommentStateTest.m @@ -0,0 +1,492 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDCommentStateTest.h" + +@implementation TDCommentStateTest + +- (void)setUp { + r = [[PKReader alloc] init]; + t = [[PKTokenizer alloc] init]; + commentState = t.commentState; +} + + +- (void)tearDown { + [r release]; + [t release]; +} + + +- (void)testSlashSlashFoo { + s = @"// foo"; + r.string = s; + t.string = s; + tok = [commentState nextTokenFromReader:r startingWith:'/' tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(tok.offset, (NSUInteger)-1); + TDEquals([r read], PKEOF); +} + + +- (void)testReportSlashSlashFoo { + s = @"// foo"; + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.offset, (NSUInteger)0); + TDEqualObjects([t nextToken], [PKToken EOFToken]); +} + + +- (void)testReportSpaceSlashSlashFoo { + s = @" // foo"; + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"// foo"); + TDEquals(tok.offset, (NSUInteger)1); + TDEqualObjects([t nextToken], [PKToken EOFToken]); +} + + +- (void)testTurnOffSlashSlashFoo { + s = @"// foo"; + r.string = s; + t.string = s; + [commentState removeSingleLineStartMarker:@"//"]; + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"/"); + TDEquals(tok.offset, (NSUInteger)0); + TDEquals([r read], (PKUniChar)'/'); +} + + +- (void)testHashFoo { + s = @"# foo"; + r.string = s; + t.string = s; + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.offset, (NSUInteger)2); + + r.string = s; + t.string = s; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)1); +} + + +- (void)testAddHashFoo { + s = @"# foo"; + t.string = s; + [commentState addSingleLineStartMarker:@"#"]; + [t setTokenizerState:commentState from:'#' to:'#']; + tok = [t nextToken]; + TDEquals(tok, [PKToken EOFToken]); + TDEqualObjects(tok.stringValue, [[PKToken EOFToken] stringValue]); + TDEquals(tok.offset, (NSUInteger)-1); +} + + +- (void)testReportAddHashFoo { + s = @"# foo"; + t.string = s; + commentState.reportsCommentTokens = YES; + [commentState addSingleLineStartMarker:@"#"]; + [t setTokenizerState:commentState from:'#' to:'#']; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testSlashStarFooStarSlash { + s = @"/* foo */"; + t.string = s; + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals([r read], PKEOF); +} + + +- (void)testSlashStarFooStarSlashSpace { + s = @"/* foo */ "; + t.string = s; + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals([r read], PKEOF); +} + + +- (void)testReportSlashStarFooStarSlash { + s = @"/* foo */"; + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals([t nextToken], [PKToken EOFToken]); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testReportSlashStarFooStarSlashSpace { + s = @"/* foo */ "; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEquals(tok.offset, (NSUInteger)0); + TDEqualObjects(tok.stringValue, @"/* foo */"); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); +} + + +- (void)testReportSlashStarFooStarSlashSpaceA { + s = @"/* foo */ a"; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)10); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)9); +} + + +- (void)testReportSlashStarStarFooStarSlashSpaceA { + s = @"/** foo */ a"; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/** foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)11); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/** foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)10); +} + + +- (void)testReportSlashStarFooStarStarSlashSpaceA { + s = @"/* foo **/ a"; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo **/"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)11); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo **/"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)10); +} + + +- (void)testReportSlashStarFooStarSlashSpaceStarSlash { + s = @"/* foo */ */"; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"*"); + TDEquals(tok.offset, (NSUInteger)10); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)9); +} + + +- (void)testTurnOffSlashStarFooStarSlash { + s = @"/* foo */"; + t.string = s; + [commentState removeMultiLineStartMarker:@"/*"]; + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"/"); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testReportSlashStarFooStar { + s = @"/* foo *"; + t.string = s; + commentState.reportsCommentTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testReportBalancedSlashStarFooStar { + s = @"/* foo *"; + t.string = s; + commentState.reportsCommentTokens = YES; + commentState.balancesEOFTerminatedComments = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo **/"); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testReportBalancedSlashStarFoo { + s = @"/* foo "; + t.string = s; + commentState.reportsCommentTokens = YES; + commentState.balancesEOFTerminatedComments = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/* foo */"); + TDEquals(tok.offset, (NSUInteger)0); +} + + +- (void)testXMLFooStarXMLA { + s = @" a"; + t.string = s; + [commentState addMultiLineStartMarker:@""]; + [t setTokenizerState:commentState from:'<' to:'<']; + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)13); + + t.string = s; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)12); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)13); +} + + +- (void)testReportXMLFooStarXMLA { + s = @" a"; + t.string = s; + commentState.reportsCommentTokens = YES; + [commentState addMultiLineStartMarker:@""]; + [t setTokenizerState:commentState from:'<' to:'<']; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @""); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + TDEquals(tok.offset, (NSUInteger)13); + + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @""); + TDEquals(tok.offset, (NSUInteger)0); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals(tok.offset, (NSUInteger)12); +} + + +- (void)testXXMarker { + s = @"XX foo XX a"; + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + [commentState addMultiLineStartMarker:@"XX" endMarker:@"XX"]; + [t setTokenizerState:commentState from:'X' to:'X']; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"XX foo XX"); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + t.whitespaceState.reportsWhitespaceTokens = YES; + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"XX foo XX"); + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); +} + + +- (void)testXXMarkerFalseStartMarkerMatch { + s = @"X foo X a"; + r.string = s; + t.string = s; + commentState.reportsCommentTokens = YES; + [commentState addMultiLineStartMarker:@"XX" endMarker:@"XX"]; + [t setTokenizerState:commentState from:'X' to:'X']; + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"X"); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"X"); + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"a"); + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLuaComments { + s = @"--[comment"; + t.string = s; + + [t setTokenizerState:t.symbolState from:'/' to:'/']; + [t setTokenizerState:t.commentState from:'-' to:'-']; + + [t.commentState addSingleLineStartMarker:@"--"]; + [t.commentState addMultiLineStartMarker:@"--[[" endMarker:@"]]"]; + + t.commentState.reportsCommentTokens = YES; + + PKToken *eof = [PKToken EOFToken]; + + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + + tok = [t nextToken]; + TDEquals(eof, tok); +} + + +- (void)testLuaComments2 { + s = @"--[[[comment]]"; + t.string = s; + + [t setTokenizerState:t.symbolState from:'/' to:'/']; + [t setTokenizerState:t.commentState from:'-' to:'-']; + + [t.commentState addSingleLineStartMarker:@"--"]; + [t.commentState addMultiLineStartMarker:@"--[[" endMarker:@"]]"]; + + t.commentState.reportsCommentTokens = YES; + + PKToken *eof = [PKToken EOFToken]; + + tok = [t nextToken]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + + tok = [t nextToken]; + TDEquals(eof, tok); +} + +@end diff --git a/test/TDDelimitStateTest.h b/test/TDDelimitStateTest.h new file mode 100644 index 0000000..86df9ce --- /dev/null +++ b/test/TDDelimitStateTest.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDDelimitStateTest : SenTestCase { + PKDelimitState *delimitState; + PKTokenizer *t; + NSString *s; + PKToken *tok; +} + +@end diff --git a/test/TDDelimitStateTest.m b/test/TDDelimitStateTest.m new file mode 100644 index 0000000..29211b8 --- /dev/null +++ b/test/TDDelimitStateTest.m @@ -0,0 +1,830 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDDelimitStateTest.h" + +@implementation TDDelimitStateTest + +- (void)setUp { + t = [[PKTokenizer alloc] init]; + delimitState = t.delimitState; +} + + +- (void)tearDown { + [t release]; +} + + +- (void)testLtFooGt { + s = @""; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testSlashFooSlash { + s = @"/foo/"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'/' to:'/']; + [delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testSlashFooSlashBar { + s = @"/foo/bar"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'/' to:'/']; + [delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"/foo/"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"bar"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testSlashFooSlashSemi { + s = @"/foo/;"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'/' to:'/']; + [delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"/foo/"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @";"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtFooGtWithFOAllowed { + s = @""; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"fo"]; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtFooGtWithFAllowed { + s = @""; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"f"]; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"<"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @">"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtFooGtWithFAllowedAndRemove { + s = @""; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<" endMarker:@">" allowedCharacterSet:cs]; + [delimitState removeStartMarker:@"<"]; + + tok = [t nextToken]; + + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"<"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @">"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooGt { + s = @"<#foo>"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<#" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooGtWithFOAllowed { + s = @"<#foo>"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"fo"]; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<#" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooGtWithFAllowed { + s = @"<#foo>"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"f"]; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<#" endMarker:@">" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"<"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @">"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooGtWithFAllowedAndMultiCharSymbol { + s = @"<#foo>"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"f"]; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"<#" endMarker:@">" allowedCharacterSet:cs]; + + [t.symbolState add:@"<#"]; + + tok = [t nextToken]; + + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"<#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @">"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooHashGt { + s = @"=#foo#="; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'=' to:'=']; + [delimitState addStartMarker:@"=#" endMarker:@"#=" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooHashGtWithFOAllowed { + s = @"=#foo#="; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"fo"]; + + [t setTokenizerState:delimitState from:'=' to:'=']; + [delimitState addStartMarker:@"=#" endMarker:@"#=" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtHashFooHashGtWithFAllowed { + s = @"=#foo#="; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"f"]; + + [t setTokenizerState:delimitState from:'=' to:'=']; + [delimitState addStartMarker:@"=#" endMarker:@"#=" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"="); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"="); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollar123Dollar { + s = @"$123$"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$" endMarker:@"$" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarDollar { + s = @"$$123$$"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$$" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarHash { + s = @"$$123$#"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarHashDecimalDigitAllowed { + s = @"$$123$#"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet decimalDigitCharacterSet]; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarHashAlphanumericAllowed { + s = @"$$123$#"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet alphanumericCharacterSet]; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarHashAlphanumericAndWhitespaceAndNewlineAllowed { + s = @"$$123 456\t789\n0$#"; + t.string = s; + NSMutableCharacterSet *cs = [[[NSCharacterSet alphanumericCharacterSet] mutableCopy] autorelease]; + [cs formUnionWithCharacterSet:[NSCharacterSet whitespaceCharacterSet]]; + [cs formUnionWithCharacterSet:[NSCharacterSet newlineCharacterSet]]; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollar123DollarHashWhitespaceAllowed { + s = @"$$123$#"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet whitespaceCharacterSet]; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"123"); + TDEquals(tok.floatValue, (CGFloat)123.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollarDollarHash { + s = @"$$$#"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollarDollar { + s = @"$$$"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"$"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testLtDollarDollarDollarBalanceEOFStrings { + s = @"$$$"; + t.string = s; + NSCharacterSet *cs = nil; + + delimitState.balancesEOFTerminatedStrings = YES; + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"$$" endMarker:@"$#" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"$$$$#"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testPHPPrint { + s = @""; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testPHP { + s = @""; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'<' to:'<']; + [delimitState addStartMarker:@"" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testEnvVars { + s = @"${PRODUCT_NAME} or ${EXECUTABLE_NAME}"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet characterSetWithCharactersInString:@"ABCDEFGHIJKLMNOPQRSTUVWXYZ_"]; + + [t setTokenizerState:delimitState from:'$' to:'$']; + [delimitState addStartMarker:@"${" endMarker:@"}" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"${PRODUCT_NAME}"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"or"); + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"${EXECUTABLE_NAME}"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testCocoaString { + s = @"@\"foo\""; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'@' to:'@']; + [delimitState addStartMarker:@"@\"" endMarker:@"\"" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAlphaMarkerXX { + s = @"XXfooXX"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'X' to:'X']; + [delimitState addStartMarker:@"XX" endMarker:@"XX" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAlphaMarkerXXAndXXX { + s = @"XXfooXXX"; + t.string = s; + NSCharacterSet *cs = nil; + + [t setTokenizerState:delimitState from:'X' to:'X']; + [delimitState addStartMarker:@"XX" endMarker:@"XXX" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAlphaMarkerXXFails { + s = @"XXfooXX"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet whitespaceCharacterSet]; + + [t setTokenizerState:delimitState from:'X' to:'X']; + [delimitState addStartMarker:@"XX" endMarker:@"XX" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAlphaMarkerXXFalseStartMarker { + s = @"XfooXX"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet whitespaceCharacterSet]; + + [t setTokenizerState:delimitState from:'X' to:'X']; + [delimitState addStartMarker:@"XX" endMarker:@"XX" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAtStartMarkerNilEndMarker { + s = @"@foo"; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet alphanumericCharacterSet]; + + [t setTokenizerState:delimitState from:'@' to:'@']; + [delimitState addStartMarker:@"@" endMarker:nil allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, s); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testAtStartMarkerNilEndMarker2 { + s = @"@foo bar @ @baz "; + t.string = s; + NSCharacterSet *cs = [NSCharacterSet alphanumericCharacterSet]; + + [t setTokenizerState:delimitState from:'@' to:'@']; + [delimitState addStartMarker:@"@" endMarker:nil allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"@foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"bar"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"@"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @"@baz"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDEqualObjects(tok, [PKToken EOFToken]); +} + + +- (void)testUnbalancedElementStartTag { + s = @"" allowedCharacterSet:cs]; + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"<"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEquals(tok.floatValue, (CGFloat)0.0); + + t.string = s; + delimitState.allowsUnbalancedStrings = YES; + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(tok.stringValue, @" + +@class PKTokenizer; +@class PKToken; + +@interface TDFastJsonParser : NSObject { + PKTokenizer *tokenizer; + NSMutableArray *stack; + PKToken *curly; + PKToken *bracket; +} +- (id)parse:(NSString *)s; +@end diff --git a/test/TDFastJsonParser.m b/test/TDFastJsonParser.m new file mode 100644 index 0000000..5fa6733 --- /dev/null +++ b/test/TDFastJsonParser.m @@ -0,0 +1,141 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDFastJsonParser.h" +#import "ParseKit.h" +#import "NSString+ParseKitAdditions.h" + +@interface TDFastJsonParser () +- (void)didMatchDictionary; +- (void)didMatchArray; +- (NSArray *)objectsAbove:(id)fence; + +@property (retain) PKTokenizer *tokenizer; +@property (retain) NSMutableArray *stack; +@property (retain) PKToken *curly; +@property (retain) PKToken *bracket; +@end + +@implementation TDFastJsonParser + +- (id)init { + if (self = [super init]) { + self.tokenizer = [PKTokenizer tokenizer]; + + // configure tokenizer + [tokenizer setTokenizerState:tokenizer.symbolState from: '/' to: '/']; // JSON doesn't have slash slash or slash star comments + [tokenizer setTokenizerState:tokenizer.symbolState from: '\'' to: '\'']; // JSON does not have single quoted strings + + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0.0]; + self.bracket = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"[" floatValue:0.0]; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.stack = nil; + self.curly = nil; + self.bracket = nil; + [super dealloc]; +} + + +- (id)parse:(NSString *)s { + self.stack = [NSMutableArray array]; + + tokenizer.string = s; + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + while ((tok = [tokenizer nextToken]) != eof) { + NSString *sval = tok.stringValue; + + if (tok.isSymbol) { + if ([@"{" isEqualToString:sval]) { + [stack addObject:tok]; + } else if ([@"}" isEqualToString:sval]) { + [self didMatchDictionary]; + } else if ([@"[" isEqualToString:sval]) { + [stack addObject:tok]; + } else if ([@"]" isEqualToString:sval]) { + [self didMatchArray]; + } + } else { + id value = nil; + if (tok.isQuotedString) { + value = [sval stringByTrimmingQuotes]; + } else if (tok.isNumber) { + value = [NSNumber numberWithFloat:tok.floatValue]; + } else { // if (tok.isWord) { + if ([@"null" isEqualToString:sval]) { + value = [NSNull null]; + } else if ([@"true" isEqualToString:sval]) { + value = [NSNumber numberWithBool:YES]; + } else if ([@"false" isEqualToString:sval]) { + value = [NSNumber numberWithBool:NO]; + } + } + [stack addObject:value]; + } + } + + return [stack lastObject]; +} + + +- (void)didMatchDictionary { + NSArray *a = [self objectsAbove:curly]; + NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity:[a count]/2.]; + + NSInteger i = [a count] - 1; + for ( ; i >= 0; i--) { + NSString *key = [a objectAtIndex:i--]; + id value = [a objectAtIndex:i]; + [result setObject:value forKey:key]; + } + + [stack addObject:result]; +} + + +- (void)didMatchArray { + NSArray *a = [self objectsAbove:bracket]; + NSMutableArray *result = [NSMutableArray arrayWithCapacity:[a count]]; + for (id obj in [a reverseObjectEnumerator]) { + [result addObject:obj]; + } + [stack addObject:result]; +} + + +- (NSArray *)objectsAbove:(id)fence { + NSMutableArray *result = [NSMutableArray array]; + while (1) { + id obj = [stack lastObject]; + [stack removeLastObject]; + if ([obj isEqual:fence]) { + break; + } + [result addObject:obj]; + } + return result; +} + +@synthesize stack; +@synthesize tokenizer; +@synthesize curly; +@synthesize bracket; +@end diff --git a/test/TDFastJsonParserTest.h b/test/TDFastJsonParserTest.h new file mode 100644 index 0000000..ecc5213 --- /dev/null +++ b/test/TDFastJsonParserTest.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "ParseKit.h" + +@interface TDFastJsonParserTest : SenTestCase { + +} + +@end diff --git a/test/TDFastJsonParserTest.m b/test/TDFastJsonParserTest.m new file mode 100644 index 0000000..46a6c5d --- /dev/null +++ b/test/TDFastJsonParserTest.m @@ -0,0 +1,39 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDFastJsonParserTest.h" +#import "TDFastJsonParser.h" + +@implementation TDFastJsonParserTest + +- (void)testRun { + NSString *s = @"{\"foo\":\"bar\"}"; + TDFastJsonParser *p = [[[TDFastJsonParser alloc] init] autorelease]; + id result = [p parse:s]; + + NSLog(@"result"); + TDNotNil(result); +} + + +- (void)testCrunchBaseJsonParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDFastJsonParser *parser = [[[TDFastJsonParser alloc] init] autorelease]; + [parser parse:s]; + // id res = [parser parse:s]; + //NSLog(@"res %@", res); +} + +@end diff --git a/test/TDGenericAssembler.h b/test/TDGenericAssembler.h new file mode 100644 index 0000000..6c502db --- /dev/null +++ b/test/TDGenericAssembler.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKAssembly; + +@interface TDGenericAssembler : NSObject { + NSMutableDictionary *attributes; + NSMutableDictionary *defaultProperties; + NSMutableDictionary *productionNames; + PKAssembly *currentAssembly; + NSString *prefix; + NSString *suffix; +} +@property (nonatomic, retain) NSMutableDictionary *attributes; +@property (nonatomic, retain) NSMutableDictionary *defaultProperties; +@property (nonatomic, retain) NSMutableDictionary *productionNames; +@property (nonatomic, retain) PKAssembly *currentAssembly; +@end diff --git a/test/TDGenericAssembler.m b/test/TDGenericAssembler.m new file mode 100644 index 0000000..31921fd --- /dev/null +++ b/test/TDGenericAssembler.m @@ -0,0 +1,175 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDGenericAssembler.h" +#import "NSArray+ParseKitAdditions.h" +#import + +@interface TDGenericAssembler () +- (void)didMatchTerminalNamed:(NSString *)name withAssembly:(PKAssembly *)a; +- (void)appendAttributedStringForObjects:(NSArray *)objs withAttrs:(id)attrs; +- (void)appendAttributedStringForObject:(id)obj withAttrs:(id)attrs; +- (NSMutableArray *)popWhitespaceTokensFrom:(PKAssembly *)a; +- (void)consumeWhitespaceTokens:(NSArray *)whitespaceToks; +- (void)consumeWhitespaceToken:(PKToken *)whitespaceTok; +- (void)consumeWhitespaceFrom:(PKAssembly *)a; + +@property (nonatomic, retain) NSString *prefix; +@property (nonatomic, retain) NSString *suffix; +@end + +@implementation TDGenericAssembler + +- (id)init { + if (self = [super init]) { + self.productionNames = [NSMutableDictionary dictionary]; + self.defaultProperties = [NSDictionary dictionaryWithObjectsAndKeys: + [NSColor blackColor], NSForegroundColorAttributeName, + [NSColor whiteColor], NSBackgroundColorAttributeName, + [NSFont fontWithName:@"Monaco" size:11.0], NSFontAttributeName, + nil]; + self.prefix = @"didMatch"; + self.suffix = @":"; + } + return self; +} + + +- (void)dealloc { + self.attributes = nil; + self.defaultProperties = nil; + self.productionNames = nil; + self.currentAssembly = nil; + self.prefix = nil; + self.suffix = nil; + [super dealloc]; +} + + +- (BOOL)respondsToSelector:(SEL)sel { + return YES; +} + + +- (id)performSelector:(SEL)sel withObject:(id)obj { + NSString *selName = NSStringFromSelector(sel); + + NSString *productionName = [productionNames objectForKey:selName]; + + if (!productionName) { + NSUInteger prefixLen = [prefix length]; + NSInteger c = ((NSInteger)[selName characterAtIndex:prefixLen]) + 32; // lowercase + NSRange r = NSMakeRange(prefixLen + 1, [selName length] - (prefixLen + [suffix length] + 1 /*:*/)); + productionName = [NSString stringWithFormat:@"%C%@", c, [selName substringWithRange:r]]; + [productionNames setObject:productionName forKey:selName]; + } + + [self didMatchTerminalNamed:productionName withAssembly:obj]; + + return nil; +} + + +- (void)didMatchTerminalNamed:(NSString *)name withAssembly:(PKAssembly *)a { + //NSLog(@"%@ : %@", name, a); + self.currentAssembly = a; + NSMutableArray *whitespaceToks = [self popWhitespaceTokensFrom:a]; + + id props = [attributes objectForKey:name]; + if (!props) props = defaultProperties; + + NSMutableArray *toks = nil; + PKToken *tok = nil; + while (tok = [a pop]) { + if (PKTokenTypeWhitespace != tok.tokenType) { + if (!toks) toks = [NSMutableArray array]; + [toks addObject:tok]; + } else { + [self consumeWhitespaceToken:tok]; + break; + } + } + + [self consumeWhitespaceFrom:a]; + [self appendAttributedStringForObjects:toks withAttrs:props]; + [self consumeWhitespaceTokens:whitespaceToks]; +} + + +- (void)appendAttributedStringForObjects:(NSArray *)objs withAttrs:(id)attrs { + for (id obj in objs) { + [self appendAttributedStringForObject:obj withAttrs:attrs]; + } +} + + +- (void)appendAttributedStringForObject:(id)obj withAttrs:(id)attrs { + NSMutableAttributedString *displayString = currentAssembly.target; + if (!displayString) { + displayString = [[[NSMutableAttributedString alloc] initWithString:@"" attributes:nil] autorelease]; + currentAssembly.target = displayString; + } + + + NSAttributedString *as = [[NSAttributedString alloc] initWithString:[obj stringValue] attributes:attrs]; + [displayString appendAttributedString:as]; + [as release]; +} + + +- (NSMutableArray *)popWhitespaceTokensFrom:(PKAssembly *)a { + NSMutableArray *whitespaceToks = nil; + PKToken *tok = nil; + while (tok = [a pop]) { + if (PKTokenTypeWhitespace == tok.tokenType) { + if (!whitespaceToks) { + whitespaceToks = [NSMutableArray array]; + } + [whitespaceToks addObject:tok]; + } else { + [a push:tok]; + break; + } + } + if (whitespaceToks) { + whitespaceToks = [whitespaceToks reversedMutableArray]; + } + return whitespaceToks; +} + + +- (void)consumeWhitespaceTokens:(NSArray *)whitespaceToks { + [self appendAttributedStringForObjects:whitespaceToks withAttrs:nil]; +} + + +- (void)consumeWhitespaceToken:(PKToken *)whitespaceTok { + [self appendAttributedStringForObject:whitespaceTok withAttrs:nil]; +} + + +- (void)consumeWhitespaceFrom:(PKAssembly *)a { + NSMutableArray *whitespaceToks = [self popWhitespaceTokensFrom:a]; + if (whitespaceToks) { + [self consumeWhitespaceTokens:whitespaceToks]; + } +} + +@synthesize attributes; +@synthesize defaultProperties; +@synthesize productionNames; +@synthesize currentAssembly; +@synthesize prefix; +@synthesize suffix; +@end diff --git a/test/TDGenericAssemblerTest.h b/test/TDGenericAssemblerTest.h new file mode 100644 index 0000000..006cc69 --- /dev/null +++ b/test/TDGenericAssemblerTest.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" +#import "TDMiniCSSAssembler.h" +#import "TDGenericAssembler.h" + +@interface TDGenericAssemblerTest : SenTestCase { + NSString *path; + NSString *grammarString; + NSString *s; + TDMiniCSSAssembler *cssAssember; + PKParserFactory *factory; + PKParser *cssParser; + PKAssembly *a; + TDGenericAssembler *genericAssember; +} + +@end diff --git a/test/TDGenericAssemblerTest.m b/test/TDGenericAssemblerTest.m new file mode 100644 index 0000000..2b26d93 --- /dev/null +++ b/test/TDGenericAssemblerTest.m @@ -0,0 +1,72 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDGenericAssemblerTest.h" + +@implementation TDGenericAssemblerTest + +- (void)setUp { + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + cssAssember = [[TDMiniCSSAssembler alloc] init]; + factory = [PKParserFactory factory]; + cssParser = [factory parserFromGrammar:grammarString assembler:cssAssember]; +} + + +- (void)tearDown { + [cssAssember release]; +} + + +- (void)testColor { + TDNotNil(cssParser); + + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"css"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + a = [PKTokenAssembly assemblyWithString:s]; + a = [cssParser bestMatchFor:a]; + + TDNotNil(cssAssember.attributes); + id props = [cssAssember.attributes objectForKey:@"openCurly"]; + TDNotNil(props); + +// color:red; +// background-color:blue; +// font-family:'Helvetica'; +// font-size:17px; + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEqualObjects([font familyName], @"Monaco"); + TDEquals((CGFloat)[font pointSize], (CGFloat)11.0); + + NSColor *bgColor = [props objectForKey:NSBackgroundColorAttributeName]; + TDNotNil(bgColor); + STAssertEqualsWithAccuracy([bgColor redComponent], (CGFloat)0.117, 0.001, @""); + STAssertEqualsWithAccuracy([bgColor greenComponent], (CGFloat)0.117, 0.001, @""); + STAssertEqualsWithAccuracy([bgColor blueComponent], (CGFloat)0.141, 0.001, @""); + + NSColor *color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)0.7, 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)0.14, 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)0.530, 0.001, @""); + +} + + + + +@end diff --git a/test/TDHtmlSyntaxHighlighter.h b/test/TDHtmlSyntaxHighlighter.h new file mode 100644 index 0000000..7eb7803 --- /dev/null +++ b/test/TDHtmlSyntaxHighlighter.h @@ -0,0 +1,60 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKTokenizer; +@class PKToken; + +@interface TDHtmlSyntaxHighlighter : NSObject { + BOOL isDarkBG; + BOOL inScript; + PKTokenizer *tokenizer; + NSMutableArray *stack; + PKToken *ltToken; + PKToken *gtToken; + PKToken *startCommentToken; + PKToken *endCommentToken; + PKToken *startCDATAToken; + PKToken *endCDATAToken; + PKToken *startPIToken; + PKToken *endPIToken; + PKToken *startDoctypeToken; + PKToken *fwdSlashToken; + PKToken *eqToken; + PKToken *scriptToken; + PKToken *endScriptToken; + + NSMutableAttributedString *highlightedString; + NSDictionary *tagAttributes; + NSDictionary *textAttributes; + NSDictionary *attrNameAttributes; + NSDictionary *attrValueAttributes; + NSDictionary *eqAttributes; + NSDictionary *commentAttributes; + NSDictionary *piAttributes; +} +- (id)initWithAttributesForDarkBackground:(BOOL)isDark; + +- (NSAttributedString *)attributedStringForString:(NSString *)s; + +@property (nonatomic, retain) NSMutableAttributedString *highlightedString; +@property (nonatomic, retain) NSDictionary *tagAttributes; +@property (nonatomic, retain) NSDictionary *textAttributes; +@property (nonatomic, retain) NSDictionary *attrNameAttributes; +@property (nonatomic, retain) NSDictionary *attrValueAttributes; +@property (nonatomic, retain) NSDictionary *eqAttributes; +@property (nonatomic, retain) NSDictionary *commentAttributes; +@property (nonatomic, retain) NSDictionary *piAttributes; +@end diff --git a/test/TDHtmlSyntaxHighlighter.m b/test/TDHtmlSyntaxHighlighter.m new file mode 100644 index 0000000..28c5747 --- /dev/null +++ b/test/TDHtmlSyntaxHighlighter.m @@ -0,0 +1,583 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDHtmlSyntaxHighlighter.h" +#import "NSArray+ParseKitAdditions.h" +#import + +@interface TDHtmlSyntaxHighlighter () +- (void)didMatchTag; +- (void)didMatchText; +- (void)didMatchComment; +- (void)didMatchCDATA; +- (void)didMatchPI; +- (void)didMatchDoctype; +- (void)didMatchScript; +- (id)peek; +- (id)pop; +- (NSArray *)objectsAbove:(id)fence; +- (PKToken *)nextNonWhitespaceTokenFrom:(NSEnumerator *)e; +- (void)consumeWhitespaceOnStack; + +@property (retain) PKTokenizer *tokenizer; +@property (retain) NSMutableArray *stack; +@property (retain) PKToken *ltToken; +@property (retain) PKToken *gtToken; +@property (retain) PKToken *startCommentToken; +@property (retain) PKToken *endCommentToken; +@property (retain) PKToken *startCDATAToken; +@property (retain) PKToken *endCDATAToken; +@property (retain) PKToken *startPIToken; +@property (retain) PKToken *endPIToken; +@property (retain) PKToken *startDoctypeToken; +@property (retain) PKToken *fwdSlashToken; +@property (retain) PKToken *eqToken; +@property (retain) PKToken *scriptToken; +@property (retain) PKToken *endScriptToken; +@end + +@implementation TDHtmlSyntaxHighlighter + +- (id)init { + return [self initWithAttributesForDarkBackground:NO]; +} + + +- (id)initWithAttributesForDarkBackground:(BOOL)isDark { + if (self = [super init]) { + isDarkBG = isDark; + self.tokenizer = [PKTokenizer tokenizer]; + + [tokenizer setTokenizerState:tokenizer.symbolState from:'/' to:'/']; // XML doesn't have slash slash or slash star comments + tokenizer.whitespaceState.reportsWhitespaceTokens = YES; + [tokenizer.wordState setWordChars:YES from:':' to:':']; + + self.ltToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"<" floatValue:0.0]; + self.gtToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@">" floatValue:0.0]; + + self.startCommentToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"" floatValue:0.0]; + [tokenizer.symbolState add:startCommentToken.stringValue]; + [tokenizer.symbolState add:endCommentToken.stringValue]; + + self.startCDATAToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"" floatValue:0.0]; + [tokenizer.symbolState add:startCDATAToken.stringValue]; + [tokenizer.symbolState add:endCDATAToken.stringValue]; + + self.startPIToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"" floatValue:0.0]; + [tokenizer.symbolState add:startPIToken.stringValue]; + [tokenizer.symbolState add:endPIToken.stringValue]; + + self.startDoctypeToken = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"" floatValue:0.0]; +// [tokenizer.symbolState add:endScriptToken.stringValue]; + + NSFont *monacoFont = [NSFont fontWithName:@"Monaco" size:11.]; + + NSColor *textColor = nil; + NSColor *tagColor = nil; + NSColor *attrNameColor = nil; + NSColor *attrValueColor = nil; + NSColor *eqColor = nil; + NSColor *commentColor = nil; + NSColor *piColor = nil; + + if (isDarkBG) { + textColor = [NSColor whiteColor]; + tagColor = [NSColor colorWithDeviceRed:.70 green:.14 blue:.53 alpha:1.]; + attrNameColor = [NSColor colorWithDeviceRed:.33 green:.45 blue:.48 alpha:1.]; + attrValueColor = [NSColor colorWithDeviceRed:.77 green:.18 blue:.20 alpha:1.]; + eqColor = tagColor; + commentColor = [NSColor colorWithDeviceRed:.24 green:.70 blue:.27 alpha:1.]; + piColor = [NSColor colorWithDeviceRed:.09 green:.62 blue:.74 alpha:1.]; + } else { + textColor = [NSColor blackColor]; + tagColor = [NSColor purpleColor]; + attrNameColor = [NSColor colorWithDeviceRed:0. green:0. blue:.75 alpha:1.]; + attrValueColor = [NSColor colorWithDeviceRed:.75 green:0. blue:0. alpha:1.]; + eqColor = [NSColor darkGrayColor]; + commentColor = [NSColor grayColor]; + piColor = [NSColor colorWithDeviceRed:.09 green:.62 blue:.74 alpha:1.]; + } + + self.textAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + textColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.tagAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + tagColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.attrNameAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + attrNameColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.attrValueAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + attrValueColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.eqAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + eqColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.commentAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + commentColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + self.piAttributes = [NSDictionary dictionaryWithObjectsAndKeys: + piColor, NSForegroundColorAttributeName, + monacoFont, NSFontAttributeName, + nil]; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.stack = nil; + self.ltToken = nil; + self.gtToken = nil; + self.startCommentToken = nil; + self.endCommentToken = nil; + self.startCDATAToken = nil; + self.endCDATAToken = nil; + self.startPIToken = nil; + self.endPIToken = nil; + self.startDoctypeToken = nil; + self.fwdSlashToken = nil; + self.eqToken = nil; + self.scriptToken = nil; + self.endScriptToken = nil; + self.highlightedString = nil; + self.textAttributes = nil; + self.tagAttributes = nil; + self.attrNameAttributes = nil; + self.attrValueAttributes = nil; + self.eqAttributes = nil; + self.commentAttributes = nil; + self.piAttributes = nil; + [super dealloc]; +} + + +- (NSAttributedString *)attributedStringForString:(NSString *)s { + self.stack = [NSMutableArray array]; + self.highlightedString = [[[NSMutableAttributedString alloc] init] autorelease]; + + tokenizer.string = s; + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + BOOL inComment = NO; + BOOL inCDATA = NO; + BOOL inPI = NO; + BOOL inDoctype = NO; + + while ((tok = [tokenizer nextToken]) != eof) { + + if (!inComment && !inCDATA && !inPI && !inDoctype && !inScript && tok.isSymbol) { + if ([startCommentToken isEqual:tok]) { + [stack addObject:tok]; + inComment = YES; + } else if ([startCDATAToken isEqual:tok]) { + [stack addObject:tok]; + inCDATA = YES; + } else if ([startPIToken isEqual:tok]) { + [stack addObject:tok]; + inPI = YES; + } else if ([startDoctypeToken isEqual:tok]) { + [stack addObject:tok]; + inDoctype = YES; + } else if ([ltToken isEqual:tok]) { + [self didMatchText]; + [stack addObject:tok]; + } else if ([gtToken isEqual:tok]) { + [stack addObject:tok]; + [self didMatchTag]; + } else { + [stack addObject:tok]; + } + } else if (inComment && [endCommentToken isEqual:tok]) { + inComment = NO; + [stack addObject:tok]; + [self didMatchComment]; + } else if (inCDATA && [endCDATAToken isEqual:tok]) { + inCDATA = NO; + [stack addObject:tok]; + [self didMatchCDATA]; + } else if (inPI && [endPIToken isEqual:tok]) { + inPI = NO; + [stack addObject:tok]; + [self didMatchPI]; + } else if (inDoctype && [gtToken isEqual:tok]) { + inDoctype = NO; + [stack addObject:tok]; + [self didMatchDoctype]; + } else if (inScript && [endScriptToken isEqual:tok]) { + inScript = NO; + [stack addObject:tok]; + [self didMatchScript]; + } else { + [stack addObject:tok]; + } + } + + // handle case where no elements were encountered (plain text basically) + if (![highlightedString length]) { + PKToken *tok = nil; + while (tok = [self pop]) { + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:textAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + NSAttributedString *result = [[highlightedString copy] autorelease]; + self.stack = nil; + self.highlightedString = nil; + tokenizer.string = nil; + return result; +} + + +- (PKToken *)nextNonWhitespaceTokenFrom:(NSEnumerator *)e { + PKToken *tok = [e nextObject]; + while (tok.isWhitespace) { + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + tok = [e nextObject]; + } + return tok; +} + + +- (void)consumeWhitespaceOnStack { + PKToken *tok = [self peek]; + while (tok.isWhitespace) { + tok = [self pop]; + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + tok = [self peek]; + } +} + + +- (void)didMatchComment { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:startCommentToken] reversedMutableArray]; + + [self consumeWhitespaceOnStack]; + + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:startCommentToken.stringValue attributes:commentAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + NSEnumerator *e = [toks objectEnumerator]; + + PKToken *tok = nil; + while (tok = [self nextNonWhitespaceTokenFrom:e]) { + if ([tok isEqual:endCommentToken]) { + break; + } else { + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:commentAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:commentAttributes] autorelease]; + [highlightedString appendAttributedString:as]; +} + + +- (void)didMatchCDATA { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:startCDATAToken] reversedMutableArray]; + + [self consumeWhitespaceOnStack]; + + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:startCDATAToken.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + NSEnumerator *e = [toks objectEnumerator]; + + PKToken *tok = nil; + while (tok = [self nextNonWhitespaceTokenFrom:e]) { + if ([tok isEqual:endCDATAToken]) { + break; + } else { + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:textAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; +} + + +- (void)didMatchPI { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:startPIToken] reversedMutableArray]; + + [self consumeWhitespaceOnStack]; + + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:startPIToken.stringValue attributes:piAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + NSEnumerator *e = [toks objectEnumerator]; + + PKToken *tok = nil; + while (tok = [self nextNonWhitespaceTokenFrom:e]) { + if ([tok isEqual:endPIToken]) { + break; + } else { + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:piAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:piAttributes] autorelease]; + [highlightedString appendAttributedString:as]; +} + + +- (void)didMatchDoctype { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:startDoctypeToken] reversedMutableArray]; + + [self consumeWhitespaceOnStack]; + + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:startDoctypeToken.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + NSEnumerator *e = [toks objectEnumerator]; + + PKToken *tok = nil; + while (tok = [self nextNonWhitespaceTokenFrom:e]) { + if ([tok isEqual:gtToken]) { + break; + } else { + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; +} + + +- (void)didMatchScript { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:startDoctypeToken] reversedMutableArray]; + + NSEnumerator *e = [toks objectEnumerator]; + NSAttributedString *as = nil; + + PKToken *tok = nil; + while (tok = [self nextNonWhitespaceTokenFrom:e]) { + if ([tok isEqual:endScriptToken]) { + break; + } else { + NSDictionary *attrs = nil; + if ([tok isEqual:scriptToken] || [tok isEqual:ltToken] || [tok isEqual:fwdSlashToken]) { + attrs = tagAttributes; + } else { + attrs = textAttributes; + } + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:attrs] autorelease]; + [highlightedString appendAttributedString:as]; + } + } + + as = [[[NSAttributedString alloc] initWithString:endScriptToken.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; +} + + +- (void)didMatchStartTag:(NSEnumerator *)e { + while (1) { + // attr name or ns prefix decl "xmlns:foo" or "/" for empty element + PKToken *tok = [self nextNonWhitespaceTokenFrom:e]; + if (!tok) return; + + NSDictionary *attrs = nil; + if ([tok isEqual:eqToken]) { + attrs = eqAttributes; + } else if ([tok isEqual:fwdSlashToken] || [tok isEqual:gtToken]) { + attrs = tagAttributes; + } else if (tok.isQuotedString) { + attrs = attrValueAttributes; + } else { + attrs = attrNameAttributes; + } + + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:attrs] autorelease]; + [highlightedString appendAttributedString:as]; + + // "=" + tok = [self nextNonWhitespaceTokenFrom:e]; + if (!tok) return; + + if ([tok isEqual:eqToken]) { + attrs = eqAttributes; + } else if ([tok isEqual:fwdSlashToken] || [tok isEqual:gtToken]) { + attrs = tagAttributes; + } else if (tok.isQuotedString) { + attrs = attrValueAttributes; + } else { + attrs = tagAttributes; + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:attrs] autorelease]; + [highlightedString appendAttributedString:as]; + + // quoted string attr value or ns url value + tok = [self nextNonWhitespaceTokenFrom:e]; + if (!tok) return; + + if ([tok isEqual:fwdSlashToken] || [tok isEqual:gtToken]) { + attrs = tagAttributes; + } else { + attrs = attrValueAttributes; + } + + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:attrs] autorelease]; + [highlightedString appendAttributedString:as]; + } +} + + +- (void)didMatchEndTag:(NSEnumerator *)e { + // consume tagName to ">" + PKToken *tok = nil; + while (tok = [e nextObject]) { + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } +} + + +- (void)didMatchTag { + // reverse toks to be in document order + NSMutableArray *toks = [[self objectsAbove:nil] reversedMutableArray]; + NSAttributedString *as = nil; + + NSEnumerator *e = [toks objectEnumerator]; + + // append "<" + [self nextNonWhitespaceTokenFrom:e]; // discard + as = [[[NSAttributedString alloc] initWithString:ltToken.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + // consume whitespace to tagName or "/" for end tags or "!" for comments + PKToken *tok = [self nextNonWhitespaceTokenFrom:e]; + + if (tok) { + if ([tok isEqual:scriptToken]) { + inScript = YES; + } else { + inScript = NO; + } + + // consume tagName or "/" or "!" + as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:tagAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + + if ([tok isEqual:fwdSlashToken]) { + [self didMatchEndTag:e]; + } else { + [self didMatchStartTag:e]; + } + } +} + + +- (void)didMatchText { + NSArray *a = [self objectsAbove:gtToken]; + for (PKToken *tok in [a reverseObjectEnumerator]) { + NSString *s = tok.stringValue; + if (s) { + NSAttributedString *as = [[[NSAttributedString alloc] initWithString:tok.stringValue attributes:textAttributes] autorelease]; + [highlightedString appendAttributedString:as]; + } + } +} + + +- (NSArray *)objectsAbove:(id)fence { + NSMutableArray *res = [NSMutableArray array]; + while (1) { + if (![stack count]) { + break; + } + id obj = [self pop]; + if ([obj isEqual:fence]) { + break; + } + [res addObject:obj]; + } + return res; +} + + +- (id)peek { + id obj = nil; + if ([stack count]) { + obj = [stack lastObject]; + } + return obj; +} + + +- (id)pop { + id obj = [self peek]; + if (obj) { + [stack removeLastObject]; + } + return obj; +} + +@synthesize stack; +@synthesize tokenizer; +@synthesize ltToken; +@synthesize gtToken; +@synthesize startCommentToken; +@synthesize endCommentToken; +@synthesize startCDATAToken; +@synthesize endCDATAToken; +@synthesize startPIToken; +@synthesize endPIToken; +@synthesize startDoctypeToken; +@synthesize fwdSlashToken; +@synthesize eqToken; +@synthesize scriptToken; +@synthesize endScriptToken; +@synthesize highlightedString; +@synthesize tagAttributes; +@synthesize textAttributes; +@synthesize attrNameAttributes; +@synthesize attrValueAttributes; +@synthesize eqAttributes; +@synthesize commentAttributes; +@synthesize piAttributes; +@end diff --git a/test/TDJavaScriptParser.h b/test/TDJavaScriptParser.h new file mode 100644 index 0000000..b1a4f78 --- /dev/null +++ b/test/TDJavaScriptParser.h @@ -0,0 +1,350 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface TDJavaScriptParser : PKRepetition { + PKCollectionParser *assignmentOpParser; + PKCollectionParser *relationalOpParser; + PKCollectionParser *equalityOpParser; + PKCollectionParser *shiftOpParser; + PKCollectionParser *incrementOpParser; + PKCollectionParser *unaryOpParser; + PKCollectionParser *multiplicativeOpParser; + + PKCollectionParser *programParser; + PKCollectionParser *elementParser; + PKCollectionParser *funcParser; + PKCollectionParser *paramListOptParser; + PKCollectionParser *paramListParser; + PKCollectionParser *commaIdentifierParser; + PKCollectionParser *compoundStmtParser; + PKCollectionParser *stmtsParser; + PKCollectionParser *stmtParser; + PKCollectionParser *ifStmtParser; + PKCollectionParser *ifElseStmtParser; + PKCollectionParser *whileStmtParser; + PKCollectionParser *forParenStmtParser; + PKCollectionParser *forBeginStmtParser; + PKCollectionParser *forInStmtParser; + PKCollectionParser *breakStmtParser; + PKCollectionParser *continueStmtParser; + PKCollectionParser *withStmtParser; + PKCollectionParser *returnStmtParser; + PKCollectionParser *variablesOrExprStmtParser; + PKCollectionParser *conditionParser; + PKCollectionParser *forParenParser; + PKCollectionParser *forBeginParser; + PKCollectionParser *variablesOrExprParser; + PKCollectionParser *varVariablesParser; + PKCollectionParser *variablesParser; + PKCollectionParser *commaVariableParser; + PKCollectionParser *variableParser; + PKCollectionParser *assignmentParser; + PKCollectionParser *exprOptParser; + PKCollectionParser *exprParser; + PKCollectionParser *commaAssignmentExprParser; + PKCollectionParser *assignmentExprParser; + PKCollectionParser *assignmentOpConditionalExprParser; + PKCollectionParser *conditionalExprParser; + PKCollectionParser *ternaryExprParser; + PKCollectionParser *orExprParser; + PKCollectionParser *orAndExprParser; + PKCollectionParser *andExprParser; + PKCollectionParser *andBitwiseOrExprParser; + PKCollectionParser *bitwiseOrExprParser; + PKCollectionParser *pipeBitwiseXorExprParser; + PKCollectionParser *bitwiseXorExprParser; + PKCollectionParser *caretBitwiseAndExprParser; + PKCollectionParser *bitwiseAndExprParser; + PKCollectionParser *ampEqualityExprParser; + PKCollectionParser *equalityExprParser; + PKCollectionParser *equalityOpRelationalExprParser; + PKCollectionParser *relationalExprParser; + PKCollectionParser *relationalOpShiftExprParser; + PKCollectionParser *shiftExprParser; + PKCollectionParser *shiftOpAdditiveExprParser; + PKCollectionParser *additiveExprParser; + PKCollectionParser *plusOrMinusExprParser; + PKCollectionParser *plusExprParser; + PKCollectionParser *minusExprParser; + PKCollectionParser *multiplicativeExprParser; + PKCollectionParser *multiplicativeOpUnaryExprParser; + PKCollectionParser *unaryExprParser; + PKCollectionParser *unaryExpr1Parser; + PKCollectionParser *unaryExpr2Parser; + PKCollectionParser *unaryExpr3Parser; + PKCollectionParser *unaryExpr4Parser; + PKCollectionParser *unaryExpr5Parser; + PKCollectionParser *unaryExpr6Parser; + PKCollectionParser *constructorCallParser; + PKCollectionParser *parenArgListOptParenParser; + PKCollectionParser *memberExprParser; + PKCollectionParser *memberExprExtParser; + PKCollectionParser *dotMemberExprParser; + PKCollectionParser *bracketMemberExprParser; + PKCollectionParser *argListOptParser; + PKCollectionParser *argListParser; + PKCollectionParser *primaryExprParser; + PKCollectionParser *parenExprParenParser; + + PKCollectionParser *funcLiteralParser; + PKCollectionParser *arrayLiteralParser; + PKCollectionParser *objectLiteralParser; + + PKParser *identifierParser; + PKParser *stringParser; + PKParser *numberParser; + + // keywords + PKParser *ifParser; + PKParser *elseParser; + PKParser *whileParser; + PKParser *forParser; + PKParser *inParser; + PKParser *breakParser; + PKParser *continueParser; + PKParser *withParser; + PKParser *returnParser; + PKParser *varParser; + PKParser *deleteParser; + PKParser *newParser; + PKParser *thisParser; + PKParser *falseParser; + PKParser *trueParser; + PKParser *nullParser; + PKParser *undefinedParser; + PKParser *voidParser; + PKParser *typeofParser; + PKParser *instanceofParser; + PKParser *functionParser; + + // multi-char symbols + PKParser *orParser; + PKParser *andParser; + PKParser *neParser; + PKParser *isNotParser; + PKParser *eqParser; + PKParser *isParser; + PKParser *leParser; + PKParser *geParser; + PKParser *plusPlusParser; + PKParser *minusMinusParser; + PKParser *plusEqParser; + PKParser *minusEqParser; + PKParser *timesEqParser; + PKParser *divEqParser; + PKParser *modEqParser; + PKParser *shiftLeftParser; + PKParser *shiftRightParser; + PKParser *shiftRightExtParser; + PKParser *shiftLeftEqParser; + PKParser *shiftRightEqParser; + PKParser *shiftRightExtEqParser; + PKParser *andEqParser; + PKParser *xorEqParser; + PKParser *orEqParser; + + // single char symbols + PKParser *openCurlyParser; + PKParser *closeCurlyParser; + PKParser *openParenParser; + PKParser *closeParenParser; + PKParser *openBracketParser; + PKParser *closeBracketParser; + PKParser *commaParser; + PKParser *dotParser; + PKParser *semiOptParser; + PKParser *semiParser; + PKParser *colonParser; + PKParser *equalsParser; + PKParser *notParser; + PKParser *ltParser; + PKParser *gtParser; + PKParser *ampParser; + PKParser *pipeParser; + PKParser *caretParser; + PKParser *tildeParser; + PKParser *questionParser; + PKParser *plusParser; + PKParser *minusParser; + PKParser *timesParser; + PKParser *divParser; + PKParser *modParser; +} +@property (nonatomic, retain) PKCollectionParser *assignmentOpParser; +@property (nonatomic, retain) PKCollectionParser *relationalOpParser; +@property (nonatomic, retain) PKCollectionParser *equalityOpParser; +@property (nonatomic, retain) PKCollectionParser *shiftOpParser; +@property (nonatomic, retain) PKCollectionParser *incrementOpParser; +@property (nonatomic, retain) PKCollectionParser *unaryOpParser; +@property (nonatomic, retain) PKCollectionParser *multiplicativeOpParser; + +@property (nonatomic, retain) PKCollectionParser *programParser; +@property (nonatomic, retain) PKCollectionParser *elementParser; +@property (nonatomic, retain) PKCollectionParser *funcParser; +@property (nonatomic, retain) PKCollectionParser *paramListOptParser; +@property (nonatomic, retain) PKCollectionParser *paramListParser; +@property (nonatomic, retain) PKCollectionParser *commaIdentifierParser; +@property (nonatomic, retain) PKCollectionParser *compoundStmtParser; +@property (nonatomic, retain) PKCollectionParser *stmtsParser; +@property (nonatomic, retain) PKCollectionParser *stmtParser; +@property (nonatomic, retain) PKCollectionParser *ifStmtParser; +@property (nonatomic, retain) PKCollectionParser *ifElseStmtParser; +@property (nonatomic, retain) PKCollectionParser *whileStmtParser; +@property (nonatomic, retain) PKCollectionParser *forParenStmtParser; +@property (nonatomic, retain) PKCollectionParser *forBeginStmtParser; +@property (nonatomic, retain) PKCollectionParser *forInStmtParser; +@property (nonatomic, retain) PKCollectionParser *breakStmtParser; +@property (nonatomic, retain) PKCollectionParser *continueStmtParser; +@property (nonatomic, retain) PKCollectionParser *withStmtParser; +@property (nonatomic, retain) PKCollectionParser *returnStmtParser; +@property (nonatomic, retain) PKCollectionParser *variablesOrExprStmtParser; +@property (nonatomic, retain) PKCollectionParser *conditionParser; +@property (nonatomic, retain) PKCollectionParser *forParenParser; +@property (nonatomic, retain) PKCollectionParser *forBeginParser; +@property (nonatomic, retain) PKCollectionParser *variablesOrExprParser; +@property (nonatomic, retain) PKCollectionParser *varVariablesParser; +@property (nonatomic, retain) PKCollectionParser *variablesParser; +@property (nonatomic, retain) PKCollectionParser *commaVariableParser; +@property (nonatomic, retain) PKCollectionParser *variableParser; +@property (nonatomic, retain) PKCollectionParser *assignmentParser; +@property (nonatomic, retain) PKCollectionParser *exprOptParser; +@property (nonatomic, retain) PKCollectionParser *exprParser; +@property (nonatomic, retain) PKCollectionParser *commaAssignmentExprParser; +@property (nonatomic, retain) PKCollectionParser *assignmentExprParser; +@property (nonatomic, retain) PKCollectionParser *assignmentOpConditionalExprParser; +@property (nonatomic, retain) PKCollectionParser *conditionalExprParser; +@property (nonatomic, retain) PKCollectionParser *ternaryExprParser; +@property (nonatomic, retain) PKCollectionParser *orExprParser; +@property (nonatomic, retain) PKCollectionParser *orAndExprParser; +@property (nonatomic, retain) PKCollectionParser *andExprParser; +@property (nonatomic, retain) PKCollectionParser *andBitwiseOrExprParser; +@property (nonatomic, retain) PKCollectionParser *bitwiseOrExprParser; +@property (nonatomic, retain) PKCollectionParser *pipeBitwiseXorExprParser; +@property (nonatomic, retain) PKCollectionParser *bitwiseXorExprParser; +@property (nonatomic, retain) PKCollectionParser *caretBitwiseAndExprParser; +@property (nonatomic, retain) PKCollectionParser *bitwiseAndExprParser; +@property (nonatomic, retain) PKCollectionParser *ampEqualityExprParser; +@property (nonatomic, retain) PKCollectionParser *equalityExprParser; +@property (nonatomic, retain) PKCollectionParser *equalityOpRelationalExprParser; +@property (nonatomic, retain) PKCollectionParser *relationalExprParser; +@property (nonatomic, retain) PKCollectionParser *relationalOpShiftExprParser; +@property (nonatomic, retain) PKCollectionParser *shiftExprParser; +@property (nonatomic, retain) PKCollectionParser *shiftOpAdditiveExprParser; +@property (nonatomic, retain) PKCollectionParser *additiveExprParser; +@property (nonatomic, retain) PKCollectionParser *plusOrMinusExprParser; +@property (nonatomic, retain) PKCollectionParser *plusExprParser; +@property (nonatomic, retain) PKCollectionParser *minusExprParser; +@property (nonatomic, retain) PKCollectionParser *multiplicativeExprParser; +@property (nonatomic, retain) PKCollectionParser *multiplicativeOpUnaryExprParser; +@property (nonatomic, retain) PKCollectionParser *unaryExprParser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr1Parser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr2Parser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr3Parser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr4Parser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr5Parser; +@property (nonatomic, retain) PKCollectionParser *unaryExpr6Parser; +@property (nonatomic, retain) PKCollectionParser *constructorCallParser; +@property (nonatomic, retain) PKCollectionParser *parenArgListOptParenParser; +@property (nonatomic, retain) PKCollectionParser *memberExprParser; +@property (nonatomic, retain) PKCollectionParser *memberExprExtParser; +@property (nonatomic, retain) PKCollectionParser *dotMemberExprParser; +@property (nonatomic, retain) PKCollectionParser *bracketMemberExprParser; +@property (nonatomic, retain) PKCollectionParser *argListOptParser; +@property (nonatomic, retain) PKCollectionParser *argListParser; +@property (nonatomic, retain) PKCollectionParser *primaryExprParser; +@property (nonatomic, retain) PKCollectionParser *parenExprParenParser; + +@property (nonatomic, retain) PKCollectionParser *funcLiteralParser; +@property (nonatomic, retain) PKCollectionParser *arrayLiteralParser; +@property (nonatomic, retain) PKCollectionParser *objectLiteralParser; + +@property (nonatomic, retain) PKParser *identifierParser; +@property (nonatomic, retain) PKParser *stringParser; +@property (nonatomic, retain) PKParser *numberParser; + +@property (nonatomic, retain) PKParser *ifParser; +@property (nonatomic, retain) PKParser *elseParser; +@property (nonatomic, retain) PKParser *whileParser; +@property (nonatomic, retain) PKParser *forParser; +@property (nonatomic, retain) PKParser *inParser; +@property (nonatomic, retain) PKParser *breakParser; +@property (nonatomic, retain) PKParser *continueParser; +@property (nonatomic, retain) PKParser *withParser; +@property (nonatomic, retain) PKParser *returnParser; +@property (nonatomic, retain) PKParser *varParser; +@property (nonatomic, retain) PKParser *deleteParser; +@property (nonatomic, retain) PKParser *newParser; +@property (nonatomic, retain) PKParser *thisParser; +@property (nonatomic, retain) PKParser *falseParser; +@property (nonatomic, retain) PKParser *trueParser; +@property (nonatomic, retain) PKParser *nullParser; +@property (nonatomic, retain) PKParser *undefinedParser; +@property (nonatomic, retain) PKParser *voidParser; +@property (nonatomic, retain) PKParser *typeofParser; +@property (nonatomic, retain) PKParser *instanceofParser; +@property (nonatomic, retain) PKParser *functionParser; + +@property (nonatomic, retain) PKParser *orParser; +@property (nonatomic, retain) PKParser *andParser; +@property (nonatomic, retain) PKParser *neParser; +@property (nonatomic, retain) PKParser *isNotParser; +@property (nonatomic, retain) PKParser *eqParser; +@property (nonatomic, retain) PKParser *isParser; +@property (nonatomic, retain) PKParser *leParser; +@property (nonatomic, retain) PKParser *geParser; +@property (nonatomic, retain) PKParser *plusPlusParser; +@property (nonatomic, retain) PKParser *minusMinusParser; +@property (nonatomic, retain) PKParser *plusEqParser; +@property (nonatomic, retain) PKParser *minusEqParser; +@property (nonatomic, retain) PKParser *timesEqParser; +@property (nonatomic, retain) PKParser *divEqParser; +@property (nonatomic, retain) PKParser *modEqParser; +@property (nonatomic, retain) PKParser *shiftLeftParser; +@property (nonatomic, retain) PKParser *shiftRightParser; +@property (nonatomic, retain) PKParser *shiftRightExtParser; +@property (nonatomic, retain) PKParser *shiftLeftEqParser; +@property (nonatomic, retain) PKParser *shiftRightEqParser; +@property (nonatomic, retain) PKParser *shiftRightExtEqParser; +@property (nonatomic, retain) PKParser *andEqParser; +@property (nonatomic, retain) PKParser *xorEqParser; +@property (nonatomic, retain) PKParser *orEqParser; + +@property (nonatomic, retain) PKParser *openCurlyParser; +@property (nonatomic, retain) PKParser *closeCurlyParser; +@property (nonatomic, retain) PKParser *openParenParser; +@property (nonatomic, retain) PKParser *closeParenParser; +@property (nonatomic, retain) PKParser *openBracketParser; +@property (nonatomic, retain) PKParser *closeBracketParser; +@property (nonatomic, retain) PKParser *commaParser; +@property (nonatomic, retain) PKParser *dotParser; +@property (nonatomic, retain) PKParser *semiOptParser; +@property (nonatomic, retain) PKParser *semiParser; +@property (nonatomic, retain) PKParser *colonParser; +@property (nonatomic, retain) PKParser *equalsParser; +@property (nonatomic, retain) PKParser *notParser; +@property (nonatomic, retain) PKParser *ltParser; +@property (nonatomic, retain) PKParser *gtParser; +@property (nonatomic, retain) PKParser *ampParser; +@property (nonatomic, retain) PKParser *pipeParser; +@property (nonatomic, retain) PKParser *caretParser; +@property (nonatomic, retain) PKParser *tildeParser; +@property (nonatomic, retain) PKParser *questionParser; +@property (nonatomic, retain) PKParser *plusParser; +@property (nonatomic, retain) PKParser *minusParser; +@property (nonatomic, retain) PKParser *timesParser; +@property (nonatomic, retain) PKParser *divParser; +@property (nonatomic, retain) PKParser *modParser; +@end diff --git a/test/TDJavaScriptParser.m b/test/TDJavaScriptParser.m new file mode 100644 index 0000000..edf20f5 --- /dev/null +++ b/test/TDJavaScriptParser.m @@ -0,0 +1,2398 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDJavaScriptParser.h" + +@interface PKParser () +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@interface TDJavaScriptParser () +- (PKAlternation *)zeroOrOne:(PKParser *)p; +- (PKSequence *)oneOrMore:(PKParser *)p; +@end + +@implementation TDJavaScriptParser + +- (id)init { + if (self = [super initWithSubparser:self.elementParser]) { + self.tokenizer = [PKTokenizer tokenizer]; + + // JS supports scientific number notation (exponents like 4E+12 or 2.0e-42) + tokenizer.numberState.allowsScientificNotation = YES; + + // Nums cannot end with '.' (e.g. 32. must be 32.0) + tokenizer.numberState.allowsTrailingDot = NO; + + [tokenizer setTokenizerState:tokenizer.numberState from:'-' to:'-']; + [tokenizer setTokenizerState:tokenizer.numberState from:'.' to:'.']; + [tokenizer setTokenizerState:tokenizer.numberState from:'0' to:'9']; + + // Words can start with '_' + [tokenizer setTokenizerState:tokenizer.wordState from:'_' to:'_']; + + // Words cannot contain '-' + [tokenizer.wordState setWordChars:NO from:'-' to:'-']; + + // Comments + tokenizer.commentState.reportsCommentTokens = YES; + [tokenizer setTokenizerState:tokenizer.commentState from:'/' to:'/']; + + // single-line Comments + [tokenizer.commentState addSingleLineStartMarker:@"//"]; + + // multi-line Comments + [tokenizer.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + [tokenizer.symbolState add:@"||"]; + [tokenizer.symbolState add:@"&&"]; + [tokenizer.symbolState add:@"!="]; + [tokenizer.symbolState add:@"!=="]; + [tokenizer.symbolState add:@"=="]; + [tokenizer.symbolState add:@"==="]; + [tokenizer.symbolState add:@"<="]; + [tokenizer.symbolState add:@">="]; + [tokenizer.symbolState add:@"++"]; + [tokenizer.symbolState add:@"--"]; + [tokenizer.symbolState add:@"+="]; + [tokenizer.symbolState add:@"-="]; + [tokenizer.symbolState add:@"*="]; + [tokenizer.symbolState add:@"/="]; + [tokenizer.symbolState add:@"%="]; + [tokenizer.symbolState add:@"<<"]; + [tokenizer.symbolState add:@">>"]; + [tokenizer.symbolState add:@">>>"]; + [tokenizer.symbolState add:@"<<="]; + [tokenizer.symbolState add:@">>="]; + [tokenizer.symbolState add:@">>>="]; + [tokenizer.symbolState add:@"&="]; + [tokenizer.symbolState add:@"^="]; + } + return self; +} + + +- (void)dealloc { + self.assignmentOpParser = nil; + self.relationalOpParser = nil; + self.equalityOpParser = nil; + self.shiftOpParser = nil; + self.incrementOpParser = nil; + self.unaryOpParser = nil; + self.multiplicativeOpParser = nil; + self.programParser = nil; + self.elementParser = nil; + self.funcParser = nil; + self.paramListOptParser = nil; + self.paramListParser = nil; + self.commaIdentifierParser = nil; + self.compoundStmtParser = nil; + self.stmtsParser = nil; + self.stmtParser = nil; + self.ifStmtParser = nil; + self.ifElseStmtParser = nil; + self.whileStmtParser = nil; + self.forParenStmtParser = nil; + self.forBeginStmtParser = nil; + self.forInStmtParser = nil; + self.breakStmtParser = nil; + self.continueStmtParser = nil; + self.withStmtParser = nil; + self.returnStmtParser = nil; + self.variablesOrExprStmtParser = nil; + self.conditionParser = nil; + self.forParenParser = nil; + self.forBeginParser = nil; + self.variablesOrExprParser = nil; + self.varVariablesParser = nil; + self.variablesParser = nil; + self.commaVariableParser = nil; + self.variableParser = nil; + self.assignmentParser = nil; + self.exprOptParser = nil; + self.exprParser = nil; + self.commaAssignmentExprParser = nil; + self.assignmentExprParser = nil; + self.assignmentOpConditionalExprParser = nil; + self.conditionalExprParser = nil; + self.ternaryExprParser = nil; + self.orExprParser = nil; + self.orAndExprParser = nil; + self.andExprParser = nil; + self.andBitwiseOrExprParser = nil; + self.bitwiseOrExprParser = nil; + self.pipeBitwiseXorExprParser = nil; + self.bitwiseXorExprParser = nil; + self.caretBitwiseAndExprParser = nil; + self.bitwiseAndExprParser = nil; + self.ampEqualityExprParser = nil; + self.equalityExprParser = nil; + self.equalityOpRelationalExprParser = nil; + self.relationalExprParser = nil; + self.relationalOpShiftExprParser = nil; + self.shiftExprParser = nil; + self.shiftOpAdditiveExprParser = nil; + self.additiveExprParser = nil; + self.plusOrMinusExprParser = nil; + self.plusExprParser = nil; + self.minusExprParser = nil; + self.multiplicativeExprParser = nil; + self.multiplicativeOpUnaryExprParser = nil; + self.unaryExprParser = nil; + self.unaryExpr1Parser = nil; + self.unaryExpr2Parser = nil; + self.unaryExpr3Parser = nil; + self.unaryExpr4Parser = nil; + self.unaryExpr5Parser = nil; + self.unaryExpr6Parser = nil; + self.constructorCallParser = nil; + self.parenArgListOptParenParser = nil; + self.memberExprParser = nil; + self.memberExprExtParser = nil; + self.dotMemberExprParser = nil; + self.bracketMemberExprParser = nil; + self.argListOptParser = nil; + self.argListParser = nil; + self.primaryExprParser = nil; + self.parenExprParenParser = nil; + + self.funcLiteralParser = nil; + self.arrayLiteralParser = nil; + self.objectLiteralParser = nil; + + self.identifierParser = nil; + self.stringParser = nil; + self.numberParser = nil; + + self.ifParser = nil; + self.elseParser = nil; + self.whileParser = nil; + self.forParser = nil; + self.inParser = nil; + self.breakParser = nil; + self.continueParser = nil; + self.withParser = nil; + self.returnParser = nil; + self.varParser = nil; + self.deleteParser = nil; + self.newParser = nil; + self.thisParser = nil; + self.falseParser = nil; + self.trueParser = nil; + self.nullParser = nil; + self.undefinedParser = nil; + self.voidParser = nil; + self.typeofParser = nil; + self.instanceofParser = nil; + self.functionParser = nil; + + self.orParser = nil; + self.andParser = nil; + self.neParser = nil; + self.isNotParser = nil; + self.eqParser = nil; + self.isParser = nil; + self.leParser = nil; + self.geParser = nil; + self.plusPlusParser = nil; + self.minusMinusParser = nil; + self.plusEqParser = nil; + self.minusEqParser = nil; + self.timesEqParser = nil; + self.divEqParser = nil; + self.modEqParser = nil; + self.shiftLeftParser = nil; + self.shiftRightParser = nil; + self.shiftRightExtParser = nil; + self.shiftLeftEqParser = nil; + self.shiftRightEqParser = nil; + self.shiftRightExtEqParser = nil; + self.andEqParser = nil; + self.xorEqParser = nil; + self.orEqParser = nil; + + self.openCurlyParser = nil; + self.closeCurlyParser = nil; + self.openParenParser = nil; + self.closeParenParser = nil; + self.openBracketParser = nil; + self.closeBracketParser = nil; + self.commaParser = nil; + self.dotParser = nil; + self.semiOptParser = nil; + self.semiParser = nil; + self.colonParser = nil; + self.equalsParser = nil; + self.notParser = nil; + self.ltParser = nil; + self.gtParser = nil; + self.ampParser = nil; + self.pipeParser = nil; + self.caretParser = nil; + self.tildeParser = nil; + self.questionParser = nil; + self.plusParser = nil; + self.minusParser = nil; + self.timesParser = nil; + self.divParser = nil; + self.modParser = nil; + + [super dealloc]; +} + + +- (PKAlternation *)zeroOrOne:(PKParser *)p { + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:p]; + return a; +} + + +- (PKSequence *)oneOrMore:(PKParser *)p { + PKSequence *s = [PKSequence sequence]; + [s add:p]; + [s add:[PKRepetition repetitionWithSubparser:p]]; + return s; +} + + +// assignmentOperator = equals | plusEq | minusEq | timesEq | divEq | modEq | shiftLeftEq | shiftRightEq | shiftRightExtEq | andEq | xorEq | orEq; +- (PKCollectionParser *)assignmentOpParser { + if (!assignmentOpParser) { + self.assignmentOpParser = [PKAlternation alternation]; + assignmentOpParser.name = @"assignmentOp"; + [assignmentOpParser add:self.equalsParser]; + [assignmentOpParser add:self.plusEqParser]; + [assignmentOpParser add:self.minusEqParser]; + [assignmentOpParser add:self.timesEqParser]; + [assignmentOpParser add:self.divEqParser]; + [assignmentOpParser add:self.modEqParser]; + [assignmentOpParser add:self.shiftLeftEqParser]; + [assignmentOpParser add:self.shiftRightEqParser]; + [assignmentOpParser add:self.shiftRightExtEqParser]; + [assignmentOpParser add:self.andEqParser]; + [assignmentOpParser add:self.orEqParser]; + [assignmentOpParser add:self.xorEqParser]; + } + return assignmentOpParser; +} + + +// relationalOperator = lt | gt | ge | le | instanceof; +- (PKCollectionParser *)relationalOpParser { + if (!relationalOpParser) { + self.relationalOpParser = [PKAlternation alternation]; + relationalOpParser.name = @"relationalOp"; + [relationalOpParser add:self.ltParser]; + [relationalOpParser add:self.gtParser]; + [relationalOpParser add:self.geParser]; + [relationalOpParser add:self.leParser]; + [relationalOpParser add:self.instanceofParser]; + } + return relationalOpParser; +} + + +// equalityOp = eq | ne | is | isnot; +- (PKCollectionParser *)equalityOpParser { + if (!equalityOpParser) { + self.equalityOpParser = [PKAlternation alternation];; + equalityOpParser.name = @"equalityOp"; + [equalityOpParser add:self.eqParser]; + [equalityOpParser add:self.neParser]; + [equalityOpParser add:self.isParser]; + [equalityOpParser add:self.isNotParser]; + } + return equalityOpParser; +} + + +//shiftOp = shiftLeft | shiftRight | shiftRightExt; +- (PKCollectionParser *)shiftOpParser { + if (!shiftOpParser) { + self.shiftOpParser = [PKAlternation alternation]; + shiftOpParser.name = @"shiftOp"; + [shiftOpParser add:self.shiftLeftParser]; + [shiftOpParser add:self.shiftRightParser]; + [shiftOpParser add:self.shiftRightExtParser]; + } + return shiftOpParser; +} + + +//incrementOperator = plusPlus | minusMinus; +- (PKCollectionParser *)incrementOpParser { + if (!incrementOpParser) { + self.incrementOpParser = [PKAlternation alternation]; + incrementOpParser.name = @"incrementOp"; + [incrementOpParser add:self.plusPlusParser]; + [incrementOpParser add:self.minusMinusParser]; + } + return incrementOpParser; +} + + +//unaryOperator = tilde | delete | typeof | void; +- (PKCollectionParser *)unaryOpParser { + if (!unaryOpParser) { + self.unaryOpParser = [PKAlternation alternation]; + unaryOpParser.name = @"unaryOp"; + [unaryOpParser add:self.tildeParser]; + [unaryOpParser add:self.deleteParser]; + [unaryOpParser add:self.typeofParser]; + [unaryOpParser add:self.voidParser]; + } + return unaryOpParser; +} + + +// multiplicativeOperator = times | div | mod; +- (PKCollectionParser *)multiplicativeOpParser { + if (!multiplicativeOpParser) { + self.multiplicativeOpParser = [PKAlternation alternation]; + multiplicativeOpParser.name = @"multiplicativeOperator"; + [multiplicativeOpParser add:self.timesParser]; + [multiplicativeOpParser add:self.divParser]; + [multiplicativeOpParser add:self.modParser]; + } + return multiplicativeOpParser; +} + + + +// Program: +// empty +// Element Program +// +//program = element*; +- (PKCollectionParser *)programParser { + if (!programParser) { + self.programParser = [PKRepetition repetitionWithSubparser:self.elementParser]; + programParser.name = @"program"; + } + return programParser; +} + + +// Element: +// function Identifier ( ParameterListOpt ) CompoundStatement +// Statement +// +//element = func | stmt; +- (PKCollectionParser *)elementParser { + if (!elementParser) { + self.elementParser = [PKAlternation alternation]; + elementParser.name = @"element"; + [elementParser add:self.funcParser]; + [elementParser add:self.stmtParser]; + } + return elementParser; +} + + +//func = function identifier openParen paramListOpt closeParen compoundStmt; +- (PKCollectionParser *)funcParser { + if (!funcParser) { + self.funcParser = [PKSequence sequence]; + funcParser.name = @"func"; + [funcParser add:self.functionParser]; + [funcParser add:self.identifierParser]; + [funcParser add:self.openParenParser]; + [funcParser add:self.paramListOptParser]; + [funcParser add:self.closeParenParser]; + [funcParser add:self.compoundStmtParser]; + } + return funcParser; +} + + +// ParameterListOpt: +// empty +// ParameterList +// +//paramListOpt = Empty | paramList; +- (PKCollectionParser *)paramListOptParser { + if (!paramListOptParser) { + self.paramListOptParser = [PKAlternation alternation]; + paramListOptParser.name = @"paramListOpt"; + [paramListOptParser add:[self zeroOrOne:self.paramListParser]]; + } + return paramListOptParser; +} + + +// ParameterList: +// Identifier +// Identifier , ParameterList +// +//paramList = identifier commaIdentifier*; +- (PKCollectionParser *)paramListParser { + if (!paramListParser) { + self.paramListParser = [PKSequence sequence]; + paramListParser.name = @"paramList"; + [paramListParser add:self.identifierParser]; + [paramListParser add:[PKRepetition repetitionWithSubparser:self.commaIdentifierParser]]; + } + return paramListParser; +} + + +//commaIdentifier = comma identifier; +- (PKCollectionParser *)commaIdentifierParser { + if (!commaIdentifierParser) { + self.commaIdentifierParser = [PKSequence sequence]; + commaIdentifierParser.name = @"commaIdentifier"; + [commaIdentifierParser add:self.commaParser]; + [commaIdentifierParser add:self.identifierParser]; + } + return commaIdentifierParser; +} + + +// CompoundStatement: +// { Statements } +// +//compoundStmt = openCurly stmts closeCurly; +- (PKCollectionParser *)compoundStmtParser { + if (!compoundStmtParser) { + self.compoundStmtParser = [PKSequence sequence]; + compoundStmtParser.name = @"compoundStmt"; + [compoundStmtParser add:self.openCurlyParser]; + [compoundStmtParser add:self.stmtsParser]; + [compoundStmtParser add:self.closeCurlyParser]; + } + return compoundStmtParser; +} + + +// Statements: +// empty +// Statement Statements +// +//stmts = stmt*; +- (PKCollectionParser *)stmtsParser { + if (!stmtsParser) { + self.stmtsParser = [PKRepetition repetitionWithSubparser:self.stmtParser]; + stmtsParser.name = @"stmts"; + } + return stmtsParser; +} + + +// Statement: +// ; +// if Condition Statement +// if Condition Statement else Statement +// while Condition Statement +// ForParen ; ExpressionOpt ; ExpressionOpt ) Statement +// ForBegin ; ExpressionOpt ; ExpressionOpt ) Statement +// ForBegin in Expression ) Statement +// break ; +// continue ; +// with ( Expression ) Statement +// return ExpressionOpt ; +// CompoundStatement +// VariablesOrExpression ; +// +//stmt = semi | ifStmt | ifElseStmt | whileStmt | forParenStmt | forBeginStmt | forInStmt | breakStmt | continueStmt | withStmt | returnStmt | compoundStmt | variablesOrExprStmt; +- (PKCollectionParser *)stmtParser { + if (!stmtParser) { + self.stmtParser = [PKAlternation alternation]; + stmtParser.name = @"stmt"; + [stmtParser add:self.semiParser]; + [stmtParser add:self.ifStmtParser]; + [stmtParser add:self.ifElseStmtParser]; + [stmtParser add:self.whileStmtParser]; + [stmtParser add:self.forParenStmtParser]; + [stmtParser add:self.forBeginStmtParser]; + [stmtParser add:self.forInStmtParser]; + [stmtParser add:self.breakStmtParser]; + [stmtParser add:self.continueStmtParser]; + [stmtParser add:self.withStmtParser]; + [stmtParser add:self.returnStmtParser]; + [stmtParser add:self.compoundStmtParser]; + [stmtParser add:self.variablesOrExprStmtParser]; + } + return stmtParser; +} + + +// if Condition Statement +//ifStmt = if condition stmt; +- (PKCollectionParser *)ifStmtParser { + if (!ifStmtParser) { + self.ifStmtParser = [PKSequence sequence]; + ifStmtParser.name = @"ifStmt"; + [ifStmtParser add:self.ifParser]; + [ifStmtParser add:self.conditionParser]; + [ifStmtParser add:self.stmtParser]; + } + return ifStmtParser; +} + + +// if Condition Statement else Statement +//ifElseStmt = if condition stmt else stmt; +- (PKCollectionParser *)ifElseStmtParser { + if (!ifElseStmtParser) { + self.ifElseStmtParser = [PKSequence sequence]; + ifElseStmtParser.name = @"ifElseStmt"; + [ifElseStmtParser add:self.ifParser]; + [ifElseStmtParser add:self.conditionParser]; + [ifElseStmtParser add:self.stmtParser]; + [ifElseStmtParser add:self.elseParser]; + [ifElseStmtParser add:self.stmtParser]; + } + return ifElseStmtParser; +} + + +// while Condition Statement +//whileStmt = while condition stmt; +- (PKCollectionParser *)whileStmtParser { + if (!whileStmtParser) { + self.whileStmtParser = [PKSequence sequence]; + whileStmtParser.name = @"whileStmt"; + [whileStmtParser add:self.whileParser]; + [whileStmtParser add:self.conditionParser]; + [whileStmtParser add:self.stmtParser]; + } + return whileStmtParser; +} + + +// ForParen ; ExpressionOpt ; ExpressionOpt ) Statement +//forParenStmt = forParen semi exprOpt semi exprOpt closeParen stmt; +- (PKCollectionParser *)forParenStmtParser { + if (!forParenStmtParser) { + self.forParenStmtParser = [PKSequence sequence]; + forParenStmtParser.name = @"forParenStmt"; + [forParenStmtParser add:self.forParenParser]; + [forParenStmtParser add:self.semiParser]; + [forParenStmtParser add:self.exprOptParser]; + [forParenStmtParser add:self.semiParser]; + [forParenStmtParser add:self.exprOptParser]; + [forParenStmtParser add:self.closeParenParser]; + [forParenStmtParser add:self.stmtParser]; + } + return forParenStmtParser; +} + + +// ForBegin ; ExpressionOpt ; ExpressionOpt ) Statement +//forBeginStmt = forBegin semi exprOpt semi exprOpt closeParen stmt; +- (PKCollectionParser *)forBeginStmtParser { + if (!forBeginStmtParser) { + self.forBeginStmtParser = [PKSequence sequence]; + forBeginStmtParser.name = @"forBeginStmt"; + [forBeginStmtParser add:self.forBeginParser]; + [forBeginStmtParser add:self.semiParser]; + [forBeginStmtParser add:self.exprOptParser]; + [forBeginStmtParser add:self.semiParser]; + [forBeginStmtParser add:self.exprOptParser]; + [forBeginStmtParser add:self.closeParenParser]; + [forBeginStmtParser add:self.stmtParser]; + } + return forBeginStmtParser; +} + + +// ForBegin in Expression ) Statement +//forInStmt = forBegin in expr closeParen stmt; +- (PKCollectionParser *)forInStmtParser { + if (!forInStmtParser) { + self.forInStmtParser = [PKSequence sequence]; + forInStmtParser.name = @"forInStmt"; + [forInStmtParser add:self.forBeginParser]; + [forInStmtParser add:self.inParser]; + [forInStmtParser add:self.exprParser]; + [forInStmtParser add:self.closeParenParser]; + [forInStmtParser add:self.stmtParser]; + } + return forInStmtParser; +} + + +// break ; +//breakStmt = break semi; +- (PKCollectionParser *)breakStmtParser { + if (!breakStmtParser) { + self.breakStmtParser = [PKSequence sequence]; + breakStmtParser.name = @"breakStmt"; + [breakStmtParser add:self.breakParser]; + [breakStmtParser add:self.semiOptParser]; + } + return breakStmtParser; +} + + +//continueStmt = continue semi; +- (PKCollectionParser *)continueStmtParser { + if (!continueStmtParser) { + self.continueStmtParser = [PKSequence sequence]; + continueStmtParser.name = @"continueStmt"; + [continueStmtParser add:self.continueParser]; + [continueStmtParser add:self.semiOptParser]; + } + return continueStmtParser; +} + + +// with ( Expression ) Statement +//withStmt = with openParen expr closeParen stmt; +- (PKCollectionParser *)withStmtParser { + if (!withStmtParser) { + self.withStmtParser = [PKSequence sequence]; + withStmtParser.name = @"withStmt"; + [withStmtParser add:self.withParser]; + [withStmtParser add:self.openParenParser]; + [withStmtParser add:self.exprParser]; + [withStmtParser add:self.closeParenParser]; + [withStmtParser add:self.stmtParser]; + } + return withStmtParser; +} + + +// return ExpressionOpt ; +//returnStmt = return exprOpt semi; +- (PKCollectionParser *)returnStmtParser { + if (!returnStmtParser) { + self.returnStmtParser = [PKSequence sequence]; + returnStmtParser.name = @"returnStmt"; + [returnStmtParser add:self.returnParser]; + [returnStmtParser add:self.exprOptParser]; + [returnStmtParser add:self.semiOptParser]; + } + return returnStmtParser; +} + + +// VariablesOrExpression ; +//variablesOrExprStmt = variablesOrExpr semi; +- (PKCollectionParser *)variablesOrExprStmtParser { + if (!variablesOrExprStmtParser) { + self.variablesOrExprStmtParser = [PKSequence sequence]; + variablesOrExprStmtParser.name = @"variablesOrExprStmt"; + [variablesOrExprStmtParser add:self.variablesOrExprParser]; + [variablesOrExprStmtParser add:self.semiOptParser]; + } + return variablesOrExprStmtParser; +} + + +// Condition: +// ( Expression ) +// +//condition = openParen expr closeParen; +- (PKCollectionParser *)conditionParser { + if (!conditionParser) { + self.conditionParser = [PKSequence sequence]; + conditionParser.name = @"condition"; + [conditionParser add:self.openParenParser]; + [conditionParser add:self.exprParser]; + [conditionParser add:self.closeParenParser]; + } + return conditionParser; +} + + +// ForParen: +// for ( +// +//forParen = for openParen; +- (PKCollectionParser *)forParenParser { + if (!forParenParser) { + self.forParenParser = [PKSequence sequence]; + forParenParser.name = @"forParen"; + [forParenParser add:self.forParser]; + [forParenParser add:self.openParenParser]; + } + return forParenParser; +} + + +// ForBegin: +// ForParen VariablesOrExpression +// +//forBegin = forParen variablesOrExpr; +- (PKCollectionParser *)forBeginParser { + if (!forBeginParser) { + self.forBeginParser = [PKSequence sequence]; + forBeginParser.name = @"forBegin"; + [forBeginParser add:self.forParenParser]; + [forBeginParser add:self.variablesOrExprParser]; + } + return forBeginParser; +} + + +// VariablesOrExpression: +// var Variables +// Expression +// +//variablesOrExpr = varVariables | expr; +- (PKCollectionParser *)variablesOrExprParser { + if (!variablesOrExprParser) { + self.variablesOrExprParser = [PKAlternation alternation]; + variablesOrExprParser.name = @"variablesOrExpr"; + [variablesOrExprParser add:self.varVariablesParser]; + [variablesOrExprParser add:self.exprParser]; + } + return variablesOrExprParser; +} + + +//varVariables = var variables; +- (PKCollectionParser *)varVariablesParser { + if (!varVariablesParser) { + self.varVariablesParser = [PKSequence sequence]; + varVariablesParser.name = @"varVariables"; + [varVariablesParser add:self.varParser]; + [varVariablesParser add:self.variablesParser]; + } + return varVariablesParser; +} + + +// Variables: +// Variable +// Variable , Variables +// +//variables = variable commaVariable*; +- (PKCollectionParser *)variablesParser { + if (!variablesParser) { + self.variablesParser = [PKSequence sequence]; + variablesParser.name = @"variables"; + [variablesParser add:self.variableParser]; + [variablesParser add:[PKRepetition repetitionWithSubparser:self.commaVariableParser]]; + } + return variablesParser; +} + + +//commaVariable = comma variable; +- (PKCollectionParser *)commaVariableParser { + if (!commaVariableParser) { + self.commaVariableParser = [PKSequence sequence]; + commaVariableParser.name = @"commaVariable"; + [commaVariableParser add:self.commaParser]; + [commaVariableParser add:self.variableParser]; + } + return commaVariableParser; +} + + +// Variable: +// Identifier +// Identifier = AssignmentExpression +// +//variable = identifier assignment?; +- (PKCollectionParser *)variableParser { + if (!variableParser) { + self.variableParser = [PKSequence sequence]; + variableParser.name = @"variableParser"; + [variableParser add:self.identifierParser]; + [variableParser add:[self zeroOrOne:self.assignmentParser]]; + } + return variableParser; +} + + +//assignment = equals assignmentExpr; +- (PKCollectionParser *)assignmentParser { + if (!assignmentParser) { + self.assignmentParser = [PKSequence sequence]; + assignmentParser.name = @"assignment"; + [assignmentParser add:self.equalsParser]; + [assignmentParser add:self.assignmentExprParser]; + } + return assignmentParser; +} + + +// ExpressionOpt: +// empty +// Expression +// +// exprOpt = Empty | expr; +- (PKCollectionParser *)exprOptParser { + if (!exprOptParser) { + self.exprOptParser = [self zeroOrOne:self.exprParser]; + exprOptParser.name = @"exprOpt"; + } + return exprOptParser; +} + + +// Expression: +// AssignmentExpression +// AssignmentExpression , Expression +// +//expr = assignmentExpr commaAssignmentExpr*; +- (PKCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [PKSequence sequence]; + exprParser.name = @"exprParser"; + [exprParser add:self.assignmentExprParser]; + [exprParser add:[PKRepetition repetitionWithSubparser:self.commaAssignmentExprParser]]; + } + return exprParser; +} + + +//commaAssignmentExpr = comma assignmentExpr; +- (PKCollectionParser *)commaAssignmentExprParser { + if (!commaAssignmentExprParser) { + self.commaAssignmentExprParser = [PKSequence sequence]; + commaAssignmentExprParser.name = @"commaAssignmentExpr"; + [commaAssignmentExprParser add:self.commaParser]; + [commaAssignmentExprParser add:self.assignmentExprParser]; + } + return commaAssignmentExprParser; +} + + +// AssignmentExpression: +// ConditionalExpression +// ConditionalExpression AssignmentOperator AssignmentExpression +// +// assignmentExpr = conditionalExpr assignmentOpConditionalExpr*; +- (PKCollectionParser *)assignmentExprParser { + if (!assignmentExprParser) { + self.assignmentExprParser = [PKSequence sequence]; + assignmentExprParser.name = @"assignmentExpr"; + [assignmentExprParser add:self.conditionalExprParser]; + [assignmentExprParser add:[PKRepetition repetitionWithSubparser:self.assignmentOpConditionalExprParser]]; + } + return assignmentExprParser; +} + + +// assignmentOpConditionalExpr = assignmentOperator conditionalExpr; +- (PKCollectionParser *)assignmentOpConditionalExprParser { + if (!assignmentOpConditionalExprParser) { + self.assignmentOpConditionalExprParser = [PKSequence sequence]; + assignmentOpConditionalExprParser.name = @"assignmentOpConditionalExpr"; + [assignmentOpConditionalExprParser add:self.assignmentOpParser]; + [assignmentOpConditionalExprParser add:self.conditionalExprParser]; + } + return assignmentOpConditionalExprParser; +} + + +// ConditionalExpression: +// OrExpression +// OrExpression ? AssignmentExpression : AssignmentExpression +// +// conditionalExpr = orExpr ternaryExpr?; +- (PKCollectionParser *)conditionalExprParser { + if (!conditionalExprParser) { + self.conditionalExprParser = [PKSequence sequence]; + conditionalExprParser.name = @"conditionalExpr"; + [conditionalExprParser add:self.orExprParser]; + [conditionalExprParser add:[self zeroOrOne:self.ternaryExprParser]]; + } + return conditionalExprParser; +} + + +// ternaryExpr = question assignmentExpr colon assignmentExpr; +- (PKCollectionParser *)ternaryExprParser { + if (!ternaryExprParser) { + self.ternaryExprParser = [PKSequence sequence]; + ternaryExprParser.name = @"ternaryExpr"; + [ternaryExprParser add:self.questionParser]; + [ternaryExprParser add:self.assignmentExprParser]; + [ternaryExprParser add:self.colonParser]; + [ternaryExprParser add:self.assignmentExprParser]; + } + return ternaryExprParser; +} + + +// OrExpression: +// AndExpression +// AndExpression || OrExpression +// +// orExpr = andExpr orAndExpr*; +- (PKCollectionParser *)orExprParser { + if (!orExprParser) { + self.orExprParser = [PKSequence sequence]; + orExprParser.name = @"orExpr"; + [orExprParser add:self.andExprParser]; + [orExprParser add:[PKRepetition repetitionWithSubparser:self.orAndExprParser]]; + } + return orExprParser; +} + + +// orAndExpr = or andExpr; +- (PKCollectionParser *)orAndExprParser { + if (!orAndExprParser) { + self.orAndExprParser = [PKSequence sequence]; + orAndExprParser.name = @"orAndExpr"; + [orAndExprParser add:self.orParser]; + [orAndExprParser add:self.andExprParser]; + } + return orAndExprParser; +} + + +// AndExpression: +// BitwiseOrExpression +// BitwiseOrExpression && AndExpression +// +// andExpr = bitwiseOrExpr andBitwiseOrExprParser*; +- (PKCollectionParser *)andExprParser { + if (!andExprParser) { + self.andExprParser = [PKSequence sequence]; + andExprParser.name = @"andExpr"; + [andExprParser add:self.bitwiseOrExprParser]; + [andExprParser add:[PKRepetition repetitionWithSubparser:self.andBitwiseOrExprParser]]; + } + return andExprParser; +} + + +// andBitwiseOrExprParser = and bitwiseOrExpr; +- (PKCollectionParser *)andBitwiseOrExprParser { + if (!andBitwiseOrExprParser) { + self.andBitwiseOrExprParser = [PKSequence sequence]; + andBitwiseOrExprParser.name = @"andBitwiseOrExpr"; + [andBitwiseOrExprParser add:self.andParser]; + [andBitwiseOrExprParser add:self.bitwiseOrExprParser]; + } + return andBitwiseOrExprParser; +} + + +// BitwiseOrExpression: +// BitwiseXorExpression +// BitwiseXorExpression | BitwiseOrExpression +// +// bitwiseOrExpr = bitwiseXorExpr pipeBitwiseXorExpr*; +- (PKCollectionParser *)bitwiseOrExprParser { + if (!bitwiseOrExprParser) { + self.bitwiseOrExprParser = [PKSequence sequence]; + bitwiseOrExprParser.name = @"bitwiseOrExpr"; + [bitwiseOrExprParser add:self.bitwiseXorExprParser]; + [bitwiseOrExprParser add:[PKRepetition repetitionWithSubparser:self.pipeBitwiseXorExprParser]]; + } + return bitwiseOrExprParser; +} + + +// pipeBitwiseXorExprParser = pipe bitwiseXorExpr; +- (PKCollectionParser *)pipeBitwiseXorExprParser { + if (!pipeBitwiseXorExprParser) { + self.pipeBitwiseXorExprParser = [PKSequence sequence]; + pipeBitwiseXorExprParser.name = @"pipeBitwiseXorExpr"; + [pipeBitwiseXorExprParser add:self.pipeParser]; + [pipeBitwiseXorExprParser add:self.bitwiseXorExprParser]; + } + return pipeBitwiseXorExprParser; +} + + +// BitwiseXorExpression: +// BitwiseAndExpression +// BitwiseAndExpression ^ BitwiseXorExpression +// +// bitwiseXorExpr = bitwiseAndExpr caretBitwiseAndExpr*; +- (PKCollectionParser *)bitwiseXorExprParser { + if (!bitwiseXorExprParser) { + self.bitwiseXorExprParser = [PKSequence sequence]; + bitwiseXorExprParser.name = @"bitwiseXorExpr"; + [bitwiseXorExprParser add:self.bitwiseAndExprParser]; + [bitwiseXorExprParser add:[PKRepetition repetitionWithSubparser:self.caretBitwiseAndExprParser]]; + } + return bitwiseXorExprParser; +} + + +// caretBitwiseAndExpr = caret bitwiseAndExpr; +- (PKCollectionParser *)caretBitwiseAndExprParser { + if (!caretBitwiseAndExprParser) { + self.caretBitwiseAndExprParser = [PKSequence sequence]; + caretBitwiseAndExprParser.name = @"caretBitwiseAndExpr"; + [caretBitwiseAndExprParser add:self.caretParser]; + [caretBitwiseAndExprParser add:self.bitwiseAndExprParser]; + } + return caretBitwiseAndExprParser; +} + + +// BitwiseAndExpression: +// EqualityExpression +// EqualityExpression & BitwiseAndExpression +// +// bitwiseAndExpr = equalityExpr ampEqualityExpr*; +- (PKCollectionParser *)bitwiseAndExprParser { + if (!bitwiseAndExprParser) { + self.bitwiseAndExprParser = [PKSequence sequence]; + bitwiseAndExprParser.name = @"bitwiseAndExpr"; + [bitwiseAndExprParser add:self.equalityExprParser]; + [bitwiseAndExprParser add:[PKRepetition repetitionWithSubparser:self.ampEqualityExprParser]]; + } + return bitwiseAndExprParser; +} + + +// ampEqualityExpression = amp equalityExpression; +- (PKCollectionParser *)ampEqualityExprParser { + if (!ampEqualityExprParser) { + self.ampEqualityExprParser = [PKSequence sequence]; + ampEqualityExprParser.name = @"ampEqualityExpr"; + [ampEqualityExprParser add:self.ampParser]; + [ampEqualityExprParser add:self.equalityExprParser]; + } + return ampEqualityExprParser; +} + + +// EqualityExpression: +// RelationalExpression +// RelationalExpression EqualityualityOperator EqualityExpression +// +// equalityExpr = relationalExpr equalityOpRelationalExpr*; +- (PKCollectionParser *)equalityExprParser { + if (!equalityExprParser) { + self.equalityExprParser = [PKSequence sequence]; + equalityExprParser.name = @"equalityExpr"; + [equalityExprParser add:self.relationalExprParser]; + [equalityExprParser add:[PKRepetition repetitionWithSubparser:self.equalityOpRelationalExprParser]]; + } + return equalityExprParser; +} + + +// equalityOpRelationalExpr = equalityOp relationalExpr; +- (PKCollectionParser *)equalityOpRelationalExprParser { + if (!equalityOpRelationalExprParser) { + self.equalityOpRelationalExprParser = [PKSequence sequence]; + equalityOpRelationalExprParser.name = @"equalityOpRelationalExpr"; + [equalityOpRelationalExprParser add:self.equalityOpParser]; + [equalityOpRelationalExprParser add:self.relationalExprParser]; + } + return equalityOpRelationalExprParser; +} + + +// RelationalExpression: +// ShiftExpression +// RelationalExpression RelationalationalOperator ShiftExpression +// + +// relationalExpr = shiftExpr relationalOpShiftExpr*; /// TODO ???? +- (PKCollectionParser *)relationalExprParser { + if (!relationalExprParser) { + self.relationalExprParser = [PKSequence sequence]; + relationalExprParser.name = @"relationalExpr"; + [relationalExprParser add:self.shiftExprParser]; + [relationalExprParser add:[PKRepetition repetitionWithSubparser:self.relationalOpShiftExprParser]]; + } + return relationalExprParser; +} + + +// relationalOpShiftExpr = relationalOperator shiftExpr; +- (PKCollectionParser *)relationalOpShiftExprParser { + if (!relationalOpShiftExprParser) { + self.relationalOpShiftExprParser = [PKSequence sequence]; + relationalOpShiftExprParser.name = @"relationalOpShiftExpr"; + [relationalOpShiftExprParser add:self.relationalOpParser]; + [relationalOpShiftExprParser add:self.shiftExprParser]; + } + return relationalOpShiftExprParser; +} + + +// ShiftExpression: +// AdditiveExpression +// AdditiveExpression ShiftOperator ShiftExpression +// +// shiftExpr = additiveExpr shiftOpAdditiveExpr?; +- (PKCollectionParser *)shiftExprParser { + if (!shiftExprParser) { + self.shiftExprParser = [PKSequence sequence]; + shiftExprParser.name = @"shiftExpr"; + [shiftExprParser add:self.additiveExprParser]; + [shiftExprParser add:[PKRepetition repetitionWithSubparser:self.shiftOpAdditiveExprParser]]; + } + return shiftExprParser; +} + + +// shiftOpShiftExpr = shiftOp additiveExpr; +- (PKCollectionParser *)shiftOpAdditiveExprParser { + if (!shiftOpAdditiveExprParser) { + self.shiftOpAdditiveExprParser = [PKSequence sequence]; + shiftOpAdditiveExprParser.name = @"shiftOpShiftExpr"; + [shiftOpAdditiveExprParser add:self.shiftOpParser]; + [shiftOpAdditiveExprParser add:self.additiveExprParser]; + } + return shiftOpAdditiveExprParser; +} + + +// AdditiveExpression: +// MultiplicativeExpression +// MultiplicativeExpression + AdditiveExpression +// MultiplicativeExpression - AdditiveExpression +// +// additiveExpr = multiplicativeExpr plusOrMinusExpr*; +- (PKCollectionParser *)additiveExprParser { + if (!additiveExprParser) { + self.additiveExprParser = [PKSequence sequence]; + additiveExprParser.name = @"additiveExpr"; + [additiveExprParser add:self.multiplicativeExprParser]; + [additiveExprParser add:[PKRepetition repetitionWithSubparser:self.plusOrMinusExprParser]]; + } + return additiveExprParser; +} + + +// plusOrMinusExpr = plusExpr | minusExpr; +- (PKCollectionParser *)plusOrMinusExprParser { + if (!plusOrMinusExprParser) { + self.plusOrMinusExprParser = [PKAlternation alternation]; + plusOrMinusExprParser.name = @"plusOrMinusExpr"; + [plusOrMinusExprParser add:self.plusExprParser]; + [plusOrMinusExprParser add:self.minusExprParser]; + } + return plusOrMinusExprParser; +} + + +// plusExpr = plus multiplicativeExprParser; +- (PKCollectionParser *)plusExprParser { + if (!plusExprParser) { + self.plusExprParser = [PKSequence sequence]; + plusExprParser.name = @"plusExpr"; + [plusExprParser add:self.plusParser]; + [plusExprParser add:self.multiplicativeExprParser]; + } + return plusExprParser; +} + + +// minusExpr = minus multiplicativeExprParser; +- (PKCollectionParser *)minusExprParser { + if (!minusExprParser) { + self.minusExprParser = [PKSequence sequence]; + minusExprParser.name = @"minusExpr"; + [minusExprParser add:self.minusParser]; + [minusExprParser add:self.multiplicativeExprParser]; + } + return minusExprParser; +} + + +// MultiplicativeExpression: +// UnaryExpression +// UnaryExpression MultiplicativeOperator MultiplicativeExpression +// +// multiplicativeExpr = unaryExpr multiplicativeOpUnaryExpr*; +- (PKCollectionParser *)multiplicativeExprParser { + if (!multiplicativeExprParser) { + self.multiplicativeExprParser = [PKSequence sequence]; + multiplicativeExprParser.name = @"multiplicativeExpr"; + [multiplicativeExprParser add:self.unaryExprParser]; + [multiplicativeExprParser add:[PKRepetition repetitionWithSubparser:self.multiplicativeOpUnaryExprParser]]; + } + return multiplicativeExprParser; +} + + +// multiplicativeOpUnaryExpr = multiplicativeOp unaryExpr; +- (PKCollectionParser *)multiplicativeOpUnaryExprParser { + if (!multiplicativeOpUnaryExprParser) { + self.multiplicativeOpUnaryExprParser = [PKSequence sequence]; + multiplicativeOpUnaryExprParser.name = @"multiplicativeOpUnaryExpr"; + [multiplicativeOpUnaryExprParser add:self.multiplicativeOpParser]; + [multiplicativeOpUnaryExprParser add:self.unaryExprParser]; + } + return multiplicativeOpUnaryExprParser; +} + + +// UnaryExpression: +// MemberExpression +// UnaryOperator UnaryExpression +// - UnaryExpression +// IncrementOperator MemberExpression +// MemberExpression IncrementOperator +// new Constructor +// delete MemberExpression +// +// unaryExpr = memberExpr | unaryExpr1 | unaryExpr2 | unaryExpr3 | unaryExpr4 | unaryExpr5 | unaryExpr6; +- (PKCollectionParser *)unaryExprParser { + if (!unaryExprParser) { + self.unaryExprParser = [PKAlternation alternation]; + unaryExprParser.name = @"unaryExpr"; + [unaryExprParser add:self.memberExprParser]; + [unaryExprParser add:self.unaryExpr1Parser]; + [unaryExprParser add:self.unaryExpr2Parser]; + [unaryExprParser add:self.unaryExpr3Parser]; + [unaryExprParser add:self.unaryExpr4Parser]; + [unaryExprParser add:self.unaryExpr5Parser]; + [unaryExprParser add:self.unaryExpr6Parser]; + } + return unaryExprParser; +} + + +// unaryExpr1 = unaryOperator unaryExpr; +- (PKCollectionParser *)unaryExpr1Parser { + if (!unaryExpr1Parser) { + self.unaryExpr1Parser = [PKSequence sequence]; + unaryExpr1Parser.name = @"unaryExpr1"; + [unaryExpr1Parser add:self.unaryOpParser]; + [unaryExpr1Parser add:self.unaryExprParser]; + } + return unaryExpr1Parser; +} + + +// unaryExpr2 = minus unaryExpr; +- (PKCollectionParser *)unaryExpr2Parser { + if (!unaryExpr2Parser) { + self.unaryExpr2Parser = [PKSequence sequence]; + unaryExpr2Parser.name = @"unaryExpr2"; + [unaryExpr2Parser add:self.minusParser]; + [unaryExpr2Parser add:self.unaryExprParser]; + } + return unaryExpr2Parser; +} + + +// unaryExpr3 = incrementOperator memberExpr; +- (PKCollectionParser *)unaryExpr3Parser { + if (!unaryExpr3Parser) { + self.unaryExpr3Parser = [PKSequence sequence]; + unaryExpr3Parser.name = @"unaryExpr3"; + [unaryExpr3Parser add:self.incrementOpParser]; + [unaryExpr3Parser add:self.memberExprParser]; + } + return unaryExpr3Parser; +} + + +// unaryExpr4 = memberExpr incrementOperator; +- (PKCollectionParser *)unaryExpr4Parser { + if (!unaryExpr4Parser) { + self.unaryExpr4Parser = [PKSequence sequence]; + unaryExpr4Parser.name = @"unaryExpr4"; + [unaryExpr4Parser add:self.memberExprParser]; + [unaryExpr4Parser add:self.incrementOpParser]; + } + return unaryExpr4Parser; +} + + +// unaryExpr5 = new constructor; +- (PKCollectionParser *)unaryExpr5Parser { + if (!unaryExpr5Parser) { + self.unaryExpr5Parser = [PKSequence sequence]; + unaryExpr5Parser.name = @"unaryExpr5"; + [unaryExpr5Parser add:self.newParser]; + [unaryExpr5Parser add:self.constructorCallParser]; + } + return unaryExpr5Parser; +} + + +// unaryExpr6 = delete memberExpr; +- (PKCollectionParser *)unaryExpr6Parser { + if (!unaryExpr6Parser) { + self.unaryExpr6Parser = [PKSequence sequence]; + unaryExpr6Parser.name = @"unaryExpr6"; + [unaryExpr6Parser add:self.deleteParser]; + [unaryExpr6Parser add:self.memberExprParser]; + } + return unaryExpr6Parser; +} + + +// ConstructorCall: +// Identifier +// Identifier ( ArgumentListOpt ) +// Identifier . ConstructorCall +// + +// constructorCall = identifier parentArgListOptParent? memberExprExt* +- (PKCollectionParser *)constructorCallParser { + if (!constructorCallParser) { + self.constructorCallParser = [PKSequence sequence]; + constructorCallParser.name = @"constructorCall"; + [constructorCallParser add:self.identifierParser]; + [constructorCallParser add:[self zeroOrOne:self.parenArgListOptParenParser]]; + [constructorCallParser add:[PKRepetition repetitionWithSubparser:self.memberExprExtParser]]; + } + return constructorCallParser; +} + + +// parenArgListParen = openParen argListOpt closeParen; +- (PKCollectionParser *)parenArgListOptParenParser { + if (!parenArgListOptParenParser) { + self.parenArgListOptParenParser = [PKSequence sequence]; + parenArgListOptParenParser.name = @"parenArgListParen"; + [parenArgListOptParenParser add:self.openParenParser]; + [parenArgListOptParenParser add:self.argListOptParser]; + [parenArgListOptParenParser add:self.closeParenParser]; + } + return parenArgListOptParenParser; +} + + +// MemberExpression: +// PrimaryExpression +// PrimaryExpression . MemberExpression +// PrimaryExpression [ Expression ] +// PrimaryExpression ( ArgumentListOpt ) +// +// memberExpr = primaryExpr memberExprExt?; // TODO ?????? +- (PKCollectionParser *)memberExprParser { + if (!memberExprParser) { + self.memberExprParser = [PKSequence sequence]; + memberExprParser.name = @"memberExpr"; + [memberExprParser add:self.primaryExprParser]; + [memberExprParser add:[PKRepetition repetitionWithSubparser:self.memberExprExtParser]]; + } + return memberExprParser; +} + + +// memberExprExt = dotMemberExpr | bracketMemberExpr | parenMemberExpr; +- (PKCollectionParser *)memberExprExtParser { + if (!memberExprExtParser) { + self.memberExprExtParser = [PKAlternation alternation]; + memberExprExtParser.name = @"memberExprExt"; + [memberExprExtParser add:self.dotMemberExprParser]; + [memberExprExtParser add:self.bracketMemberExprParser]; + [memberExprExtParser add:self.parenArgListOptParenParser]; + } + return memberExprExtParser; +} + + +// dotMemberExpr = dot memberExpr; +- (PKCollectionParser *)dotMemberExprParser { + if (!dotMemberExprParser) { + self.dotMemberExprParser = [PKSequence sequence]; + dotMemberExprParser.name = @"dotMemberExpr"; + [dotMemberExprParser add:self.dotParser]; + [dotMemberExprParser add:self.memberExprParser]; + } + return dotMemberExprParser; +} + + +// bracketMemberExpr = openBracket expr closeBracket; +- (PKCollectionParser *)bracketMemberExprParser { + if (!bracketMemberExprParser) { + self.bracketMemberExprParser = [PKSequence sequence]; + bracketMemberExprParser.name = @"bracketMemberExpr"; + [bracketMemberExprParser add:self.openBracketParser]; + [bracketMemberExprParser add:self.exprParser]; + [bracketMemberExprParser add:self.closeBracketParser]; + } + return bracketMemberExprParser; +} + + +// ArgumentListOpt: +// empty +// ArgumentList +// +// argListOpt = argList?; +- (PKCollectionParser *)argListOptParser { + if (!argListOptParser) { + self.argListOptParser = [self zeroOrOne:self.argListParser]; + argListOptParser.name = @"argListOpt"; + } + return argListOptParser; +} + + +// ArgumentList: +// AssignmentExpression +// AssignmentExpression , ArgumentList +// +// argList = assignmentExpr commaAssignmentExpr*; +- (PKCollectionParser *)argListParser { + if (!argListParser) { + self.argListParser = [PKSequence sequence]; + argListParser.name = @"argList"; + [argListParser add:self.assignmentExprParser]; + [argListParser add:[PKRepetition repetitionWithSubparser:self.commaAssignmentExprParser]]; + } + return argListParser; +} + + + // PrimaryExpression: + // ( Expression ) + // funcLiteral + // arrayLiteral + // Identifier + // IntegerLiteral + // FloatingPointLiteral + // StringLiteral + // false + // true + // null + // this +// primaryExpr = parenExprParen | funcLiteral | arrayLiteral | identifier | Number | QuotedString | false | true | null | undefined | this; +- (PKCollectionParser *)primaryExprParser { + if (!primaryExprParser) { + self.primaryExprParser = [PKAlternation alternation]; + primaryExprParser.name = @"primaryExpr"; + [primaryExprParser add:self.parenExprParenParser]; + [primaryExprParser add:self.funcLiteralParser]; + [primaryExprParser add:self.arrayLiteralParser]; + [primaryExprParser add:self.objectLiteralParser]; + [primaryExprParser add:self.identifierParser]; + [primaryExprParser add:self.numberParser]; + [primaryExprParser add:self.stringParser]; + [primaryExprParser add:self.trueParser]; + [primaryExprParser add:self.falseParser]; + [primaryExprParser add:self.nullParser]; + [primaryExprParser add:self.undefinedParser]; // TODO ?? + [primaryExprParser add:self.thisParser]; + } + return primaryExprParser; +} + + + +// parenExprParen = openParen expr closeParen; +- (PKCollectionParser *)parenExprParenParser { + if (!parenExprParenParser) { + self.parenExprParenParser = [PKSequence sequence]; + parenExprParenParser.name = @"parenExprParen"; + [parenExprParenParser add:self.openParenParser]; + [parenExprParenParser add:self.exprParser]; + [parenExprParenParser add:self.closeParenParser]; + } + return parenExprParenParser; +} + + +//funcLiteral = function openParen paramListOpt closeParen compoundStmt; +- (PKCollectionParser *)funcLiteralParser { + if (!funcLiteralParser) { + self.funcLiteralParser = [PKSequence sequence]; + funcLiteralParser.name = @"funcLiteral"; + [funcLiteralParser add:self.functionParser]; + [funcLiteralParser add:self.openParenParser]; + [funcLiteralParser add:self.paramListOptParser]; + [funcLiteralParser add:self.closeParenParser]; + [funcLiteralParser add:self.compoundStmtParser]; + } + return funcLiteralParser; +} + + +//arrayLiteral = '[' arrayContents ']'; +- (PKCollectionParser *)arrayLiteralParser { + if (!arrayLiteralParser) { + self.arrayLiteralParser = [PKTrack track]; + arrayLiteralParser.name = @"arrayLiteralParser"; + + PKSequence *commaPrimaryExpr = [PKSequence sequence]; + [commaPrimaryExpr add:self.commaParser]; + [commaPrimaryExpr add:self.primaryExprParser]; + + PKSequence *arrayContents = [PKSequence sequence]; + [arrayContents add:self.primaryExprParser]; + [arrayContents add:[PKRepetition repetitionWithSubparser:commaPrimaryExpr]]; + + PKAlternation *arrayContentsOpt = [PKAlternation alternation]; + [arrayContentsOpt add:[PKEmpty empty]]; + [arrayContentsOpt add:arrayContents]; + + [arrayLiteralParser add:self.openBracketParser]; + [arrayLiteralParser add:arrayContentsOpt]; + [arrayLiteralParser add:self.closeBracketParser]; + } + return arrayLiteralParser; +} + + +//objectLiteral = '{' objectContentsOpt '}'; +- (PKCollectionParser *)objectLiteralParser { + if (!objectLiteralParser) { + self.objectLiteralParser = [PKSequence sequence]; + objectLiteralParser.name = @"objectLiteralParser"; + + PKSequence *member = [PKSequence sequence]; + [member add:self.identifierParser]; + [member add:self.colonParser]; + [member add:self.primaryExprParser]; + + PKSequence *commaMember = [PKSequence sequence]; + [commaMember add:self.commaParser]; + [commaMember add:member]; + + PKSequence *objectContents = [PKSequence sequence]; + [objectContents add:member]; + [objectContents add:[PKRepetition repetitionWithSubparser:commaMember]]; + + PKAlternation *objectContentsOpt = [PKAlternation alternation]; + [objectContentsOpt add:[PKEmpty empty]]; + [objectContentsOpt add:objectContents]; + + [objectLiteralParser add:self.openCurlyParser]; + [objectLiteralParser add:objectContentsOpt]; + [objectLiteralParser add:self.closeCurlyParser]; + } + return objectLiteralParser; +} + + +// identifier = Word; +- (PKParser *)identifierParser { + if (!identifierParser) { + self.identifierParser = [PKWord word]; + identifierParser.name = @"identifier"; + } + return identifierParser; +} + + +- (PKParser *)stringParser { + if (!stringParser) { + self.stringParser = [PKQuotedString quotedString]; + stringParser.name = @"string"; + } + return stringParser; +} + + +- (PKParser *)numberParser { + if (!numberParser) { + self.numberParser = [PKNumber number]; + numberParser.name = @"number"; + } + return numberParser; +} + + +#pragma mark - +#pragma mark keywords + +- (PKParser *)ifParser { + if (!ifParser) { + self.ifParser = [PKLiteral literalWithString:@"if"]; + ifParser.name = @"if"; + } + return ifParser; +} + + +- (PKParser *)elseParser { + if (!elseParser) { + self.elseParser = [PKLiteral literalWithString:@"else"]; + elseParser.name = @"else"; + } + return elseParser; +} + + +- (PKParser *)whileParser { + if (!whileParser) { + self.whileParser = [PKLiteral literalWithString:@"while"]; + whileParser.name = @"while"; + } + return whileParser; +} + + +- (PKParser *)forParser { + if (!forParser) { + self.forParser = [PKLiteral literalWithString:@"for"]; + forParser.name = @"for"; + } + return forParser; +} + + +- (PKParser *)inParser { + if (!inParser) { + self.inParser = [PKLiteral literalWithString:@"in"]; + inParser.name = @"in"; + } + return inParser; +} + + +- (PKParser *)breakParser { + if (!breakParser) { + self.breakParser = [PKLiteral literalWithString:@"break"]; + breakParser.name = @"break"; + } + return breakParser; +} + + +- (PKParser *)continueParser { + if (!continueParser) { + self.continueParser = [PKLiteral literalWithString:@"continue"]; + continueParser.name = @"continue"; + } + return continueParser; +} + + +- (PKParser *)withParser { + if (!withParser) { + self.withParser = [PKLiteral literalWithString:@"with"]; + withParser.name = @"with"; + } + return withParser; +} + + +- (PKParser *)returnParser { + if (!returnParser) { + self.returnParser = [PKLiteral literalWithString:@"return"]; + returnParser.name = @"return"; + } + return returnParser; +} + + +- (PKParser *)varParser { + if (!varParser) { + self.varParser = [PKLiteral literalWithString:@"var"]; + varParser.name = @"var"; + } + return varParser; +} + + +- (PKParser *)deleteParser { + if (!deleteParser) { + self.deleteParser = [PKLiteral literalWithString:@"delete"]; + deleteParser.name = @"delete"; + } + return deleteParser; +} + + +- (PKParser *)newParser { + if (!newParser) { + self.newParser = [PKLiteral literalWithString:@"new"]; + newParser.name = @"new"; + } + return newParser; +} + + +- (PKParser *)thisParser { + if (!thisParser) { + self.thisParser = [PKLiteral literalWithString:@"this"]; + thisParser.name = @"this"; + } + return thisParser; +} + + +- (PKParser *)falseParser { + if (!falseParser) { + self.falseParser = [PKLiteral literalWithString:@"false"]; + falseParser.name = @"false"; + } + return falseParser; +} + + +- (PKParser *)trueParser { + if (!trueParser) { + self.trueParser = [PKLiteral literalWithString:@"true"]; + trueParser.name = @"true"; + } + return trueParser; +} + + +- (PKParser *)nullParser { + if (!nullParser) { + self.nullParser = [PKLiteral literalWithString:@"null"]; + nullParser.name = @"null"; + } + return nullParser; +} + + +- (PKParser *)undefinedParser { + if (!undefinedParser) { + self.undefinedParser = [PKLiteral literalWithString:@"undefined"]; + undefinedParser.name = @"undefined"; + } + return undefinedParser; +} + + +- (PKParser *)voidParser { + if (!voidParser) { + self.voidParser = [PKLiteral literalWithString:@"void"]; + voidParser.name = @"void"; + } + return voidParser; +} + + +- (PKParser *)typeofParser { + if (!typeofParser) { + self.typeofParser = [PKLiteral literalWithString:@"typeof"]; + typeofParser.name = @"typeof"; + } + return typeofParser; +} + + +- (PKParser *)instanceofParser { + if (!instanceofParser) { + self.instanceofParser = [PKLiteral literalWithString:@"instanceof"]; + instanceofParser.name = @"instanceof"; + } + return instanceofParser; +} + + +- (PKParser *)functionParser { + if (!functionParser) { + self.functionParser = [PKLiteral literalWithString:@"function"]; + functionParser.name = @"function"; + } + return functionParser; +} + + +#pragma mark - +#pragma mark single-char symbols + +- (PKParser *)orParser { + if (!orParser) { + self.orParser = [PKSymbol symbolWithString:@"||"]; + orParser.name = @"or"; + } + return orParser; +} + + +- (PKParser *)andParser { + if (!andParser) { + self.andParser = [PKSymbol symbolWithString:@"&&"]; + andParser.name = @"and"; + } + return andParser; +} + + +- (PKParser *)neParser { + if (!neParser) { + self.neParser = [PKSymbol symbolWithString:@"!="]; + neParser.name = @"ne"; + } + return neParser; +} + + +- (PKParser *)isNotParser { + if (!isNotParser) { + self.isNotParser = [PKSymbol symbolWithString:@"!=="]; + isNotParser.name = @"isNot"; + } + return isNotParser; +} + + +- (PKParser *)eqParser { + if (!eqParser) { + self.eqParser = [PKSymbol symbolWithString:@"=="]; + eqParser.name = @"eq"; + } + return eqParser; +} + + +- (PKParser *)isParser { + if (!isParser) { + self.isParser = [PKSymbol symbolWithString:@"==="]; + isParser.name = @"is"; + } + return isParser; +} + + +- (PKParser *)leParser { + if (!leParser) { + self.leParser = [PKSymbol symbolWithString:@"<="]; + leParser.name = @"le"; + } + return leParser; +} + + +- (PKParser *)geParser { + if (!geParser) { + self.geParser = [PKSymbol symbolWithString:@">="]; + geParser.name = @"ge"; + } + return geParser; +} + + +- (PKParser *)plusPlusParser { + if (!plusPlusParser) { + self.plusPlusParser = [PKSymbol symbolWithString:@"++"]; + plusPlusParser.name = @"plusPlus"; + } + return plusPlusParser; +} + + +- (PKParser *)minusMinusParser { + if (!minusMinusParser) { + self.minusMinusParser = [PKSymbol symbolWithString:@"--"]; + minusMinusParser.name = @"minusMinus"; + } + return minusMinusParser; +} + + +- (PKParser *)plusEqParser { + if (!plusEqParser) { + self.plusEqParser = [PKSymbol symbolWithString:@"+="]; + plusEqParser.name = @"plusEq"; + } + return plusEqParser; +} + + +- (PKParser *)minusEqParser { + if (!minusEqParser) { + self.minusEqParser = [PKSymbol symbolWithString:@"-="]; + minusEqParser.name = @"minusEq"; + } + return minusEqParser; +} + + +- (PKParser *)timesEqParser { + if (!timesEqParser) { + self.timesEqParser = [PKSymbol symbolWithString:@"*="]; + timesEqParser.name = @"timesEq"; + } + return timesEqParser; +} + + +- (PKParser *)divEqParser { + if (!divEqParser) { + self.divEqParser = [PKSymbol symbolWithString:@"/="]; + divEqParser.name = @"divEq"; + } + return divEqParser; +} + + +- (PKParser *)modEqParser { + if (!modEqParser) { + self.modEqParser = [PKSymbol symbolWithString:@"%="]; + modEqParser.name = @"modEq"; + } + return modEqParser; +} + + +- (PKParser *)shiftLeftParser { + if (!shiftLeftParser) { + self.shiftLeftParser = [PKSymbol symbolWithString:@"<<"]; + shiftLeftParser.name = @"shiftLeft"; + } + return shiftLeftParser; +} + + +- (PKParser *)shiftRightParser { + if (!shiftRightParser) { + self.shiftRightParser = [PKSymbol symbolWithString:@">>"]; + shiftRightParser.name = @"shiftRight"; + } + return shiftRightParser; +} + + +- (PKParser *)shiftRightExtParser { + if (!shiftRightExtParser) { + self.shiftRightExtParser = [PKSymbol symbolWithString:@">>>"]; + shiftRightExtParser.name = @"shiftRightExt"; + } + return shiftRightExtParser; +} + + +- (PKParser *)shiftLeftEqParser { + if (!shiftLeftEqParser) { + self.shiftLeftEqParser = [PKSymbol symbolWithString:@"<<="]; + shiftLeftEqParser.name = @"shiftLeftEq"; + } + return shiftLeftEqParser; +} + + +- (PKParser *)shiftRightEqParser { + if (!shiftRightEqParser) { + self.shiftRightEqParser = [PKSymbol symbolWithString:@">>="]; + shiftRightEqParser.name = @"shiftRightEq"; + } + return shiftRightEqParser; +} + + +- (PKParser *)shiftRightExtEqParser { + if (!shiftRightExtEqParser) { + self.shiftRightExtEqParser = [PKSymbol symbolWithString:@">>>="]; + shiftRightExtEqParser.name = @"shiftRightExtEq"; + } + return shiftRightExtEqParser; +} + + +- (PKParser *)andEqParser { + if (!andEqParser) { + self.andEqParser = [PKSymbol symbolWithString:@"&="]; + andEqParser.name = @"andEq"; + } + return andEqParser; +} + + +- (PKParser *)xorEqParser { + if (!xorEqParser) { + self.xorEqParser = [PKSymbol symbolWithString:@"^="]; + xorEqParser.name = @"xorEq"; + } + return xorEqParser; +} + + +- (PKParser *)orEqParser { + if (!orEqParser) { + self.orEqParser = [PKSymbol symbolWithString:@"|="]; + orEqParser.name = @"orEq"; + } + return orEqParser; +} + + +#pragma mark - +#pragma mark single-char symbols + +- (PKParser *)openCurlyParser { + if (!openCurlyParser) { + self.openCurlyParser = [PKSymbol symbolWithString:@"{"]; + openCurlyParser.name = @"openCurly"; + } + return openCurlyParser; +} + + +- (PKParser *)closeCurlyParser { + if (!closeCurlyParser) { + self.closeCurlyParser = [PKSymbol symbolWithString:@"}"]; + closeCurlyParser.name = @"closeCurly"; + } + return closeCurlyParser; +} + + +- (PKParser *)openParenParser { + if (!openParenParser) { + self.openParenParser = [PKSymbol symbolWithString:@"("]; + openParenParser.name = @"openParen"; + } + return openParenParser; +} + + +- (PKParser *)closeParenParser { + if (!closeParenParser) { + self.closeParenParser = [PKSymbol symbolWithString:@")"]; + closeParenParser.name = @"closeParen"; + } + return closeParenParser; +} + + +- (PKParser *)openBracketParser { + if (!openBracketParser) { + self.openBracketParser = [PKSymbol symbolWithString:@"["]; + openBracketParser.name = @"openBracket"; + } + return openBracketParser; +} + + +- (PKParser *)closeBracketParser { + if (!closeBracketParser) { + self.closeBracketParser = [PKSymbol symbolWithString:@"]"]; + closeBracketParser.name = @"closeBracket"; + } + return closeBracketParser; +} + + +- (PKParser *)commaParser { + if (!commaParser) { + self.commaParser = [PKSymbol symbolWithString:@","]; + commaParser.name = @"comma"; + } + return commaParser; +} + + +- (PKParser *)dotParser { + if (!dotParser) { + self.dotParser = [PKSymbol symbolWithString:@"."]; + dotParser.name = @"dot"; + } + return dotParser; +} + + +- (PKParser *)semiOptParser { + if (!semiOptParser) { + self.semiOptParser = [self zeroOrOne:self.semiParser]; + semiOptParser.name = @"semiOpt"; + } + return semiOptParser; +} + + +- (PKParser *)semiParser { + if (!semiParser) { + self.semiParser = [PKSymbol symbolWithString:@";"]; + semiParser.name = @"semi"; + } + return semiParser; +} + + +- (PKParser *)colonParser { + if (!colonParser) { + self.colonParser = [PKSymbol symbolWithString:@":"]; + colonParser.name = @"colon"; + } + return colonParser; +} + + +- (PKParser *)equalsParser { + if (!equalsParser) { + self.equalsParser = [PKSymbol symbolWithString:@"="]; + equalsParser.name = @"equals"; + } + return equalsParser; +} + + +- (PKParser *)notParser { + if (!notParser) { + self.notParser = [PKSymbol symbolWithString:@"!"]; + notParser.name = @"not"; + } + return notParser; +} + + +- (PKParser *)ltParser { + if (!ltParser) { + self.ltParser = [PKSymbol symbolWithString:@"<"]; + ltParser.name = @"lt"; + } + return ltParser; +} + + +- (PKParser *)gtParser { + if (!gtParser) { + self.gtParser = [PKSymbol symbolWithString:@">"]; + gtParser.name = @"gt"; + } + return gtParser; +} + + +- (PKParser *)ampParser { + if (!ampParser) { + self.ampParser = [PKSymbol symbolWithString:@"&"]; + ampParser.name = @"amp"; + } + return ampParser; +} + + +- (PKParser *)pipeParser { + if (!pipeParser) { + self.pipeParser = [PKSymbol symbolWithString:@"|"]; + pipeParser.name = @"pipe"; + } + return pipeParser; +} + + +- (PKParser *)caretParser { + if (!caretParser) { + self.caretParser = [PKSymbol symbolWithString:@"^"]; + caretParser.name = @"caret"; + } + return caretParser; +} + + +- (PKParser *)tildeParser { + if (!tildeParser) { + self.tildeParser = [PKSymbol symbolWithString:@"~"]; + tildeParser.name = @"tilde"; + } + return tildeParser; +} + + +- (PKParser *)questionParser { + if (!questionParser) { + self.questionParser = [PKSymbol symbolWithString:@"?"]; + questionParser.name = @"question"; + } + return questionParser; +} + + +- (PKParser *)plusParser { + if (!plusParser) { + self.plusParser = [PKSymbol symbolWithString:@"+"]; + plusParser.name = @"plus"; + } + return plusParser; +} + + +- (PKParser *)minusParser { + if (!minusParser) { + self.minusParser = [PKSymbol symbolWithString:@"-"]; + minusParser.name = @"minus"; + } + return minusParser; +} + + +- (PKParser *)timesParser { + if (!timesParser) { + self.timesParser = [PKSymbol symbolWithString:@"x"]; + timesParser.name = @"times"; + } + return timesParser; +} + + +- (PKParser *)divParser { + if (!divParser) { + self.divParser = [PKSymbol symbolWithString:@"/"]; + divParser.name = @"div"; + } + return divParser; +} + + +- (PKParser *)modParser { + if (!modParser) { + self.modParser = [PKSymbol symbolWithString:@"%"]; + modParser.name = @"mod"; + } + return modParser; +} + +@synthesize assignmentOpParser; +@synthesize relationalOpParser; +@synthesize equalityOpParser; +@synthesize shiftOpParser; +@synthesize incrementOpParser; +@synthesize unaryOpParser; +@synthesize multiplicativeOpParser; + +@synthesize programParser; +@synthesize elementParser; +@synthesize funcParser; +@synthesize paramListOptParser; +@synthesize paramListParser; +@synthesize commaIdentifierParser; +@synthesize compoundStmtParser; +@synthesize stmtsParser; +@synthesize stmtParser; +@synthesize ifStmtParser; +@synthesize ifElseStmtParser; +@synthesize whileStmtParser; +@synthesize forParenStmtParser; +@synthesize forBeginStmtParser; +@synthesize forInStmtParser; +@synthesize breakStmtParser; +@synthesize continueStmtParser; +@synthesize withStmtParser; +@synthesize returnStmtParser; +@synthesize variablesOrExprStmtParser; +@synthesize conditionParser; +@synthesize forParenParser; +@synthesize forBeginParser; +@synthesize variablesOrExprParser; +@synthesize varVariablesParser; +@synthesize variablesParser; +@synthesize commaVariableParser; +@synthesize variableParser; +@synthesize assignmentParser; +@synthesize exprOptParser; +@synthesize exprParser; +@synthesize commaAssignmentExprParser; +@synthesize assignmentExprParser; +@synthesize assignmentOpConditionalExprParser; +@synthesize conditionalExprParser; +@synthesize ternaryExprParser; +@synthesize orExprParser; +@synthesize orAndExprParser; +@synthesize andExprParser; +@synthesize andBitwiseOrExprParser; +@synthesize bitwiseOrExprParser; +@synthesize pipeBitwiseXorExprParser; +@synthesize bitwiseXorExprParser; +@synthesize caretBitwiseAndExprParser; +@synthesize bitwiseAndExprParser; +@synthesize ampEqualityExprParser; +@synthesize equalityExprParser; +@synthesize equalityOpRelationalExprParser; +@synthesize relationalExprParser; +@synthesize relationalOpShiftExprParser; +@synthesize shiftExprParser; +@synthesize shiftOpAdditiveExprParser; +@synthesize additiveExprParser; +@synthesize plusOrMinusExprParser; +@synthesize plusExprParser; +@synthesize minusExprParser; +@synthesize multiplicativeExprParser; +@synthesize multiplicativeOpUnaryExprParser; +@synthesize unaryExprParser; +@synthesize unaryExpr1Parser; +@synthesize unaryExpr2Parser; +@synthesize unaryExpr3Parser; +@synthesize unaryExpr4Parser; +@synthesize unaryExpr5Parser; +@synthesize unaryExpr6Parser; +@synthesize constructorCallParser; +@synthesize parenArgListOptParenParser; +@synthesize memberExprParser; +@synthesize memberExprExtParser; +@synthesize dotMemberExprParser; +@synthesize bracketMemberExprParser; +@synthesize argListOptParser; +@synthesize argListParser; +@synthesize primaryExprParser; +@synthesize parenExprParenParser; + +@synthesize funcLiteralParser; +@synthesize arrayLiteralParser; +@synthesize objectLiteralParser; + +@synthesize identifierParser; +@synthesize stringParser; +@synthesize numberParser; + +@synthesize ifParser; +@synthesize elseParser; +@synthesize whileParser; +@synthesize forParser; +@synthesize inParser; +@synthesize breakParser; +@synthesize continueParser; +@synthesize withParser; +@synthesize returnParser; +@synthesize varParser; +@synthesize deleteParser; +@synthesize newParser; +@synthesize thisParser; +@synthesize falseParser; +@synthesize trueParser; +@synthesize nullParser; +@synthesize undefinedParser; +@synthesize voidParser; +@synthesize typeofParser; +@synthesize instanceofParser; +@synthesize functionParser; + +@synthesize orParser; +@synthesize andParser; +@synthesize neParser; +@synthesize isNotParser; +@synthesize eqParser; +@synthesize isParser; +@synthesize leParser; +@synthesize geParser; +@synthesize plusPlusParser; +@synthesize minusMinusParser; +@synthesize plusEqParser; +@synthesize minusEqParser; +@synthesize timesEqParser; +@synthesize divEqParser; +@synthesize modEqParser; +@synthesize shiftLeftParser; +@synthesize shiftRightParser; +@synthesize shiftRightExtParser; +@synthesize shiftLeftEqParser; +@synthesize shiftRightEqParser; +@synthesize shiftRightExtEqParser; +@synthesize andEqParser; +@synthesize xorEqParser; +@synthesize orEqParser; + +@synthesize openCurlyParser; +@synthesize closeCurlyParser; +@synthesize openParenParser; +@synthesize closeParenParser; +@synthesize openBracketParser; +@synthesize closeBracketParser; +@synthesize commaParser; +@synthesize dotParser; +@synthesize semiOptParser; +@synthesize semiParser; +@synthesize colonParser; +@synthesize equalsParser; +@synthesize notParser; +@synthesize ltParser; +@synthesize gtParser; +@synthesize ampParser; +@synthesize pipeParser; +@synthesize caretParser; +@synthesize tildeParser; +@synthesize questionParser; +@synthesize plusParser; +@synthesize minusParser; +@synthesize timesParser; +@synthesize divParser; +@synthesize modParser; +@end diff --git a/test/TDJavaScriptParserTest.h b/test/TDJavaScriptParserTest.h new file mode 100644 index 0000000..20a6de6 --- /dev/null +++ b/test/TDJavaScriptParserTest.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "TDJavaScriptParser.h" + +@interface TDJavaScriptParserTest : SenTestCase { + TDJavaScriptParser *jsp; + NSString *s; + PKTokenAssembly *a; + id res; +} + +@end diff --git a/test/TDJavaScriptParserTest.m b/test/TDJavaScriptParserTest.m new file mode 100644 index 0000000..4e6d16c --- /dev/null +++ b/test/TDJavaScriptParserTest.m @@ -0,0 +1,748 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDJavaScriptParserTest.h" + +@implementation TDJavaScriptParserTest + +- (void)setUp { + jsp = [TDJavaScriptParser parser]; +} + + +- (void)tearDown { + +} + + +- (void)testStmtParser { + s = @";"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.stmtParser bestMatchFor:a]; + TDEqualObjects([res description], @"[;];^"); + + s = @"{}"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.stmtParser bestMatchFor:a]; + TDEqualObjects([res description], @"[{, }]{/}^"); +} + + +- (void)testFunctionParser { + s = @"function"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.functionParser bestMatchFor:a]; + TDEqualObjects([res description], @"[function]function^"); +} + + +- (void)testIdentifierParser { + s = @"foo"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.identifierParser bestMatchFor:a]; + TDEqualObjects([res description], @"[foo]foo^"); +} + + +- (void)testParamListOptParserParser { + s = @"a, b"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.paramListOptParser bestMatchFor:a]; + TDEqualObjects([res description], @"[a, ,, b]a/,/b^"); +} + + +- (void)testCompoundStmtParserParser { + s = @"{}"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.compoundStmtParser bestMatchFor:a]; + TDEqualObjects([res description], @"[{, }]{/}^"); +} + + +- (void)testFuncParser { + s = @"function foo(a, b) {}"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.funcParser bestMatchFor:a]; + TDEqualObjects([res description], @"[function, foo, (, a, ,, b, ), {, }]function/foo/(/a/,/b/)/{/}^"); + + s = @"function foo(a, b) { return a + b; }"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.funcParser bestMatchFor:a]; + TDEqualObjects([res description], @"[function, foo, (, a, ,, b, ), {, return, a, +, b, ;, }]function/foo/(/a/,/b/)/{/return/a/+/b/;/}^"); + + s = @"function foo(a, b) { a++; b--; return a + b; }"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.funcParser bestMatchFor:a]; + TDEqualObjects([res description], @"[function, foo, (, a, ,, b, ), {, a, ++, ;, b, --, ;, return, a, +, b, ;, }]function/foo/(/a/,/b/)/{/a/++/;/b/--/;/return/a/+/b/;/}^"); + + s = @"function foo(a, b) { a++; b--; return a + b; }"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.elementParser bestMatchFor:a]; + TDEqualObjects([res description], @"[function, foo, (, a, ,, b, ), {, a, ++, ;, b, --, ;, return, a, +, b, ;, }]function/foo/(/a/,/b/)/{/a/++/;/b/--/;/return/a/+/b/;/}^"); +} + + +- (void)testBitwiseOrExprParser { + s = @"true"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.bitwiseOrExprParser bestMatchFor:a]; + TDEqualObjects([res description], @"[true]true^"); +} + + +- (void)testAndBitwiseOrExprParser { + s = @"&& true"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.andBitwiseOrExprParser bestMatchFor:a]; + TDEqualObjects([res description], @"[&&, true]&&/true^"); +} + + +- (void)testParamListParser { + s = @"baz, bat"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.paramListParser bestMatchFor:a]; + TDEqualObjects([res description], @"[baz, ,, bat]baz/,/bat^"); + + s = @"foo,bar,c_str"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.paramListParser bestMatchFor:a]; + TDEqualObjects([res description], @"[foo, ,, bar, ,, c_str]foo/,/bar/,/c_str^"); + + s = @"_x, __y"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.paramListParser bestMatchFor:a]; + TDEqualObjects([res description], @"[_x, ,, __y]_x/,/__y^"); +} + + +- (void)testCommaIdentifierParser { + s = @", foo"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.commaIdentifierParser bestMatchFor:a]; + TDEqualObjects([res description], @"[,, foo],/foo^"); + + s = @" ,bar"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.commaIdentifierParser bestMatchFor:a]; + TDEqualObjects([res description], @"[,, bar],/bar^"); +} + + +- (void)testBreakStmtParser { + s = @"break;"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.breakStmtParser bestMatchFor:a]; + TDEqualObjects([res description], @"[break, ;]break/;^"); +} + + +- (void)testContinueStmtParser { + s = @"continue;"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.continueStmtParser bestMatchFor:a]; + TDEqualObjects([res description], @"[continue, ;]continue/;^"); +} + + +- (void)testAssignmentOpParser { + s = @"="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.assignmentOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[=]=^"); + + s = @"*="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.assignmentOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[*=]*=^"); + + s = @"%="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.assignmentOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[%=]%=^"); + + s = @">>>="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.assignmentOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[>>>=]>>>=^"); +} + + +- (void)testRelationalOpParser { + s = @"<="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.relationalOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[<=]<=^"); + + s = @"instanceof"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.relationalOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[instanceof]instanceof^"); +} + + +- (void)testEqualityOpParser { + s = @"=="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.equalityOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[==]==^"); + + s = @"!=="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.equalityOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[!==]!==^"); + + s = @"==="; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.equalityOpParser bestMatchFor:a]; + TDEqualObjects([res description], @"[===]===^"); +} + + +- (void)testForParenParser { + s = @"for ("; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.forParenParser bestMatchFor:a]; + TDEqualObjects([res description], @"[for, (]for/(^"); + + s = @"for("; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.forParenParser bestMatchFor:a]; + TDEqualObjects([res description], @"[for, (]for/(^"); +} + + +- (void)testExprOptParser { + s = @"true"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.exprOptParser bestMatchFor:a]; + TDEqualObjects([res description], @"[true]true^"); +} + + +- (void)testForBeginParenStmtParser { + s = @"for(1"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.forBeginParser bestMatchFor:a]; + TDEqualObjects([res description], @"[for, (, 1]for/(/1^"); + + s = @";"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.semiParser bestMatchFor:a]; + TDEqualObjects([res description], @"[;];^"); + + s = @"3<2"; + jsp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:jsp.tokenizer]; + res = [jsp.exprOptParser bestMatchFor:a]; + TDEqualObjects([res description], @"[3, <, 2]3/ + +@interface TDJsonParser : PKAlternation { + BOOL shouldAssemble; + PKParser *stringParser; + PKParser *numberParser; + PKParser *nullParser; + PKCollectionParser *booleanParser; + PKCollectionParser *arrayParser; + PKCollectionParser *objectParser; + PKCollectionParser *valueParser; + PKCollectionParser *commaValueParser; + PKCollectionParser *propertyParser; + PKCollectionParser *commaPropertyParser; + + PKToken *curly; + PKToken *bracket; +} + +- (id)initWithIntentToAssemble:(BOOL)shouldAssemble; + +- (id)parse:(NSString *)s; + +@property (nonatomic, retain) PKParser *stringParser; +@property (nonatomic, retain) PKParser *numberParser; +@property (nonatomic, retain) PKParser *nullParser; +@property (nonatomic, retain) PKCollectionParser *booleanParser; +@property (nonatomic, retain) PKCollectionParser *arrayParser; +@property (nonatomic, retain) PKCollectionParser *objectParser; +@property (nonatomic, retain) PKCollectionParser *valueParser; +@property (nonatomic, retain) PKCollectionParser *commaValueParser; +@property (nonatomic, retain) PKCollectionParser *propertyParser; +@property (nonatomic, retain) PKCollectionParser *commaPropertyParser; +@end \ No newline at end of file diff --git a/test/TDJsonParser.m b/test/TDJsonParser.m new file mode 100644 index 0000000..14f12ae --- /dev/null +++ b/test/TDJsonParser.m @@ -0,0 +1,322 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDJsonParser.h" +#import "ParseKit.h" +#import "NSString+ParseKitAdditions.h" + +@interface PKParser (PKParserFactoryAdditionsFriend) +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@interface PKCollectionParser () +@property (nonatomic, readwrite, retain) NSMutableArray *subparsers; +@end + +@interface TDJsonParser () +@property (nonatomic, retain) PKToken *curly; +@property (nonatomic, retain) PKToken *bracket; +@end + +@implementation TDJsonParser + +- (id)init { + return [self initWithIntentToAssemble:YES]; +} + + +- (id)initWithIntentToAssemble:(BOOL)yn { + if (self = [super init]) { + shouldAssemble = yn; + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0.0]; + self.bracket = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"[" floatValue:0.0]; + + self.tokenizer = [PKTokenizer tokenizer]; + [self.tokenizer setTokenizerState:self.tokenizer.symbolState from: '/' to: '/']; // JSON doesn't have slash slash or slash star comments + [self.tokenizer setTokenizerState:self.tokenizer.symbolState from: '\'' to: '\'']; // JSON does not have single quoted strings + + [self add:self.objectParser]; + [self add:self.arrayParser]; + } + return self; +} + + +- (void)dealloc { + // yikes. this is necessary to prevent a very nasty retain cycle leak. + // to be safe, release the subparsers of all collection parsers (as they may have retain cycles in complex grammars like this one) + // technically i only need to release the valueParser.subparers in this case, but better to be paranoid than to leak. + booleanParser.subparsers = nil; + arrayParser.subparsers = nil; + objectParser.subparsers = nil; + valueParser.subparsers = nil; + commaValueParser.subparsers = nil; + propertyParser.subparsers = nil; + commaPropertyParser.subparsers = nil; + + self.tokenizer = nil; + self.stringParser = nil; + self.numberParser = nil; + self.nullParser = nil; + self.booleanParser = nil; + self.arrayParser = nil; + self.objectParser = nil; + self.valueParser = nil; + self.propertyParser = nil; + self.commaPropertyParser = nil; + self.commaValueParser = nil; + self.curly = nil; + self.bracket = nil; + [super dealloc]; +} + + +- (id)parse:(NSString *)s { + self.tokenizer.string = s; + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:self.tokenizer]; + + PKAssembly *result = [self completeMatchFor:a]; + return [result pop]; +} + + +- (PKParser *)stringParser { + if (!stringParser) { + self.stringParser = [PKQuotedString quotedString]; + if (shouldAssemble) { + [stringParser setAssembler:self selector:@selector(didMatchString:)]; + } + } + return stringParser; +} + + +- (PKParser *)numberParser { + if (!numberParser) { + self.numberParser = [PKNumber number]; + if (shouldAssemble) { + [numberParser setAssembler:self selector:@selector(didMatchNumber:)]; + } + } + return numberParser; +} + + +- (PKParser *)nullParser { + if (!nullParser) { + self.nullParser = [[PKLiteral literalWithString:@"null"] discard]; + if (shouldAssemble) { + [nullParser setAssembler:self selector:@selector(didMatchNull:)]; + } + } + return nullParser; +} + + +- (PKCollectionParser *)booleanParser { + if (!booleanParser) { + self.booleanParser = [PKAlternation alternation]; + [booleanParser add:[PKLiteral literalWithString:@"true"]]; + [booleanParser add:[PKLiteral literalWithString:@"false"]]; + if (shouldAssemble) { + [booleanParser setAssembler:self selector:@selector(didMatchBoolean:)]; + } + } + return booleanParser; +} + + +- (PKCollectionParser *)arrayParser { + if (!arrayParser) { + + // array = '[' content ']' + // content = Empty | actualArray + // actualArray = value commaValue* + + PKTrack *actualArray = [PKTrack sequence]; + [actualArray add:self.valueParser]; + [actualArray add:[PKRepetition repetitionWithSubparser:self.commaValueParser]]; + + PKAlternation *content = [PKAlternation alternation]; + [content add:[PKEmpty empty]]; + [content add:actualArray]; + + self.arrayParser = [PKSequence sequence]; + [arrayParser add:[PKSymbol symbolWithString:@"["]]; // serves as fence + [arrayParser add:content]; + [arrayParser add:[[PKSymbol symbolWithString:@"]"] discard]]; + + if (shouldAssemble) { + [arrayParser setAssembler:self selector:@selector(didMatchArray:)]; + } + } + return arrayParser; +} + + +- (PKCollectionParser *)objectParser { + if (!objectParser) { + + // object = '{' content '}' + // content = Empty | actualObject + // actualObject = property commaProperty* + // property = QuotedString ':' value + // commaProperty = ',' property + + PKTrack *actualObject = [PKTrack sequence]; + [actualObject add:self.propertyParser]; + [actualObject add:[PKRepetition repetitionWithSubparser:self.commaPropertyParser]]; + + PKAlternation *content = [PKAlternation alternation]; + [content add:[PKEmpty empty]]; + [content add:actualObject]; + + self.objectParser = [PKSequence sequence]; + [objectParser add:[PKSymbol symbolWithString:@"{"]]; // serves as fence + [objectParser add:content]; + [objectParser add:[[PKSymbol symbolWithString:@"}"] discard]]; + + if (shouldAssemble) { + [objectParser setAssembler:self selector:@selector(didMatchObject:)]; + } + } + return objectParser; +} + + +- (PKCollectionParser *)valueParser { + if (!valueParser) { + self.valueParser = [PKAlternation alternation]; + [valueParser add:self.stringParser]; + [valueParser add:self.numberParser]; + [valueParser add:self.nullParser]; + [valueParser add:self.booleanParser]; + [valueParser add:self.arrayParser]; + [valueParser add:self.objectParser]; + } + return valueParser; +} + + +- (PKCollectionParser *)commaValueParser { + if (!commaValueParser) { + self.commaValueParser = [PKTrack sequence]; + [commaValueParser add:[[PKSymbol symbolWithString:@","] discard]]; + [commaValueParser add:self.valueParser]; + } + return commaValueParser; +} + + +- (PKCollectionParser *)propertyParser { + if (!propertyParser) { + self.propertyParser = [PKSequence sequence]; + [propertyParser add:[PKQuotedString quotedString]]; + [propertyParser add:[[PKSymbol symbolWithString:@":"] discard]]; + [propertyParser add:self.valueParser]; + if (shouldAssemble) { + [propertyParser setAssembler:self selector:@selector(didMatchProperty:)]; + } + } + return propertyParser; +} + + +- (PKCollectionParser *)commaPropertyParser { + if (!commaPropertyParser) { + self.commaPropertyParser = [PKTrack sequence]; + [commaPropertyParser add:[[PKSymbol symbolWithString:@","] discard]]; + [commaPropertyParser add:self.propertyParser]; + } + return commaPropertyParser; +} + + +- (void)didMatchNull:(PKAssembly *)a { + [a push:[NSNull null]]; +} + + +- (void)didMatchNumber:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)didMatchString:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[tok.stringValue stringByTrimmingQuotes]]; +} + + +- (void)didMatchBoolean:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithBool:[tok.stringValue isEqualToString:@"true"] ? YES : NO]]; +} + + +- (void)didMatchArray:(PKAssembly *)a { + NSArray *elements = [a objectsAbove:self.bracket]; + NSMutableArray *array = [NSMutableArray arrayWithCapacity:[elements count]]; + + for (id element in [elements reverseObjectEnumerator]) { + if (element) { + [array addObject:element]; + } + } + [a pop]; // pop the [ + [a push:array]; +} + + +- (void)didMatchObject:(PKAssembly *)a { + NSArray *elements = [a objectsAbove:self.curly]; + NSMutableDictionary *d = [NSMutableDictionary dictionaryWithCapacity:[elements count] / 2.]; + + NSInteger i = 0; + for ( ; i < [elements count] - 1; i++) { + id value = [elements objectAtIndex:i++]; + NSString *key = [elements objectAtIndex:i]; + if (key && value) { + [d setObject:value forKey:key]; + } + } + + [a pop]; // pop the { + [a push:d]; +} + + +- (void)didMatchProperty:(PKAssembly *)a { + id value = [a pop]; + PKToken *tok = [a pop]; + NSString *key = [tok.stringValue stringByTrimmingQuotes]; + + [a push:key]; + [a push:value]; +} + +@synthesize stringParser; +@synthesize numberParser; +@synthesize nullParser; +@synthesize booleanParser; +@synthesize arrayParser; +@synthesize objectParser; +@synthesize valueParser; +@synthesize commaValueParser; +@synthesize propertyParser; +@synthesize commaPropertyParser; +@synthesize curly; +@synthesize bracket; +@end diff --git a/test/TDJsonParserTest.h b/test/TDJsonParserTest.h new file mode 100644 index 0000000..229fc08 --- /dev/null +++ b/test/TDJsonParserTest.h @@ -0,0 +1,26 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@class TDJsonParser; + +@interface TDJsonParserTest : SenTestCase { + TDJsonParser *p; + NSString *s; + PKAssembly *a; + PKAssembly *result; +} + +@end diff --git a/test/TDJsonParserTest.m b/test/TDJsonParserTest.m new file mode 100644 index 0000000..49f1568 --- /dev/null +++ b/test/TDJsonParserTest.m @@ -0,0 +1,543 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDJsonParserTest.h" +#import "TDJsonParser.h" +#import "TDFastJsonParser.h" + +@implementation TDJsonParserTest + +- (void)setUp { + p = [TDJsonParser parser]; +} + + +- (void)testForAppleBossResultTokenization { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKTokenizer *t = [[[PKTokenizer alloc] initWithString:s] autorelease]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + while (eof != (tok = [t nextToken])) { + //NSLog(@"tok: %@", tok); + } +} + + +- (void)testForAppleBossResult { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + @try { + result = [p parse:s]; + } + @catch (NSException *e) { + //NSLog(@"\n\n\nexception:\n\n %@", [e reason]); + } + + //NSLog(@"result %@", result); +} + + +- (void)testEmptyString { + s = @""; + a = [PKTokenAssembly assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDNil(result); +} + + +- (void)testNum { + s = @"456"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p numberParser] bestMatchFor:a]; + TDNotNil(result); + + TDEqualObjects(@"[456]456^", [result description]); + id obj = [result pop]; + TDNotNil(obj); + TDEqualObjects([NSNumber numberWithFloat:456], obj); + + + s = @"-3.47"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p numberParser] bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[-3.47]-3.47^", [result description]); + obj = [result pop]; + TDNotNil(obj); + TDEqualObjects([NSNumber numberWithFloat:-3.47], obj); +} + + +- (void)testString { + s = @"'foobar'"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p stringParser] bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foobar]'foobar'^", [result description]); + id obj = [result pop]; + TDNotNil(obj); + TDEqualObjects(@"foobar", obj); + + s = @"\"baz boo boo\""; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p stringParser] bestMatchFor:a]; + TDNotNil(result); + + TDEqualObjects(@"[baz boo boo]\"baz boo boo\"^", [result description]); + obj = [result pop]; + TDNotNil(obj); + TDEqualObjects(@"baz boo boo", obj); +} + + +- (void)testBoolean { + s = @"true"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p booleanParser] bestMatchFor:a]; + TDNotNil(result); + + TDEqualObjects(@"[1]true^", [result description]); + id obj = [result pop]; + TDNotNil(obj); + TDEqualObjects([NSNumber numberWithBool:YES], obj); + + s = @"false"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p booleanParser] bestMatchFor:a]; + TDNotNil(result); + + TDEqualObjects(@"[0]false^", [result description]); + obj = [result pop]; + TDNotNil(obj); + TDEqualObjects([NSNumber numberWithBool:NO], obj); +} + + +- (void)testArray { + s = @"[1, 2, 3]"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p arrayParser] bestMatchFor:a]; + + NSLog(@"result: %@", result); + TDNotNil(result); + id obj = [result pop]; + TDEquals((int)3, (int)[obj count]); + TDEqualObjects([NSNumber numberWithInteger:1], [obj objectAtIndex:0]); + TDEqualObjects([NSNumber numberWithInteger:2], [obj objectAtIndex:1]); + TDEqualObjects([NSNumber numberWithInteger:3], [obj objectAtIndex:2]); + TDEqualObjects(@"[][/1/,/2/,/3/]^", [result description]); + + s = @"[true, 'garlic jazz!', .888]"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p arrayParser] bestMatchFor:a]; + TDNotNil(result); + + //TDEqualObjects(@"[true, 'garlic jazz!', .888]true/'garlic jazz!'/.888^", [result description]); + obj = [result pop]; + TDEqualObjects([NSNumber numberWithBool:YES], [obj objectAtIndex:0]); + TDEqualObjects(@"garlic jazz!", [obj objectAtIndex:1]); + TDEqualObjects([NSNumber numberWithFloat:.888], [obj objectAtIndex:2]); + + s = @"[1, [2, [3, 4]]]"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p arrayParser] bestMatchFor:a]; + TDNotNil(result); + //NSLog(@"result: %@", [a stack]); + TDEqualObjects([NSNumber numberWithInteger:1], [obj objectAtIndex:0]); +} + + +- (void)testObject { + s = @"{'key': 'value'}"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p objectParser] bestMatchFor:a]; + TDNotNil(result); + + id obj = [result pop]; + TDEqualObjects([obj objectForKey:@"key"], @"value"); + + s = @"{'foo': false, 'bar': true, \"baz\": -9.457}"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p objectParser] bestMatchFor:a]; + TDNotNil(result); + + obj = [result pop]; + TDEqualObjects([obj objectForKey:@"foo"], [NSNumber numberWithBool:NO]); + TDEqualObjects([obj objectForKey:@"bar"], [NSNumber numberWithBool:YES]); + TDEqualObjects([obj objectForKey:@"baz"], [NSNumber numberWithFloat:-9.457]); + + s = @"{'baz': {'foo': [1,2]}}"; + a = [PKTokenAssembly assemblyWithString:s]; + result = [[p objectParser] bestMatchFor:a]; + TDNotNil(result); + + obj = [result pop]; + NSDictionary *dict = [obj objectForKey:@"baz"]; + TDTrue([dict isKindOfClass:[NSDictionary class]]); + NSArray *arr = [dict objectForKey:@"foo"]; + TDTrue([arr isKindOfClass:[NSArray class]]); + TDEqualObjects([NSNumber numberWithInteger:1], [arr objectAtIndex:0]); + + // TDEqualObjects(@"['baz', 'foo', 1, 2]'baz'/'foo'/1/2^", [result description]); +} + + +- (void)testCrunchBaseJsonParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDJsonParser *parser = [[[TDJsonParser alloc] init] autorelease]; + [parser parse:s]; +// id res = [parser parse:s]; + //NSLog(@"res %@", res); +} + + +- (void)testCrunchBaseJsonParserTokenization { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKTokenizer *t = [[[PKTokenizer alloc] initWithString:s] autorelease]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + while (eof != (tok = [t nextToken])) { + //NSLog(@"tok: %@", tok); + } +} + + +- (void)testCrunchBaseJsonTokenParser { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"yahoo" ofType:@"json"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + TDFastJsonParser *parser = [[[TDFastJsonParser alloc] init] autorelease]; + [parser parse:s]; + // id res = [parser parse:s]; + //NSLog(@"res %@", res); +} + + +- (void)testYahoo1 { + s = + @"{" + @"\"name\": \"Yahoo!\"," + @"\"permalink\": \"yahoo\"," + @"\"homepage_url\": \"http://www.yahoo.com\"," + @"\"blog_url\": \"http://yodel.yahoo.com/\"," + @"\"blog_feed_url\": \"http://ycorpblog.com/feed/\"," + @"\"category_code\": \"web\"," + @"\"number_of_employees\": 13600," + @"\"founded_year\": 1994," + @"\"founded_month\": null," + @"\"founded_day\": null," + @"\"deadpooled_year\": null," + @"\"deadpooled_month\": null," + @"\"deadpooled_day\": null," + @"\"deadpooled_url\": null," + @"\"tag_list\": \"search, portal, webmail, photos\"," + @"\"email_address\": \"\"," + @"\"phone_number\": \"(408) 349-3300\"" + @"}"; + result = [p parse:s]; + //NSLog(@"result %@", result); + TDNotNil(result); + id d = result; + TDNotNil(d); + TDTrue([d isKindOfClass:[NSDictionary class]]); + TDEqualObjects([d objectForKey:@"name"], @"Yahoo!"); + TDEqualObjects([d objectForKey:@"permalink"], @"yahoo"); + TDEqualObjects([d objectForKey:@"homepage_url"], @"http://www.yahoo.com"); + TDEqualObjects([d objectForKey:@"blog_url"], @"http://yodel.yahoo.com/"); + TDEqualObjects([d objectForKey:@"blog_feed_url"], @"http://ycorpblog.com/feed/"); + TDEqualObjects([d objectForKey:@"category_code"], @"web"); + TDEqualObjects([d objectForKey:@"number_of_employees"], [NSNumber numberWithInteger:13600]); + TDEqualObjects([d objectForKey:@"founded_year"], [NSNumber numberWithInteger:1994]); + TDEqualObjects([d objectForKey:@"founded_month"], [NSNull null]); + TDEqualObjects([d objectForKey:@"founded_day"], [NSNull null]); + TDEqualObjects([d objectForKey:@"deadpooled_year"], [NSNull null]); + TDEqualObjects([d objectForKey:@"deadpooled_month"], [NSNull null]); + TDEqualObjects([d objectForKey:@"deadpooled_day"], [NSNull null]); + TDEqualObjects([d objectForKey:@"deadpooled_url"], [NSNull null]); + TDEqualObjects([d objectForKey:@"tag_list"], @"search, portal, webmail, photos"); + TDEqualObjects([d objectForKey:@"email_address"], @""); + TDEqualObjects([d objectForKey:@"phone_number"], @"(408) 349-3300"); +} + + +- (void)testYahoo2 { + s = @"{\"image\":" + @" {\"available_sizes\":" + @" [[[150, 37]," + @" \"assets/images/resized/0001/0836/10836v1-max-250x150.png\"]," + @" [[200, 50]," + @" \"assets/images/resized/0001/0836/10836v1-max-250x250.png\"]," + @" [[200, 50]," + @" \"assets/images/resized/0001/0836/10836v1-max-450x450.png\"]]," + @" \"attribution\": null}" + @"}"; + result = [p parse:s]; + //NSLog(@"result %@", result); + + TDNotNil(result); + + id d = result; + TDNotNil(d); + TDTrue([d isKindOfClass:[NSDictionary class]]); + + id image = [d objectForKey:@"image"]; + TDNotNil(image); + TDTrue([image isKindOfClass:[NSDictionary class]]); + + NSArray *sizes = [image objectForKey:@"available_sizes"]; + TDNotNil(sizes); + TDTrue([sizes isKindOfClass:[NSArray class]]); + + TDEquals(3, (int)[sizes count]); + + NSArray *first = [sizes objectAtIndex:0]; + TDNotNil(first); + TDTrue([first isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[first count]); + + NSArray *firstKey = [first objectAtIndex:0]; + TDNotNil(firstKey); + TDTrue([firstKey isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[firstKey count]); + TDEqualObjects([NSNumber numberWithInteger:150], [firstKey objectAtIndex:0]); + TDEqualObjects([NSNumber numberWithInteger:37], [firstKey objectAtIndex:1]); + + NSArray *second = [sizes objectAtIndex:1]; + TDNotNil(second); + TDTrue([second isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[second count]); + + NSArray *secondKey = [second objectAtIndex:0]; + TDNotNil(secondKey); + TDTrue([secondKey isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[secondKey count]); + TDEqualObjects([NSNumber numberWithInteger:200], [secondKey objectAtIndex:0]); + TDEqualObjects([NSNumber numberWithInteger:50], [secondKey objectAtIndex:1]); + + NSArray *third = [sizes objectAtIndex:2]; + TDNotNil(third); + TDTrue([third isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[third count]); + + NSArray *thirdKey = [third objectAtIndex:0]; + TDNotNil(thirdKey); + TDTrue([thirdKey isKindOfClass:[NSArray class]]); + TDEquals(2, (int)[thirdKey count]); + TDEqualObjects([NSNumber numberWithInteger:200], [thirdKey objectAtIndex:0]); + TDEqualObjects([NSNumber numberWithInteger:50], [thirdKey objectAtIndex:1]); + + +// TDEqualObjects([d objectForKey:@"name"], @"Yahoo!"); +} + + +- (void)testYahoo3 { + s = + @"{\"products\":" + @"[" + @"{\"name\": \"Yahoo.com\", \"permalink\": \"yahoo-com\"}," + @"{\"name\": \"Yahoo! Mail\", \"permalink\": \"yahoo-mail\"}," + @"{\"name\": \"Yahoo! Search\", \"permalink\": \"yahoo-search\"}," + @"{\"name\": \"Yahoo! Directory\", \"permalink\": \"yahoo-directory\"}," + @"{\"name\": \"Yahoo! Finance\", \"permalink\": \"yahoo-finance\"}," + @"{\"name\": \"My Yahoo\", \"permalink\": \"my-yahoo\"}," + @"{\"name\": \"Yahoo! News\", \"permalink\": \"yahoo-news\"}," + @"{\"name\": \"Yahoo! Groups\", \"permalink\": \"yahoo-groups\"}," + @"{\"name\": \"Yahoo! Messenger\", \"permalink\": \"yahoo-messenger\"}," + @"{\"name\": \"Yahoo! Games\", \"permalink\": \"yahoo-games\"}," + @"{\"name\": \"Yahoo! People Search\", \"permalink\": \"yahoo-people-search\"}," + @"{\"name\": \"Yahoo! Movies\", \"permalink\": \"yahoo-movies\"}," + @"{\"name\": \"Yahoo! Weather\", \"permalink\": \"yahoo-weather\"}," + @"{\"name\": \"Yahoo! Video\", \"permalink\": \"yahoo-video\"}," + @"{\"name\": \"Yahoo! Music\", \"permalink\": \"yahoo-music\"}," + @"{\"name\": \"Yahoo! Sports\", \"permalink\": \"yahoo-sports\"}," + @"{\"name\": \"Yahoo! Maps\", \"permalink\": \"yahoo-maps\"}," + @"{\"name\": \"Yahoo! Auctions\", \"permalink\": \"yahoo-auctions\"}," + @"{\"name\": \"Yahoo! Widgets\", \"permalink\": \"yahoo-widgets\"}," + @"{\"name\": \"Yahoo! Shopping\", \"permalink\": \"yahoo-shopping\"}," + @"{\"name\": \"Yahoo! Real Estate\", \"permalink\": \"yahoo-real-estate\"}," + @"{\"name\": \"Yahoo! Travel\", \"permalink\": \"yahoo-travel\"}," + @"{\"name\": \"Yahoo! Classifieds\", \"permalink\": \"yahoo-classifieds\"}," + @"{\"name\": \"Yahoo! Answers\", \"permalink\": \"yahoo-answers\"}," + @"{\"name\": \"Yahoo! Mobile\", \"permalink\": \"yahoo-mobile\"}," + @"{\"name\": \"Yahoo! Buzz\", \"permalink\": \"yahoo-buzz\"}," + @"{\"name\": \"Yahoo! Open Search Platform\", \"permalink\": \"yahoo-open-search-platform\"}," + @"{\"name\": \"Fire Eagle\", \"permalink\": \"fireeagle\"}," + @"{\"name\": \"Shine\", \"permalink\": \"shine\"}," + @"{\"name\": \"Yahoo! Shortcuts\", \"permalink\": \"yahoo-shortcuts\"}" + @"]" + @"}"; + result = [p parse:s]; + //NSLog(@"result %@", result); + + TDNotNil(result); + + id d = result; + TDNotNil(d); + TDTrue([d isKindOfClass:[NSDictionary class]]); + + NSArray *products = [d objectForKey:@"products"]; + TDNotNil(products); + TDTrue([products isKindOfClass:[NSArray class]]); +} + + +- (void)testYahoo4 { + s = @"[" + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1," + @"1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1" + @"]"; + + p = [[[TDFastJsonParser alloc] init] autorelease]; + result = [p parse:s]; + //NSLog(@"result %@", result); + + TDNotNil(result); + + id d = result; + TDNotNil(d); + TDTrue([d isKindOfClass:[NSArray class]]); + +// NSArray *products = [d objectForKey:@"products"]; +// TDNotNil(products); +// TDTrue([products isKindOfClass:[NSArray class]]); +} +@end diff --git a/test/TDLetterTest.h b/test/TDLetterTest.h new file mode 100644 index 0000000..052741d --- /dev/null +++ b/test/TDLetterTest.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + + +@interface TDLetterTest : SenTestCase { + NSString *s; + PKCharacterAssembly *a; + PKChar *p; + PKAssembly *result; +} + +@end diff --git a/test/TDLetterTest.m b/test/TDLetterTest.m new file mode 100644 index 0000000..41dd111 --- /dev/null +++ b/test/TDLetterTest.m @@ -0,0 +1,65 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDLetterTest.h" + +@interface PKAssembly () +- (BOOL)hasMore; +@end + +@implementation TDLetterTest + +- (void)test123 { + s = @"123"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^123", [a description]); + p = [PKLetter letter]; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDNil(result); + TDTrue([a hasMore]); +} + + +- (void)testAbc { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^abc", [a description]); + p = [PKLetter letter]; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[a]a^bc", [result description]); + TDTrue([result hasMore]); +} + + +- (void)testRepetition { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^abc", [a description]); + p = [PKLetter letter]; + PKParser *r = [PKRepetition repetitionWithSubparser:p]; + + result = [r bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[a, b, c]abc^", [result description]); + TDFalse([result hasMore]); +} + +@end diff --git a/test/TDLiteralTest.h b/test/TDLiteralTest.h new file mode 100644 index 0000000..c1dae34 --- /dev/null +++ b/test/TDLiteralTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDLiteralTest : SenTestCase { + PKParser *p; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/TDLiteralTest.m b/test/TDLiteralTest.m new file mode 100644 index 0000000..7804465 --- /dev/null +++ b/test/TDLiteralTest.m @@ -0,0 +1,97 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDLiteralTest.h" + +@implementation TDLiteralTest + +- (void)tearDown { + [a release]; +} + +- (void)testTrueCompleteMatchForLiteral123 { + s = @"123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + NSLog(@"a: %@", a); + + p = [PKNumber number]; + PKAssembly *result = [p completeMatchFor:a]; + + // -[PKParser completeMatchFor:] + // -[PKParser bestMatchFor:] + // -[PKParser matchAndAssemble:] + // -[PKTerminal allMatchesFor:] + // -[PKTerminal matchOneAssembly:] + // -[PKLiteral qualifies:] + // -[PKParser best:] + + NSLog(@"result: %@", result); + TDNotNil(result); + TDEqualObjects(@"[123]123^", [result description]); +} + + +- (void)testFalseCompleteMatchForLiteral123 { + s = @"1234"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKLiteral literalWithString:@"123"]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); + TDEqualObjects(@"[]^1234", [a description]); +} + + +- (void)testTrueCompleteMatchForLiteralFoo { + s = @"Foo"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKLiteral literalWithString:@"Foo"]; + PKAssembly *result = [p completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[Foo]Foo^", [result description]); +} + + +- (void)testFalseCompleteMatchForLiteralFoo { + s = @"Foo"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKLiteral literalWithString:@"foo"]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testFalseCompleteMatchForCaseInsensitiveLiteralFoo { + s = @"Fool"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKCaseInsensitiveLiteral literalWithString:@"Foo"]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testTrueCompleteMatchForCaseInsensitiveLiteralFoo { + s = @"Foo"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [PKCaseInsensitiveLiteral literalWithString:@"foo"]; + PKAssembly *result = [p completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[Foo]Foo^", [result description]); +} + +@end diff --git a/test/TDLowercaseWordTest.h b/test/TDLowercaseWordTest.h new file mode 100644 index 0000000..e150738 --- /dev/null +++ b/test/TDLowercaseWordTest.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDLowercaseWordTest : SenTestCase { + +} +@end + diff --git a/test/TDLowercaseWordTest.m b/test/TDLowercaseWordTest.m new file mode 100644 index 0000000..e586a45 --- /dev/null +++ b/test/TDLowercaseWordTest.m @@ -0,0 +1,63 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDLowercaseWordTest.h" + +@implementation TDLowercaseWordTest + +- (void)testFoobar { + NSString *s = @"Foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKLowercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + + +- (void)testfoobar { + NSString *s = @"foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKLowercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foobar]foobar^", [result description]); +} + + +- (void)test123 { + NSString *s = @"123"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKLowercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + + +- (void)testPercentFoobar { + NSString *s = @"%Foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKLowercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + +@end diff --git a/test/TDMiniCSSAssembler.h b/test/TDMiniCSSAssembler.h new file mode 100644 index 0000000..34864f0 --- /dev/null +++ b/test/TDMiniCSSAssembler.h @@ -0,0 +1,27 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKToken; + +@interface TDMiniCSSAssembler : NSObject { + NSMutableDictionary *attributes; + PKToken *paren; + PKToken *curly; +} +@property (nonatomic, retain) NSMutableDictionary *attributes; +@property (nonatomic, retain) PKToken *paren; +@property (nonatomic, retain) PKToken *curly; +@end diff --git a/test/TDMiniCSSAssembler.m b/test/TDMiniCSSAssembler.m new file mode 100644 index 0000000..dca1e1c --- /dev/null +++ b/test/TDMiniCSSAssembler.m @@ -0,0 +1,190 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDMiniCSSAssembler.h" +#import "NSString+ParseKitAdditions.h" +#import + +@interface TDMiniCSSAssembler () +- (void)gatherPropertiesIn:(id)props; +@end + +@implementation TDMiniCSSAssembler + +- (id)init { + if (self = [super init]) { + self.attributes = [NSMutableDictionary dictionary]; + self.paren = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"(" floatValue:0.0]; + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0.0]; + } + return self; +} + + +- (void)dealloc { + self.attributes = nil; + self.paren = nil; + self.curly = nil; + [super dealloc]; +} + + +#pragma mark - +#pragma mark Assembler Callbacks + +// @start = ruleset*; +// ruleset = selector '{' decls >'}'; +// selector = LowercaseWord; // forcing selectors to be lowercase words for use in a future syntax-highlight framework where i want that +// decls = Empty | actualDecls; +// actualDecls = decl decl*; +// decl = property >':' expr >';'?; +// property = 'color' | 'background-color' | 'font-family' | 'font-size'; +// expr = pixelValue | rgb | string | constants; +// pixelValue = Number >'px'; +// rgb = >'rgb' '(' Number >',' Number >',' Number >')'; +// string = QuotedString; +// constants = 'bold' | 'normal' | 'italic'; + +- (void)didMatchProperty:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:tok.stringValue]; +} + + +- (void)didMatchString:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[tok.stringValue stringByTrimmingQuotes]]; +} + + +- (void)didMatchConstant:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:tok.stringValue]; +} + + +- (void)didMatchNum:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)didMatchPixelValue:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)didMatchRgb:(PKAssembly *)a { + NSArray *objs = [a objectsAbove:paren]; + [a pop]; // discard '(' + CGFloat blue = [(PKToken *)[objs objectAtIndex:0] floatValue]/255.0; + CGFloat green = [(PKToken *)[objs objectAtIndex:1] floatValue]/255.0; + CGFloat red = [(PKToken *)[objs objectAtIndex:2] floatValue]/255.0; + [a push:[NSColor colorWithDeviceRed:red green:green blue:blue alpha:1.0]]; +} + + +- (void)didMatchActualDecls:(PKAssembly *)a { + id d = [NSMutableDictionary dictionary]; + NSArray *objs = [a objectsAbove:curly]; + [a pop]; // discard curly + + NSInteger i = 0; + NSInteger count = [objs count]; + for ( ; i < count - 1; i++) { + id propVal = [objs objectAtIndex:i]; + id propName = [objs objectAtIndex:++i]; + [d setObject:propVal forKey:propName]; + } + + [a push:d]; +} + + +- (void)didMatchRuleset:(PKAssembly *)a { + id props = [a pop]; + [self gatherPropertiesIn:props]; + + for (PKToken *selectorTok in [a objectsAbove:nil]) { + NSString *selector = selectorTok.stringValue; + [attributes setObject:props forKey:selector]; + } +} + + +- (void)gatherPropertiesIn:(id)props { + NSColor *color = [props objectForKey:@"color"]; + if (!color) { + color = [NSColor blackColor]; + } + [props setObject:color forKey:NSForegroundColorAttributeName]; + [props removeObjectForKey:@"color"]; + + color = [props objectForKey:@"background-color"]; + if (!color) { + color = [NSColor whiteColor]; + } + [props setObject:color forKey:NSBackgroundColorAttributeName]; + [props removeObjectForKey:@"background-color"]; + + NSString *fontFamily = [props objectForKey:@"font-family"]; + if (![fontFamily length]) { + fontFamily = @"Monaco"; + } + + CGFloat fontSize = [[props objectForKey:@"font-size"] doubleValue]; + if (fontSize < 9.0) { + fontSize = 9.0; + } + + NSFont *font = [NSFont fontWithName:fontFamily size:fontSize]; + [props setObject:font forKey:NSFontAttributeName]; + [props removeObjectForKey:@"font-family"]; + [props removeObjectForKey:@"font-size"]; +} + +@synthesize attributes; +@synthesize paren; +@synthesize curly; +@end + + +//- (NSUInteger)hexValueFor:(NSString *)inStr { +// NSUInteger i = [[inStr substringWithRange:NSMakeRange(0, 1)] integerValue]; +// i = i *= 16; +// i += [[inStr substringWithRange:NSMakeRange(1, 1)] integerValue]; +// return i; +//} +// +//- (void)didMatchHexcolor:(PKAssembly *)a { +// PKToken *tok = [a pop]; +// NSString *s = tok.stringValue; +// NSColor *color = nil; +// +// if (6 == [s length]) { +// NSString *redStr = [s substringWithRange:NSMakeRange(0, 2)]; +// NSString *greenStr = [s substringWithRange:NSMakeRange(2, 2)]; +// NSString *blueStr = [s substringWithRange:NSMakeRange(4, 2)]; +// +// NSUInteger red = [self hexValueFor:redStr]; +// NSUInteger green = [self hexValueFor:greenStr]; +// NSUInteger blue = [self hexValueFor:blueStr]; +// +// color = [NSColor colorWithDeviceRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:1.0]; +// } else { +// color = [NSColor magentaColor]; // signals incorrect value in stylesheet +// } +// [a push:color]; +//} diff --git a/test/TDMiniCSSAssemblerTest.h b/test/TDMiniCSSAssemblerTest.h new file mode 100644 index 0000000..92034dd --- /dev/null +++ b/test/TDMiniCSSAssemblerTest.h @@ -0,0 +1,29 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" +#import "TDMiniCSSAssembler.h" + +@interface TDMiniCSSAssemblerTest : SenTestCase { + NSString *path; + NSString *grammarString; + NSString *s; + TDMiniCSSAssembler *ass; + PKParserFactory *factory; + PKParser *lp; + PKAssembly *a; +} + +@end diff --git a/test/TDMiniCSSAssemblerTest.m b/test/TDMiniCSSAssemblerTest.m new file mode 100644 index 0000000..e7ff4d5 --- /dev/null +++ b/test/TDMiniCSSAssemblerTest.m @@ -0,0 +1,239 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDMiniCSSAssemblerTest.h" + +@implementation TDMiniCSSAssemblerTest + +- (void)setUp { + path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + ass = [[TDMiniCSSAssembler alloc] init]; + factory = [PKParserFactory factory]; + lp = [factory parserFromGrammar:grammarString assembler:ass]; +} + + +- (void)tearDown { + [ass release]; +} + + +- (void)testColor { + TDNotNil(lp); + + s = @"bar { color:rgb(10, 200, 30); }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]bar/{/color/:/rgb/(/10/,/200/,/30/)/;/}^", [a description]); + TDNotNil(ass.attributes); + id props = [ass.attributes objectForKey:@"bar"]; + TDNotNil(props); + + NSColor *color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); +} + + +- (void)testMultiSelectorColor { + TDNotNil(lp); + + s = @"foo, bar { color:rgb(10, 200, 30); }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]foo/,/bar/{/color/:/rgb/(/10/,/200/,/30/)/;/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"bar"]; + TDNotNil(props); + + NSColor *color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); + + props = [ass.attributes objectForKey:@"foo"]; + TDNotNil(props); + + color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); +} + + +- (void)testBackgroundColor { + TDNotNil(lp); + + s = @"foo { background-color:rgb(255.0, 0.0, 255.0) }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]foo/{/background-color/:/rgb/(/255.0/,/0.0/,/255.0/)/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"foo"]; + TDNotNil(props); + + NSColor *color = [props objectForKey:NSBackgroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(255.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(0.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(255.0/255.0), 0.001, @""); +} + + +- (void)testFontSize { + TDNotNil(lp); + + s = @"decl { font-size:12px }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]decl/{/font-size/:/12/px/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"decl"]; + TDNotNil(props); + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEquals((CGFloat)[font pointSize], (CGFloat)12.0); + TDEqualObjects([font familyName], @"Monaco"); +} + + +- (void)testSmallFontSize { + TDNotNil(lp); + + s = @"decl { font-size:8px }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]decl/{/font-size/:/8/px/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"decl"]; + TDNotNil(props); + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEquals((CGFloat)[font pointSize], (CGFloat)9.0); + TDEqualObjects([font familyName], @"Monaco"); +} + + +- (void)testFont { + TDNotNil(lp); + + s = @"expr { font-size:16px; font-family:'Helvetica' }"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]expr/{/font-size/:/16/px/;/font-family/:/'Helvetica'/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"expr"]; + TDNotNil(props); + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEqualObjects([font familyName], @"Helvetica"); + TDEquals((CGFloat)[font pointSize], (CGFloat)16.0); +} + + +- (void)testAll { + TDNotNil(lp); + + s = @"expr { font-size:9.0px; font-family:'Courier'; background-color:rgb(255.0, 0.0, 255.0) ; color:rgb(10, 200, 30);}"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]expr/{/font-size/:/9.0/px/;/font-family/:/'Courier'/;/background-color/:/rgb/(/255.0/,/0.0/,/255.0/)/;/color/:/rgb/(/10/,/200/,/30/)/;/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"expr"]; + TDNotNil(props); + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEqualObjects([font familyName], @"Courier"); + TDEquals((CGFloat)[font pointSize], (CGFloat)9.0); + + NSColor *bgColor = [props objectForKey:NSBackgroundColorAttributeName]; + TDNotNil(bgColor); + STAssertEqualsWithAccuracy([bgColor redComponent], (CGFloat)(255.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor greenComponent], (CGFloat)(0.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor blueComponent], (CGFloat)(255.0/255.0), 0.001, @""); + + NSColor *color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); +} + + +- (void)testMultiAll { + TDNotNil(lp); + + s = @"expr, decl { font-size:9.0px; font-family:'Courier'; background-color:rgb(255.0, 0.0, 255.0) ; color:rgb(10, 200, 30);}"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [lp bestMatchFor:a]; + TDEqualObjects(@"[]expr/,/decl/{/font-size/:/9.0/px/;/font-family/:/'Courier'/;/background-color/:/rgb/(/255.0/,/0.0/,/255.0/)/;/color/:/rgb/(/10/,/200/,/30/)/;/}^", [a description]); + TDNotNil(ass.attributes); + + id props = [ass.attributes objectForKey:@"expr"]; + TDNotNil(props); + + NSFont *font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEqualObjects([font familyName], @"Courier"); + TDEquals((CGFloat)[font pointSize], (CGFloat)9.0); + + NSColor *bgColor = [props objectForKey:NSBackgroundColorAttributeName]; + TDNotNil(bgColor); + STAssertEqualsWithAccuracy([bgColor redComponent], (CGFloat)(255.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor greenComponent], (CGFloat)(0.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor blueComponent], (CGFloat)(255.0/255.0), 0.001, @""); + + NSColor *color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); + + props = [ass.attributes objectForKey:@"decl"]; + TDNotNil(props); + + font = [props objectForKey:NSFontAttributeName]; + TDNotNil(font); + TDEqualObjects([font familyName], @"Courier"); + TDEquals((CGFloat)[font pointSize], (CGFloat)9.0); + + bgColor = [props objectForKey:NSBackgroundColorAttributeName]; + TDNotNil(bgColor); + STAssertEqualsWithAccuracy([bgColor redComponent], (CGFloat)(255.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor greenComponent], (CGFloat)(0.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([bgColor blueComponent], (CGFloat)(255.0/255.0), 0.001, @""); + + color = [props objectForKey:NSForegroundColorAttributeName]; + TDNotNil(color); + STAssertEqualsWithAccuracy([color redComponent], (CGFloat)(10.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color greenComponent], (CGFloat)(200.0/255.0), 0.001, @""); + STAssertEqualsWithAccuracy([color blueComponent], (CGFloat)(30.0/255.0), 0.001, @""); +} + +@end diff --git a/test/TDNCName.h b/test/TDNCName.h new file mode 100644 index 0000000..0af35d0 --- /dev/null +++ b/test/TDNCName.h @@ -0,0 +1,28 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKTerminal.h" +#import "PKToken.h" + +extern const NSInteger PKTokenTypeNCName; + +@interface PKToken (NCNameAdditions) +@property (readonly, getter=isNCName) BOOL NCName; +@end + +@interface TDNCName : PKTerminal { + +} ++ (id)NCName; +@end diff --git a/test/TDNCName.m b/test/TDNCName.m new file mode 100644 index 0000000..93e2081 --- /dev/null +++ b/test/TDNCName.m @@ -0,0 +1,39 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDNCName.h" + +const NSInteger PKTokenTypeNCName = 300; + +@implementation PKToken (NCNameAdditions) + +- (BOOL)isNCName { + return self.tokenType == PKTokenTypeNCName; +} + +@end + +@implementation TDNCName + ++ (id)NCName { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + return tok.isNCName; +} + +@end diff --git a/test/TDNCNameState.h b/test/TDNCNameState.h new file mode 100644 index 0000000..3123ce3 --- /dev/null +++ b/test/TDNCNameState.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKTokenizerState.h" + +@interface TDNCNameState : PKTokenizerState { + +} + +@end diff --git a/test/TDNCNameState.m b/test/TDNCNameState.m new file mode 100644 index 0000000..0dfa550 --- /dev/null +++ b/test/TDNCNameState.m @@ -0,0 +1,85 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDNCNameState.h" +#import "PKTokenizer.h" +#import "PKReader.h" +#import "TDXmlToken.h" + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface TDNCNameState () ++ (BOOL)isNameChar:(PKUniChar)c; ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c; ++ (BOOL)isValidNonStartSymbolChar:(PKUniChar)c; +@end + +// NCName ::= (Letter | '_') (NameChar)* +@implementation TDNCNameState + +//- (BOOL)isWhitespace:(PKUniChar)c { +// return (' ' == c || '\n' == c || '\r' == c || '\t' == c); +//} + + +// NameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender ++ (BOOL)isNameChar:(PKUniChar)c { + if (isalnum(c)) { + return YES; + } else if ([self isValidNonStartSymbolChar:c]) { + return YES; + } + // TODO CombiningChar & Extender + return NO; +} + + ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c { + return ('_' == c); +} + + ++ (BOOL)isValidNonStartSymbolChar:(PKUniChar)c { + return ('_' == c || '.' == c || '-' == c); +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + [self resetWithReader:r]; + + NSInteger c = cin; + do { + [self append:c]; + c = [r read]; + } while ([TDNCNameState isNameChar:c]); + + if (PKEOF != c) { + [r unread]; + } + + if ([[self bufferedString] length] == 1 && [TDNCNameState isValidStartSymbolChar:cin]) { + return [t.symbolState nextTokenFromReader:r startingWith:cin tokenizer:t]; + } else { +// return [[[TDXmlToken alloc] initWithTokenType:TDTT_NAME +// stringValue:[[stringbuf copy] autorelease] +// floatValue:0.0] autorelease]; + return nil; + } +} + +@end diff --git a/test/TDNSPredicateBuilder.h b/test/TDNSPredicateBuilder.h new file mode 100644 index 0000000..b955b73 --- /dev/null +++ b/test/TDNSPredicateBuilder.h @@ -0,0 +1,82 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface TDNSPredicateBuilder : NSObject { + NSString *defaultAttr; + NSString *defaultRelation; + NSString *defaultValue; + PKToken *nonReservedWordFence; + PKCollectionParser *exprParser; + PKCollectionParser *orTermParser; + PKCollectionParser *termParser; + PKCollectionParser *andPrimaryExprParser; + PKCollectionParser *primaryExprParser; + PKCollectionParser *phraseParser; + PKCollectionParser *negatedPredicateParser; + PKCollectionParser *predicateParser; + PKCollectionParser *completePredicateParser; + PKCollectionParser *attrValuePredicateParser; + PKCollectionParser *attrPredicateParser; + PKCollectionParser *valuePredicateParser; + PKCollectionParser *attrParser; + PKCollectionParser *tagParser; + PKCollectionParser *relationParser; + PKCollectionParser *valueParser; + PKCollectionParser *boolParser; + PKParser *trueParser; + PKParser *falseParser; + PKCollectionParser *stringParser; + PKParser *quotedStringParser; + PKCollectionParser *unquotedStringParser; + PKCollectionParser *reservedWordParser; + PKCollectionParser *nonReservedWordParser; + PKPattern *reservedWordPattern; + PKParser *numberParser; + +} +- (NSPredicate *)buildFrom:(NSString *)s; + +@property (nonatomic, copy) NSString *defaultAttr; +@property (nonatomic, copy) NSString *defaultRelation; +@property (nonatomic, copy) NSString *defaultValue; + +@property (nonatomic, retain) PKCollectionParser *exprParser; +@property (nonatomic, retain) PKCollectionParser *orTermParser; +@property (nonatomic, retain) PKCollectionParser *termParser; +@property (nonatomic, retain) PKCollectionParser *andPrimaryExprParser; +@property (nonatomic, retain) PKCollectionParser *primaryExprParser; +@property (nonatomic, retain) PKCollectionParser *phraseParser; +@property (nonatomic, retain) PKCollectionParser *negatedPredicateParser; +@property (nonatomic, retain) PKCollectionParser *predicateParser; +@property (nonatomic, retain) PKCollectionParser *completePredicateParser; +@property (nonatomic, retain) PKCollectionParser *attrValuePredicateParser; +@property (nonatomic, retain) PKCollectionParser *attrPredicateParser; +@property (nonatomic, retain) PKCollectionParser *valuePredicateParser; +@property (nonatomic, retain) PKCollectionParser *attrParser; +@property (nonatomic, retain) PKCollectionParser *tagParser; +@property (nonatomic, retain) PKCollectionParser *relationParser; +@property (nonatomic, retain) PKCollectionParser *valueParser; +@property (nonatomic, retain) PKCollectionParser *boolParser; +@property (nonatomic, retain) PKParser *trueParser; +@property (nonatomic, retain) PKParser *falseParser; +@property (nonatomic, retain) PKCollectionParser *stringParser; +@property (nonatomic, retain) PKParser *quotedStringParser; +@property (nonatomic, retain) PKCollectionParser *unquotedStringParser; +@property (nonatomic, retain) PKCollectionParser *reservedWordParser; +@property (nonatomic, retain) PKCollectionParser *nonReservedWordParser; +@property (nonatomic, retain) PKPattern *reservedWordPattern; +@property (nonatomic, retain) PKParser *numberParser; +@end diff --git a/test/TDNSPredicateBuilder.m b/test/TDNSPredicateBuilder.m new file mode 100644 index 0000000..1416e43 --- /dev/null +++ b/test/TDNSPredicateBuilder.m @@ -0,0 +1,593 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDNSPredicateBuilder.h" +#import "NSString+ParseKitAdditions.h" + +// expr = term orTerm*; +// orTerm = 'or' term; +// term = primaryExpr andPrimaryExpr*; +// andPrimaryExpr = 'and' primaryExpr; +// primaryExpr = phrase | '(' expr ')'; +// phrase = predicate | negatedPredicate; +// negatedPredicate = 'not' predicate; +// predicate = completePredicate | attrValuePredicate | attrPredicate | valuePredicate; +// completePredicate = attr relation value; +// attrValuePredicate = attr value; +// attrPredicate = attr; +// valuePredicate = value; +// attr = tag | Word; +// tag = '@' Word; +// value = string | Number | bool; +// string = QuotedString | unquotedString; +// unquotedString = nonReservedWord+; +// bool = 'true' | 'false'; + +@interface TDNSPredicateBuilder () +@property (nonatomic, retain) PKToken *nonReservedWordFence; +@end + +@implementation TDNSPredicateBuilder + +- (id)init { + if (self = [super init]) { + self.defaultAttr = @"content"; + self.defaultRelation = @"="; + self.defaultValue = @""; + self.nonReservedWordFence = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"." floatValue:0.0]; + } + return self; +} + + +- (void)dealloc { + self.defaultAttr = nil; + self.defaultRelation = nil; + self.defaultValue = nil; + self.nonReservedWordFence = nil; + self.exprParser = nil; + self.orTermParser = nil; + self.termParser = nil; + self.andPrimaryExprParser = nil; + self.primaryExprParser = nil; + self.phraseParser = nil; + self.negatedPredicateParser = nil; + self.predicateParser = nil; + self.completePredicateParser = nil; + self.attrValuePredicateParser = nil; + self.attrPredicateParser = nil; + self.valuePredicateParser = nil; + self.attrParser = nil; + self.tagParser = nil; + self.relationParser = nil; + self.valueParser = nil; + self.boolParser = nil; + self.trueParser = nil; + self.falseParser = nil; + self.stringParser = nil; + self.quotedStringParser = nil; + self.unquotedStringParser = nil; + self.reservedWordParser = nil; + self.nonReservedWordParser = nil; + self.reservedWordPattern = nil; + self.numberParser = nil; + [super dealloc]; +} + + +- (NSPredicate *)buildFrom:(NSString *)s; { + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + return [[self.exprParser completeMatchFor:a] pop]; +} + + +// expression = term orTerm* +- (PKCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [PKSequence sequence]; + [exprParser add:self.termParser]; + [exprParser add:[PKRepetition repetitionWithSubparser:self.orTermParser]]; + } + return exprParser; +} + + +// orTerm = 'or' term +- (PKCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [PKSequence sequence]; + orTermParser.name = @"orTerm"; + [orTermParser add:[[PKCaseInsensitiveLiteral literalWithString:@"or"] discard]]; + [orTermParser add:self.termParser]; + [orTermParser setAssembler:self selector:@selector(didMatchOr:)]; + } + return orTermParser; +} + + +// term = primaryExpr andPrimaryExpr* +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + termParser.name = @"term"; + [termParser add:self.primaryExprParser]; + [termParser add:[PKRepetition repetitionWithSubparser:self.andPrimaryExprParser]]; + } + return termParser; +} + + +// andPrimaryExpr = 'and' primaryExpr +- (PKCollectionParser *)andPrimaryExprParser { + if (!andPrimaryExprParser) { + self.andPrimaryExprParser = [PKSequence sequence]; + andPrimaryExprParser.name = @"andPrimaryExpr"; + [andPrimaryExprParser add:[[PKCaseInsensitiveLiteral literalWithString:@"and"] discard]]; + [andPrimaryExprParser add:self.primaryExprParser]; + [andPrimaryExprParser setAssembler:self selector:@selector(didMatchAnd:)]; + } + return andPrimaryExprParser; +} + + +// primaryExpr = phrase | '(' expression ')' +- (PKCollectionParser *)primaryExprParser { + if (!primaryExprParser) { + self.primaryExprParser = [PKAlternation alternation]; + primaryExprParser.name = @"primaryExpr"; + [primaryExprParser add:self.phraseParser]; + + PKSequence *s = [PKSequence sequence]; + [s add:[[PKSymbol symbolWithString:@"("] discard]]; + [s add:self.exprParser]; + [s add:[[PKSymbol symbolWithString:@")"] discard]]; + + [primaryExprParser add:s]; + } + return primaryExprParser; +} + + +// phrase = predicate | negatedPredicate +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + self.phraseParser = [PKAlternation alternation]; + phraseParser.name = @"phrase"; + [phraseParser add:self.predicateParser]; + [phraseParser add:self.negatedPredicateParser]; + } + return phraseParser; +} + + +// negatedPredicate = 'not' predicate +- (PKCollectionParser *)negatedPredicateParser { + if (!negatedPredicateParser) { + self.negatedPredicateParser = [PKSequence sequence]; + negatedPredicateParser.name = @"negatedPredicate"; + [negatedPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"not"] discard]]; + [negatedPredicateParser add:self.predicateParser]; + [negatedPredicateParser setAssembler:self selector:@selector(didMatchNegatedValue:)]; + } + return negatedPredicateParser; +} + + +// predicate = bool | eqPredicate | nePredicate | gtPredicate | gteqPredicate | ltPredicate | lteqPredicate | beginswithPredicate | containsPredicate | endswithPredicate | matchesPredicate +- (PKCollectionParser *)predicateParser { + if (!predicateParser) { + self.predicateParser = [PKAlternation alternation]; + predicateParser.name = @"predicate"; + [predicateParser add:self.completePredicateParser]; + [predicateParser add:self.attrValuePredicateParser]; + [predicateParser add:self.attrPredicateParser]; + [predicateParser add:self.valuePredicateParser]; + [predicateParser setAssembler:self selector:@selector(didMatchPredicate:)]; + } + return predicateParser; +} + + +// completePredicate = attribute relation value +- (PKCollectionParser *)completePredicateParser { + if (!completePredicateParser) { + self.completePredicateParser = [PKSequence sequence]; + completePredicateParser.name = @"completePredicate"; + [completePredicateParser add:self.attrParser]; + [completePredicateParser add:self.relationParser]; + [completePredicateParser add:self.valueParser]; + } + return completePredicateParser; +} + + +// attrValuePredicate = attribute value +- (PKCollectionParser *)attrValuePredicateParser { + if (!attrValuePredicateParser) { + self.attrValuePredicateParser = [PKSequence sequence]; + attrValuePredicateParser.name = @"attrValuePredicate"; + [attrValuePredicateParser add:self.attrParser]; + [attrValuePredicateParser add:self.valueParser]; + [attrValuePredicateParser setAssembler:self selector:@selector(didMatchAttrValuePredicate:)]; + } + return attrValuePredicateParser; +} + + +// attrPredicate = attribute +- (PKCollectionParser *)attrPredicateParser { + if (!attrPredicateParser) { + self.attrPredicateParser = [PKSequence sequence]; + attrPredicateParser.name = @"attrPredicate"; + [attrPredicateParser add:self.attrParser]; + [attrPredicateParser setAssembler:self selector:@selector(didMatchAttrPredicate:)]; + } + return attrPredicateParser; +} + + +// valuePredicate = value +- (PKCollectionParser *)valuePredicateParser { + if (!valuePredicateParser) { + self.valuePredicateParser = [PKSequence sequence]; + valuePredicateParser.name = @"valuePredicate"; + [valuePredicateParser add:self.valueParser]; + [valuePredicateParser setAssembler:self selector:@selector(didMatchValuePredicate:)]; + } + return valuePredicateParser; +} + + +// attr = tag | 'uniqueid' | 'line' | 'type' | 'isgroupheader' | 'level' | 'index' | 'content' | 'parent' | 'project' | 'countofchildren' +- (PKCollectionParser *)attrParser { + if (!attrParser) { + self.attrParser = [PKAlternation alternation]; + attrParser.name = @"attr"; + [attrParser add:self.tagParser]; + [attrParser add:self.nonReservedWordParser]; + [attrParser setAssembler:self selector:@selector(didMatchAttr:)]; + } + return attrParser; +} + + +// relation = '=' | '!=' | '>' | '>=' | '<' | '<=' | 'beginswith' | 'contains' | 'endswith' | 'matches' +- (PKCollectionParser *)relationParser { + if (!relationParser) { + self.relationParser = [PKAlternation alternation]; + relationParser.name = @"relation"; + [relationParser add:[PKSymbol symbolWithString:@"="]]; + [relationParser add:[PKSymbol symbolWithString:@"!="]]; + [relationParser add:[PKSymbol symbolWithString:@">"]]; + [relationParser add:[PKSymbol symbolWithString:@">="]]; + [relationParser add:[PKSymbol symbolWithString:@"<"]]; + [relationParser add:[PKSymbol symbolWithString:@"<="]]; + [relationParser add:[PKCaseInsensitiveLiteral literalWithString:@"beginswith"]]; + [relationParser add:[PKCaseInsensitiveLiteral literalWithString:@"contains"]]; + [relationParser add:[PKCaseInsensitiveLiteral literalWithString:@"endswith"]]; + [relationParser add:[PKCaseInsensitiveLiteral literalWithString:@"matches"]]; + [relationParser setAssembler:self selector:@selector(didMatchRelation:)]; + } + return relationParser; +} + + +// tag = '@' Word +- (PKCollectionParser *)tagParser { + if (!tagParser) { + self.tagParser = [PKSequence sequence]; + tagParser.name = @"tag"; + [tagParser add:[[PKSymbol symbolWithString:@"@"] discard]]; + [tagParser add:[PKWord word]]; + } + return tagParser; +} + + +// value = QuotedString | Number | bool +- (PKCollectionParser *)valueParser { + if (!valueParser) { + self.valueParser = [PKAlternation alternation]; + valueParser.name = @"value"; + [valueParser add:self.stringParser]; + [valueParser add:self.numberParser]; + [valueParser add:self.boolParser]; + } + return valueParser; +} + + +- (PKCollectionParser *)boolParser { + if (!boolParser) { + self.boolParser = [PKAlternation alternation]; + boolParser.name = @"bool"; + [boolParser add:self.trueParser]; + [boolParser add:self.falseParser]; + [boolParser setAssembler:self selector:@selector(didMatchBool:)]; + } + return boolParser; +} + + +- (PKParser *)trueParser { + if (!trueParser) { + self.trueParser = [[PKCaseInsensitiveLiteral literalWithString:@"true"] discard]; + trueParser.name = @"true"; + [trueParser setAssembler:self selector:@selector(didMatchTrue:)]; + } + return trueParser; +} + + +- (PKParser *)falseParser { + if (!falseParser) { + self.falseParser = [[PKCaseInsensitiveLiteral literalWithString:@"false"] discard]; + falseParser.name = @"false"; + [falseParser setAssembler:self selector:@selector(didMatchFalse:)]; + } + return falseParser; +} + + +// string = quotedString | unquotedString +- (PKCollectionParser *)stringParser { + if (!stringParser) { + self.stringParser = [PKAlternation alternation]; + stringParser.name = @"string"; + [stringParser add:self.quotedStringParser]; + [stringParser add:self.unquotedStringParser]; + } + return stringParser; +} + + +// quotedString = QuotedString +- (PKParser *)quotedStringParser { + if (!quotedStringParser) { + self.quotedStringParser = [PKQuotedString quotedString]; + quotedStringParser.name = @"quotedString"; + [quotedStringParser setAssembler:self selector:@selector(didMatchQuotedString:)]; + } + return quotedStringParser; +} + + +// unquotedString = nonReservedWord+ +- (PKCollectionParser *)unquotedStringParser { + if (!unquotedStringParser) { + self.unquotedStringParser = [PKSequence sequence]; + unquotedStringParser.name = @"unquotedString"; + [unquotedStringParser add:self.nonReservedWordParser]; + [unquotedStringParser add:[PKRepetition repetitionWithSubparser:self.nonReservedWordParser]]; + [unquotedStringParser setAssembler:self selector:@selector(didMatchUnquotedString:)]; + } + return unquotedStringParser; +} + + +- (PKCollectionParser *)reservedWordParser { + if (!reservedWordParser) { + self.reservedWordParser = [PKIntersection intersection]; + [reservedWordParser add:[PKWord word]]; + [reservedWordParser add:self.reservedWordPattern]; + reservedWordParser.name = @"reservedWord"; + [reservedWordParser setAssembler:self selector:@selector(didMatchReservedWord:)]; + } + return reservedWordParser; +} + + +// nonReservedWord = Word +- (PKCollectionParser *)nonReservedWordParser { + if (!nonReservedWordParser) { + self.nonReservedWordParser = [PKDifference differenceWithSubparser:[PKWord word] minus:self.reservedWordParser]; + nonReservedWordParser.name = @"nonReservedWord"; + [nonReservedWordParser setAssembler:self selector:@selector(didMatchNonReservedWord:)]; + } + return nonReservedWordParser; +} + + +- (PKPattern *)reservedWordPattern { + if (!reservedWordPattern) { + NSString *s = @"true|false|and|or|not|contains|beginswith|endswith|matches"; + self.reservedWordPattern = [PKPattern patternWithString:s options:PKPatternOptionsIgnoreCase]; + reservedWordPattern.name = @"reservedWordPattern"; + } + return reservedWordPattern; +} + + +- (PKParser *)numberParser { + if (!numberParser) { + self.numberParser = [PKNumber number]; + numberParser.name = @"number"; + [numberParser setAssembler:self selector:@selector(didMatchNumber:)]; + } + return numberParser; +} + + +- (void)didMatchAnd:(PKAssembly *)a { + NSPredicate *p2 = [a pop]; + NSPredicate *p1 = [a pop]; + NSArray *subs = [NSArray arrayWithObjects:p1, p2, nil]; + [a push:[NSCompoundPredicate andPredicateWithSubpredicates:subs]]; +} + + +- (void)didMatchOr:(PKAssembly *)a { + NSPredicate *p2 = [a pop]; + NSPredicate *p1 = [a pop]; + NSArray *subs = [NSArray arrayWithObjects:p1, p2, nil]; + [a push:[NSCompoundPredicate orPredicateWithSubpredicates:subs]]; +} + + +- (void)didMatchPredicate:(PKAssembly *)a { + id value = [a pop]; + id relation = [a pop]; + id attr = [a pop]; + NSString *predicateFormat = [NSString stringWithFormat:@"%@ %@ %%@", attr, relation, nil]; + NSPredicate *predicate = [NSPredicate predicateWithFormat:predicateFormat, value, nil]; + [a push:predicate]; +} + + +- (void)didMatchAttrValuePredicate:(PKAssembly *)a { + id value = [a pop]; + id attr = [a pop]; + [a push:attr]; + [a push:defaultRelation]; + [a push:value]; +} + + +- (void)didMatchAttrPredicate:(PKAssembly *)a { + id attr = [a pop]; + [a push:attr]; + [a push:defaultRelation]; + [a push:defaultValue]; +} + + +- (void)didMatchValuePredicate:(PKAssembly *)a { + id value = [a pop]; + [a push:defaultAttr]; + [a push:defaultRelation]; + [a push:value]; +} + + +- (void)didMatchAttr:(PKAssembly *)a { + [a push:[[a pop] stringValue]]; +} + + +- (void)didMatchRelation:(PKAssembly *)a { + [a push:[[a pop] stringValue]]; +} + + +- (void)didMatchNegatedValue:(PKAssembly *)a { + id p = [a pop]; + [a push:[NSCompoundPredicate notPredicateWithSubpredicate:p]]; +} + + +- (void)didMatchBool:(PKAssembly *)a { + NSNumber *b = [a pop]; + [a push:[NSPredicate predicateWithValue:[b boolValue]]]; +} + + +- (void)didMatchTrue:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:YES]]; +} + + +- (void)didMatchFalse:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:NO]]; +} + + +- (void)didMatchQuotedString:(PKAssembly *)a { + [a push:[[[a pop] stringValue] stringByTrimmingQuotes]]; +} + + +- (void)didMatchReservedWord:(PKAssembly *)a { +// PKToken *tok = [a pop]; +// [a push:tok.stringValue]; +} + + +- (void)didMatchNonReservedWord:(PKAssembly *)a { +// id obj = [a pop]; +// [a push:nonReservedWordFence]; +// [a push:obj]; +} + + +- (void)didMatchUnquotedString:(PKAssembly *)a { + NSMutableArray *wordStrings = [NSMutableArray array]; + + while (1) { + NSArray *objs = [a objectsAbove:nonReservedWordFence]; + id next = [a pop]; // is the next obj a fence? + if (![nonReservedWordFence isEqual:next]) { + // if not, put the next token back + if (next) { + [a push:next]; + } + // also put back any toks we didnt mean to pop + for (id obj in [objs reverseObjectEnumerator]) { + [a push:obj]; + } + break; + } + NSAssert(1 == [objs count], @""); + [wordStrings addObject:[objs objectAtIndex:0]]; + } + + NSInteger last = [wordStrings count] - 1; + NSInteger i = 0; + NSMutableString *ms = [NSMutableString string]; + for (NSString *wordString in [wordStrings reverseObjectEnumerator]) { + if (i++ == last) { + [ms appendString:wordString]; + } else { + [ms appendFormat:@"%@ ", wordString]; + } + } + [a push:[[ms copy] autorelease]]; +} + + +- (void)didMatchNumber:(PKAssembly *)a { + NSNumber *n = [NSNumber numberWithFloat:[(PKToken *)[a pop] floatValue]]; + [a push:n]; +} + +@synthesize defaultAttr; +@synthesize defaultRelation; +@synthesize defaultValue; +@synthesize nonReservedWordFence; +@synthesize exprParser; +@synthesize orTermParser; +@synthesize termParser; +@synthesize andPrimaryExprParser; +@synthesize primaryExprParser; +@synthesize phraseParser; +@synthesize negatedPredicateParser; +@synthesize predicateParser; +@synthesize completePredicateParser; +@synthesize attrValuePredicateParser; +@synthesize attrPredicateParser; +@synthesize valuePredicateParser; +@synthesize attrParser; +@synthesize tagParser; +@synthesize relationParser; +@synthesize valueParser; +@synthesize boolParser; +@synthesize trueParser; +@synthesize falseParser; +@synthesize stringParser; +@synthesize quotedStringParser; +@synthesize unquotedStringParser; +@synthesize reservedWordParser; +@synthesize nonReservedWordParser; +@synthesize reservedWordPattern; +@synthesize numberParser; +@end diff --git a/test/TDNSPredicateBuilderTest.h b/test/TDNSPredicateBuilderTest.h new file mode 100644 index 0000000..1b01d16 --- /dev/null +++ b/test/TDNSPredicateBuilderTest.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "TDNSPredicateBuilder.h" + +@interface TDNSPredicateBuilderTest : SenTestCase { + TDNSPredicateBuilder *b; + NSString *s; + PKAssembly *a; +} + +@end diff --git a/test/TDNSPredicateBuilderTest.m b/test/TDNSPredicateBuilderTest.m new file mode 100644 index 0000000..caa236f --- /dev/null +++ b/test/TDNSPredicateBuilderTest.m @@ -0,0 +1,219 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDNSPredicateBuilderTest.h" + +@implementation TDNSPredicateBuilderTest + +- (void)setUp { + b = [[[TDNSPredicateBuilder alloc] init] autorelease]; +} + + +- (void)testEq { + // test numbers + s = @"foo = 1.0"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == 1]foo/=/1.0^", [a description]); + + s = @"foo = -1.0"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == -1]foo/=/-1.0^", [a description]); + + + // test bools + s = @"foo = true"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == TRUEPREDICATE]foo/=/true^", [a description]); + + s = @"foo = false"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == FALSEPREDICATE]foo/=/false^", [a description]); + + + // test strings + s = @"foo = 'bar'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == \"bar\"]foo/=/'bar'^", [a description]); + + s = @"foo = 'baz'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo == \"baz\"]foo/=/'baz'^", [a description]); +} + + +- (void)testNe { + // test numbers + s = @"foo != 1.0"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != 1]foo/!=/1.0^", [a description]); + + s = @"foo != 1.00"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != 1]foo/!=/1.00^", [a description]); + + + // test bools + s = @"foo != true"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != TRUEPREDICATE]foo/!=/true^", [a description]); + + s = @"foo != false"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != FALSEPREDICATE]foo/!=/false^", [a description]); + + + // test strings + s = @"foo != 'bar'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != \"bar\"]foo/!=/'bar'^", [a description]); + + s = @"foo != 'baz'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo != \"baz\"]foo/!=/'baz'^", [a description]); +} + + +- (void)testGt { + s = @"foo > 42"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo > 42]foo/>/42^", [a description]); +} + + +- (void)testLt { + s = @"foo < .3"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo < 0.3]foo/= 42"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo >= 42]foo/>=/42^", [a description]); +} + + +- (void)testLteq { + s = @"foo <= .3"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo <= 0.3]foo/<=/.3^", [a description]); +} + + +- (void)testBeginswith { + s = @"foo beginswith 'bar'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo BEGINSWITH \"bar\"]foo/beginswith/'bar'^", [a description]); +} + + +- (void)testContains { + s = @"foo contains 'baz'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo CONTAINS \"baz\"]foo/contains/'baz'^", [a description]); +} + + +- (void)testEndswith { + s = @"foo endswith 'baz'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo ENDSWITH \"baz\"]foo/endswith/'baz'^", [a description]); +} + + +- (void)testMatches { + s = @"foo matches 'baz'"; + a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo MATCHES \"baz\"]foo/matches/'baz'^", [a description]); +} + + +- (void)testUnqotedString { +// s = @"foo contains bar"; +// a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; +// TDEqualObjects(@"[foo CONTAINS \"bar\"]foo/contains/bar^", [a description]); +// +// s = @"foo matches bar baz"; +// a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; +// TDEqualObjects(@"[foo MATCHES \"bar baz\"]foo/matches/bar/baz^", [a description]); +// +// s = @"foo matches foo bar baz"; +// a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; +// TDEqualObjects(@"[foo MATCHES \"foo bar baz\"]foo/matches/foo/bar/baz^", [a description]); +// +// s = @"foo matches bar and baz contains bat"; +// a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; +// TDEqualObjects(@"[foo MATCHES \"bar\" AND baz CONTAINS \"bat\"]foo/matches/bar/and/baz/contains/bat^", [a description]); +// +// s = @"foo matches foo bar and baz contains bat"; +// a = [b.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; +// TDEqualObjects(@"[foo MATCHES \"foo bar\" AND baz CONTAINS \"bat\"]foo/matches/foo/bar/and/baz/contains/bat^", [a description]); +} + + +- (void)testBools { + s = @"true"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[content == TRUEPREDICATE]true^", [a description]); + + s = @"not true"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[NOT content == TRUEPREDICATE]not/true^", [a description]); + + s = @"false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[content == FALSEPREDICATE]false^", [a description]); + + s = @"not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[NOT content == FALSEPREDICATE]not/false^", [a description]); + + s = @"true and false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[content == TRUEPREDICATE AND content == FALSEPREDICATE]true/and/false^", [a description]); + + s = @"not true and false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[(NOT content == TRUEPREDICATE) AND content == FALSEPREDICATE]not/true/and/false^", [a description]); + + s = @"not true and not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[(NOT content == TRUEPREDICATE) AND (NOT content == FALSEPREDICATE)]not/true/and/not/false^", [a description]); + + s = @"true or false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[content == TRUEPREDICATE OR content == FALSEPREDICATE]true/or/false^", [a description]); + + s = @"(true and false) or false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[(content == TRUEPREDICATE AND content == FALSEPREDICATE) OR content == FALSEPREDICATE](/true/and/false/)/or/false^", [a description]); + + s = @"(true and false) or not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [b.exprParser bestMatchFor:a]; + TDEqualObjects(@"[(content == TRUEPREDICATE AND content == FALSEPREDICATE) OR (NOT content == FALSEPREDICATE)](/true/and/false/)/or/not/false^", [a description]); +} + +@end diff --git a/test/TDNSPredicateEvaluator.h b/test/TDNSPredicateEvaluator.h new file mode 100644 index 0000000..cf1b4c7 --- /dev/null +++ b/test/TDNSPredicateEvaluator.h @@ -0,0 +1,34 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class TDNSPredicateEvaluator; + +@protocol TDKeyPathResolver +- (id)resolvedValueForKeyPath:(NSString *)s; +@end + +@interface TDNSPredicateEvaluator : NSObject { + id resolver; + PKParser *parser; + PKToken *openCurly; +} +- (id)initWithKeyPathResolver:(id )r; + +- (BOOL)evaluate:(NSString *)s; + +@property (nonatomic, retain) PKParser *parser; +@end diff --git a/test/TDNSPredicateEvaluator.m b/test/TDNSPredicateEvaluator.m new file mode 100644 index 0000000..b6e3a6e --- /dev/null +++ b/test/TDNSPredicateEvaluator.m @@ -0,0 +1,230 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDNSPredicateEvaluator.h" +#import "PKParserFactory.h" +#import "NSString+ParseKitAdditions.h" +#import "NSArray+ParseKitAdditions.h" + +@interface TDNSPredicateEvaluator () +- (void)didMatchCollectionPredicateAssembly:(PKAssembly *)a ordered:(NSComparisonResult)ordered; + +@property (nonatomic, assign) id resolver; +@property (nonatomic, retain) PKToken *openCurly; +@end + +@implementation TDNSPredicateEvaluator + +- (id)initWithKeyPathResolver:(id )r { + if (self = [super init]) { + self.resolver = r; + + self.openCurly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0]; + + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"nspredicate" ofType:@"grammar"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + self.parser = [[PKParserFactory factory] parserFromGrammar:s assembler:self]; + } + return self; +} + + +- (void)dealloc { + resolver = nil; + self.parser = nil; + self.openCurly = nil; + [super dealloc]; +} + + +- (BOOL)evaluate:(NSString *)s { + id result = [parser parse:s]; + return [result boolValue]; +} + + +- (void)didMatchNegatedPredicate:(PKAssembly *)a { + BOOL b = [[a pop] boolValue]; + [a push:[NSNumber numberWithBool:!b]]; +} + + +- (void)didMatchNumComparisonPredicate:(PKAssembly *)a { + CGFloat n2 = [(PKToken *)[a pop] floatValue]; + NSString *op = [[a pop] stringValue]; + CGFloat n1 = [(PKToken *)[a pop] floatValue]; + + BOOL result = NO; + if ([op isEqualToString:@"<"]) { + result = n1 < n2; + } else if ([op isEqualToString:@">"]) { + result = n1 > n2; + } else if ([op isEqualToString:@"="] || [op isEqualToString:@"=="]) { + result = n1 == n2; + } else if ([op isEqualToString:@"<="] || [op isEqualToString:@"=<"]) { + result = n1 <= n2; + } else if ([op isEqualToString:@">="] || [op isEqualToString:@"=>"]) { + result = n1 >= n2; + } else if ([op isEqualToString:@"!="] || [op isEqualToString:@"<>"]) { + result = n1 != n2; + } + + [a push:[NSNumber numberWithBool:result]]; +} + + +- (void)didMatchCollectionLtPredicate:(PKAssembly *)a { + [self didMatchCollectionPredicateAssembly:a ordered:NSOrderedAscending]; +} + + +- (void)didMatchCollectionGtPredicate:(PKAssembly *)a { + [self didMatchCollectionPredicateAssembly:a ordered:NSOrderedDescending]; +} + + +- (void)didMatchCollectionEqPredicate:(PKAssembly *)a { + [self didMatchCollectionPredicateAssembly:a ordered:NSOrderedSame]; +} + + +- (void)didMatchCollectionPredicateAssembly:(PKAssembly *)a ordered:(NSComparisonResult)ordered { + id value = [a pop]; + [a pop]; // discard op + NSArray *array = [a pop]; + NSString *aggOp = [[a pop] stringValue]; + + BOOL isAny = NSOrderedSame == [aggOp caseInsensitiveCompare:@"ANY"]; + BOOL isSome = NSOrderedSame == [aggOp caseInsensitiveCompare:@"SOME"]; + BOOL isNone = NSOrderedSame == [aggOp caseInsensitiveCompare:@"NONE"]; + BOOL isAll = NSOrderedSame == [aggOp caseInsensitiveCompare:@"ALL"]; + + BOOL result = NO; + if (isAny || isSome || isNone) { + for (id obj in array) { + if (ordered == [obj compare:value]) { + result = YES; + break; + } + } + } else if (isAll) { + NSInteger c = 0; + for (id obj in array) { + if (ordered != [obj compare:value]) { + break; + } + c++; + } + result = c == [array count]; + } + + if (isNone) { + result = !result; + } + + [a push:[NSNumber numberWithBool:result]]; +} + + +- (void)didMatchString:(PKAssembly *)a { + NSString *s = [[[a pop] stringValue] stringByTrimmingQuotes]; + [a push:s]; +} + + +- (void)didMatchStringTestPredicate:(PKAssembly *)a { + NSString *s2 = [a pop]; + NSString *op = [[a pop] stringValue]; + NSString *s1 = [a pop]; + + BOOL result = NO; + if (NSOrderedSame == [op caseInsensitiveCompare:@"BEGINSWITH"]) { + result = [s1 hasPrefix:s2]; + } else if (NSOrderedSame == [op caseInsensitiveCompare:@"CONTAINS"]) { + result = (NSNotFound != [s1 rangeOfString:s2].location); + } else if (NSOrderedSame == [op caseInsensitiveCompare:@"ENDSWITH"]) { + result = [s1 hasSuffix:s2]; + } else if (NSOrderedSame == [op caseInsensitiveCompare:@"LIKE"]) { + result = NSOrderedSame == [s1 caseInsensitiveCompare:s2]; // TODO + } else if (NSOrderedSame == [op caseInsensitiveCompare:@"MATCHES"]) { + result = NSOrderedSame == [s1 caseInsensitiveCompare:s2]; // TODO + } + + [a push:[NSNumber numberWithBool:result]]; +} + + +- (void)didMatchAndAndTerm:(PKAssembly *)a { + BOOL b2 = [[a pop] boolValue]; + BOOL b1 = [[a pop] boolValue]; + [a push:[NSNumber numberWithBool:b1 && b2]]; +} + + +- (void)didMatchOrOrTerm:(PKAssembly *)a { + BOOL b2 = [[a pop] boolValue]; + BOOL b1 = [[a pop] boolValue]; + [a push:[NSNumber numberWithBool:b1 || b2]]; +} + + +- (void)didMatchArray:(PKAssembly *)a { + NSArray *objs = [a objectsAbove:openCurly]; + [a pop]; // discard '{' + [a push:[objs reversedArray]]; +} + + +- (void)didMatchCollectionTestPredicate:(PKAssembly *)a { + NSArray *array = [a pop]; + NSAssert([array isKindOfClass:[NSArray class]], @""); + id value = [a pop]; + [a push:[NSNumber numberWithBool:[array containsObject:value]]]; +} + + +- (void)didMatchKeyPath:(PKAssembly *)a { + NSString *keyPath = [[a pop] stringValue]; + [a push:[resolver resolvedValueForKeyPath:keyPath]]; +} + + +- (void)didMatchNum:(PKAssembly *)a { + [a push:[NSNumber numberWithFloat:[(PKToken *)[a pop] floatValue]]]; +} + + +- (void)didMatchTrue:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:YES]]; +} + + +- (void)didMatchFalse:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:NO]]; +} + + +- (void)didMatchTruePredicate:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:YES]]; +} + + +- (void)didMatchFalsePredicate:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:NO]]; +} + +@synthesize resolver; +@synthesize parser; +@synthesize openCurly; +@end diff --git a/test/TDNSPredicateEvaluatorTest.h b/test/TDNSPredicateEvaluatorTest.h new file mode 100644 index 0000000..cc918c1 --- /dev/null +++ b/test/TDNSPredicateEvaluatorTest.h @@ -0,0 +1,28 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "TDNSPredicateEvaluator.h" + +@interface TDNSPredicateEvaluatorTest : SenTestCase { + TDNSPredicateEvaluator *eval; + NSString *s; + PKAssembly *a; + PKAssembly *res; + PKTokenizer *t; + + NSMutableDictionary *d; +} + +@end diff --git a/test/TDNSPredicateEvaluatorTest.m b/test/TDNSPredicateEvaluatorTest.m new file mode 100644 index 0000000..8367588 --- /dev/null +++ b/test/TDNSPredicateEvaluatorTest.m @@ -0,0 +1,278 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDNSPredicateEvaluatorTest.h" + +@implementation TDNSPredicateEvaluatorTest + +- (id)resolvedValueForKeyPath:(NSString *)kp { + id result = [d objectForKey:kp]; + if (!result) { + result = [NSNumber numberWithBool:NO]; + } + return result; +} + + +- (void)dealloc { + [eval release]; + [super dealloc]; +} + + +- (void)setUp { + d = [NSMutableDictionary dictionary]; + eval = [[TDNSPredicateEvaluator alloc] initWithKeyPathResolver:self]; + t = eval.parser.tokenizer; +} + + +- (void)testKeyPath { + [d setObject:[NSNumber numberWithBool:YES] forKey:@"foo"]; + [d setObject:[NSNumber numberWithBool:NO] forKey:@"baz"]; + + t.string = @"foo"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[eval.parser parserNamed:@"keyPath"] completeMatchFor:a]; + TDEqualObjects(@"[1]foo^", [res description]); + + t.string = @"bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[eval.parser parserNamed:@"keyPath"] completeMatchFor:a]; + TDEqualObjects(@"[0]bar^", [res description]); + + t.string = @"baz"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[eval.parser parserNamed:@"keyPath"] completeMatchFor:a]; + TDEqualObjects(@"[0]baz^", [res description]); + + t.string = @"foo.bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[eval.parser parserNamed:@"keyPath"] completeMatchFor:a]; + TDEqualObjects(@"[0]foo.bar^", [res description]); +} + + +- (void)testNegatedPredicate { + t.string = @"not 0 < 2"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]not/0/ 2"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]1/>/2^", [res description]); + + t.string = @"1 != 2"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]1/!=/2^", [res description]); + + t.string = @"1 == 2"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]1/==/2^", [res description]); + + t.string = @"1 = 2"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]1/=/2^", [res description]); +} + + +- (void)testArray { + t.string = @"{1, 3}"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [[eval.parser parserNamed:@"array"] completeMatchFor:a]; + NSArray *array = [res pop]; + TDEquals((NSUInteger)2, [array count]); + TDEqualObjects([array objectAtIndex:0], [NSNumber numberWithInteger:1]); + TDEqualObjects([array objectAtIndex:1], [NSNumber numberWithInteger:3]); +} + + +- (void)testTrue { + t.string = @"true"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [[eval.parser parserNamed:@"bool"] completeMatchFor:a]; + TDEqualObjects(@"[1]true^", [res description]); +} + + +- (void)testFalse { + t.string = @"false"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [[eval.parser parserNamed:@"bool"] completeMatchFor:a]; + TDEqualObjects(@"[0]false^", [res description]); +} + + +- (void)testTruePredicate { + t.string = @"TRUEPREDICATE"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]TRUEPREDICATE^", [res description]); +} + + +- (void)testFalsePredicate { + t.string = @"FALSEPREDICATE"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]FALSEPREDICATE^", [res description]); +} + + +- (void)testCollectionTest { + t.string = @"1 IN {1}"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]1/IN/{/1/}^", [res description]); +} + + +- (void)testCollectionLtComparison { + t.string = @"ANY {3} < 4"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]ANY/{/3/}/ 4"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]ANY/{/3/}/>/4^", [res description]); + + t.string = @"SOME {3} > 4"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]SOME/{/3/}/>/4^", [res description]); + + t.string = @"NONE {3} > 4"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]NONE/{/3/}/>/4^", [res description]); + + t.string = @"ALL {3} > 4"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]ALL/{/3/}/>/4^", [res description]); +} + + +- (void)testOr { + t.string = @"TRUEPREDICATE OR FALSEPREDICATE"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1]TRUEPREDICATE/OR/FALSEPREDICATE^", [res description]); +} + + +- (void)testAnd { + t.string = @"TRUEPREDICATE AND FALSEPREDICATE"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[0]TRUEPREDICATE/AND/FALSEPREDICATE^", [res description]); +} + + +- (void)testCompoundExpr { + t.string = @"(TRUEPREDICATE)"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [eval.parser completeMatchFor:a]; + TDEqualObjects(@"[1](/TRUEPREDICATE/)^", [res description]); +} + +@end diff --git a/test/TDNegationTest.h b/test/TDNegationTest.h new file mode 100644 index 0000000..81fdc4b --- /dev/null +++ b/test/TDNegationTest.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDNegationTest : SenTestCase { + PKNegation *n; + PKTokenizer *t; + PKAssembly *a; + PKAssembly *res; + NSString *s; +} + +@end diff --git a/test/TDNegationTest.m b/test/TDNegationTest.m new file mode 100644 index 0000000..498845c --- /dev/null +++ b/test/TDNegationTest.m @@ -0,0 +1,66 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDNegationTest.h" + +@implementation TDNegationTest + +- (void)testFoo { + n = [PKNegation negationWithSubparser:[PKWord word]]; + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [n bestMatchFor:a]; + TDNil(res); + + s = @"'foo'"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [n bestMatchFor:a]; + TDEqualObjects(@"['foo']'foo'^", [res description]); + + n = [PKNegation negationWithSubparser:[PKLiteral literalWithString:@"foo"]]; + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [n bestMatchFor:a]; + TDNil(res); +} + + +- (void)testParserNamed { + PKWord *w = [PKWord word]; + w.name = @"w"; + n = [PKNegation negationWithSubparser:w]; + + TDEquals(w, [n parserNamed:@"w"]); + + PKCollectionParser *alt = [PKAlternation alternation]; + alt.name = @"alt"; + + PKParser *foo = [PKLiteral literalWithString:@"foo"]; + foo.name = @"foo"; + [alt add:foo]; + + PKParser *bar = [PKLiteral literalWithString:@"bar"]; + bar.name = @"bar"; + [alt add:bar]; + + n = [PKNegation negationWithSubparser:alt]; + + TDEquals(alt, [n parserNamed:@"alt"]); + TDEquals(foo, [n parserNamed:@"foo"]); + TDEquals(bar, [n parserNamed:@"bar"]); +} + +@end diff --git a/test/TDNonReservedWord.h b/test/TDNonReservedWord.h new file mode 100644 index 0000000..863caef --- /dev/null +++ b/test/TDNonReservedWord.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface TDNonReservedWord : PKWord { + +} + +@end diff --git a/test/TDNonReservedWord.m b/test/TDNonReservedWord.m new file mode 100644 index 0000000..8385b30 --- /dev/null +++ b/test/TDNonReservedWord.m @@ -0,0 +1,35 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import + +@interface TDReservedWord () ++ (NSArray *)reservedWords; +@end + +@implementation TDNonReservedWord + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + if (!tok.isWord) { + return NO; + } + + NSString *s = tok.stringValue; + return [s length] && ![[TDReservedWord reservedWords] containsObject:s]; +} + +@end diff --git a/test/TDNumberStateTest.h b/test/TDNumberStateTest.h new file mode 100644 index 0000000..820a7e4 --- /dev/null +++ b/test/TDNumberStateTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDNumberStateTest : SenTestCase { + PKNumberState *numberState; + PKTokenizer *t; + PKReader *r; + NSString *s; +} +@end diff --git a/test/TDNumberStateTest.m b/test/TDNumberStateTest.m new file mode 100644 index 0000000..05b46f0 --- /dev/null +++ b/test/TDNumberStateTest.m @@ -0,0 +1,668 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDNumberStateTest.h" + +@implementation TDNumberStateTest + +- (void)setUp { + t = [[PKTokenizer alloc] init]; + r = [[PKReader alloc] init]; + numberState = t.numberState; +} + + +- (void)tearDown { + [t release]; + [r release]; +} + + +- (void)testSingleDigit { + s = @"3"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)3.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"3", tok.stringValue); +} + + +- (void)testDoubleDigit { + s = @"47"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)47.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"47", tok.stringValue); +} + + +- (void)testTripleDigit { + s = @"654"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)654.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"654", tok.stringValue); +} + + +- (void)testSingleDigitPositive { + s = @"+3"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)3.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+3", tok.stringValue); +} + + +- (void)testDoubleDigitPositive { + s = @"+22"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)22.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)testDoubleDigitPositiveSpace { + s = @"+22 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)22.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)testMultipleDots { + s = @"1.1.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.1", tok.stringValue); + + tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".1", tok.stringValue); +} + + +- (void)testOneDot { + s = @"1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1", tok.stringValue); +} + + +- (void)testCustomOneDot { + s = @"1."; + t.string = s; + r.string = s; + numberState.allowsTrailingDot = YES; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.", tok.stringValue); +} + + +- (void)testOneDotZero { + s = @"1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.0", tok.stringValue); +} + + +- (void)testPositiveOneDot { + s = @"+1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1", tok.stringValue); +} + + +- (void)testPositiveOneDotCustom { + s = @"+1."; + t.string = s; + r.string = s; + numberState.allowsTrailingDot = YES; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.", tok.stringValue); +} + + +- (void)testPositiveOneDotZero { + s = @"+1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.0", tok.stringValue); +} + + +- (void)testPositiveOneDotZeroSpace { + s = @"+1.0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.0", tok.stringValue); +} + + +- (void)testNegativeOneDot { + s = @"-1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testNegativeOneDotCustom { + s = @"-1."; + t.string = s; + r.string = s; + numberState.allowsTrailingDot = YES; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.", tok.stringValue); +} + + +- (void)testNegativeOneDotSpace { + s = @"-1. "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testNegativeOneDotZero { + s = @"-1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.0", tok.stringValue); +} + + +- (void)testNegativeOneDotZeroSpace { + s = @"-1.0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.0", tok.stringValue); +} + + +- (void)testOneDotOne { + s = @"1.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.1", tok.stringValue); +} + + +- (void)testZeroDotOne { + s = @"0.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0.1", tok.stringValue); +} + + +- (void)testDotOne { + s = @".1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".1", tok.stringValue); +} + + +- (void)testDotZero { + s = @".0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); +} + + +- (void)testNegativeDotZero { + s = @"-.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.0", tok.stringValue); +} + + +- (void)testPositiveDotZero { + s = @"+.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+.0", tok.stringValue); +} + + +- (void)testPositiveDotOne { + s = @"+.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+.1", tok.stringValue); +} + + +- (void)testNegativeDotOne { + s = @"-.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1", tok.stringValue); +} + + +- (void)testNegativeDotOneOne { + s = @"-.11"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.11, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.11", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOne { + s = @"-.111"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.111", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZero { + s = @"-.1110"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1110", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZeroZero { + s = @"-.11100"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.11100", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZeroSpace { + s = @"-.1110 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1110", tok.stringValue); +} + + +- (void)testZeroDotThreeSixtyFive { + s = @"0.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0.365", tok.stringValue); +} + + +- (void)testNegativeZeroDotThreeSixtyFive { + s = @"-0.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0.365", tok.stringValue); +} + + +- (void)testNegativeTwentyFourDotThreeSixtyFive { + s = @"-24.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-24.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-24.365", tok.stringValue); +} + + +- (void)testTwentyFourDotThreeSixtyFive { + s = @"24.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)24.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"24.365", tok.stringValue); +} + + +- (void)testZero { + s = @"0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0", tok.stringValue); +} + + +- (void)testNegativeOne { + s = @"-1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testOne { + s = @"1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1", tok.stringValue); +} + + +- (void)testPositiveOne { + s = @"+1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1", tok.stringValue); +} + + +- (void)testPositiveZero { + s = @"+0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+0", tok.stringValue); +} + + +- (void)testPositiveZeroSpace { + s = @"+0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+0", tok.stringValue); +} + + +- (void)testNegativeZero { + s = @"-0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0", tok.stringValue); +} + + +- (void)testNull { + s = @"NULL"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testNil { + s = @"nil"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testEmptyString { + s = @""; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDot { + s = @"."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDotSpace { + s = @". "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDotSpaceOne { + s = @". 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlus { + s = @"+"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlusSpace { + s = @"+ "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlusSpaceOne { + s = @"+ 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinus { + s = @"-"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinusSpace { + s = @"- "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinusSpaceOne { + s = @"- 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testInitSig { + s = @"- (id)init {"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + TDEquals((CGFloat)0.0, tok.floatValue); +} + + +- (void)testInitSig2 { + s = @"-(id)init {"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + TDEquals((CGFloat)0.0, tok.floatValue); +} + + +- (void)testParenStuff { + s = @"-(ab+5)"; + t.string = s; + r.string = s; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + TDEquals((CGFloat)0.0, tok.floatValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); +} + +@end diff --git a/test/TDParseTreeTest.h b/test/TDParseTreeTest.h new file mode 100644 index 0000000..4533383 --- /dev/null +++ b/test/TDParseTreeTest.h @@ -0,0 +1,34 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "PKParseTree.h" +#import "PKRuleNode.h" +#import "PKTokenNode.h" +#import "PKParseTreeAssembler.h" + + +@interface TDParseTreeTest : SenTestCase { + PKParserFactory *factory; + PKParseTreeAssembler *as; + NSString *g; + NSString *s; + PKTokenAssembly *a; + PKAssembly *res; + PKParser *lp; // language parser + PKTokenizer *t; + PKToken *tok; +} + +@end diff --git a/test/TDParseTreeTest.m b/test/TDParseTreeTest.m new file mode 100644 index 0000000..bbe80be --- /dev/null +++ b/test/TDParseTreeTest.m @@ -0,0 +1,170 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDParseTreeTest.h" + +@implementation TDParseTreeTest + +- (void)setUp { + factory = [PKParserFactory factory]; + as = [[[PKParseTreeAssembler alloc] init] autorelease]; +} + + +- (void)testAddExpr { + g = @"@start = expr;" + @"expr = addExpr;" + @"addExpr = atom (('+'|'-') atom)*;" + @"atom = Number;"; + lp = [factory parserFromGrammar:g assembler:as preassembler:as]; + + lp.tokenizer.string = @"1 + 2"; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp completeMatchFor:a]; + TDNotNil(res); + TDEqualObjects([res description], @"[]1/+/2^"); + + PKParseTree *tr = res.target; + TDEqualObjects([tr class], [PKParseTree class]); + TDEquals([[tr children] count], (NSUInteger)1); + + PKRuleNode *expr = [[tr children] objectAtIndex:0]; + TDEqualObjects([expr name], @"expr"); + TDEqualObjects([expr class], [PKRuleNode class]); + TDEquals([[expr children] count], (NSUInteger)1); + + PKRuleNode *addExpr = [[expr children] objectAtIndex:0]; + TDEqualObjects([addExpr name], @"addExpr"); + TDEqualObjects([addExpr class], [PKRuleNode class]); + TDEquals([[addExpr children] count], (NSUInteger)3); + + PKRuleNode *atom1 = [[addExpr children] objectAtIndex:0]; + TDEqualObjects([atom1 class], [PKRuleNode class]); + TDEqualObjects([atom1 name], @"atom"); + TDEquals([[atom1 children] count], (NSUInteger)1); + + PKTokenNode *one = [[atom1 children] objectAtIndex:0]; + TDEqualObjects([one class], [PKTokenNode class]); + TDEqualObjects([one token], [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:@"1" floatValue:1.0]); + + PKTokenNode *plus = [[addExpr children] objectAtIndex:1]; + TDEqualObjects([plus class], [PKTokenNode class]); + TDEqualObjects([plus token], [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"+" floatValue:0]); + + PKRuleNode *atom2 = [[addExpr children] objectAtIndex:2]; + TDEqualObjects([atom2 class], [PKRuleNode class]); + TDEqualObjects([atom2 name], @"atom"); + TDEquals([[atom2 children] count], (NSUInteger)1); + + PKTokenNode *two = [[atom2 children] objectAtIndex:0]; + TDEqualObjects([two class], [PKTokenNode class]); + TDEqualObjects([two token], [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:@"2" floatValue:2.0]); +} + + +- (void)testFoo { + g = @"@start = expr;" + @"expr = Word+;"; + lp = [factory parserFromGrammar:g assembler:as preassembler:as]; + + lp.tokenizer.string = @"foo"; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp completeMatchFor:a]; + TDNotNil(res); + TDEqualObjects([res description], @"[]foo^"); + + PKParseTree *tr = res.target; + TDEqualObjects([tr class], [PKParseTree class]); + TDEquals([[tr children] count], (NSUInteger)1); + + PKRuleNode *expr = [[tr children] objectAtIndex:0]; + TDEqualObjects([expr name], @"expr"); + TDEqualObjects([expr class], [PKRuleNode class]); + TDEquals([[expr children] count], (NSUInteger)1); + + PKTokenNode *foo = [[expr children] objectAtIndex:0]; + TDEqualObjects([foo class], [PKTokenNode class]); + TDEqualObjects([foo token], [PKToken tokenWithTokenType:PKTokenTypeWord stringValue:@"foo" floatValue:0.0]); +} + + +- (void)testFooBar { + g = @"@start = expr;" + @"expr = Word+;"; + lp = [factory parserFromGrammar:g assembler:as preassembler:as]; + + lp.tokenizer.string = @"foo bar"; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp completeMatchFor:a]; + TDNotNil(res); + TDEqualObjects([res description], @"[]foo/bar^"); + + PKParseTree *tr = res.target; + TDEqualObjects([tr class], [PKParseTree class]); + TDEquals([[tr children] count], (NSUInteger)1); + + PKRuleNode *expr = [[tr children] objectAtIndex:0]; + TDEqualObjects([expr name], @"expr"); + TDEqualObjects([expr class], [PKRuleNode class]); + TDEquals([[expr children] count], (NSUInteger)2); + + PKTokenNode *foo = [[expr children] objectAtIndex:0]; + TDEqualObjects([foo class], [PKTokenNode class]); + TDEqualObjects([foo token], [PKToken tokenWithTokenType:PKTokenTypeWord stringValue:@"foo" floatValue:0.0]); + + PKTokenNode *bar = [[expr children] objectAtIndex:1]; + TDEqualObjects([bar class], [PKTokenNode class]); + TDEqualObjects([bar token], [PKToken tokenWithTokenType:PKTokenTypeWord stringValue:@"bar" floatValue:0.0]); +} + + +- (void)testArray { + g = @"@start = array;" + @"array = '[' Number (commaNumber)* ']';" + @"commaNumber = ',' Number;"; + + lp = [factory parserFromGrammar:g assembler:as preassembler:as]; + + lp.tokenizer.string = @"[1,2]"; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp completeMatchFor:a]; + TDNotNil(res); + TDEqualObjects([res description], @"[][/1/,/2/]^"); + + PKRuleNode *root = res.target; + PKRuleNode *array = [[root children] objectAtIndex:0]; + + TDEqualObjects([array name], @"array"); + TDEqualObjects([array class], [PKRuleNode class]); + TDEquals([[array children] count], (NSUInteger)4); + + PKTokenNode *open = [[array children] objectAtIndex:0]; + TDEqualObjects([open class], [PKTokenNode class]); + TDEqualObjects([open token], [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"[" floatValue:0.0]); + + PKTokenNode *one = [[array children] objectAtIndex:1]; + TDEqualObjects([one class], [PKTokenNode class]); + TDEqualObjects([one token], [PKToken tokenWithTokenType:PKTokenTypeNumber stringValue:@"1" floatValue:1.0]); + + PKRuleNode *commaNumber = [[array children] objectAtIndex:2]; + TDEqualObjects([commaNumber name], @"commaNumber"); + TDEqualObjects([commaNumber class], [PKRuleNode class]); + TDEquals([[commaNumber children] count], (NSUInteger)2); + + PKTokenNode *close = [[array children] objectAtIndex:3]; + TDEqualObjects([close class], [PKTokenNode class]); + TDEqualObjects([close token], [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"]" floatValue:1.0]); +} + +@end diff --git a/test/TDParserBlocksTest.h b/test/TDParserBlocksTest.h new file mode 100644 index 0000000..627e17f --- /dev/null +++ b/test/TDParserBlocksTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDParserBlocksTest : SenTestCase { + PKAssembly *start; + NSString *s; + PKParser *p; +} + +@end diff --git a/test/TDParserBlocksTest.m b/test/TDParserBlocksTest.m new file mode 100644 index 0000000..af1fb9f --- /dev/null +++ b/test/TDParserBlocksTest.m @@ -0,0 +1,90 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDParserBlocksTest.h" + +@implementation TDParserBlocksTest + +- (void)setUp { +} + + +- (void)tearDown { +} + + +#ifdef TARGET_OS_SNOW_LEOPARD +- (void)testMath { + s = @"2 4 6 8"; + start = [PKTokenAssembly assemblyWithString:s]; + + PKNumber *n = [PKNumber number]; + p = [PKRepetition repetitionWithSubparser:n]; + + n.assemblerBlock = ^(PKAssembly *a) { + if (![a isStackEmpty]) { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; + } + }; + + p.assemblerBlock = ^(PKAssembly *a) { + NSNumber *total = [a pop]; + if (!total) { + total = [NSNumber numberWithFloat:0]; + } + + while (![a isStackEmpty]) { + NSNumber *n = [a pop]; + total = [NSNumber numberWithFloat:[total floatValue] + [n floatValue]]; + } + + [a push:total]; + }; + + PKAssembly *result = [p completeMatchFor:start]; + TDNotNil(result); + TDEqualObjects(@"[20]2/4/6/8^", [result description]); + TDEquals((double)20.0, [[result pop] doubleValue]); +} + + +- (void)testMath2 { + PKParser *addParser = [PKRepetition repetitionWithSubparser:[PKNumber number]]; + + addParser.assemblerBlock = ^(PKAssembly *a) { + NSArray *toks = [a objectsAbove:nil]; + double total = 0.0; + + for (PKToken *tok in toks) { + total += [tok floatValue]; + } + + [a push:[NSNumber numberWithDouble:total]]; + }; + + s = @"2.5 -5.5 8"; + +// NSNumber *result = [addParser parse:s]; +// NSAssert([result doubleValue] == 5.0, @""); + + start = [PKTokenAssembly assemblyWithString:s]; + PKAssembly *result = [addParser completeMatchFor:start]; + TDNotNil(result); + TDEqualObjects(@"[5]2.5/-5.5/8^", [result description]); + TDEquals(5.0, [(NSNumber *)[result pop] doubleValue]); +} +#endif + +@end diff --git a/test/TDParserFactoryPatternTest.h b/test/TDParserFactoryPatternTest.h new file mode 100644 index 0000000..509907f --- /dev/null +++ b/test/TDParserFactoryPatternTest.h @@ -0,0 +1,28 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" + +@interface TDParserFactoryPatternTest : SenTestCase { + NSString *g; + NSString *s; + PKTokenAssembly *a; + PKParserFactory *factory; + PKAssembly *res; + PKParser *lp; // language parser + PKTokenizer *t; +} + +@end diff --git a/test/TDParserFactoryPatternTest.m b/test/TDParserFactoryPatternTest.m new file mode 100644 index 0000000..c652dee --- /dev/null +++ b/test/TDParserFactoryPatternTest.m @@ -0,0 +1,90 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDParserFactoryPatternTest.h" + +@implementation TDParserFactoryPatternTest + +- (void)setUp { + factory = [PKParserFactory factory]; +} + + +- (void)test1 { + g = @"@start = /foo/;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + + g = @"@start = /fo+/;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + + g = @"@start = /fo+/;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + + g = @"@start = /[fo]+/;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + + g = @"@start = /\\w+/;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); +} + + +- (void)testOptions { + g = @"@start = /foo/i;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"FOO"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[FOO]FOO^", [res description]); + + + g = @"@start = /foo/i;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"FoO"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[FoO]FoO^", [res description]); +} + +@end diff --git a/test/TDParserFactoryTest.h b/test/TDParserFactoryTest.h new file mode 100644 index 0000000..1d65617 --- /dev/null +++ b/test/TDParserFactoryTest.h @@ -0,0 +1,23 @@ +// +// PKParserFactoryTest.h +// ParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2009 Todd Ditchendorf All rights reserved. +// + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" + +@interface TDParserFactoryTest : SenTestCase { + NSString *s; + PKTokenAssembly *a; + PKParserFactory *factory; + PKAssembly *res; + + PKSequence *exprSeq; + PKTokenizer *t; + PKParser *lp; // language parser +} + +@end diff --git a/test/TDParserFactoryTest.m b/test/TDParserFactoryTest.m new file mode 100644 index 0000000..1c863ae --- /dev/null +++ b/test/TDParserFactoryTest.m @@ -0,0 +1,1256 @@ +// +// PKParserFactoryTest.m +// ParseKit +// +// Created by Todd Ditchendorf on 12/12/08. +// Copyright 2009 Todd Ditchendorf All rights reserved. +// + +#import "TDParserFactoryTest.h" +#import + +@interface PKParserFactory () +- (PKTokenizer *)tokenizerForParsingGrammar; +- (PKSequence *)parserFromExpression:(NSString *)s; +@property (retain) PKCollectionParser *exprParser; +@end + +@protocol TDMockAssember +- (void)didMatchFoo:(PKAssembly *)a; +- (void)didMatchBaz:(PKAssembly *)a; +- (void)didMatchStart:(PKAssembly *)a; +- (void)didMatchStart:(PKAssembly *)a; +- (void)didMatch_Start:(PKAssembly *)a; +@end + +@implementation TDParserFactoryTest + +- (void)setUp { + factory = [PKParserFactory factory]; + PKSequence *seq = [PKSequence sequence]; + [seq add:factory.exprParser]; + exprSeq = seq; + t = [factory tokenizerForParsingGrammar]; +} + + +- (void)testJavaScript { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"javascript" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"var foo = 'bar';"; + lp.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; +// res = [lp bestMatchFor:a]; +// TDEqualObjects(@"[var, foo, =, 'bar', ;]var/foo/=/bar/;^", [res description]); +} + + +- (void)testCSS2_1 { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"css2_1" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + +// s = @"foo {font-size:12px}"; +// a = [PKTokenAssembly assemblyWithString:s]; +// res = [lp bestMatchFor:a]; +// TDEqualObjects(@"[foo, {, font-family, :, 'helvetica', ;, }]foo/{/font-family/:/'helvetica'/;/}^", [res description]); +} + + +- (void)testCSS { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + PKParser *selectorParser = [lp parserNamed:@"selector"]; + TDNotNil(selectorParser); + TDEqualObjects(selectorParser.name, @"selector"); + TDEqualObjects([selectorParser class], [PKLowercaseWord class]); + + PKParser *declParser = [lp parserNamed:@"decl"]; + TDNotNil(declParser); + TDEqualObjects(declParser.name, @"decl"); + TDEqualObjects([declParser class], [PKSequence class]); + + PKParser *rulesetParser = [lp parserNamed:@"ruleset"]; + TDNotNil(rulesetParser); + TDEqualObjects(rulesetParser, [(PKRepetition *)lp subparser]); + TDEqualObjects(rulesetParser.name, @"ruleset"); + TDEqualObjects([rulesetParser class], [PKSequence class]); + + PKParser *startParser = [lp parserNamed:@"@start"]; + TDNotNil(startParser); + TDEqualObjects(startParser, lp); + TDEqualObjects(startParser.name, @"@start"); + TDEqualObjects([startParser class], [PKRepetition class]); + + s = @"foo {font-family:'helvetica';}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, {, font-family, 'helvetica']foo/{/font-family/:/'helvetica'/;/}^", [res description]); + + s = @"foo {font-family:'helvetica'}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, {, font-family, 'helvetica']foo/{/font-family/:/'helvetica'/}^", [res description]); + + s = @"bar {color:rgb(1, 255, 255); font-size:13px;}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar, {, color, (, 1, 255, 255, font-size, 13]bar/{/color/:/rgb/(/1/,/255/,/255/)/;/font-size/:/13/px/;/}^", [res description]); + + s = @"bar {color:rgb(1, 255, 47.0); font-family:'Helvetica'}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar, {, color, (, 1, 255, 47.0, font-family, 'Helvetica']bar/{/color/:/rgb/(/1/,/255/,/47.0/)/;/font-family/:/'Helvetica'/}^", [res description]); + + s = @"foo {font-family:'Lucida Grande'} bar {color:rgb(1, 255, 255); font-size:9px;}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, {, font-family, 'Lucida Grande', bar, {, color, (, 1, 255, 255, font-size, 9]foo/{/font-family/:/'Lucida Grande'/}/bar/{/color/:/rgb/(/1/,/255/,/255/)/;/font-size/:/9/px/;/}^", [res description]); +} + + +- (void)testJSON { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"{'foo':'bar'}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', :, 'bar', }]{/'foo'/:/'bar'/}^", [res description]); + + s = @"{'foo':{}}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', :, {, }, }]{/'foo'/:/{/}/}^", [res description]); + + s = @"{'foo':{'bar':[]}}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', :, {, 'bar', :, [, ], }, }]{/'foo'/:/{/'bar'/:/[/]/}/}^", [res description]); + + s = @"['foo', true, null]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, 'foo', ,, true, ,, null, ]][/'foo'/,/true/,/null/]^", [res description]); + + s = @"[[]]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, [, ], ]][/[/]/]^", [res description]); + + s = @"[[[1]]]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, [, [, 1, ], ], ]][/[/[/1/]/]/]^", [res description]); +} + + +- (void)testJSONWithDiscards { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"json_with_discards" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"{'foo':'bar'}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', 'bar']{/'foo'/:/'bar'/}^", [res description]); + + s = @"{'foo':{}}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', {]{/'foo'/:/{/}/}^", [res description]); + + s = @"{'foo':{'bar':[]}}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', {, 'bar', []{/'foo'/:/{/'bar'/:/[/]/}/}^", [res description]); + + s = @"['foo', true, null]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, 'foo'][/'foo'/,/true/,/null/]^", [res description]); + + s = @"[[]]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, [][/[/]/]^", [res description]); + + s = @"[[[1]]]"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[[, [, [, 1][/[/[/1/]/]/]^", [res description]); +} + + +- (void)testStartLiteral { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = 'bar';"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testStartLiteralNonReserved { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo*; foo = 'bar';"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + s = @"bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar, bar]bar/bar^", [res description]); + [mock verify]; +} + + +- (void)testStartLiteralNonReserved2 { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = (foo|baz)*; foo = 'bar'; baz = 'bat'"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + [[mock expect] didMatchBaz:OCMOCK_ANY]; + s = @"bar bat"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar, bat]bar/bat^", [res description]); + [mock verify]; +} + + +- (void)testStartLiteralNonReserved3 { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = (foo|baz)+; foo = 'bar'; baz = 'bat'"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + [[mock expect] didMatchBaz:OCMOCK_ANY]; + s = @"bar bat"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar, bat]bar/bat^", [res description]); + [mock verify]; +} + + +- (void)testStartLiteralNonReserved4 { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = (foo|baz)+; foo = 'bar'; baz = 'bat'"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + [[mock expect] didMatchBaz:OCMOCK_ANY]; + [[mock expect] didMatchBaz:OCMOCK_ANY]; + s = @"bar bat bat"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar, bat, bat]bar/bat/bat^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorDefault { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo|baz; foo = 'bar'; baz = 'bat'"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorOnAll { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo|baz; foo = 'bar'; baz = 'bat'"; + factory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnAll; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); +// TDTrue(lp.assembler == mock); +// TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatch_Start:"); + +// [[mock expect] didMatch_Start:OCMOCK_ANY]; + [[mock expect] didMatchFoo:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorOnTerminals { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo|baz; foo = 'bar'; baz = 'bat'"; + factory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnTerminals; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); + TDNil(lp.assembler); + TDNil(NSStringFromSelector(lp.assemblerSelector)); + + [[mock expect] didMatchFoo:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorOnExplicit { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo|baz; foo (didMatchFoo:) = 'bar'; baz (didMatchBaz:) = 'bat'"; + factory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnExplicit; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); + TDNil(lp.assembler); + TDNil(NSStringFromSelector(lp.assemblerSelector)); + + [[mock expect] didMatchFoo:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorOnExplicitNone { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = foo|baz; foo = 'bar'; baz = 'bat'"; + factory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnExplicit; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); + TDNil(lp.assembler); + TDNil(NSStringFromSelector(lp.assemblerSelector)); + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testAssemblerSettingBehaviorOnExplicitOrTerminal { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start = (foo|baz)+; foo (didMatchFoo:) = 'bar'; baz = 'bat'"; + factory.assemblerSettingBehavior = (PKParserFactoryAssemblerSettingBehaviorOnExplicit | PKParserFactoryAssemblerSettingBehaviorOnTerminals); + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); + TDNil(lp.assembler); + TDNil(NSStringFromSelector(lp.assemblerSelector)); + + [[mock expect] didMatchFoo:OCMOCK_ANY]; + [[mock expect] didMatchBaz:OCMOCK_ANY]; + s = @"bar bat"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp completeMatchFor:a]; + TDEqualObjects(@"[bar, bat]bar/bat^", [res description]); + [mock verify]; +} + + +- (void)testStartLiteralWithCallback { + id mock = [OCMockObject mockForProtocol:@protocol(TDMockAssember)]; + s = @"@start (didMatchStart:) = 'bar';"; + lp = [factory parserFromGrammar:s assembler:mock]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + TDEqualObjects(lp.name, @"@start"); + TDTrue(lp.assembler == mock); + TDEqualObjects(NSStringFromSelector(lp.assemblerSelector), @"didMatchStart:"); + + [[mock expect] didMatchStart:OCMOCK_ANY]; + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + [mock verify]; +} + + +- (void)testStartRefToLiteral { + s = @" @start = foo; foo = 'bar';"; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); +} + + +- (void)testStartRefToLiteral3 { + s = @" @start = foo|baz; baz = 'bat'; foo = 'bar';"; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); +} + + +- (void)testStartRefToLiteral2 { + s = @"foo = 'bar'; baz = 'bat'; @start = (foo | baz)*;"; + lp = [factory parserFromGrammar:s assembler:nil]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + + s = @"bat bat"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bat, bat]bat/bat^", [res description]); + + s = @"bat bat bat bat bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bat, bat, bat, bat, bar]bat/bat/bat/bat/bar^", [res description]); +} + + +#ifndef TARGET_CPU_X86_64 +- (void)testStmtTrackException { + s = @"@start ="; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testCallbackTrackException { + s = @"@start ( = 'foo';"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start (foo: = 'foo'"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testSelectorTrackException { + s = @"@start (foo) = 'foo';"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testOrTrackException { + s = @"@start = 'foo'|;"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +//- (void)testExprTrackException { +// s = @"@start=(foo;"; +// STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +//} + + +- (void)testIntersectionTrackException { + s = @"@start='foo' &;"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testExclusionTrackException { + s = @"@start='foo' -;"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testDelimitedStringTrackException { + s = @"@start=DelimitedString('/';"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start=DelimitedString('/', ;"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} + + +- (void)testCardinalityTrackException { + s = @"@start='foo'{;"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start='foo'{};"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start='foo'{,};"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); + + s = @"@start='foo'{m};"; + STAssertThrowsSpecificNamed([factory parserFromGrammar:s assembler:nil], PKTrackException, PKTrackExceptionName, @""); +} +#endif + + +- (void)testExprHelloPlus { + s = @"'hello'+"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[hello, hello]hello/hello^", [res description]); +} + + +- (void)testExprHelloStar { + s = @"'hello'*"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKRepetition class]); + + s = @"hello hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[hello, hello, hello]hello/hello/hello^", [res description]); +} + + +- (void)testExprHelloQuestion { + s = @"'hello'?"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKAlternation class]); + + s = @"hello hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[hello]hello^hello/hello", [res description]); +} + + +- (void)testExprOhHaiThereQuestion { + s = @"'oh'? 'hai'? 'there'?"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + s = @"there"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[there]there^", [res description]); +} + + +- (void)testExprFooBar { + s = @"'foo' 'bar'"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]'foo'/ /'bar'^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + TDEquals((NSUInteger)2, [seq.subparsers count]); + + PKLiteral *c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + c = [seq.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + s = @"foo bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, bar]foo/bar^", [res description]); +} + + +- (void)testExprFooBarBaz { + s = @"'foo' 'bar' 'baz'"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]'foo'/ /'bar'/ /'baz'^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + TDEquals((NSUInteger)3, [seq.subparsers count]); + + PKLiteral *c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + c = [seq.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + c = [seq.subparsers objectAtIndex:2]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"baz", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [res description]); +} + + +- (void)testExprFooOrBar { + s = @"'foo'|'bar'"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]'foo'/|/'bar'^", [res description]); + + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKAlternation class]); + + s = @"bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^", [res description]); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^", [res description]); +} + + +- (void)testExprFooOrBarStar { + s = @"'foo'|'bar'*"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]'foo'/|/'bar'/*^", [res description]); + + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + PKRepetition *rep = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKRepetition class], [rep class]); + c = (PKLiteral *)rep.subparser; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKAlternation class]]); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^", [res description]); + + s = @"foo foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^foo", [res description]); + + s = @"bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar, bar]bar/bar^", [res description]); +} + + +- (void)testExprFooOrBarPlus { + s = @"'foo'|'bar'+"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]'foo'/|/'bar'/+^", [res description]); + + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + PKSequence *seq = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKSequence class], [seq class]); + + c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + PKRepetition *rep = [seq.subparsers objectAtIndex:1]; + TDEqualObjects([PKRepetition class], [rep class]); + c = (PKLiteral *)rep.subparser; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKAlternation class]]); + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^", [res description]); + + s = @"foo foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^foo", [res description]); + + s = @"foo bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^bar", [res description]); + + s = @"bar bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar, bar, bar]bar/bar/bar^", [res description]); +} + + +- (void)testExprFooOrBarQuestion { + s = @"'foo'|'bar'?"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]'foo'/|/'bar'/?^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + alt = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKAlternation class], [alt class]); + + PKEmpty *e = [alt.subparsers objectAtIndex:0]; + TDTrue([e isMemberOfClass:[PKEmpty class]]); + + c = (PKLiteral *)[alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKAlternation class]]); + s = @"bar bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^bar/bar", [res description]); + + s = @"foo bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^bar/bar", [res description]); +} + + +- (void)testExprParenFooOrBarParenStar { + s = @"('foo'|'bar')*"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Repetition](/'foo'/|/'bar'/)/*^", [res description]); + PKRepetition *rep = [res pop]; + TDTrue([rep isMemberOfClass:[PKRepetition class]]); + + PKAlternation *alt = (PKAlternation *)rep.subparser; + TDTrue([alt class] == [PKAlternation class]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKRepetition class]); + s = @"foo bar bar foo"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, bar, bar, foo]foo/bar/bar/foo^", [res description]); +} + + +- (void)testExprParenFooOrBooParenPlus { + s = @"('foo'|'bar')+"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence](/'foo'/|/'bar'/)/+^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + + TDEquals((NSUInteger)2, [seq.subparsers count]); + + PKAlternation *alt = [seq.subparsers objectAtIndex:0]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + PKRepetition *rep = [seq.subparsers objectAtIndex:1]; + TDTrue([rep isMemberOfClass:[PKRepetition class]]); + + alt = (PKAlternation *)rep.subparser; + TDEqualObjects([PKAlternation class], [alt class]); + + c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + s = @"foo foo bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo, foo, bar, bar]foo/foo/bar/bar^", [res description]); +} + + +- (void)testExprParenFooOrBarParenQuestion { + s = @"('foo'|'bar')?"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation](/'foo'/|/'bar'/)/?^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + + TDEquals((NSUInteger)2, [alt.subparsers count]); + PKEmpty *e = [alt.subparsers objectAtIndex:0]; + TDTrue([PKEmpty class] == [e class]); + + alt = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([alt class], [PKAlternation class]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKLiteral *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"foo", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isKindOfClass:[PKLiteral class]]); + TDEqualObjects(@"bar", c.string); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKAlternation class]); + s = @"foo bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^bar", [res description]); + + s = @"bar bar"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[bar]bar^bar", [res description]); +} + + +- (void)testExprWord { + s = @"Word"; + t.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Word]Word^", [res description]); + PKWord *w = [res pop]; + TDTrue([w isMemberOfClass:[PKWord class]]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKWord class]); + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[hello]hello^hello", [res description]); +} + + +- (void)testExprWordPlus { + s = @"Word+"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[hello, hello]hello/hello^", [res description]); +} + + +- (void)testExprNum { + s = @"Number"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Number]Number^", [res description]); + PKNumber *w = [res pop]; + TDTrue([w isMemberOfClass:[PKNumber class]]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKNumber class]]); + + s = @"333 444"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[333]333^444", [res description]); + + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDNil(res); +} + + +- (void)testExprNumCardinality { + s = @"Number{2}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]Number/{/2/}^", [res description]); + PKSequence *seq = [res pop]; + TDEqualObjects([seq class], [PKSequence class]); + + TDEquals((NSUInteger)2, [seq.subparsers count]); + PKNumber *n = [seq.subparsers objectAtIndex:0]; + TDEqualObjects([n class], [PKNumber class]); + + n = [seq.subparsers objectAtIndex:1]; + TDEqualObjects([n class], [PKNumber class]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + + s = @"333 444"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[333, 444]333/444^", [res description]); + + s = @"1.1 2.2 3.3"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[1.1, 2.2]1.1/2.2^3.3", [res description]); + + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDNil(res); +} + + +- (void)testExprNumCardinality2 { + s = @"Number{2,3}"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]Number/{/2/,/3/}^", [res description]); + PKSequence *seq = [res pop]; + TDEqualObjects([seq class], [PKSequence class]); + + TDEquals((NSUInteger)3, [seq.subparsers count]); + + PKNumber *n = [seq.subparsers objectAtIndex:0]; + TDEqualObjects([n class], [PKNumber class]); + + n = [seq.subparsers objectAtIndex:1]; + TDEqualObjects([n class], [PKNumber class]); + + n = [seq.subparsers objectAtIndex:2]; + TDEqualObjects([n class], [PKAlternation class]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSequence class]]); + + s = @"333 444"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[333, 444]333/444^", [res description]); + + s = @"1.1 2.2 3.3"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[1.1, 2.2, 3.3]1.1/2.2/3.3^", [res description]); + + s = @"1.1 2.2 3.3 4"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[1.1, 2.2, 3.3]1.1/2.2/3.3^4", [res description]); + + s = @"hello hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDNil(res); +} + + +- (void)testExprNumPlus { + s = @"Number+"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + s = @"333 444"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[333, 444]333/444^", [res description]); +} + + +- (void)testExprSymbol { + s = @"Symbol"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Symbol]Symbol^", [res description]); + PKSymbol *w = [res pop]; + TDTrue([w isMemberOfClass:[PKSymbol class]]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKSymbol class]]); + + s = @"? #"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[?]?^#", [res description]); + + s = @"hello"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDNil(res); +} + + +- (void)testExprSymbolPlus { + s = @"Symbol+"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + s = @"% *"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[%, *]%/*^", [res description]); +} + + +- (void)testExprQuotedString { + s = @"QuotedString"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [exprSeq bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[QuotedString]QuotedString^", [res description]); + PKQuotedString *w = [res pop]; + TDTrue([w isMemberOfClass:[PKQuotedString class]]); + + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + TDEqualObjects([lp class], [PKQuotedString class]); + s = @"'hello' 'hello'"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"['hello']'hello'^'hello'", [res description]); +} + + +- (void)testExprQuotedStringPlus { + s = @"QuotedString+"; + // use the result parser + lp = [factory parserFromExpression:s]; + TDNotNil(lp); + s = @"'hello' 'hello'"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"['hello', 'hello']'hello'/'hello'^", [res description]); +} + + +- (void)testRubyHash { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"rubyhash" ofType:@"grammar"]; + s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + lp = [factory parserFromGrammar:s assembler:nil]; + + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + +// s = @"{\"brand\"=>{\"name\"=>\"something\"," +// @"\"logo\"=>#," +// @"\"summary\"=>\"wee\", \"content\"=>\"woopy doo\"}, \"commit\"=>\"Save\"," +// @"\"authenticity_token\"=>\"43a94d60304a7fb13a4ff61a5960461ce714e92b\"," +// @"\"action\"=>\"create\", \"controller\"=>\"admin/brands\"}"; + + lp.tokenizer.string = @"{'foo'=> {'logo' => # } }"; + + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[{, 'foo', =>, {, 'logo', =>, #, }, }]{/'foo'/=>/{/'logo'/=>/#/}/}^", [res description]); +} + + +- (void)testSymbolState { + s = @"@symbolState = 'b'; @start = ('b'|'ar')*;"; + lp = [factory parserFromGrammar:s assembler:nil]; + + TDNotNil(lp); + TDTrue([lp isKindOfClass:[PKParser class]]); + + lp.tokenizer.string = @"bar"; + a = [PKTokenAssembly assemblyWithTokenizer:lp.tokenizer]; + res = [lp bestMatchFor:a]; + TDEqualObjects(@"[b, ar]b/ar^", [res description]); + [res pop]; // discar 'ar' + PKToken *tok = [res pop]; + TDEqualObjects([tok class], [PKToken class]); + TDEqualObjects(tok.stringValue, @"b"); + TDTrue(tok.isSymbol); +} + +@end \ No newline at end of file diff --git a/test/TDParserFactoryTest2.h b/test/TDParserFactoryTest2.h new file mode 100644 index 0000000..c694921 --- /dev/null +++ b/test/TDParserFactoryTest2.h @@ -0,0 +1,29 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "PKParserFactory.h" + +@interface TDParserFactoryTest2 : SenTestCase { + NSString *g; + NSString *s; + PKTokenAssembly *a; + PKParserFactory *factory; + PKAssembly *res; + PKParser *lp; // language parser + PKTokenizer *t; + PKToken *tok; +} + +@end diff --git a/test/TDParserFactoryTest2.m b/test/TDParserFactoryTest2.m new file mode 100644 index 0000000..97b058c --- /dev/null +++ b/test/TDParserFactoryTest2.m @@ -0,0 +1,710 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDParserFactoryTest2.h" + +@implementation TDParserFactoryTest2 + +- (void)setUp { + factory = [PKParserFactory factory]; +} + + +- (void)testOrVsAndPrecendence { + g = @"@start = Word | Number Symbol;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + s = @"foo %"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + g = @"@start = Word Number | Symbol;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo 3"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 3]foo/3^", [res description]); + + s = @"%"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[%]%^", [res description]); + + s = @"foo %"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + g = @"@start = Word (Number | Symbol);"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo 3"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 3]foo/3^", [res description]); + + s = @"foo"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + s = @"foo %"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, %]foo/%^", [res description]); +} + + +- (void)test1 { + g = @"@start = (Word | Number)*;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + s = @"24.5"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[24.5]24.5^", [res description]); + + s = @"foo bar 2 baz"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, baz]foo/bar/2/baz^", [res description]); + + s = @"foo bar 2 4 baz"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, 4, baz]foo/bar/2/4/baz^", [res description]); +} + + +- (void)test2 { + g = @"@start = (Word | Number)* QuotedString;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 'bar']foo/'bar'^", [res description]); + + s = @"24.5 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[24.5, 'bar']24.5/'bar'^", [res description]); + + s = @"foo bar 2 baz 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, baz, 'bar']foo/bar/2/baz/'bar'^", [res description]); + + s = @"foo bar 2 4 baz 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, 4, baz, 'bar']foo/bar/2/4/baz/'bar'^", [res description]); +} + + +- (void)test3 { + g = @"@start = (Word | Number)* '$'+ QuotedString;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo $ 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, 'bar']foo/$/'bar'^", [res description]); + + s = @"foo $ $ 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, $, 'bar']foo/$/$/'bar'^", [res description]); + + s = @"24.5 $ 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[24.5, $, 'bar']24.5/$/'bar'^", [res description]); + + s = @"foo bar 2 baz $ 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, baz, $, 'bar']foo/bar/2/baz/$/'bar'^", [res description]); + + s = @"foo bar 2 4 baz $ 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, bar, 2, 4, baz, $, 'bar']foo/bar/2/4/baz/$/'bar'^", [res description]); +} + + +- (void)test4 { + g = @"@start = (Word | Number)* ('$' '%')+ QuotedString;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, 'bar']foo/$/%/'bar'^", [res description]); + + s = @"foo $ % $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, $, %, 'bar']foo/$/%/$/%/'bar'^", [res description]); +} + + +- (void)test5 { + g = @"@start = (Word | Number)* ('$' '%')+ QuotedString;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, 'bar']foo/$/%/'bar'^", [res description]); + + s = @"foo $ % $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, $, %, 'bar']foo/$/%/$/%/'bar'^", [res description]); + + s = @"foo 33 4 $ % $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 33, 4, $, %, $, %, 'bar']foo/33/4/$/%/$/%/'bar'^", [res description]); + + s = @"foo 33 bar 4 $ % $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 33, bar, 4, $, %, $, %, 'bar']foo/33/bar/4/$/%/$/%/'bar'^", [res description]); +} + + +- (void)test6 { + g = @"@start = ((Word | Number)* ('$' '%')+) | QuotedString;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"['bar']'bar'^", [res description]); + + s = @"foo $ % $ %"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, $, %]foo/$/%/$/%^", [res description]); +} + + +- (void)test7 { + g = @"@start = ((Word | Number)* ('$' '%')+) | QuotedString+;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"'bar' 'foo'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"['bar', 'foo']'bar'/'foo'^", [res description]); + + s = @"foo $ % $ %"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, $, %]foo/$/%/$/%^", [res description]); + + s = @"$ % $ %"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[$, %, $, %]$/%/$/%^", [res description]); +} + + +- (void)test8 { + g = @"@start = ((Word | Number)* ('$' '%')+) | QuotedString+;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"'bar' 'foo'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"['bar', 'foo']'bar'/'foo'^", [res description]); + + s = @"foo $ % $ %"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, $, %, $, %]foo/$/%/$/%^", [res description]); + + s = @"$ % $ %"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[$, %, $, %]$/%/$/%^", [res description]); +} + + +- (void)test9 { + g = @"@start = Word | (Number);"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"42"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[42]42^", [res description]); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); +} + + +- (void)test10 { + g = @"@start = Word | (Number QuotedString);"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + s = @"42 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[42, 'bar']42/'bar'^", [res description]); +} + + +- (void)test11 { + g = @"@start = ((Word | Number)* | ('$' '%')+) QuotedString+;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo, 'bar']foo/'bar'^", [res description]); + + s = @"$ % $ % 'bar'"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[$, %, $, %, 'bar']$/%/$/%/'bar'^", [res description]); +} + + +- (void)test12 { + g = @"@delimitState = '$'; @delimitedString = '$' '%' nil; @start = DelimitedString('$', '%');"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"$foo%"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[$foo%]$foo%^", [res description]); + + + g = @"@delimitState = '$'; @delimitedString = '$' '%' nil; @start = DelimitedString('$', '');"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"$foo%"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[$foo%]$foo%^", [res description]); + + + g = @"@delimitState = '$'; @delimitedString = '$' '%' 'fo'; @start = DelimitedString('$', '%');"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"$foo%"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[$foo%]$foo%^", [res description]); + + + g = @"@delimitState = '$'; @delimitedString = '$' '%' 'f'; @start = DelimitedString('$', '%');"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"$foo%"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + + +- (void)testWhitespace { + g = @"@reportsWhitespaceTokens = YES; @start = 'foo' S '+' S 'bar';"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo + bar"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo, , +, , bar]foo/ /+/ /bar^", [res description]); + + s = @"foo +bar"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + g = @"@start = 'foo' S '+' S 'bar';"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo + bar"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + g = @"@reportsWhitespaceTokens = NO; @start = 'foo' S '+' S 'bar';"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo + bar"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + + g = @"@reportsWhitespaceTokens = YES; @start = 'foo' S '+' S 'bar';"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo \t \t + bar"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo, \t \t , +, , bar]foo/ \t \t /+/ /bar^", [res description]); +} + + +- (void)testDiscard { + g = @"@start = 'foo'!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]foo^", [res description]); + + g = @"@start = /foo/!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]foo^", [res description]); + + g = @"@delimitState='<'; @delimitedStrings='<%' '%>' nil; @start=DelimitedString('<%', '%>')!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"<% foo %>"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]<% foo %>^", [res description]); +} + + +- (void)testDiscard2 { + g = @"@reportsWhitespaceTokens=YES;@start=S!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @" "; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[] ^", [res description]); + + g = @"@start=Any!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]foo^", [res description]); + + g = @"@start=Word!;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]foo^", [res description]); + +} + + +- (void)testComments { + g = + @"@commentState = '/';" + @"@singleLineComments = '//';" + @"@reportsCommentTokens = YES;" + @"@start = Any+;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"# // foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[#, // foo]#/// foo^", [res description]); + + tok = [res pop]; + TDTrue(tok.isComment); + +} + + + +- (void)testFallbackState { + g = + @"@commentState = '/';" + @"@commentState.fallbackState = delimitState;" + @"@delimitedString = '/' '/' nil;" + @"@singleLineComments = '//';" + @"@multiLineComments = '/*' '*/';" + @"@start = Any+;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"/ %"; + t = lp.tokenizer; + + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, %]//%^", [res description]); + tok = [res pop]; + TDTrue(tok.isSymbol); + + s = @"/ /"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/ /]/ /^", [res description]); + tok = [res pop]; + TDTrue(tok.isDelimitedString); + + s = @"/foo/"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/foo/]/foo/^", [res description]); + tok = [res pop]; + TDTrue(tok.isDelimitedString); + + s = @"# // foo"; + t = lp.tokenizer; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[#]#^", [res description]); + tok = [res pop]; + TDTrue(tok.isSymbol); + +} + + +- (void)testPatternPredicate1 { + g = @"@wordChar = ':'; @start = Word;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"foo:bar"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo:bar]foo:bar^", [res description]); + tok = [res pop]; + TDTrue(tok.isWord); + + g = @"@wordChar = ':'; @start = Word & /[^:]+/;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo]foo^", [res description]); + tok = [res pop]; + TDTrue(tok.isWord); + + s = @"foo:bar"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + + +- (void)testPatternPredicate2 { + g = @"@wordChar = ':'; @start=ncName+; name=Word; ncName=name & /[^:]+/;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo]foo^", [res description]); + tok = [res pop]; + TDTrue(tok.isWord); + + s = @"foo:bar"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + + +- (void)testExclusionFoo { + g = @"@start = ex; ex = Word - 'foo';"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"bar"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[bar]bar^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[wee]wee^", [res description]); +} + + +- (void)testExclusionAlt { + g = @"@start = ex; m = ('foo'|'bar'); ex = Word - m;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"baz"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[baz]baz^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[wee]wee^", [res description]); +} + + +- (void)testExclusionAlt2 { + g = @"@start = ex; ex = Word - ('foo'|'bar');"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"baz"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[baz]baz^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[wee]wee^", [res description]); +} + + +- (void)testExclusionAlt3 { + g = @"@start = ex; s = 'foo'|'baz'; m = ('foo'|'bar'); ex = s - m;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"baz"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[baz]baz^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + + +- (void)testExclusionAlt4 { + g = @"@start = ex; m = ('foo'|'bar'); ex = ('foo'|'baz') - m;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"baz"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[baz]baz^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + + +- (void)testExclusionAlt5 { + g = @"@start = ex; ex = ('foo'|'baz') - ('foo'|'bar');"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + s = @"baz"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[baz]baz^", [res description]); + + s = @"foo"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + s = @"wee"; + t.string = s; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); +} + +@end diff --git a/test/TDParserFactoryTest3.h b/test/TDParserFactoryTest3.h new file mode 100644 index 0000000..3adeefa --- /dev/null +++ b/test/TDParserFactoryTest3.h @@ -0,0 +1,28 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDParserFactoryTest3 : SenTestCase { + NSString *g; + NSString *s; + PKTokenAssembly *a; + PKParserFactory *factory; + PKAssembly *res; + PKParser *lp; // language parser + PKTokenizer *t; + PKToken *tok; +} + +@end diff --git a/test/TDParserFactoryTest3.m b/test/TDParserFactoryTest3.m new file mode 100644 index 0000000..b6a0dd0 --- /dev/null +++ b/test/TDParserFactoryTest3.m @@ -0,0 +1,182 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDParserFactoryTest3.h" + +@implementation TDParserFactoryTest3 + +- (void)setUp { + factory = [PKParserFactory factory]; +} + + +- (void)testOrVsAndPrecendence { + g = @" @start ( didMatchFoo: ) = foo;\n" + @" foo = Word & /foo/ | Number! { 1 } ( DelimitedString ( '/' , '/' ) Symbol- '%' ) * /bar/ ;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[foo]foo^", [res description]); +} + + +- (void)testNegation { + g = @"@start = ~'foo';"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"foo"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + s = @"'bar'"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"['bar']'bar'^", [res description]); + + s = @"bar"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[bar]bar^", [res description]); +} + + +- (void)testNegateSymbol { + g = @"@start = ~Symbol;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"1"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]1^", [res description]); + + s = @"'bar'"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"['bar']'bar'^", [res description]); + + s = @"bar"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[bar]bar^", [res description]); + + s = @"$"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + +} + + +- (void)testNegateMore { + g = @"@start = ~Symbol & ~Number;"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"1"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + s = @"$"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); +} + + +- (void)testNegateMore2 { + g = @"@start = ~(Symbol|Number);"; + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + + s = @"1"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); + + s = @"$"; + res = [lp completeMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDNil(res); +} + + +- (void)testNcName { + g = @"@wordChars=':' '_'; @wordState='_';" + @"@start = name;" + @"ncName = name & /[^:]+/;" + @"name = Word;"; + // @"nameTest = '*' | ncName ':' '*' | qName;" + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + t.string = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + t.string = @"foo:bar"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo:bar]foo:bar^", [res description]); +} + + +- (void)testFunctionName { + g = + @"@wordState = '_';" + @"@wordChars = '_' '.' '-';" + @"@start = functionName;" + @"functionName = qName - nodeType;" + @"nodeType = 'comment' | 'text' | 'processing-instruction' | 'node';" + @"qName = prefixedName | unprefixedName;" + @"prefixedName = prefix ':' localPart;" + @"unprefixedName = localPart;" + @"localPart = ncName;" + @"prefix = ncName;" + @"ncName = Word;"; + + lp = [factory parserFromGrammar:g assembler:nil]; + TDNotNil(lp); + t = lp.tokenizer; + + t.string = @"foo"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + t.string = @"foo:bar"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo, :, bar]foo/:/bar^", [res description]); + + t.string = @":bar"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + t.string = @"text"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + t.string = @"comment"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + t.string = @"node"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + t.string = @"processing-instruction"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNil(res); + + t.string = @"texts"; + res = [lp bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[texts]texts^", [res description]); + +} + +@end diff --git a/test/TDParserTest.h b/test/TDParserTest.h new file mode 100644 index 0000000..224d8b1 --- /dev/null +++ b/test/TDParserTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDParserTest : SenTestCase { + PKAssembly *a; + NSString *s; + PKParser *p; +} + +@end diff --git a/test/TDParserTest.m b/test/TDParserTest.m new file mode 100644 index 0000000..8d3eaa2 --- /dev/null +++ b/test/TDParserTest.m @@ -0,0 +1,183 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDParserTest.h" + +@implementation TDParserTest + +- (void)setUp { +} + + +- (void)tearDown { +} + + +#pragma mark - + +- (void)testMath { + s = @"2 4 6 8"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKRepetition repetitionWithSubparser:[PKNumber number]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[2, 4, 6, 8]2/4/6/8^", [result description]); +} + + +- (void)testMiniMath { + s = @"4.5 - 5.6 - 222.0"; + a = [PKTokenAssembly assemblyWithString:s]; + + PKSequence *minusNum = [PKSequence sequence]; + [minusNum add:[[PKSymbol symbolWithString:@"-"] discard]]; + [minusNum add:[PKNumber number]]; + + PKSequence *e = [PKSequence sequence]; + [e add:[PKNumber number]]; + [e add:[PKRepetition repetitionWithSubparser:minusNum]]; + + PKAssembly *result = [e completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[4.5, 5.6, 222.0]4.5/-/5.6/-/222.0^", [result description]); +} + + +- (void)testMiniMathWithBrackets { + s = @"[4.5 - 5.6 - 222.0]"; + a = [PKTokenAssembly assemblyWithString:s]; + + PKSequence *minusNum = [PKSequence sequence]; + [minusNum add:[[PKSymbol symbolWithString:@"-"] discard]]; + [minusNum add:[PKNumber number]]; + + PKSequence *e = [PKSequence sequence]; + [e add:[[PKSymbol symbolWithString:@"["] discard]]; + [e add:[PKNumber number]]; + [e add:[PKRepetition repetitionWithSubparser:minusNum]]; + [e add:[[PKSymbol symbolWithString:@"]"] discard]]; + + PKAssembly *result = [e completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[4.5, 5.6, 222.0][/4.5/-/5.6/-/222.0/]^", [result description]); +} + + +- (void)testHotHotSteamingHotCoffee { + PKAlternation *adjective = [PKAlternation alternation]; + [adjective add:[PKLiteral literalWithString:@"hot"]]; + [adjective add:[PKLiteral literalWithString:@"steaming"]]; + + PKRepetition *adjectives = [PKRepetition repetitionWithSubparser:adjective]; + + PKSequence *sentence = [PKSequence sequence]; + [sentence add:adjectives]; + [sentence add:[PKLiteral literalWithString:@"coffee"]]; + + s = @"hot hot steaming hot coffee"; + a = [PKTokenAssembly assemblyWithString:s]; + + PKAssembly *result = [sentence bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[hot, hot, steaming, hot, coffee]hot/hot/steaming/hot/coffee^", [result description]); +} + + +- (void)testList { + PKAssembly *result = nil; + + PKSequence *commaTerm = [PKSequence sequence]; + [commaTerm add:[[PKSymbol symbolWithString:@","] discard]]; + [commaTerm add:[PKWord word]]; + + PKSequence *actualList = [PKSequence sequence]; + [actualList add:[PKWord word]]; + [actualList add:[PKRepetition repetitionWithSubparser:commaTerm]]; + + PKSequence *list = [PKSequence sequence]; + [list add:[[PKSymbol symbolWithString:@"["] discard]]; + [list add:actualList]; + [list add:[[PKSymbol symbolWithString:@"]"] discard]]; + + s = @"[foo, bar, baz]"; + a = [PKTokenAssembly assemblyWithString:s]; + + result = [list bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz][/foo/,/bar/,/baz/]^", [result description]); +} + + +- (void)testJavaScriptStatement { + s = @"123 'boo'"; + a = [PKTokenAssembly assemblyWithString:s]; + + PKAlternation *literals = [PKAlternation alternation]; + [literals add:[PKQuotedString quotedString]]; + [literals add:[PKNumber number]]; + + PKAssembly *result = [literals bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[123]123^'boo'", [result description]); +} + + +- (void)testParserNamed { + + // seq = (foo|bar|seq) foo* w sy; + PKCollectionParser *seq = [PKSequence sequence]; + seq.name = @"seq"; + + PKCollectionParser *alt = [PKAlternation alternation]; + alt.name = @"alt"; + + PKParser *foo = [PKLiteral literalWithString:@"foo"]; + foo.name = @"w"; + [alt add:foo]; + + PKParser *bar = [PKLiteral literalWithString:@"bar"]; + bar.name = @"w"; + [alt add:bar]; + + [alt add:seq]; + + PKRepetition *r = [PKRepetition repetitionWithSubparser:foo]; + + PKWord *w = [PKWord word]; + w.name = @"w"; + + PKSymbol *sy = [PKSymbol symbol]; + sy.name = @"sy"; + + + [seq add:alt]; + [seq add:r]; + [seq add:w]; + [seq add:sy]; + + TDEquals(seq, [seq parserNamed:@"seq"]); + TDEquals(seq, [alt parserNamed:@"seq"]); + + TDEquals(alt, [seq parserNamed:@"alt"]); + TDEquals(w, [seq parserNamed:@"w"]); + TDEquals(sy, [seq parserNamed:@"sy"]); + + TDEquals(foo, [alt parserNamed:@"w"]); + TDEquals(foo, [r parserNamed:@"w"]); +} + +@end diff --git a/test/TDPatternTest.h b/test/TDPatternTest.h new file mode 100644 index 0000000..eaf2f7b --- /dev/null +++ b/test/TDPatternTest.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDPatternTest : SenTestCase { + PKTokenizer *t; + PKPattern *p; + PKIntersection *inter; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/TDPatternTest.m b/test/TDPatternTest.m new file mode 100644 index 0000000..3a7d575 --- /dev/null +++ b/test/TDPatternTest.m @@ -0,0 +1,245 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDPatternTest.h" + +@implementation TDPatternTest + +- (void)testFoo { + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"foo"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"foo"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"foo"]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKWord word]]; + + a = [inter completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"foo"]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKSymbol symbol]]; + + a = [inter completeMatchFor:a]; + + TDNil(a); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"fo+"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"fo*"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"fo{1,2}"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"fo{3,4}"]; + a = [p completeMatchFor:a]; + + TDNil(a); +} + + +- (void)testSlashFooSlash { + s = @"/foo/"; + + t = [PKTokenizer tokenizerWithString:s]; + [t setTokenizerState:t.quoteState from:'/' to:'/']; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + p = [PKPattern patternWithString:@"/foo/" options:PKPatternOptionsNone]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKQuotedString quotedString]]; + + a = [inter completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[/foo/]/foo/^"); + + t = [PKTokenizer tokenizerWithString:s]; + [t setTokenizerState:t.quoteState from:'/' to:'/']; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + p = [PKPattern patternWithString:@"/[^/]+/" options:PKPatternOptionsNone]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKQuotedString quotedString]]; + + a = [inter completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[/foo/]/foo/^"); +} + + +- (void)testAndOrOr { + s = @"and"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"and|or"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[and]and^"); + + s = @"and"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"an|or"]; + a = [p completeMatchFor:a]; + + TDNil(a); + + s = @"or"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"(and)|(or)"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[or]or^"); +} + + +- (void)testNotAnd { + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"[^and]+"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + s = @"and"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"[^(and)]"]; + a = [p completeMatchFor:a]; + + TDNil(a); +} + + +- (void)testInvertFoo { + s = @"foo"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"fo+"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[foo]foo^"); + + p = [PKNegation negationWithSubparser:p]; + a = [p completeMatchFor:a]; + + TDNil(a); +} + + +- (void)testInvertAndOrNotTrueFalse { + s = @"true"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"and|or|not|true|false"]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[true]true^"); + + p = [PKNegation negationWithSubparser:p]; + a = [p completeMatchFor:a]; + + TDNil(a); + + s = @"TRUE"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"and|or|not|true|false" options:PKPatternOptionsIgnoreCase]; + a = [p completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[TRUE]TRUE^"); + + p = [PKNegation negationWithSubparser:p]; + a = [p completeMatchFor:a]; + + TDNil(a); + + s = @"NOT"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"and|or|not|true|false" options:PKPatternOptionsIgnoreCase]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKWord word]]; + + a = [inter completeMatchFor:a]; + + TDNotNil(a); + TDEqualObjects([a description], @"[NOT]NOT^"); + + p = [PKNegation negationWithSubparser:p]; + a = [p completeMatchFor:a]; + + TDNil(a); + + s = @"oR"; + a = [PKTokenAssembly assemblyWithString:s]; + p = [PKPattern patternWithString:@"and|or|not|true|false" options:PKPatternOptionsIgnoreCase]; + + inter = [PKIntersection intersection]; + [inter add:p]; + [inter add:[PKSymbol symbol]]; + + a = [inter completeMatchFor:a]; + + TDNil(a); +} + +@end diff --git a/test/TDPlistParser.h b/test/TDPlistParser.h new file mode 100644 index 0000000..6c5ed61 --- /dev/null +++ b/test/TDPlistParser.h @@ -0,0 +1,41 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface TDPlistParser : PKAlternation { + PKCollectionParser *dictParser; + PKCollectionParser *keyValuePairParser; + PKCollectionParser *arrayParser; + PKCollectionParser *commaValueParser; + PKCollectionParser *keyParser; + PKCollectionParser *valueParser; + PKCollectionParser *stringParser; + PKParser *numParser; + PKParser *nullParser; + PKToken *curly; + PKToken *paren; +} +- (id)parse:(NSString *)s; + +@property (nonatomic, retain) PKCollectionParser *dictParser; +@property (nonatomic, retain) PKCollectionParser *keyValuePairParser; +@property (nonatomic, retain) PKCollectionParser *arrayParser; +@property (nonatomic, retain) PKCollectionParser *commaValueParser; +@property (nonatomic, retain) PKCollectionParser *keyParser; +@property (nonatomic, retain) PKCollectionParser *valueParser; +@property (nonatomic, retain) PKCollectionParser *stringParser; +@property (nonatomic, retain) PKParser *numParser; +@property (nonatomic, retain) PKParser *nullParser; +@end diff --git a/test/TDPlistParser.m b/test/TDPlistParser.m new file mode 100644 index 0000000..3c3dcb9 --- /dev/null +++ b/test/TDPlistParser.m @@ -0,0 +1,322 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDPlistParser.h" +#import "NSString+ParseKitAdditions.h" + +//{ +// 0 = 0; +// dictKey = { +// bar = foo; +// }; +// 47 = 0; +// IntegerKey = 1; +// 47.7 = 0; +// = ; +// ArrayKey = ( +// "one one", +// two, +// three +// ); +// "Null Key" = ; +// emptyDictKey = { +// }; +// StringKey = String; +// "1.0" = 1; +// YESKey = 1; +// "NO Key" = 0; +//} + + +// dict = '{' dictContent '}' +// dictContent = keyValuePair* +// keyValuePair = key '=' value ';' +// key = num | string | null +// value = num | string | null | array | dict +// null = '' +// string = Word | QuotedString +// num = Number + +// array = '(' arrayContent ')' +// arrayContent = Empty | actualArray +// actualArray = value commaValue* +// commaValue = ',' value + +static NSString *kTDPlistNullString = @""; + +@interface PKParser (PKParserFactoryAdditionsFriend) +- (void)setTokenizer:(PKTokenizer *)t; +@end + +@interface PKCollectionParser () +@property (nonatomic, readwrite, retain) NSMutableArray *subparsers; +@end + +@interface TDPlistParser () +@property (nonatomic, retain) PKToken *curly; +@property (nonatomic, retain) PKToken *paren; +@end + +@implementation TDPlistParser + +- (id)init { + self = [super init]; + if (self != nil) { + + self.tokenizer = [PKTokenizer tokenizer]; + // add '' as a multichar symbol + [self.tokenizer.symbolState add:kTDPlistNullString]; + + self.curly = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"{" floatValue:0.]; + self.paren = [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"(" floatValue:0.]; + [self add:[PKEmpty empty]]; + [self add:self.arrayParser]; + [self add:self.dictParser]; + } + return self; +} + + +- (void)dealloc { + // avoid retain cycle leaks by releasing the subparsers of all collection parsers + dictParser.subparsers = nil; + keyValuePairParser.subparsers = nil; + arrayParser.subparsers = nil; + commaValueParser.subparsers = nil; + keyParser.subparsers = nil; + valueParser.subparsers = nil; + stringParser.subparsers = nil; + + self.tokenizer = nil; + self.dictParser = nil; + self.keyValuePairParser = nil; + self.arrayParser = nil; + self.commaValueParser = nil; + self.keyParser = nil; + self.valueParser = nil; + self.stringParser = nil; + self.numParser = nil; + self.nullParser = nil; + self.curly = nil; + self.paren = nil; + [super dealloc]; +} + + +- (id)parse:(NSString *)s { + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:self.tokenizer]; + + // parse + PKAssembly *res = [self completeMatchFor:a]; + + // pop the built result off the assembly's stack and return. + // this will be an array or a dictionary or nil + return [res pop]; +} + + +// dict = '{' dictContent '}' +// dictContent = keyValuePair* +- (PKCollectionParser *)dictParser { + if (!dictParser) { + self.dictParser = [PKTrack track]; + [dictParser add:[PKSymbol symbolWithString:@"{"]]; // dont discard. serves as fence + [dictParser add:[PKRepetition repetitionWithSubparser:self.keyValuePairParser]]; + [dictParser add:[[PKSymbol symbolWithString:@"}"] discard]]; + [dictParser setAssembler:self selector:@selector(didMatchDict:)]; + } + return dictParser; +} + + +// keyValuePair = key '=' value ';' +- (PKCollectionParser *)keyValuePairParser { + if (!keyValuePairParser) { + self.keyValuePairParser = [PKTrack track]; + [keyValuePairParser add:self.keyParser]; + [keyValuePairParser add:[[PKSymbol symbolWithString:@"="] discard]]; + [keyValuePairParser add:self.valueParser]; + [keyValuePairParser add:[[PKSymbol symbolWithString:@";"] discard]]; + } + return keyValuePairParser; +} + + +// array = '(' arrayContent ')' +// arrayContent = Empty | actualArray +// actualArray = value commaValue* +- (PKCollectionParser *)arrayParser { + if (!arrayParser) { + self.arrayParser = [PKTrack track]; + [arrayParser add:[PKSymbol symbolWithString:@"("]]; // dont discard. serves as fence + + PKAlternation *arrayContent = [PKAlternation alternation]; + [arrayContent add:[PKEmpty empty]]; + + PKSequence *actualArray = [PKSequence sequence]; + [actualArray add:self.valueParser]; + [actualArray add:[PKRepetition repetitionWithSubparser:self.commaValueParser]]; + + [arrayContent add:actualArray]; + [arrayParser add:arrayContent]; + [arrayParser add:[[PKSymbol symbolWithString:@")"] discard]]; + [arrayParser setAssembler:self selector:@selector(didMatchArray:)]; + } + return arrayParser; +} + + +// key = num | string | null +- (PKCollectionParser *)keyParser { + if (!keyParser) { + self.keyParser = [PKAlternation alternation]; + [keyParser add:self.numParser]; + [keyParser add:self.stringParser]; + [keyParser add:self.nullParser]; + } + return keyParser; +} + + +// value = num | string | null | array | dict +- (PKCollectionParser *)valueParser { + if (!valueParser) { + self.valueParser = [PKAlternation alternation]; + [valueParser add:self.arrayParser]; + [valueParser add:self.dictParser]; + [valueParser add:self.stringParser]; + [valueParser add:self.numParser]; + [valueParser add:self.nullParser]; + } + return valueParser; +} + + +- (PKCollectionParser *)commaValueParser { + if (!commaValueParser) { + self.commaValueParser = [PKSequence sequence]; + [commaValueParser add:[[PKSymbol symbolWithString:@","] discard]]; + [commaValueParser add:self.valueParser]; + } + return commaValueParser; +} + + +// string = QuotedString | Word +- (PKCollectionParser *)stringParser { + if (!stringParser) { + self.stringParser = [PKAlternation alternation]; + + // we have to remove the quotes from QuotedString string values. so set an assembler method to do that + PKParser *quotedString = [PKQuotedString quotedString]; + [quotedString setAssembler:self selector:@selector(didMatchQuotedString:)]; + [stringParser add:quotedString]; + + // handle non-quoted string values (Words) in a separate assembler method for simplicity. + PKParser *word = [PKWord word]; + [word setAssembler:self selector:@selector(didMatchWord:)]; + [stringParser add:word]; + } + return stringParser; +} + + +- (PKParser *)numParser { + if (!numParser) { + self.numParser = [PKNumber number]; + [numParser setAssembler:self selector:@selector(didMatchNum:)]; + } + return numParser; +} + + +// null = '' +- (PKParser *)nullParser { + if (!nullParser) { + // thus must be a PKSymbol (not a PKLiteral) to match the resulting '' symbol tok + self.nullParser = [PKSymbol symbolWithString:kTDPlistNullString]; + [nullParser setAssembler:self selector:@selector(didMatchNull:)]; + } + return nullParser; +} + + +- (void)didMatchDict:(PKAssembly *)a { + NSArray *objs = [a objectsAbove:self.curly]; + NSInteger count = [objs count]; + NSAssert1(0 == count % 2, @"in -%s, the assembly's stack's count should be a multiple of 2", _cmd); + + NSMutableDictionary *res = [NSMutableDictionary dictionaryWithCapacity:count / 2.]; + if (count) { + NSInteger i = 0; + for ( ; i < [objs count] - 1; i++) { + id value = [objs objectAtIndex:i++]; + id key = [objs objectAtIndex:i]; + [res setObject:value forKey:key]; + } + } + + [a pop]; // discard '{' tok + [a push:[[res copy] autorelease]]; +} + + +- (void)didMatchArray:(PKAssembly *)a { + NSArray *objs = [a objectsAbove:self.paren]; + NSMutableArray *res = [NSMutableArray arrayWithCapacity:[objs count]]; + + for (id obj in [objs reverseObjectEnumerator]) { + [res addObject:obj]; + } + + [a pop]; // discard '(' tok + [a push:[[res copy] autorelease]]; +} + + +- (void)didMatchQuotedString:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[tok.stringValue stringByTrimmingQuotes]]; +} + + +- (void)didMatchWord:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:tok.stringValue]; +} + + +- (void)didMatchNum:(PKAssembly *)a { + PKToken *tok = [a pop]; + [a push:[NSNumber numberWithFloat:tok.floatValue]]; +} + + +- (void)didMatchNull:(PKAssembly *)a { + [a pop]; // discard '' tok + [a push:[NSNull null]]; +} + +@synthesize dictParser; +@synthesize keyValuePairParser; +@synthesize arrayParser; +@synthesize commaValueParser; +@synthesize keyParser; +@synthesize valueParser; +@synthesize stringParser; +@synthesize numParser; +@synthesize nullParser; +@synthesize curly; +@synthesize paren; +@end diff --git a/test/TDPlistParserTest.h b/test/TDPlistParserTest.h new file mode 100644 index 0000000..81af3cd --- /dev/null +++ b/test/TDPlistParserTest.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "TDPlistParser.h" + +@interface TDPlistParserTest : SenTestCase { + TDPlistParser *p; + NSString *s; + PKTokenAssembly *a; + PKAssembly *res; +} + +@end diff --git a/test/TDPlistParserTest.m b/test/TDPlistParserTest.m new file mode 100644 index 0000000..385c5fd --- /dev/null +++ b/test/TDPlistParserTest.m @@ -0,0 +1,471 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDPlistParserTest.h" + +@implementation TDPlistParserTest + +- (void)setUp { + p = [[TDPlistParser alloc] init]; +} + + +- (void)tearDown { + [p release]; +} + + +- (void)testARealDict { + s = @" {" + @" ArrayKey = (" + @" one," + @" two," + @" three" + @" );" + @" FloatKey = 1;" + @" IntegerKey = 1;" + @" NOKey = 0;" + @" StringKey = String;" + @" YESKey = 1;" + @" }"; + + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + TDNotNil(res); + + id obj = [res pop]; + TDNotNil(obj); + TDTrue([obj isKindOfClass:[NSDictionary class]]); + TDEquals((NSUInteger)6, [obj count]); + + id arr = [obj objectForKey:@"ArrayKey"]; + TDNotNil(arr); + TDEquals((NSUInteger)3, [arr count]); + + id b = [obj objectForKey:@"YESKey"]; + TDNotNil(b); + TDEqualObjects([NSNumber numberWithInteger:1], b); +} + + +- (void)testARealDict2 { + //NSDictionary *d = [NSDictionary dictionaryWithObjectsAndKeys: + // [NSNumber numberWithBool:NO], @"NO Key", + // [NSNumber numberWithBool:YES], @"YESKey", + // [NSNumber numberWithInteger:1], @"IntegerKey", + // [NSNumber numberWithFloat:1.0], @"1.0", + // [NSNumber numberWithInteger:0], @"0", + // [NSNumber numberWithInteger:0], [NSNumber numberWithInteger:47], + // [NSNumber numberWithInteger:0], [NSNumber numberWithFloat:47.7], + // @"String", @"StringKey", + // [NSNull null], @"Null Key", + // [NSNull null], [NSNull null], + // [NSDictionary dictionaryWithObject:@"foo" forKey:@"bar"], @"dictKey", + // [NSDictionary dictionary], @"emptyDictKey", + // [NSArray arrayWithObjects:@"one one", @"two", @"three", nil], @"ArrayKey", + // nil]; + //NSLog(@"%@", d); + + s = @"{" + @" 0 = 0;" + @" dictKey = {" + @" bar = foo;" + @" };" + @" 47 = 0;" + @" IntegerKey = 1;" + @" 47.7 = 0;" + @" = ;" + @" ArrayKey = (" + @" \"one one\"," + @" two," + @" three" + @" );" + @" \"Null Key\" = ;" + @" emptyDictKey = {" + @" };" + @" StringKey = String;" + @" \"1.0\" = 1;" + @" YESKey = 1;" + @" \"NO Key\" = 0;" + @"}"; + + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + TDNotNil(res); + + id obj = [res pop]; + TDNotNil(obj); + TDTrue([obj isKindOfClass:[NSDictionary class]]); + TDEquals((NSUInteger)13, [obj count]); + + id arr = [obj objectForKey:@"ArrayKey"]; + TDNotNil(arr); + TDEquals((NSUInteger)3, [arr count]); + + id b = [obj objectForKey:@"YESKey"]; + TDNotNil(b); + TDEqualObjects([NSNumber numberWithInteger:1], b); +} + + +- (void)testDictFooEqBar { + s = @"{foo = bar;}"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchDictionaryAssembly: has already executed. + id obj = [res pop]; // NSDictionary * + TDTrue([obj isKindOfClass:[NSDictionary class]]); + TDEquals((NSUInteger)1, [obj count]); + + TDEqualObjects(@"bar", [obj objectForKey:@"foo"]); +} + + +#ifndef TARGET_CPU_X86_64 +- (void)testDictTrackFooEqBarMisingCurly { + s = @"{foo = bar;"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + STAssertThrowsSpecific([p.dictParser completeMatchFor:a], PKTrackException, @""); +} +#endif + + +- (void)testDictQuoteFooFooQuoteEqBarOneEq2 { + s = @"{\"foo foo\" = bar; 1 = 2.2;}"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.dictParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchDictionaryAssembly: has already executed. + id obj = [res pop]; // NSDictionary * + TDTrue([obj isKindOfClass:[NSDictionary class]]); + TDEquals((NSUInteger)2, [obj count]); + + TDEqualObjects(@"bar", [obj objectForKey:@"foo foo"]); + TDEqualObjects([NSNumber numberWithFloat:2.2], [obj objectForKey:[NSNumber numberWithInteger:1]]); +} + + +- (void)testKeyValuePairFooEqBar { + s = @"foo = bar;"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.keyValuePairParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchKeyValuePairAssembly: has already executed. + id value = [res pop]; // NSString * + id key = [res pop]; // NSString * + + TDTrue([key isKindOfClass:[NSString class]]); + TDEqualObjects(@"foo", key); + + TDTrue([value isKindOfClass:[NSString class]]); + TDEqualObjects(@"bar", value); +} + + +#ifndef TARGET_CPU_X86_64 +- (void)testKeyValuePairTrackFooEqBarNoSemi { + s = @"foo = bar"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + STAssertThrowsSpecific([p.keyValuePairParser completeMatchFor:a], PKTrackException, @""); +} +#endif + + +- (void)testCommaValueComma1 { + s = @", 1"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.commaValueParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumberAssembly: has already executed. + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEquals((NSInteger)1, [obj integerValue]); +} + + +- (void)testCommaValueCommaFoo { + s = @", Foo"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.commaValueParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchWordAssembly: has already executed. + id obj = [res pop]; // NSString * + TDTrue([obj isKindOfClass:[NSString class]]); + TDEqualObjects(@"Foo", obj); +} + + +- (void)testCommaValueCommaQuoteFooSpaceBarQuote { + s = @", \"Foo Bar\""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.commaValueParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchQuotedStringAssembly: has already executed. + id obj = [res pop]; // NSString * + TDTrue([obj isKindOfClass:[NSString class]]); + TDEqualObjects(@"Foo Bar", obj); +} + + +- (void)testArrayEmptyArray { + s = @"()"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.arrayParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchArrayAssembly: has already executed. + id obj = [res pop]; // NSArray * + TDTrue([obj isKindOfClass:[NSArray class]]); + TDEquals((NSUInteger)0, [obj count]); +} + + +- (void)testArrayNumArray { + s = @"(1, 2, 3)"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.arrayParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchArrayAssembly: has already executed. + id obj = [res pop]; // NSArray * + TDTrue([obj isKindOfClass:[NSArray class]]); + TDEquals((NSUInteger)3, [obj count]); + TDEqualObjects([NSNumber numberWithInt:1], [obj objectAtIndex:0]); + TDEqualObjects([NSNumber numberWithInt:2], [obj objectAtIndex:1]); + TDEqualObjects([NSNumber numberWithInt:3], [obj objectAtIndex:2]); +} + + +#ifndef TARGET_CPU_X86_64 +- (void)testArrayTrackNumArrayMissingParen { + s = @"(1, 2, 3"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + STAssertThrowsSpecific([p.arrayParser completeMatchFor:a], PKTrackException, @""); +} + + +- (void)testArrayTrackNumArrayMissingComma { + s = @"(1, 2 3)"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + STAssertThrowsSpecific([p.arrayParser completeMatchFor:a], PKTrackException, @""); +} +#endif + + +- (void)testNullLtNullGt { + s = @""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.nullParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNullAssembly: has already executed. + id obj = [res pop]; // NSNull * + TDTrue([obj isKindOfClass:[NSNull class]]); + TDEqualObjects([NSNull null], obj); +} + + +- (void)testNullQuoteLtNullGtQuote { + s = @"\"\""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.nullParser completeMatchFor:a]; + TDNil(res); +} + + +- (void)testStringQuote1Dot0Quote { + s = @"\"1.0\""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.stringParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchStringAssembly: has already executed. + id obj = [res pop]; // NSString * + TDTrue([obj isKindOfClass:[NSString class]]); + TDEqualObjects(@"1.0", obj); +} + + +- (void)testStringFoo { + s = @"foo"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.stringParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchStringAssembly: has already executed. + id obj = [res pop]; // NSString * + TDTrue([obj isKindOfClass:[NSString class]]); + TDEqualObjects(@"foo", obj); +} + + +- (void)testStringQuoteFooQuote { + s = @"\"foo\""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.stringParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchStringAssembly: has already executed. + id obj = [res pop]; // NSString * + TDTrue([obj isKindOfClass:[NSString class]]); + TDEqualObjects(@"foo", obj); +} + + +- (void)testNum1Dot0 { + s = @"1.0"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. 'floatness' has been lost + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"1", [obj stringValue]); + TDEquals((NSInteger)1, [obj integerValue]); + TDEquals((CGFloat)1.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNumMinus1Dot0 { + s = @"-1.0"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. 'floatness' has been lost + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"-1", [obj stringValue]); + TDEquals((NSInteger)-1, [obj integerValue]); + TDEquals((CGFloat)-1.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNumMinus1 { + s = @"-1"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"-1", [obj stringValue]); + TDEquals((NSInteger)-1, [obj integerValue]); + TDEquals((CGFloat)-1.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNum0 { + s = @"0"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"0", [obj stringValue]); + TDEquals((NSInteger)0, [obj integerValue]); + TDEquals((CGFloat)0.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNum0Dot0 { + s = @"0.0"; + a = [PKTokenAssembly assemblyWithString:s]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. 'floatness' has been lost + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"0", [obj stringValue]); + TDEquals((NSInteger)0, [obj integerValue]); + TDEquals((CGFloat)0.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNumMinus0Dot0 { + s = @"-0.0"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. 'floatness' has been lost + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"-0", [obj stringValue]); + TDEquals((NSInteger)-0, [obj integerValue]); + TDEquals((CGFloat)-0.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNum300 { + s = @"300"; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNotNil(res); + + // -didMatchNumAssembly: has already executed. + NSNumber *obj = [res pop]; + TDTrue([obj isKindOfClass:[NSNumber class]]); + TDEqualObjects(@"300", [obj stringValue]); + TDEquals((NSInteger)300, [obj integerValue]); + TDEquals((CGFloat)300.0, (CGFloat)[obj floatValue]); +} + + +- (void)testNumEmptyString { + s = @""; + p.tokenizer.string = s; + a = [PKTokenAssembly assemblyWithTokenizer:p.tokenizer]; + res = [p.numParser completeMatchFor:a]; + TDNil(res); +} + +@end diff --git a/test/TDPredicateEvaluator.h b/test/TDPredicateEvaluator.h new file mode 100644 index 0000000..6c55107 --- /dev/null +++ b/test/TDPredicateEvaluator.h @@ -0,0 +1,89 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@protocol TDPredicateEvaluatorDelegate +- (id)valueForAttributeKey:(NSString *)key; +- (CGFloat)floatForAttributeKey:(NSString *)key; +- (BOOL)boolForAttributeKey:(NSString *)key; +@end + +@interface TDPredicateEvaluator : NSObject { + id delegate; + PKCollectionParser *exprParser; + PKCollectionParser *orTermParser; + PKCollectionParser *termParser; + PKCollectionParser *andPrimaryExprParser; + PKCollectionParser *primaryExprParser; + PKCollectionParser *phraseParser; + PKCollectionParser *negatedPredicateParser; + PKCollectionParser *predicateParser; + PKCollectionParser *attrParser; + PKCollectionParser *tagParser; + PKCollectionParser *eqStringPredicateParser; + PKCollectionParser *eqNumberPredicateParser; + PKCollectionParser *eqBoolPredicateParser; + PKCollectionParser *neStringPredicateParser; + PKCollectionParser *neNumberPredicateParser; + PKCollectionParser *neBoolPredicateParser; + PKCollectionParser *gtPredicateParser; + PKCollectionParser *gteqPredicateParser; + PKCollectionParser *ltPredicateParser; + PKCollectionParser *lteqPredicateParser; + PKCollectionParser *beginswithPredicateParser; + PKCollectionParser *containsPredicateParser; + PKCollectionParser *endswithPredicateParser; + PKCollectionParser *matchesPredicateParser; + PKCollectionParser *valueParser; + PKCollectionParser *boolParser; + PKParser *trueParser; + PKParser *falseParser; + PKParser *stringParser; + PKParser *numberParser; +} +- (id)initWithDelegate:(id )d; +- (BOOL)evaluate:(NSString *)s; + +@property (nonatomic, retain) PKCollectionParser *exprParser; +@property (nonatomic, retain) PKCollectionParser *orTermParser; +@property (nonatomic, retain) PKCollectionParser *termParser; +@property (nonatomic, retain) PKCollectionParser *andPrimaryExprParser; +@property (nonatomic, retain) PKCollectionParser *primaryExprParser; +@property (nonatomic, retain) PKCollectionParser *phraseParser; +@property (nonatomic, retain) PKCollectionParser *negatedPredicateParser; +@property (nonatomic, retain) PKCollectionParser *predicateParser; +@property (nonatomic, retain) PKCollectionParser *attrParser; +@property (nonatomic, retain) PKCollectionParser *tagParser; +@property (nonatomic, retain) PKCollectionParser *eqStringPredicateParser; +@property (nonatomic, retain) PKCollectionParser *eqNumberPredicateParser; +@property (nonatomic, retain) PKCollectionParser *eqBoolPredicateParser; +@property (nonatomic, retain) PKCollectionParser *neStringPredicateParser; +@property (nonatomic, retain) PKCollectionParser *neNumberPredicateParser; +@property (nonatomic, retain) PKCollectionParser *neBoolPredicateParser; +@property (nonatomic, retain) PKCollectionParser *gtPredicateParser; +@property (nonatomic, retain) PKCollectionParser *gteqPredicateParser; +@property (nonatomic, retain) PKCollectionParser *ltPredicateParser; +@property (nonatomic, retain) PKCollectionParser *lteqPredicateParser; +@property (nonatomic, retain) PKCollectionParser *beginswithPredicateParser; +@property (nonatomic, retain) PKCollectionParser *containsPredicateParser; +@property (nonatomic, retain) PKCollectionParser *endswithPredicateParser; +@property (nonatomic, retain) PKCollectionParser *matchesPredicateParser; +@property (nonatomic, retain) PKCollectionParser *valueParser; +@property (nonatomic, retain) PKCollectionParser *boolParser; +@property (nonatomic, retain) PKParser *trueParser; +@property (nonatomic, retain) PKParser *falseParser; +@property (nonatomic, retain) PKParser *stringParser; +@property (nonatomic, retain) PKParser *numberParser; +@end diff --git a/test/TDPredicateEvaluator.m b/test/TDPredicateEvaluator.m new file mode 100644 index 0000000..eeca0f3 --- /dev/null +++ b/test/TDPredicateEvaluator.m @@ -0,0 +1,662 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDPredicateEvaluator.h" +#import "NSString+ParseKitAdditions.h" + +// expr = term orTerm* +// orTerm = 'or' term +// term = primaryExpr andPrimaryExpr* +// andPrimaryExpr = 'and' primaryExpr +// primaryExpr = phrase | '(' expression ')' +// phrase = predicate | negatedPredicate +// negatedPredicate = 'not' predicate +// predicate = bool | eqPredicate | nePredicate | gtPredicate | gteqPredicate | ltPredicate | lteqPredicate | beginswithPredicate | containsPredicate | endswithPredicate | matchesPredicate +// eqPredicate = attr '=' value +// nePredicate = attr '!=' value +// gtPredicate = attr '>' value +// gteqPredicate = attr '>=' value +// ltPredicate = attr '<' value +// lteqPredicate = attr '<=' value +// beginswithPredicate = attr 'beginswith' value +// containsPredicate = attr 'contains' value +// endswithPredicate = attr 'endswith' value +// matchesPredicate = attr 'matches' value + +// attr = tag | Word +// tag = '@' Word +// value = QuotedString | Number | bool +// bool = 'true' | 'false' + +@implementation TDPredicateEvaluator + +- (id)initWithDelegate:(id )d { + if (self = [super init]) { + delegate = d; + } + return self; +} + + +- (void)dealloc { + delegate = nil; + self.exprParser = nil; + self.orTermParser = nil; + self.termParser = nil; + self.andPrimaryExprParser = nil; + self.primaryExprParser = nil; + self.negatedPredicateParser = nil; + self.predicateParser = nil; + self.phraseParser = nil; + self.attrParser = nil; + self.tagParser = nil; + self.eqStringPredicateParser = nil; + self.eqNumberPredicateParser = nil; + self.eqBoolPredicateParser = nil; + self.neStringPredicateParser = nil; + self.neNumberPredicateParser = nil; + self.neBoolPredicateParser = nil; + self.gtPredicateParser = nil; + self.gteqPredicateParser = nil; + self.ltPredicateParser = nil; + self.lteqPredicateParser = nil; + self.beginswithPredicateParser = nil; + self.containsPredicateParser = nil; + self.endswithPredicateParser = nil; + self.matchesPredicateParser = nil; + self.valueParser = nil; + self.boolParser = nil; + self.trueParser = nil; + self.falseParser = nil; + self.stringParser = nil; + self.numberParser = nil; + [super dealloc]; +} + + +- (BOOL)evaluate:(NSString *)s { + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + return [[[self.exprParser completeMatchFor:a] pop] boolValue]; +} + + +// expression = term orTerm* +- (PKCollectionParser *)exprParser { + if (!exprParser) { + self.exprParser = [PKSequence sequence]; + [exprParser add:self.termParser]; + [exprParser add:[PKRepetition repetitionWithSubparser:self.orTermParser]]; + } + return exprParser; +} + + +// orTerm = 'or' term +- (PKCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [PKSequence sequence]; + [orTermParser add:[[PKCaseInsensitiveLiteral literalWithString:@"or"] discard]]; + [orTermParser add:self.termParser]; + [orTermParser setAssembler:self selector:@selector(didMatchOr:)]; + } + return orTermParser; +} + + +// term = primaryExpr andPrimaryExpr* +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + [termParser add:self.primaryExprParser]; + [termParser add:[PKRepetition repetitionWithSubparser:self.andPrimaryExprParser]]; + } + return termParser; +} + + +// andPrimaryExpr = 'and' primaryExpr +- (PKCollectionParser *)andPrimaryExprParser { + if (!andPrimaryExprParser) { + self.andPrimaryExprParser = [PKSequence sequence]; + [andPrimaryExprParser add:[[PKCaseInsensitiveLiteral literalWithString:@"and"] discard]]; + [andPrimaryExprParser add:self.primaryExprParser]; + [andPrimaryExprParser setAssembler:self selector:@selector(didMatchAnd:)]; + } + return andPrimaryExprParser; +} + + +// primaryExpr = phrase | '(' expression ')' +- (PKCollectionParser *)primaryExprParser { + if (!primaryExprParser) { + self.primaryExprParser = [PKAlternation alternation]; + [primaryExprParser add:self.phraseParser]; + + PKSequence *s = [PKSequence sequence]; + [s add:[[PKSymbol symbolWithString:@"("] discard]]; + [s add:self.exprParser]; + [s add:[[PKSymbol symbolWithString:@")"] discard]]; + + [primaryExprParser add:s]; + } + return primaryExprParser; +} + + +// phrase = predicate | negatedPredicate +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + self.phraseParser = [PKAlternation alternation]; + [phraseParser add:self.predicateParser]; + [phraseParser add:self.negatedPredicateParser]; + } + return phraseParser; +} + + +// negatedPredicate = 'not' predicate +- (PKCollectionParser *)negatedPredicateParser { + if (!negatedPredicateParser) { + self.negatedPredicateParser = [PKSequence sequence]; + [negatedPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"not"] discard]]; + [negatedPredicateParser add:self.predicateParser]; + [negatedPredicateParser setAssembler:self selector:@selector(didMatchNegatedValue:)]; + } + return negatedPredicateParser; +} + + +// predicate = bool | eqPredicate | nePredicate | gtPredicate | gteqPredicate | ltPredicate | lteqPredicate | beginswithPredicate | containsPredicate | endswithPredicate | matchesPredicate +- (PKCollectionParser *)predicateParser { + if (!predicateParser) { + self.predicateParser = [PKAlternation alternation]; + [predicateParser add:self.boolParser]; + [predicateParser add:self.eqStringPredicateParser]; + [predicateParser add:self.eqNumberPredicateParser]; + [predicateParser add:self.eqBoolPredicateParser]; + [predicateParser add:self.neStringPredicateParser]; + [predicateParser add:self.neNumberPredicateParser]; + [predicateParser add:self.neBoolPredicateParser]; + [predicateParser add:self.gtPredicateParser]; + [predicateParser add:self.gteqPredicateParser]; + [predicateParser add:self.ltPredicateParser]; + [predicateParser add:self.lteqPredicateParser]; + [predicateParser add:self.beginswithPredicateParser]; + [predicateParser add:self.containsPredicateParser]; + [predicateParser add:self.endswithPredicateParser]; + [predicateParser add:self.matchesPredicateParser]; + } + return predicateParser; +} + + +// attr = tag | Word +- (PKCollectionParser *)attrParser { + if (!attrParser) { + self.attrParser = [PKAlternation alternation]; + [attrParser add:self.tagParser]; + [attrParser add:[PKWord word]]; + [attrParser setAssembler:self selector:@selector(didMatchAttr:)]; + } + return attrParser; +} + + +// tag = '@' Word +- (PKCollectionParser *)tagParser { + if (!tagParser) { + self.tagParser = [PKSequence sequence]; + [tagParser add:[[PKSymbol symbolWithString:@"@"] discard]]; + [tagParser add:[PKWord word]]; + } + return tagParser; +} + + +// eqPredicate = attr '=' value +- (PKCollectionParser *)eqStringPredicateParser { + if (!eqStringPredicateParser) { + self.eqStringPredicateParser = [PKSequence sequence]; + [eqStringPredicateParser add:self.attrParser]; + [eqStringPredicateParser add:[[PKSymbol symbolWithString:@"="] discard]]; + [eqStringPredicateParser add:self.stringParser]; + [eqStringPredicateParser setAssembler:self selector:@selector(didMatchEqStringPredicate:)]; + } + return eqStringPredicateParser; +} + + +- (PKCollectionParser *)eqNumberPredicateParser { + if (!eqNumberPredicateParser) { + self.eqNumberPredicateParser = [PKSequence sequence]; + [eqNumberPredicateParser add:self.attrParser]; + [eqNumberPredicateParser add:[[PKSymbol symbolWithString:@"="] discard]]; + [eqNumberPredicateParser add:self.numberParser]; + [eqNumberPredicateParser setAssembler:self selector:@selector(didMatchEqNumberPredicate:)]; + } + return eqNumberPredicateParser; +} + + +- (PKCollectionParser *)eqBoolPredicateParser { + if (!eqBoolPredicateParser) { + self.eqBoolPredicateParser = [PKSequence sequence]; + [eqBoolPredicateParser add:self.attrParser]; + [eqBoolPredicateParser add:[[PKSymbol symbolWithString:@"="] discard]]; + [eqBoolPredicateParser add:self.boolParser]; + [eqBoolPredicateParser setAssembler:self selector:@selector(didMatchEqBoolPredicate:)]; + } + return eqBoolPredicateParser; +} + + +// nePredicate = attr '!=' value +- (PKCollectionParser *)neStringPredicateParser { + if (!neStringPredicateParser) { + self.neStringPredicateParser = [PKSequence sequence]; + [neStringPredicateParser add:self.attrParser]; + [neStringPredicateParser add:[[PKSymbol symbolWithString:@"!="] discard]]; + [neStringPredicateParser add:self.stringParser]; + [neStringPredicateParser setAssembler:self selector:@selector(didMatchNeStringPredicate:)]; + } + return neStringPredicateParser; +} + + +- (PKCollectionParser *)neNumberPredicateParser { + if (!neNumberPredicateParser) { + self.neNumberPredicateParser = [PKSequence sequence]; + [neNumberPredicateParser add:self.attrParser]; + [neNumberPredicateParser add:[[PKSymbol symbolWithString:@"!="] discard]]; + [neNumberPredicateParser add:self.numberParser]; + [neNumberPredicateParser setAssembler:self selector:@selector(didMatchNeNumberPredicate:)]; + } + return neNumberPredicateParser; +} + + +- (PKCollectionParser *)neBoolPredicateParser { + if (!neBoolPredicateParser) { + self.neBoolPredicateParser = [PKSequence sequence]; + [neBoolPredicateParser add:self.attrParser]; + [neBoolPredicateParser add:[[PKSymbol symbolWithString:@"!="] discard]]; + [neBoolPredicateParser add:self.boolParser]; + [neBoolPredicateParser setAssembler:self selector:@selector(didMatchNeBoolPredicate:)]; + } + return neBoolPredicateParser; +} + + +// gtPredicate = attr '>' value +- (PKCollectionParser *)gtPredicateParser { + if (!gtPredicateParser) { + self.gtPredicateParser = [PKSequence sequence]; + [gtPredicateParser add:self.attrParser]; + [gtPredicateParser add:[[PKSymbol symbolWithString:@">"] discard]]; + [gtPredicateParser add:self.valueParser]; + [gtPredicateParser setAssembler:self selector:@selector(didMatchGtPredicate:)]; + } + return gtPredicateParser; +} + + +// gteqPredicate = attr '>=' value +- (PKCollectionParser *)gteqPredicateParser { + if (!gteqPredicateParser) { + self.gteqPredicateParser = [PKSequence sequence]; + [gteqPredicateParser add:self.attrParser]; + [gteqPredicateParser add:[[PKSymbol symbolWithString:@">="] discard]]; + [gteqPredicateParser add:self.valueParser]; + [gteqPredicateParser setAssembler:self selector:@selector(didMatchGteqPredicate:)]; + } + return gteqPredicateParser; +} + + +// ltPredicate = attr '<' value +- (PKCollectionParser *)ltPredicateParser { + if (!ltPredicateParser) { + self.ltPredicateParser = [PKSequence sequence]; + [ltPredicateParser add:self.attrParser]; + [ltPredicateParser add:[[PKSymbol symbolWithString:@"<"] discard]]; + [ltPredicateParser add:self.valueParser]; + [ltPredicateParser setAssembler:self selector:@selector(didMatchLtPredicate:)]; + } + return ltPredicateParser; +} + + +// lteqPredicate = attr '<=' value +- (PKCollectionParser *)lteqPredicateParser { + if (!lteqPredicateParser) { + self.lteqPredicateParser = [PKSequence sequence]; + [lteqPredicateParser add:self.attrParser]; + [lteqPredicateParser add:[[PKSymbol symbolWithString:@"<="] discard]]; + [lteqPredicateParser add:self.valueParser]; + [lteqPredicateParser setAssembler:self selector:@selector(didMatchLteqPredicate:)]; + } + return lteqPredicateParser; +} + + +// beginswithPredicate = attr 'beginswith' value +- (PKCollectionParser *)beginswithPredicateParser { + if (!beginswithPredicateParser) { + self.beginswithPredicateParser = [PKSequence sequence]; + [beginswithPredicateParser add:self.attrParser]; + [beginswithPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"beginswith"] discard]]; + [beginswithPredicateParser add:self.valueParser]; + [beginswithPredicateParser setAssembler:self selector:@selector(didMatchBeginswithPredicate:)]; + } + return beginswithPredicateParser; +} + + +// containsPredicate = attr 'contains' value +- (PKCollectionParser *)containsPredicateParser { + if (!containsPredicateParser) { + self.containsPredicateParser = [PKSequence sequence]; + [containsPredicateParser add:self.attrParser]; + [containsPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"contains"] discard]]; + [containsPredicateParser add:self.valueParser]; + [containsPredicateParser setAssembler:self selector:@selector(didMatchContainsPredicate:)]; + } + return containsPredicateParser; +} + + +// endswithPredicate = attr 'endswith' value +- (PKCollectionParser *)endswithPredicateParser { + if (!endswithPredicateParser) { + self.endswithPredicateParser = [PKSequence sequence]; + [endswithPredicateParser add:self.attrParser]; + [endswithPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"endswith"] discard]]; + [endswithPredicateParser add:self.valueParser]; + [endswithPredicateParser setAssembler:self selector:@selector(didMatchEndswithPredicate:)]; + } + return endswithPredicateParser; +} + + +// matchesPredicate = attr 'matches' value +- (PKCollectionParser *)matchesPredicateParser { + if (!matchesPredicateParser) { + self.matchesPredicateParser = [PKSequence sequence]; + [matchesPredicateParser add:self.attrParser]; + [matchesPredicateParser add:[[PKCaseInsensitiveLiteral literalWithString:@"matches"] discard]]; + [matchesPredicateParser add:self.valueParser]; + [matchesPredicateParser setAssembler:self selector:@selector(didMatchMatchesPredicate:)]; + } + return matchesPredicateParser; +} + + +// value = QuotedString | Number | bool +- (PKCollectionParser *)valueParser { + if (!valueParser) { + self.valueParser = [PKAlternation alternation]; + [valueParser add:self.stringParser]; + [valueParser add:self.numberParser]; + [valueParser add:self.boolParser]; + } + return valueParser; +} + + +- (PKCollectionParser *)boolParser { + if (!boolParser) { + self.boolParser = [PKAlternation alternation]; + [boolParser add:self.trueParser]; + [boolParser add:self.falseParser]; + [boolParser setAssembler:self selector:@selector(didMatchBool:)]; + } + return boolParser; +} + + +- (PKParser *)trueParser { + if (!trueParser) { + self.trueParser = [[PKCaseInsensitiveLiteral literalWithString:@"true"] discard]; + [trueParser setAssembler:self selector:@selector(didMatchTrue:)]; + } + return trueParser; +} + + +- (PKParser *)falseParser { + if (!falseParser) { + self.falseParser = [[PKCaseInsensitiveLiteral literalWithString:@"false"] discard]; + [falseParser setAssembler:self selector:@selector(didMatchFalse:)]; + } + return falseParser; +} + + +- (PKParser *)stringParser { + if (!stringParser) { + self.stringParser = [PKQuotedString quotedString]; + [stringParser setAssembler:self selector:@selector(didMatchString:)]; + } + return stringParser; +} + + +- (PKParser *)numberParser { + if (!numberParser) { + self.numberParser = [PKNumber number]; + [numberParser setAssembler:self selector:@selector(didMatchNumber:)]; + } + return numberParser; +} + + +- (void)didMatchAnd:(PKAssembly *)a { + NSNumber *b2 = [a pop]; + NSNumber *b1 = [a pop]; + BOOL yn = ([b1 boolValue] && [b2 boolValue]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchOr:(PKAssembly *)a { + NSNumber *b2 = [a pop]; + NSNumber *b1 = [a pop]; + BOOL yn = ([b1 boolValue] || [b2 boolValue]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchEqStringPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = [[delegate valueForAttributeKey:attrKey] isEqual:value]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchEqNumberPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = [value isEqualToNumber:[delegate valueForAttributeKey:attrKey]]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchEqBoolPredicate:(PKAssembly *)a { + NSNumber *b = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = ([delegate boolForAttributeKey:attrKey] == [b boolValue]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchNeStringPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + + BOOL yn = ![[delegate valueForAttributeKey:attrKey] isEqual:value]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchNeNumberPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = ![value isEqualToNumber:[delegate valueForAttributeKey:attrKey]]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchNeBoolPredicate:(PKAssembly *)a { + NSNumber *b = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = ([delegate boolForAttributeKey:attrKey] != [b boolValue]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchGtPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = (NSOrderedDescending == [[delegate valueForAttributeKey:attrKey] compare:value]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchGteqPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = (NSOrderedAscending != [[delegate valueForAttributeKey:attrKey] compare:value]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchLtPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = (NSOrderedAscending == [[delegate valueForAttributeKey:attrKey] compare:value]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchLteqPredicate:(PKAssembly *)a { + NSNumber *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = (NSOrderedDescending != [[delegate valueForAttributeKey:attrKey] compare:value]); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchBeginswithPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = [[delegate valueForAttributeKey:attrKey] hasPrefix:value]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchContainsPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + NSRange r = [[delegate valueForAttributeKey:attrKey] rangeOfString:value]; + BOOL yn = (NSNotFound != r.location); + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchEndswithPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = [[delegate valueForAttributeKey:attrKey] hasSuffix:value]; + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchMatchesPredicate:(PKAssembly *)a { + NSString *value = [a pop]; + NSString *attrKey = [a pop]; + BOOL yn = [[delegate valueForAttributeKey:attrKey] isEqual:value]; // TODO should this be a regex match? + [a push:[NSNumber numberWithBool:yn]]; +} + + +- (void)didMatchAttr:(PKAssembly *)a { + [a push:[[a pop] stringValue]]; +} + + +- (void)didMatchNegatedValue:(PKAssembly *)a { + NSNumber *b = [a pop]; + [a push:[NSNumber numberWithBool:![b boolValue]]]; +} + + +- (void)didMatchBool:(PKAssembly *)a { + NSNumber *b = [a pop]; + [a push:[NSNumber numberWithBool:[b boolValue]]]; +} + + +- (void)didMatchTrue:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:YES]]; +} + + +- (void)didMatchFalse:(PKAssembly *)a { + [a push:[NSNumber numberWithBool:NO]]; +} + + +- (void)didMatchString:(PKAssembly *)a { + NSString *s = [[[a pop] stringValue] stringByTrimmingQuotes]; + [a push:s]; +} + + +- (void)didMatchNumber:(PKAssembly *)a { + NSNumber *b = [NSNumber numberWithFloat:[(PKToken *)[a pop] floatValue]]; + [a push:b]; +} + +@synthesize exprParser; +@synthesize orTermParser; +@synthesize termParser; +@synthesize andPrimaryExprParser; +@synthesize primaryExprParser; +@synthesize phraseParser; +@synthesize negatedPredicateParser; +@synthesize predicateParser; +@synthesize attrParser; +@synthesize tagParser; +@synthesize eqStringPredicateParser; +@synthesize eqNumberPredicateParser; +@synthesize eqBoolPredicateParser; +@synthesize neStringPredicateParser; +@synthesize neNumberPredicateParser; +@synthesize neBoolPredicateParser; +@synthesize gtPredicateParser; +@synthesize gteqPredicateParser; +@synthesize ltPredicateParser; +@synthesize lteqPredicateParser; +@synthesize beginswithPredicateParser; +@synthesize containsPredicateParser; +@synthesize endswithPredicateParser; +@synthesize matchesPredicateParser; +@synthesize valueParser; +@synthesize boolParser; +@synthesize trueParser; +@synthesize falseParser; +@synthesize stringParser; +@synthesize numberParser; +@end diff --git a/test/TDPredicateEvaluatorTest.h b/test/TDPredicateEvaluatorTest.h new file mode 100644 index 0000000..48dd14d --- /dev/null +++ b/test/TDPredicateEvaluatorTest.h @@ -0,0 +1,26 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "TDPredicateEvaluator.h" + +@interface TDPredicateEvaluatorTest : SenTestCase { + TDPredicateEvaluator *p; + NSString *s; + PKAssembly *a; + + NSMutableDictionary *d; +} + +@end diff --git a/test/TDPredicateEvaluatorTest.m b/test/TDPredicateEvaluatorTest.m new file mode 100644 index 0000000..5d122f7 --- /dev/null +++ b/test/TDPredicateEvaluatorTest.m @@ -0,0 +1,309 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDPredicateEvaluatorTest.h" + +@implementation TDPredicateEvaluatorTest + +- (id)valueForAttributeKey:(NSString *)key { + return [d objectForKey:key]; +} + + +- (CGFloat)floatForAttributeKey:(NSString *)key { + return [(NSNumber *)[d objectForKey:key] floatValue]; +} + + +- (BOOL)boolForAttributeKey:(NSString *)key { + return [[d objectForKey:key] boolValue]; +} + + +- (void)setUp { + d = [NSMutableDictionary dictionary]; + p = [[[TDPredicateEvaluator alloc] initWithDelegate:self] autorelease]; +} + + +- (void)testEq { + // test numbers + [d setValue:[NSNumber numberWithFloat:1.0] forKey:@"foo"]; + s = @"foo = 1.0"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/=/1.0^", [a description]); + + s = @"foo = -1.0"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/=/-1.0^", [a description]); + + + // test bools + [d setValue:[NSNumber numberWithBool:YES] forKey:@"foo"]; + s = @"foo = true"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/=/true^", [a description]); + + s = @"foo = false"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/=/false^", [a description]); + + [d setValue:[NSNumber numberWithBool:NO] forKey:@"foo"]; + s = @"foo = true"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/=/true^", [a description]); + + s = @"foo = false"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/=/false^", [a description]); + + + // test strings + [d setValue:@"bar" forKey:@"foo"]; + s = @"foo = 'bar'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/=/'bar'^", [a description]); + + s = @"foo = 'baz'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/=/'baz'^", [a description]); +} + + +- (void)testNe { + // test numbers + [d setValue:[NSNumber numberWithFloat:1.0] forKey:@"foo"]; + s = @"foo != 1.0"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/!=/1.0^", [a description]); + + s = @"foo != -1.0"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/!=/-1.0^", [a description]); + + + // test bools + [d setValue:[NSNumber numberWithBool:YES] forKey:@"foo"]; + s = @"foo != true"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/!=/true^", [a description]); + + s = @"foo != false"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/!=/false^", [a description]); + + [d setValue:[NSNumber numberWithBool:NO] forKey:@"foo"]; + s = @"foo != true"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/!=/true^", [a description]); + + s = @"foo != false"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/!=/false^", [a description]); + + + // test strings + [d setValue:@"bar" forKey:@"foo"]; + s = @"foo != 'bar'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/!=/'bar'^", [a description]); + + s = @"foo != 'baz'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/!=/'baz'^", [a description]); +} + + +- (void)testGt { + [d setValue:[NSNumber numberWithInteger:41] forKey:@"foo"]; + s = @"foo > 42"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/>/42^", [a description]); + + [d setValue:[NSNumber numberWithInteger:43] forKey:@"foo"]; + s = @"foo > 42"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/>/42^", [a description]); + + [d setValue:[NSNumber numberWithFloat:1.2] forKey:@"foo"]; + s = @"foo > 1.2"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/>/1.2^", [a description]); + + [d setValue:[NSNumber numberWithFloat:1.2001] forKey:@"foo"]; + s = @"foo > 1.2"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/>/1.2^", [a description]); +} + + +- (void)testLt { + [d setValue:[NSNumber numberWithInteger:41] forKey:@"foo"]; + s = @"foo < .3"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/= 42"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/>=/42^", [a description]); + + [d setValue:[NSNumber numberWithFloat:41.99] forKey:@"foo"]; + s = @"foo >= 42"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/>=/42^", [a description]); + + [d setValue:[NSNumber numberWithInteger:42] forKey:@"foo"]; + s = @"foo >= 42"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/>=/42^", [a description]); +} + + +- (void)testLteq { + [d setValue:[NSNumber numberWithInteger:41] forKey:@"foo"]; + s = @"foo <= .3"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/<=/.3^", [a description]); + + [d setValue:[NSNumber numberWithFloat:.3] forKey:@"foo"]; + s = @"foo <= .3"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/<=/.3^", [a description]); + + [d setValue:[NSNumber numberWithFloat:.3111] forKey:@"foo"]; + s = @"foo <= .3"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/<=/.3^", [a description]); +} + + +- (void)testBeginswith { + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo beginswith 'foo'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/beginswith/'foo'^", [a description]); + + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo beginswith 'bar'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/beginswith/'bar'^", [a description]); +} + + +- (void)testContains { + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo contains 'baz'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/contains/'baz'^", [a description]); + + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo contains 'bat'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/contains/'bat'^", [a description]); +} + + +- (void)testEndswith { + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo endswith 'baz'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[1]foo/endswith/'baz'^", [a description]); + + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo endswith 'bat'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/endswith/'bat'^", [a description]); +} + + +- (void)testMatches { + [d setValue:@"foobarbaz" forKey:@"foo"]; + s = @"foo matches 'baz'"; + a = [p.exprParser bestMatchFor:[PKTokenAssembly assemblyWithString:s]]; + TDEqualObjects(@"[0]foo/matches/'baz'^", [a description]); +} + + +- (void)testBools { + s = @"true"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[1]true^", [a description]); + + s = @"not true"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0]not/true^", [a description]); + + s = @"false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0]false^", [a description]); + + s = @"not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[1]not/false^", [a description]); + + s = @"true and false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0]true/and/false^", [a description]); + + s = @"not true and false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0]not/true/and/false^", [a description]); + + s = @"not true and not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0]not/true/and/not/false^", [a description]); + + s = @"true or false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[1]true/or/false^", [a description]); + + s = @"(true and false) or false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[0](/true/and/false/)/or/false^", [a description]); + + s = @"(true and false) or not false"; + a = [PKTokenAssembly assemblyWithString:s]; + a = [p.exprParser bestMatchFor:a]; + TDEqualObjects(@"[1](/true/and/false/)/or/not/false^", [a description]); +} + +@end diff --git a/test/TDQuoteStateTest.h b/test/TDQuoteStateTest.h new file mode 100644 index 0000000..0e62403 --- /dev/null +++ b/test/TDQuoteStateTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + + +@interface TDQuoteStateTest : SenTestCase { + PKQuoteState *quoteState; + PKReader *r; + NSString *s; +} +@end diff --git a/test/TDQuoteStateTest.m b/test/TDQuoteStateTest.m new file mode 100644 index 0000000..88b21cd --- /dev/null +++ b/test/TDQuoteStateTest.m @@ -0,0 +1,110 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDQuoteStateTest.h" + + +@implementation TDQuoteStateTest + +- (void)setUp { + quoteState = [[PKQuoteState alloc] init]; + r = [[PKReader alloc] init]; +} + + +- (void)tearDown { + [quoteState release]; + [r release]; +} + + +- (void)testQuotedString { + s = @"'stuff'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + +} + + +- (void)testQuotedStringEOFTerminated { + s = @"'stuff"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); +} + + +- (void)testQuotedStringRepairEOFTerminated { + s = @"'stuff"; + r.string = s; + quoteState.balancesEOFTerminatedQuotes = YES; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"'stuff'", tok.stringValue); +} + + +- (void)testQuotedStringPlus { + s = @"'a quote here' more"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"'a quote here'", tok.stringValue); +} + + +- (void)test14CharQuotedString { + s = @"'123456789abcef'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDTrue(tok.isQuotedString); +} + + +- (void)test15CharQuotedString { + s = @"'123456789abcefg'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDTrue(tok.isQuotedString); +} + + +- (void)test16CharQuotedString { + s = @"'123456789abcefgh'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDTrue(tok.isQuotedString); +} + + +- (void)test31CharQuotedString { + s = @"'123456789abcefgh123456789abcefg'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDTrue(tok.isQuotedString); +} + + +- (void)test32CharQuotedString { + s = @"'123456789abcefgh123456789abcefgh'"; + r.string = s; + PKToken *tok = [quoteState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDTrue(tok.isQuotedString); +} + +@end diff --git a/test/TDReaderTest.h b/test/TDReaderTest.h new file mode 100644 index 0000000..50ff128 --- /dev/null +++ b/test/TDReaderTest.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDReaderTest : SenTestCase { + PKReader *reader; + NSString *string; +} + +@end diff --git a/test/TDReaderTest.m b/test/TDReaderTest.m new file mode 100644 index 0000000..5effaf6 --- /dev/null +++ b/test/TDReaderTest.m @@ -0,0 +1,84 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDReaderTest.h" + + +@implementation TDReaderTest + +- (void)setUp { + string = @"abcdefghijklmnopqrstuvwxyz"; + [string retain]; + reader = [[PKReader alloc] initWithString:string]; +} + + +- (void)tearDown { + [string release]; + [reader release]; +} + + +#pragma mark - + +- (void)testReadCharsMatch { + TDNotNil(reader); + NSInteger len = [string length]; + PKUniChar c; + NSInteger i = 0; + for ( ; i < len; i++) { + c = [string characterAtIndex:i]; + TDEquals(c, [reader read]); + } +} + + +- (void)testReadTooFar { + NSInteger len = [string length]; + NSInteger i = 0; + for ( ; i < len; i++) { + [reader read]; + } + TDEquals(PKEOF, [reader read]); +} + + +- (void)testUnread { + [reader read]; + [reader unread]; + PKUniChar a = 'a'; + TDEquals(a, [reader read]); + + [reader read]; + [reader read]; + [reader unread]; + PKUniChar c = 'c'; + TDEquals(c, [reader read]); +} + + +- (void)testUnreadTooFar { + [reader unread]; + PKUniChar a = 'a'; + TDEquals(a, [reader read]); + + [reader unread]; + [reader unread]; + [reader unread]; + [reader unread]; + PKUniChar a2 = 'a'; + TDEquals(a2, [reader read]); +} + +@end diff --git a/test/TDRegularParser.h b/test/TDRegularParser.h new file mode 100644 index 0000000..7a5e21b --- /dev/null +++ b/test/TDRegularParser.h @@ -0,0 +1,41 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface TDRegularParser : PKSequence { + PKCollectionParser *expressionParser; + PKCollectionParser *termParser; + PKCollectionParser *orTermParser; + PKCollectionParser *factorParser; + PKCollectionParser *nextFactorParser; + PKCollectionParser *phraseParser; + PKCollectionParser *phraseStarParser; + PKCollectionParser *phrasePlusParser; + PKCollectionParser *phraseQuestionParser; + PKCollectionParser *letterOrDigitParser; +} ++ (id)parserFromGrammar:(NSString *)s; + +@property (retain) PKCollectionParser *expressionParser; +@property (retain) PKCollectionParser *termParser; +@property (retain) PKCollectionParser *orTermParser; +@property (retain) PKCollectionParser *factorParser; +@property (retain) PKCollectionParser *nextFactorParser; +@property (retain) PKCollectionParser *phraseParser; +@property (retain) PKCollectionParser *phraseStarParser; +@property (retain) PKCollectionParser *phrasePlusParser; +@property (retain) PKCollectionParser *phraseQuestionParser; +@property (retain) PKCollectionParser *letterOrDigitParser; +@end diff --git a/test/TDRegularParser.m b/test/TDRegularParser.m new file mode 100644 index 0000000..5650d11 --- /dev/null +++ b/test/TDRegularParser.m @@ -0,0 +1,321 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDRegularParser.h" + +@interface TDRegularParser () +- (void)didMatchChar:(PKAssembly *)a; +- (void)didMatchStar:(PKAssembly *)a; +- (void)didMatchPlus:(PKAssembly *)a; +- (void)didMatchQuestion:(PKAssembly *)a; +//- (void)didMatchAnd:(PKAssembly *)a; +- (void)didMatchOr:(PKAssembly *)a; +- (void)didMatchExpression:(PKAssembly *)a; +@end + +@implementation TDRegularParser + +- (id)init { + if (self = [super init]) { + [self add:self.expressionParser]; + } + return self; +} + + +- (void)dealloc { + self.expressionParser = nil; + self.termParser = nil; + self.orTermParser = nil; + self.factorParser = nil; + self.nextFactorParser = nil; + self.phraseParser = nil; + self.phraseStarParser = nil; + self.phrasePlusParser = nil; + self.phraseQuestionParser = nil; + self.letterOrDigitParser = nil; + [super dealloc]; +} + + ++ (id)parserFromGrammar:(NSString *)s { + TDRegularParser *p = [TDRegularParser parser]; + PKAssembly *a = [PKCharacterAssembly assemblyWithString:s]; + a = [p completeMatchFor:a]; + return [a pop]; +} + + +// expression = term orTerm* +// term = factor nextFactor* +// orTerm = '|' term +// factor = phrase | phraseStar | phrasePlus | phraseQuestion +// nextFactor = factor +// phrase = letterOrDigit | '(' expression ')' +// phraseStar = phrase '*' +// phraseStar = phrase '+' +// phraseStar = phrase '?' +// letterOrDigit = Letter | Digit + + +// expression = term orTerm* +- (PKCollectionParser *)expressionParser { + if (!expressionParser) { + self.expressionParser = [PKSequence sequence]; + expressionParser.name = @"expression"; + [expressionParser add:self.termParser]; + [expressionParser add:[PKRepetition repetitionWithSubparser:self.orTermParser]]; + [expressionParser setAssembler:self selector:@selector(didMatchExpression:)]; + } + return expressionParser; +} + + +// term = factor nextFactor* +- (PKCollectionParser *)termParser { + if (!termParser) { + self.termParser = [PKSequence sequence]; + termParser.name = @"term"; + [termParser add:self.factorParser]; + [termParser add:[PKRepetition repetitionWithSubparser:self.nextFactorParser]]; + } + return termParser; +} + + +// orTerm = '|' term +- (PKCollectionParser *)orTermParser { + if (!orTermParser) { + self.orTermParser = [PKSequence sequence]; + orTermParser.name = @"orTerm"; + [orTermParser add:[[PKSpecificChar specificCharWithChar:'|'] discard]]; + [orTermParser add:self.termParser]; + [orTermParser setAssembler:self selector:@selector(didMatchOr:)]; + } + return orTermParser; +} + + +// factor = phrase | phraseStar | phrasePlus | phraseQuestion +- (PKCollectionParser *)factorParser { + if (!factorParser) { + self.factorParser = [PKAlternation alternation]; + factorParser.name = @"factor"; + [factorParser add:self.phraseParser]; + [factorParser add:self.phraseStarParser]; + [factorParser add:self.phrasePlusParser]; + [factorParser add:self.phraseQuestionParser]; + } + return factorParser; +} + + +// nextFactor = factor +- (PKCollectionParser *)nextFactorParser { + if (!nextFactorParser) { + self.nextFactorParser = [PKAlternation alternation]; + nextFactorParser.name = @"nextFactor"; + [nextFactorParser add:self.phraseParser]; + [nextFactorParser add:self.phraseStarParser]; + [nextFactorParser add:self.phrasePlusParser]; + [nextFactorParser add:self.phraseQuestionParser]; +// [nextFactorParser setAssembler:self selector:@selector(didMatchAnd:)]; + } + return nextFactorParser; +} + + +// phrase = letterOrDigit | '(' expression ')' +- (PKCollectionParser *)phraseParser { + if (!phraseParser) { + PKSequence *s = [PKSequence sequence]; + [s add:[[PKSpecificChar specificCharWithChar:'('] discard]]; + [s add:self.expressionParser]; + [s add:[[PKSpecificChar specificCharWithChar:')'] discard]]; + + self.phraseParser = [PKAlternation alternation]; + phraseParser.name = @"phrase"; + [phraseParser add:self.letterOrDigitParser]; + [phraseParser add:s]; + } + return phraseParser; +} + + +// phraseStar = phrase '*' +- (PKCollectionParser *)phraseStarParser { + if (!phraseStarParser) { + self.phraseStarParser = [PKSequence sequence]; + phraseStarParser.name = @"phraseStar"; + [phraseStarParser add:self.phraseParser]; + [phraseStarParser add:[[PKSpecificChar specificCharWithChar:'*'] discard]]; + [phraseStarParser setAssembler:self selector:@selector(didMatchStar:)]; + } + return phraseStarParser; +} + + +// phrasePlus = phrase '+' +- (PKCollectionParser *)phrasePlusParser { + if (!phrasePlusParser) { + self.phrasePlusParser = [PKSequence sequence]; + phrasePlusParser.name = @"phrasePlus"; + [phrasePlusParser add:self.phraseParser]; + [phrasePlusParser add:[[PKSpecificChar specificCharWithChar:'+'] discard]]; + [phrasePlusParser setAssembler:self selector:@selector(didMatchPlus:)]; + } + return phrasePlusParser; +} + + +// phrasePlus = phrase '?' +- (PKCollectionParser *)phraseQuestionParser { + if (!phraseQuestionParser) { + self.phraseQuestionParser = [PKSequence sequence]; + phraseQuestionParser.name = @"phraseQuestion"; + [phraseQuestionParser add:self.phraseParser]; + [phraseQuestionParser add:[[PKSpecificChar specificCharWithChar:'?'] discard]]; + [phraseQuestionParser setAssembler:self selector:@selector(didMatchQuestion:)]; + } + return phraseQuestionParser; +} + + +// letterOrDigit = Letter | Digit +- (PKCollectionParser *)letterOrDigitParser { + if (!letterOrDigitParser) { + self.letterOrDigitParser = [PKAlternation alternation]; + letterOrDigitParser.name = @"letterOrDigit"; + [letterOrDigitParser add:[PKLetter letter]]; + [letterOrDigitParser add:[PKDigit digit]]; + [letterOrDigitParser setAssembler:self selector:@selector(didMatchChar:)]; + } + return letterOrDigitParser; +} + + +- (void)didMatchChar:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + id obj = [a pop]; + NSAssert([obj isKindOfClass:[NSNumber class]], @""); + NSInteger c = [obj integerValue]; + [a push:[PKSpecificChar specificCharWithChar:c]]; +} + + +- (void)didMatchStar:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + NSAssert([top isKindOfClass:[PKParser class]], @""); + PKRepetition *rep = [PKRepetition repetitionWithSubparser:top]; + [a push:rep]; +} + + +- (void)didMatchPlus:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + NSAssert([top isKindOfClass:[PKParser class]], @""); + PKSequence *seq = [PKSequence sequence]; + [seq add:top]; + [seq add:[PKRepetition repetitionWithSubparser:top]]; + [a push:seq]; +} + + +- (void)didMatchQuestion:(PKAssembly *)a { + // NSLog(@"%s", _cmd); + // NSLog(@"a: %@", a); + id top = [a pop]; + NSAssert([top isKindOfClass:[PKParser class]], @""); + PKAlternation *alt = [PKAlternation alternation]; + [alt add:[PKEmpty empty]]; + [alt add:top]; + [a push:alt]; +} + + +//- (void)didMatchAnd:(PKAssembly *)a { +//// NSLog(@"%s", _cmd); +//// NSLog(@"a: %@", a); +// id second = [a pop]; +// id first = [a pop]; +// NSAssert([first isKindOfClass:[PKParser class]], @""); +// NSAssert([second isKindOfClass:[PKParser class]], @""); +// PKSequence *p = [PKSequence sequence]; +// [p add:first]; +// [p add:second]; +// [a push:p]; +//} + + +- (void)didMatchExpression:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + + NSAssert(![a isStackEmpty], @""); + + id obj = nil; + NSMutableArray *objs = [NSMutableArray array]; + while (![a isStackEmpty]) { + obj = [a pop]; + [objs addObject:obj]; + NSAssert([obj isKindOfClass:[PKParser class]], @""); + } + + if ([objs count] > 1) { + PKSequence *seq = [PKSequence sequence]; + for (id obj in [objs reverseObjectEnumerator]) { + [seq add:obj]; + } + [a push:seq]; + } else { + NSAssert((NSUInteger)1 == [objs count], @""); + PKParser *p = [objs objectAtIndex:0]; + [a push:p]; + } +} + + +- (void)didMatchOr:(PKAssembly *)a { +// NSLog(@"%s", _cmd); +// NSLog(@"a: %@", a); + id second = [a pop]; + id first = [a pop]; +// NSLog(@"first: %@", first); +// NSLog(@"second: %@", second); + NSAssert(first, @""); + NSAssert(second, @""); + NSAssert([first isKindOfClass:[PKParser class]], @""); + NSAssert([second isKindOfClass:[PKParser class]], @""); + PKAlternation *p = [PKAlternation alternation]; + [p add:first]; + [p add:second]; + [a push:p]; +} + +@synthesize expressionParser; +@synthesize termParser; +@synthesize orTermParser; +@synthesize factorParser; +@synthesize nextFactorParser; +@synthesize phraseParser; +@synthesize phraseStarParser; +@synthesize phrasePlusParser; +@synthesize phraseQuestionParser; +@synthesize letterOrDigitParser; +@end diff --git a/test/TDRegularParserTest.h b/test/TDRegularParserTest.h new file mode 100644 index 0000000..646d3e2 --- /dev/null +++ b/test/TDRegularParserTest.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "TDRegularParser.h" + +@interface TDRegularParserTest : SenTestCase { + NSString *s; + PKCharacterAssembly *a; + TDRegularParser *p; + PKAssembly *res; +} + +@end diff --git a/test/TDRegularParserTest.m b/test/TDRegularParserTest.m new file mode 100644 index 0000000..b0d5c0b --- /dev/null +++ b/test/TDRegularParserTest.m @@ -0,0 +1,407 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDRegularParserTest.h" + +@implementation TDRegularParserTest + +- (void)setUp { + p = [TDRegularParser parser]; +} + + +- (void)testAabPlus { + s = @"aab+"; + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"aabbbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a, a, b, b, b, b]aabbbb^", [res description]); +} + + +- (void)testAabStar { + s = @"aab*"; + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"aabbbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a, a, b, b, b, b]aabbbb^", [res description]); +} + + +- (void)testAabQuestion { + s = @"aab?"; + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"aabbbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a, a, b]aab^bbb", [res description]); +} + + +- (void)testAb { + s = @"ab"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]ab^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + TDEquals((NSUInteger)2, [seq.subparsers count]); + + PKSpecificChar *c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + c = [seq.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"ab"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a, b]ab^", [res description]); +} + + +- (void)testAbc { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence]abc^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + TDEquals((NSUInteger)3, [seq.subparsers count]); + + PKSpecificChar *c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + c = [seq.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + c = [seq.subparsers objectAtIndex:2]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"c", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a, b, c]abc^", [res description]); +} + + +- (void)testAOrB { + s = @"a|b"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]a|b^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"b"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b]b^", [res description]); +} + + +- (void)test4Or7 { + s = @"4|7"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]4|7^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"4", c.string); + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"7", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"4"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[4]4^", [res description]); +} + + +- (void)testAOrBStar { + s = @"a|b*"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]a|b*^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + PKRepetition *rep = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKRepetition class], [rep class]); + c = (PKSpecificChar *)rep.subparser; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"bbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b, b, b]bbb^", [res description]); +} + + +- (void)testAOrBPlus { + s = @"a|b+"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]a|b+^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + PKSequence *seq = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKSequence class], [seq class]); + + c = [seq.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + PKRepetition *rep = [seq.subparsers objectAtIndex:1]; + TDEqualObjects([PKRepetition class], [rep class]); + c = (PKSpecificChar *)rep.subparser; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"bbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b, b, b]bbb^", [res description]); + + s = @"abbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a]a^bbb", [res description]); +} + + +- (void)testAOrBQuestion { + s = @"a|b?"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation]a|b?^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + alt = [alt.subparsers objectAtIndex:1]; + TDEqualObjects([PKAlternation class], [alt class]); + + PKEmpty *e = [alt.subparsers objectAtIndex:0]; + TDTrue([e isMemberOfClass:[PKEmpty class]]); + + c = (PKSpecificChar *)[alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"bbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b]b^bb", [res description]); + + s = @"abbb"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[a]a^bbb", [res description]); +} + + +- (void)testParenAOrBParenStar { + s = @"(a|b)*"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Repetition](a|b)*^", [res description]); + PKRepetition *rep = [res pop]; + TDTrue([rep isMemberOfClass:[PKRepetition class]]); + + PKAlternation *alt = (PKAlternation *)rep.subparser; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKRepetition class]]); + s = @"bbbaaa"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b, b, b, a, a, a]bbbaaa^", [res description]); +} + + +- (void)testParenAOrBParenPlus { + s = @"(a|b)+"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Sequence](a|b)+^", [res description]); + PKSequence *seq = [res pop]; + TDTrue([seq isMemberOfClass:[PKSequence class]]); + + TDEquals((NSUInteger)2, [seq.subparsers count]); + + PKAlternation *alt = [seq.subparsers objectAtIndex:0]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + PKRepetition *rep = [seq.subparsers objectAtIndex:1]; + TDTrue([rep isMemberOfClass:[PKRepetition class]]); + + alt = (PKAlternation *)rep.subparser; + TDEqualObjects([PKAlternation class], [alt class]); + + c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKSequence class]]); + s = @"bbbaaa"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b, b, b, a, a, a]bbbaaa^", [res description]); +} + + +- (void)testParenAOrBParenQuestion { + s = @"(a|b)?"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[Alternation](a|b)?^", [res description]); + PKAlternation *alt = [res pop]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + + TDEquals((NSUInteger)2, [alt.subparsers count]); + PKEmpty *e = [alt.subparsers objectAtIndex:0]; + TDTrue([PKEmpty class] == [e class]); + + alt = [alt.subparsers objectAtIndex:1]; + TDTrue([alt isMemberOfClass:[PKAlternation class]]); + TDEquals((NSUInteger)2, [alt.subparsers count]); + + PKSpecificChar *c = [alt.subparsers objectAtIndex:0]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"a", c.string); + + c = [alt.subparsers objectAtIndex:1]; + TDTrue([c isMemberOfClass:[PKSpecificChar class]]); + TDEqualObjects(@"b", c.string); + + // use the result parser + p = [TDRegularParser parserFromGrammar:s]; + TDNotNil(p); + TDTrue([p isKindOfClass:[PKAlternation class]]); + s = @"bbbaaa"; + a = [PKCharacterAssembly assemblyWithString:s]; + res = (PKCharacterAssembly *)[p bestMatchFor:a]; + TDEqualObjects(@"[b]b^bbaaa", [res description]); +} + +@end diff --git a/test/TDRepetitionTest.h b/test/TDRepetitionTest.h new file mode 100644 index 0000000..26ff80b --- /dev/null +++ b/test/TDRepetitionTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDRepetitionTest : SenTestCase { + PKParser *p; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/TDRepetitionTest.m b/test/TDRepetitionTest.m new file mode 100644 index 0000000..f496f95 --- /dev/null +++ b/test/TDRepetitionTest.m @@ -0,0 +1,228 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDRepetitionTest.h" + +@interface PKParser () +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@implementation TDRepetitionTest + +- (void)setUp { +} + + +- (void)tearDown { + [a release]; + [p release]; +} + + +#pragma mark - + +- (void)testWordRepetitionAllMatchesForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + NSSet *all = [p allMatchesFor:[NSSet setWithObject:a]]; + NSLog(@"all: %@", all); + + TDNotNil(all); + NSUInteger c = [all count]; + TDEquals((NSUInteger)4, c); +} + + +- (void)testWordRepetitionBestMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + + PKAssembly *result = [p bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [result description]); +} + + +- (void)testWordRepetitionBestMatchForFooSpaceBarSpace123 { + s = @"foo bar 123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, bar]foo/bar^123", [result description]); +} + + +- (void)testWordRepetitionAllMatchesForFooSpaceBarSpace123 { + s = @"foo bar 123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + NSSet *all = [p allMatchesFor:[NSSet setWithObject:a]]; + NSLog(@"all: %@", all); + + TDNotNil(all); + NSUInteger c = [all count]; + TDEquals((NSUInteger)3, c); +} + + +- (void)testWordRepetitionAllMatchesFooSpace123SpaceBaz { + s = @"foo 123 baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + NSSet *all = [p allMatchesFor:[NSSet setWithObject:a]]; + NSLog(@"all: %@", all); + + TDNotNil(all); + NSUInteger c = [all count]; + TDEquals((NSUInteger)2, c); +} + + +- (void)testNumRepetitionAllMatchesForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKNumber number]]; + + NSSet *all = [p allMatchesFor:[NSSet setWithObject:a]]; + NSLog(@"all: %@", all); + + TDNotNil(all); + NSUInteger c = [all count]; + TDEquals((NSUInteger)1, c); +} + + +- (void)testWordRepetitionCompleteMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [result description]); +} + + +- (void)testWordRepetitionCompleteMatchForFooSpaceBarSpace123 { + s = @"foo bar 123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testWordRepetitionCompleteMatchFor456SpaceBarSpace123 { + s = @"456 bar 123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testNumRepetitionCompleteMatchFor456SpaceBarSpace123 { + s = @"456 bar 123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKNumber number]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testNumRepetitionAllMatchesFor123Space456SpaceBaz { + s = @"123 456 baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKNumber number]]; + + NSSet *all = [p allMatchesFor:[NSSet setWithObject:a]]; + + TDNotNil(all); + NSInteger c = [all count]; + TDEquals((NSUInteger)3, (NSUInteger)c); +} + + +- (void)testNumRepetitionBestMatchFor123Space456SpaceBaz { + s = @"123 456 baz"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKNumber number]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123, 456]123/456^baz", [result description]); +} + + +- (void)testNumRepetitionCompleteMatchFor123 { + s = @"123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKNumber number]]; + + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[123]123^", [result description]); +} + + +- (void)testWordRepetitionCompleteMatchFor123 { + s = @"123"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + + +- (void)testWordRepetitionBestMatchForFoo { + s = @"foo"; + a = [[PKTokenAssembly alloc] initWithString:s]; + + p = [[PKRepetition alloc] initWithSubparser:[PKWord word]]; + + PKAssembly *result = [p bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo]foo^", [result description]); +} + +@end diff --git a/test/TDReservedWord.h b/test/TDReservedWord.h new file mode 100644 index 0000000..fb52ba5 --- /dev/null +++ b/test/TDReservedWord.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface TDReservedWord : PKWord { + +} + ++ (void)setReservedWords:(NSArray *)inWords; +@end diff --git a/test/TDReservedWord.m b/test/TDReservedWord.m new file mode 100644 index 0000000..bfe9dc0 --- /dev/null +++ b/test/TDReservedWord.m @@ -0,0 +1,49 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +static NSArray *sTDReservedWords = nil; + +@interface TDReservedWord () ++ (NSArray *)reservedWords; +@end + +@implementation TDReservedWord + ++ (NSArray *)reservedWords { + return [[sTDReservedWords retain] autorelease]; +} + + ++ (void)setReservedWords:(NSArray *)inWords { + if (inWords != sTDReservedWords) { + [sTDReservedWords autorelease]; + sTDReservedWords = [inWords copy]; + } +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + if (!tok.isWord) { + return NO; + } + + NSString *s = tok.stringValue; + return [s length] && [[TDReservedWord reservedWords] containsObject:s]; +} + +@end diff --git a/test/TDReservedWordTest.h b/test/TDReservedWordTest.h new file mode 100644 index 0000000..61015d6 --- /dev/null +++ b/test/TDReservedWordTest.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDReservedWordTest : SenTestCase { + +} + +@end diff --git a/test/TDReservedWordTest.m b/test/TDReservedWordTest.m new file mode 100644 index 0000000..9ea1906 --- /dev/null +++ b/test/TDReservedWordTest.m @@ -0,0 +1,47 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDReservedWordTest.h" +#import "ParseKit.h" + +@implementation TDReservedWordTest + +- (void)testFoobar { + NSString *s = @"Foobar"; + [TDReservedWord setReservedWords:[NSArray arrayWithObject:@"Foobar"]]; + + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [TDReservedWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[Foobar]Foobar^", [result description]); +// TDNil(result); +} + + +- (void)testfoobar { + NSString *s = @"foobar"; + [TDReservedWord setReservedWords:[NSArray arrayWithObject:@"Foobar"]]; + + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [TDReservedWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + +@end diff --git a/test/TDRobotCommandTest.h b/test/TDRobotCommandTest.h new file mode 100644 index 0000000..bbfeb97 --- /dev/null +++ b/test/TDRobotCommandTest.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDRobotCommandTest : SenTestCase { + +} + +@end diff --git a/test/TDRobotCommandTest.m b/test/TDRobotCommandTest.m new file mode 100644 index 0000000..f485987 --- /dev/null +++ b/test/TDRobotCommandTest.m @@ -0,0 +1,183 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDRobotCommandTest.h" + +@interface RobotCommand : NSObject { + NSString *location; +} +@property (copy) NSString *location; +@end + +@implementation RobotCommand + +- (void)dealloc { + self.location = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + RobotCommand *c = [[RobotCommand allocWithZone:zone] init]; + c->location = [location copy]; + return c; +} + +@synthesize location; +@end + +@interface RobotPickCommand : RobotCommand {} +@end +@implementation RobotPickCommand +- (NSString *)description { return [NSString stringWithFormat:@"pick %@", self.location]; } +@end + +@interface RobotPlaceCommand : RobotCommand {} +@end +@implementation RobotPlaceCommand +- (NSString *)description { return [NSString stringWithFormat:@"place %@", self.location]; } +@end + +@interface RobotScanCommand : RobotCommand {} +@end +@implementation RobotScanCommand +- (NSString *)description { return [NSString stringWithFormat:@"scan %@", self.location]; } +@end + +@implementation TDRobotCommandTest + +// e = command* +// command = pickCommand | placeCommand | scanCommand +// pickCommand = "pick" "carrier" "from" location +// placeCommand = "place" "carrier" "at" location +// scanCommand = "scan" location +// location = Word + +- (PKParser *)location { + return [PKWord word]; +} + + +- (PKParser *)pickCommand { + PKSequence *s = [PKSequence sequence]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"pick"] discard]]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"carrier"] discard]]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"from"] discard]]; + [s add:[self location]]; + [s setAssembler:self selector:@selector(didMatchPickCommand:)]; + return s; +} + + +- (PKParser *)placeCommand { + PKSequence *s = [PKSequence sequence]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"place"] discard]]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"carrier"] discard]]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"at"] discard]]; + [s add:[self location]]; + [s setAssembler:self selector:@selector(didMatchPlaceCommand:)]; + return s; +} + + +- (PKParser *)scanCommand { + PKSequence *s = [PKSequence sequence]; + [s add:[[PKCaseInsensitiveLiteral literalWithString:@"scan"] discard]]; + [s add:[self location]]; + [s setAssembler:self selector:@selector(didMatchScanCommand:)]; + return s; +} + + +- (PKParser *)command { + PKAlternation *a = [PKAlternation alternation]; + [a add:[self pickCommand]]; + [a add:[self placeCommand]]; + [a add:[self scanCommand]]; + return a; +} + + +- (void)testPick { + NSString *s1 = @"pick carrier from LINE_IN"; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithString:s1]; + PKParser *p = [self command]; + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[]pick/carrier/from/LINE_IN^", [result description]); + + id target = result.target; + TDNotNil(target); + TDEqualObjects(@"pick LINE_IN", [target description]); +} + + +- (void)testPlace { + NSString *s2 = @"place carrier at LINE_OUT"; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithString:s2]; + PKParser *p = [self command]; + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[]place/carrier/at/LINE_OUT^", [result description]); + + id target = result.target; + TDNotNil(target); + TDEqualObjects(@"place LINE_OUT", [target description]); +} + + +- (void)testScan { + NSString *s3 = @"scan DB101_OUT"; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithString:s3]; + PKParser *p = [self command]; + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[]scan/DB101_OUT^", [result description]); + + id target = result.target; + TDNotNil(target); + TDEqualObjects(@"scan DB101_OUT", [target description]); +} + + +- (void)didMatchPickCommand:(PKAssembly *)a { + RobotPickCommand *c = [[[RobotPickCommand alloc] init] autorelease]; + PKToken *location = [a pop]; + c.location = location.stringValue; + a.target = c; +} + + +- (void)didMatchPlaceCommand:(PKAssembly *)a { + RobotPlaceCommand *c = [[[RobotPlaceCommand alloc] init] autorelease]; + PKToken *location = [a pop]; + c.location = location.stringValue; + a.target = c; +} + + +- (void)didMatchScanCommand:(PKAssembly *)a { + RobotScanCommand *c = [[[RobotScanCommand alloc] init] autorelease]; + PKToken *location = [a pop]; + c.location = location.stringValue; + a.target = c; +} + +@end diff --git a/test/TDScientificNumberStateTest.h b/test/TDScientificNumberStateTest.h new file mode 100644 index 0000000..53a8663 --- /dev/null +++ b/test/TDScientificNumberStateTest.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDScientificNumberStateTest : SenTestCase { + PKNumberState *numberState; + PKTokenizer *t; + PKReader *r; + NSString *s; +} + +@end diff --git a/test/TDScientificNumberStateTest.m b/test/TDScientificNumberStateTest.m new file mode 100644 index 0000000..e2728d9 --- /dev/null +++ b/test/TDScientificNumberStateTest.m @@ -0,0 +1,1229 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDScientificNumberStateTest.h" +#import "TDArithmeticParser.h" + +@implementation TDScientificNumberStateTest + +- (void)setUp { + t = [[PKTokenizer alloc] init]; + r = [[PKReader alloc] init]; + numberState = t.numberState; + numberState.allowsScientificNotation = YES; + [t setTokenizerState:numberState from:'0' to:'9']; + [t setTokenizerState:numberState from:'.' to:'.']; + [t setTokenizerState:numberState from:'-' to:'-']; +// NSLog(@"\n\n\n\n\n %f \n\n\n\n\n", 020); +} + + +- (void)tearDown { + [numberState release]; + [r release]; +} + + +//- (void)testScientificNumberStringArithmetic { +// t.string = @"1e2 + 1e1 + 1e0 + 1e-1 + 1e-2 + 1e-3"; +// TDArithmeticParser *p = [[[TDArithmeticParser alloc] init] autorelease]; +// PKAssembly *a = [PKTokenAssembly assemblyWithTokenizer:t]; +// PKAssembly *res = [p bestMatchFor:a]; +// PKToken *tok = [res pop]; +// TDEquals((CGFloat)111.111, tok.floatValue); +//} + + +- (void)testSingleDigit { + s = @"3"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)3.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"3", tok.stringValue); +} + + +- (void)testDoubleDigit { + s = @"47"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)47.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"47", tok.stringValue); +} + + +- (void)testTripleDigit { + s = @"654"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)654.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"654", tok.stringValue); +} + + +- (void)testSingleDigitPositive { + s = @"+3"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)3.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+3", tok.stringValue); +} + + +- (void)testDoubleDigitPositive { + s = @"+22"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)22.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)testDoubleDigitPositiveSpace { + s = @"+22 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)22.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)testMultipleDots { + s = @"1.1.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.1", tok.stringValue); + + tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".1", tok.stringValue); +} + + +- (void)testOneDot { + s = @"1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1", tok.stringValue); +} + + +- (void)testCustomOneDot1 { + s = @"1."; + t.string = s; + numberState.allowsTrailingDot = YES; + numberState.allowsScientificNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.", tok.stringValue); +} + + +- (void)testCustomOneDot2 { + s = @"1."; + t.string = s; + numberState.allowsTrailingDot = YES; + numberState.allowsScientificNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.", tok.stringValue); +} + + +- (void)testOneDotZero { + s = @"1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.0", tok.stringValue); +} + + +- (void)testPositiveOneDot { + s = @"+1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1", tok.stringValue); +} + + +- (void)testPositiveOneDotCustom { + s = @"+1."; + t.string = s; + r.string = s; + numberState.allowsTrailingDot = YES; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.", tok.stringValue); +} + + +- (void)testPositiveOneDotZero { + s = @"+1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.0", tok.stringValue); +} + + +- (void)testPositiveOneDotZeroSpace { + s = @"+1.0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1.0", tok.stringValue); +} + + +- (void)testNegativeOneDot { + s = @"-1."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testNegativeOneDotCustom { + s = @"-1."; + t.string = s; + r.string = s; + numberState.allowsTrailingDot = YES; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.", tok.stringValue); +} + + +- (void)testNegativeOneDotSpace { + s = @"-1. "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testNegativeOneDotZero { + s = @"-1.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.0", tok.stringValue); +} + + +- (void)testNegativeOneDotZeroSpace { + s = @"-1.0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1.0", tok.stringValue); +} + + +- (void)testOneDotOne { + s = @"1.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1.1", tok.stringValue); +} + + +- (void)testZeroDotOne { + s = @"0.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0.1", tok.stringValue); +} + + +- (void)testDotOne { + s = @".1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".1", tok.stringValue); +} + + +- (void)testDotZero { + s = @".0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); +} + + +- (void)testNegativeDotZero { + s = @"-.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.0", tok.stringValue); +} + + +- (void)testPositiveDotZero { + s = @"+.0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+.0", tok.stringValue); +} + + +- (void)testPositiveDotOne { + s = @"+.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+.1", tok.stringValue); +} + + +- (void)testNegativeDotOne { + s = @"-.1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.1, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1", tok.stringValue); +} + + +- (void)testNegativeDotOneOne { + s = @"-.11"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.11, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.11", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOne { + s = @"-.111"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.111", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZero { + s = @"-.1110"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1110", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZeroZero { + s = @"-.11100"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.11100", tok.stringValue); +} + + +- (void)testNegativeDotOneOneOneZeroSpace { + s = @"-.1110 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.111, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-.1110", tok.stringValue); +} + + +- (void)testZeroDotThreeSixtyFive { + s = @"0.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0.365", tok.stringValue); +} + + +- (void)testNegativeZeroDotThreeSixtyFive { + s = @"-0.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0.365", tok.stringValue); +} + + +- (void)testNegativeTwentyFourDotThreeSixtyFive { + s = @"-24.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-24.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-24.365", tok.stringValue); +} + + +- (void)testTwentyFourDotThreeSixtyFive { + s = @"24.365"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)24.365, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"24.365", tok.stringValue); +} + + +- (void)testZero { + s = @"0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0", tok.stringValue); +} + + +- (void)testNegativeOne { + s = @"-1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-1", tok.stringValue); +} + + +- (void)testOne { + s = @"1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"1", tok.stringValue); +} + + +- (void)testPositiveOne { + s = @"+1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)1.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+1", tok.stringValue); +} + + +- (void)testPositiveZero { + s = @"+0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+0", tok.stringValue); +} + + +- (void)testPositiveZeroSpace { + s = @"+0 "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+0", tok.stringValue); +} + + +- (void)testNegativeZero { + s = @"-0"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)-0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0", tok.stringValue); +} + + +- (void)testNull { + s = @"NULL"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testNil { + s = @"nil"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testEmptyString { + s = @""; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDot { + s = @"."; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDotSpace { + s = @". "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testDotSpaceOne { + s = @". 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlus { + s = @"+"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlusSpace { + s = @"+ "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testPlusSpaceOne { + s = @"+ 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinus { + s = @"-"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinusSpace { + s = @"- "; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testMinusSpaceOne { + s = @"- 1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDFalse(tok.isNumber); +} + + +- (void)testInitSig { + s = @"- (id)init {"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(@"-", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); +} + + +#pragma mark - + +- (void)test1e1 { + s = @"1e1"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)10.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)test1e2 { + s = @"1e2"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)100.0, tok.floatValue); + TDTrue(tok.isNumber); +} + + +- (void)test2dot0e2 { + s = @"2.0e2"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(s, tok.stringValue); +} + + +- (void)test2dot0E2 { + s = @"2.0E2"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(s, tok.stringValue); +} + + +- (void)test2e2 { + s = @"2e2"; + t.string = s; + r.string = s; + PKToken *tok = [numberState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(s, tok.stringValue); +} + + +- (void)test2eNegative2Tok { + s = @"2e-2"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.02, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(s, tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2e2Tok { + s = @"2e2"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(s, tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2e2fooTok { + s = @"2e2 foo"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2e2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2eNegative2fooTok { + s = @"2e-2 foo"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.02, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2e-2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2ePositive2fooTok { + s = @"2e+2 foo"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2e+2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2dot0ePositive2fooTok { + s = @"2.0e+2 foo"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)200.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2.0e+2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)test2dot0eNegative2fooTok { + s = @"2.0e-2 foo"; + t.string = s; + r.string = s; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.02, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2.0e-2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testNotAllowsScientificNotation2dot0e2 { + s = @"2.0e2"; + t.string = s; + r.string = s; + numberState.allowsScientificNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2.0", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"e2", tok.stringValue); +} + + +- (void)testNotAllowsScientificNotation2dot0E2 { + s = @"2.0E2"; + t.string = s; + r.string = s; + numberState.allowsScientificNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2.0", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"E2", tok.stringValue); +} + + +- (void)testNotAllowsScientificNotation2e2 { + s = @"2e2"; + t.string = s; + r.string = s; + numberState.allowsScientificNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"e2", tok.stringValue); +} + + +- (void)testOctal { + s = @"020"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"020", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testOctal2 { + s = @"020"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"020", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testMinusOctal { + s = @"-020"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)-16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-020", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testMinusOctal2 { + s = @"-020"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)-16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-020", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testOctalDecimal { + s = @"020.0"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"020", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testOctalDecimal2 { + s = @"020.0"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)16.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"020", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testOctalDecimalNO { + s = @"020.0"; + t.string = s; + numberState.allowsOctalNotation = NO; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)20.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"020.0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHex { + s = @"0x20"; + t.string = s; + numberState.allowsOctalNotation = NO; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)32.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0x20", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHex2 { + s = @"0x20"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)32.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0x20", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testNotHex { + s = @"0x"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isWord); + TDEqualObjects(@"x", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHexAlpha { + s = @"0xA"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)10.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0xA", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); + + s = @"0xa"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + tok = [t nextToken]; + TDEquals((CGFloat)10.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0xa", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); + + s = @"0xB7"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + tok = [t nextToken]; + TDEquals((CGFloat)183.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0xB7", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); + + s = @"0x8EE"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + tok = [t nextToken]; + TDEquals((CGFloat)2286.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0x8EE", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testMinusHex { + s = @"-0x20"; + t.string = s; + numberState.allowsHexadecimalNotation = NO; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)-32.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0x20", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testMinusHex2 { + s = @"-0x20"; + t.string = s; + numberState.allowsHexadecimalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)-32.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"-0x20", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHexDecimal { + s = @"0x30.0"; + t.string = s; + numberState.allowsOctalNotation = NO; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)48.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0x30", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHexDecimal2 { + s = @"0x40.0"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)64.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"0x40", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHexDecimal3 { + s = @"00x30.0"; + t.string = s; + numberState.allowsOctalNotation = NO; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"00", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"x30", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testHexDecimal4 { + s = @"00x30.0"; + t.string = s; + numberState.allowsOctalNotation = YES; + numberState.allowsHexadecimalNotation = YES; + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"00", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"x30", tok.stringValue); + + tok = [t nextToken]; + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@".0", tok.stringValue); + + tok = [t nextToken]; + TDTrue([PKToken EOFToken] == tok); +} + +@end diff --git a/test/TDSequenceTest.h b/test/TDSequenceTest.h new file mode 100644 index 0000000..54c1105 --- /dev/null +++ b/test/TDSequenceTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDSequenceTest : SenTestCase { + PKCollectionParser *p; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/TDSequenceTest.m b/test/TDSequenceTest.m new file mode 100644 index 0000000..97a0dcc --- /dev/null +++ b/test/TDSequenceTest.m @@ -0,0 +1,257 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDSequenceTest.h" + +@interface PKParser () +- (NSSet *)allMatchesFor:(NSSet *)inAssemblies; +@end + +@implementation TDSequenceTest + +- (void)tearDown { +} + +- (void)testDiscard { + s = @"foo -"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo]foo/-^", [result description]); +} + + +- (void)testDiscard2 { + s = @"foo foo -"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, foo]foo/foo/-^", [result description]); +} + + +- (void)testDiscard3 { + s = @"foo - foo"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, foo]foo/-/foo^", [result description]); +} + + +- (void)testDiscard1 { + s = @"- foo"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo]-/foo^", [result description]); +} + + +- (void)testDiscard4 { + s = @"- foo -"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo]-/foo/-^", [result description]); +} + + +- (void)testDiscard5 { + s = @"- foo + foo"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[[PKSymbol symbolWithString:@"-"] discard]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[[PKSymbol symbolWithString:@"+"] discard]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, foo]-/foo/+/foo^", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"bar"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [result description]); +} + + +- (void)testTrueLiteralBestMatchForFooSpaceBarSpaceBaz1 { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *foo = [PKLiteral literalWithString:@"foo"]; + PKParser *bar = [PKLiteral literalWithString:@"bar"]; + PKParser *baz = [PKLiteral literalWithString:@"baz"]; + p = [PKSequence sequenceWithSubparsers:foo, baz, bar, nil]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNil(result); +} + + +- (void)testFalseLiteralBestMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p bestMatchFor:a]; + TDNil(result); +} + + +- (void)testTrueLiteralCompleteMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"bar"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [result description]); +} + + +- (void)testTrueLiteralCompleteMatchForFooSpaceBarSpaceBaz1 { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKWord word]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[foo, bar, baz]foo/bar/baz^", [result description]); +} + + +- (void)testFalseLiteralCompleteMatchForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testFalseLiteralCompleteMatchForFooSpaceBarSpaceBaz1 { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKNumber number]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testTrueLiteralAllMatchsForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"bar"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); +} + + +- (void)testFalseLiteralAllMatchsForFooSpaceBarSpaceBaz { + s = @"foo bar baz"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSequence sequence]; + [p add:[PKLiteral literalWithString:@"foo"]]; + [p add:[PKLiteral literalWithString:@"123"]]; + [p add:[PKLiteral literalWithString:@"baz"]]; + + NSSet *result = [p allMatchesFor:[NSSet setWithObject:a]]; + + TDNotNil(result); + NSUInteger c = [result count]; + TDEquals((NSUInteger)0, c); +} + +@end diff --git a/test/TDSignificantWhitespaceState.h b/test/TDSignificantWhitespaceState.h new file mode 100644 index 0000000..164298a --- /dev/null +++ b/test/TDSignificantWhitespaceState.h @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import + +// NOTE: this class is not currently in use or included in the Framework. It is an example of how to add a new token type + +static const NSInteger PKTokenTypeWhitespace = 5; + +@interface PKToken (TDSignificantWhitespaceStateAdditions) +@property (nonatomic, readonly, getter=isWhitespace) BOOL whitespace; +@end + +@interface TDSignificantWhitespaceState : PKWhitespaceState { + +} +@end diff --git a/test/TDSignificantWhitespaceState.m b/test/TDSignificantWhitespaceState.m new file mode 100644 index 0000000..0d66ba1 --- /dev/null +++ b/test/TDSignificantWhitespaceState.m @@ -0,0 +1,75 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@implementation PKToken (TDSignificantWhitespaceStateAdditions) + +- (BOOL)isWhitespace { + return self.tokenType == PKTokenTypeWhitespace; +} + + +- (NSString *)debugDescription { + NSString *typeString = nil; + if (self.isNumber) { + typeString = @"Number"; + } else if (self.isQuotedString) { + typeString = @"Quoted String"; + } else if (self.isSymbol) { + typeString = @"Symbol"; + } else if (self.isWord) { + typeString = @"Word"; + } else if (self.isWhitespace) { + typeString = @"Whitespace"; + } + return [NSString stringWithFormat:@"<%@ %C%@%C>", typeString, 0x00ab, self.value, 0x00bb]; +} + +@end + +@implementation TDSignificantWhitespaceState + +- (void)dealloc { + [super dealloc]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + [self resetWithReader:r]; + + c = cin; + while ([self isWhitespaceChar:c]) { + [self append:c]; + c = [r read]; + } + if (c != -1) { + [r unread]; + } + + return [PKToken tokenWithTokenType:PKTokenTypeWhitespace stringValue:[self bufferedString] floatValue:0.0]; +} + +@end diff --git a/test/TDSignificantWhitespaceStateTest.h b/test/TDSignificantWhitespaceStateTest.h new file mode 100644 index 0000000..e63e071 --- /dev/null +++ b/test/TDSignificantWhitespaceStateTest.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@interface TDSignificantWhitespaceStateTest : SenTestCase { + TDSignificantWhitespaceState *whitespaceState; + PKReader *r; + NSString *s; +} + +@end diff --git a/test/TDSignificantWhitespaceStateTest.m b/test/TDSignificantWhitespaceStateTest.m new file mode 100644 index 0000000..5bca46c --- /dev/null +++ b/test/TDSignificantWhitespaceStateTest.m @@ -0,0 +1,170 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDSignificantWhitespaceStateTest.h" + + +@implementation TDSignificantWhitespaceStateTest + +- (void)setUp { + whitespaceState = [[TDSignificantWhitespaceState alloc] init]; +} + + +- (void)tearDown { + [whitespaceState release]; + [r release]; +} + + +- (void)testSpace { + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testTwoSpaces { + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testEmptyString { + s = @""; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testTab { + s = @"\t"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testNewLine { + s = @"\n"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testCarriageReturn { + s = @"\r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testSpaceCarriageReturn { + s = @" \r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testSpaceTabNewLineSpace { + s = @" \t\n "; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(s, t.stringValue, @""); + STAssertEquals(PKEOF, [r read], @""); +} + + +- (void)testSpaceA { + s = @" a"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@" ", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + +- (void)testSpaceASpace { + s = @" a "; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@" ", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + + +- (void)testTabA { + s = @"\ta"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@"\t", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + + +- (void)testNewLineA { + s = @"\na"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@"\n", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + + +- (void)testCarriageReturnA { + s = @"\ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@"\r", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + + +- (void)testNewLineSpaceCarriageReturnA { + s = @"\n \ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *t = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + STAssertNotNil(t, @""); + STAssertEqualObjects(@"\n \r", t.stringValue, @""); + STAssertEquals((PKUniChar)'a', [r read], @""); +} + + +@end diff --git a/test/TDSlashSlashState.h b/test/TDSlashSlashState.h new file mode 100644 index 0000000..934557e --- /dev/null +++ b/test/TDSlashSlashState.h @@ -0,0 +1,26 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class TDSlashSlashState + @brief A slash slash state ignores everything up to an end-of-line and returns the tokenizer's next token. +*/ +@interface TDSlashSlashState : PKTokenizerState { + +} + +@end diff --git a/test/TDSlashSlashState.m b/test/TDSlashSlashState.m new file mode 100644 index 0000000..3a8816b --- /dev/null +++ b/test/TDSlashSlashState.m @@ -0,0 +1,59 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import +#import + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@implementation TDSlashSlashState + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + BOOL reportTokens = t.slashState.reportsCommentTokens; + if (reportTokens) { + [self resetWithReader:r]; + [self append:'/']; + } + + NSInteger c = cin; + + while ('\n' != c && '\r' != c && -1 != c) { + if (reportTokens) { + [self append:c]; + } + c = [r read]; + } + if (-1 != c) { + [r unread]; + } + + if (reportTokens) { + return [PKToken tokenWithTokenType:PKTokenTypeComment stringValue:[self bufferedString] floatValue:0.0]; + } else { + return [t nextToken]; + } +} + +@end diff --git a/test/TDSlashStarState.h b/test/TDSlashStarState.h new file mode 100644 index 0000000..c9157ab --- /dev/null +++ b/test/TDSlashStarState.h @@ -0,0 +1,26 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class TDSlashStarState + @brief A slash star state ignores everything up to a closing star and slash, and then returns the tokenizer's next token. +*/ +@interface TDSlashStarState : PKTokenizerState { + +} + +@end diff --git a/test/TDSlashStarState.m b/test/TDSlashStarState.m new file mode 100644 index 0000000..a54e3a5 --- /dev/null +++ b/test/TDSlashStarState.m @@ -0,0 +1,78 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import +#import + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@implementation TDSlashStarState + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + BOOL reportTokens = t.slashState.reportsCommentTokens; + if (reportTokens) { + [self resetWithReader:r]; + [self append:'/']; + } + + NSInteger c = cin; + while (-1 != c) { + if (reportTokens) { + [self append:c]; + } + c = [r read]; + + if ('*' == c) { + NSInteger peek = [r read]; + if ('/' == peek) { + if (reportTokens) { + [self append:c]; + [self append:peek]; + } + c = [r read]; + break; + } else if ('*' == peek) { + [r unread]; + } else { + if (reportTokens) { + [self append:c]; + } + c = peek; + } + } + } + + if (-1 != c) { + [r unread]; + } + + if (reportTokens) { + return [PKToken tokenWithTokenType:PKTokenTypeComment stringValue:[self bufferedString] floatValue:0.0]; + } else { + return [t nextToken]; + } +} + +@end diff --git a/test/TDSlashState.h b/test/TDSlashState.h new file mode 100644 index 0000000..d5cc38d --- /dev/null +++ b/test/TDSlashState.h @@ -0,0 +1,33 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +@class TDSlashSlashState; +@class TDSlashStarState; + +/*! + @class TDSlashState + @brief This state will either delegate to a comment-handling state, or return a PKSymbol token with just a slash in it. +*/ +@interface TDSlashState : PKTokenizerState { + TDSlashSlashState *slashSlashState; + TDSlashStarState *slashStarState; + BOOL reportsCommentTokens; +} + + +@property (nonatomic) BOOL reportsCommentTokens; +@end diff --git a/test/TDSlashState.m b/test/TDSlashState.m new file mode 100644 index 0000000..2e4b7cb --- /dev/null +++ b/test/TDSlashState.m @@ -0,0 +1,65 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import +#import +#import +#import + +@interface TDSlashState () +@property (nonatomic, retain) TDSlashSlashState *slashSlashState; +@property (nonatomic, retain) TDSlashStarState *slashStarState; +@end + +@implementation TDSlashState + +- (id)init { + if (self = [super init]) { + self.slashSlashState = [[[TDSlashSlashState alloc] init] autorelease]; + self.slashStarState = [[[TDSlashStarState alloc] init] autorelease]; + } + return self; +} + + +- (void)dealloc { + self.slashSlashState = nil; + self.slashStarState = nil; + [super dealloc]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + NSParameterAssert(t); + + NSInteger c = [r read]; + if ('/' == c) { + return [slashSlashState nextTokenFromReader:r startingWith:c tokenizer:t]; + } else if ('*' == c) { + return [slashStarState nextTokenFromReader:r startingWith:c tokenizer:t]; + } else { + if (-1 != c) { + [r unread]; + } + return [PKToken tokenWithTokenType:PKTokenTypeSymbol stringValue:@"/" floatValue:0.0]; + } +} + +@synthesize slashSlashState; +@synthesize slashStarState; +@synthesize reportsCommentTokens; +@end diff --git a/test/TDSlashStateTest.h b/test/TDSlashStateTest.h new file mode 100644 index 0000000..150df1e --- /dev/null +++ b/test/TDSlashStateTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDSlashStateTest : SenTestCase { + TDSlashState *slashState; + PKReader *r; + PKTokenizer *t; + NSString *s; +} +@end diff --git a/test/TDSlashStateTest.m b/test/TDSlashStateTest.m new file mode 100644 index 0000000..4776172 --- /dev/null +++ b/test/TDSlashStateTest.m @@ -0,0 +1,396 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDSlashStateTest.h" + +@implementation TDSlashStateTest + +- (void)setUp { + r = [[PKReader alloc] init]; + t = [[PKTokenizer alloc] init]; + slashState = t.slashState; +} + + +- (void)tearDown { + [r release]; + [t release]; +} + + +- (void)testSpace { + s = @" "; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlash { + s = @"/"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlash { + s = @"/"; + r.string = s; + t.string = s; + + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashSlash { + s = @"//"; + r.string = s; + t.string = s; + + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, s); + TDTrue(tok.isComment); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashSlashFoo { + s = @"// foo"; + r.string = s; + t.string = s; + + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, s); + TDTrue(tok.isComment); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashAbc { + s = @"/abc"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testReportSlashAbc { + s = @"/abc"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSlashSpaceAbc { + s = @"/ abc"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testReportSlashSpaceAbc { + s = @"/ abc"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok.stringValue, @"/"); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testSlashSlashAbc { + s = @"//abc"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashSlashAbc { + s = @"//abc"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashSlashSpaceAbc { + s = @"// abc"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashSlashSpaceAbc { + s = @"// abc"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcStarSlash { + s = @"/*abc*/"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbcStarSlash { + s = @"/*abc*/"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbcStarStar { + s = @"/*abc**"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAStarStarSpaceA { + s = @"/*a**/ a"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/*a**/"); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testReportSlashStarAbcStarStarSpaceA { + s = @"/*abc**/ a"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/*abc**/"); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testReportSlashStarStarSlash { + s = @"/**/"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarStarStarSlash { + s = @"/***/"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarStarSlashSpace { + s = @"/**/ "; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/**/"); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testReportSlashStarAbcStarSpaceStarSpaceA { + s = @"/*abc* */ a"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, @"/*abc* */"); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testSlashStarAbc { + s = @"/*abc"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbc { + s = @"/*abc"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcStar { + s = @"/*abc*"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcStarSpace { + s = @"/*abc* "; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbcStarSpace { + s = @"/*abc* "; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcSlash { + s = @"/*abc/"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcSlashSpace { + s = @"/*abc/ "; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbcSlashSpace { + s = @"/*abc/ "; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSlashStarAbcNewline { + s = @"/*abc\n"; + r.string = s; + t.string = s; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDEqualObjects(tok, [PKToken EOFToken]); + TDEquals(PKEOF, [r read]); +} + + +- (void)testReportSlashStarAbcNewline { + s = @"/*abc\n"; + r.string = s; + t.string = s; + slashState.reportsCommentTokens = YES; + PKToken *tok = [slashState nextTokenFromReader:r startingWith:[r read] tokenizer:t]; + TDTrue(tok.isComment); + TDEqualObjects(tok.stringValue, s); + TDEquals(PKEOF, [r read]); +} + +@end diff --git a/test/TDSpecificCharTest.h b/test/TDSpecificCharTest.h new file mode 100644 index 0000000..e5e83d3 --- /dev/null +++ b/test/TDSpecificCharTest.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + + +@interface TDSpecificCharTest : SenTestCase { + NSString *s; + PKCharacterAssembly *a; + PKChar *p; + PKAssembly *result; +} + +@end diff --git a/test/TDSpecificCharTest.m b/test/TDSpecificCharTest.m new file mode 100644 index 0000000..723eaa9 --- /dev/null +++ b/test/TDSpecificCharTest.m @@ -0,0 +1,65 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDSpecificCharTest.h" + +@interface PKAssembly () +- (BOOL)hasMore; +@end + +@implementation TDSpecificCharTest + +- (void)test123 { + s = @"123"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^123", [a description]); + p = [PKSpecificChar specificCharWithChar:'1']; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[1]1^23", [result description]); + TDTrue([a hasMore]); +} + + +- (void)testAbc { + s = @"abc"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^abc", [a description]); + p = [PKSpecificChar specificCharWithChar:'1']; + + result = [p bestMatchFor:a]; + TDNotNil(a); + TDNil(result); + TDTrue([a hasMore]); +} + + +- (void)testRepetition { + s = @"aaa"; + a = [PKCharacterAssembly assemblyWithString:s]; + + TDEqualObjects(@"[]^aaa", [a description]); + p = [PKSpecificChar specificCharWithChar:'a']; + PKParser *r = [PKRepetition repetitionWithSubparser:p]; + + result = [r bestMatchFor:a]; + TDNotNil(a); + TDEqualObjects(@"[a, a, a]aaa^", [result description]); + TDFalse([result hasMore]); +} + +@end diff --git a/test/TDSymbolStateTest.h b/test/TDSymbolStateTest.h new file mode 100644 index 0000000..f2ea819 --- /dev/null +++ b/test/TDSymbolStateTest.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDSymbolStateTest : SenTestCase { + PKSymbolState *symbolState; + PKReader *r; + NSString *s; +} +@end diff --git a/test/TDSymbolStateTest.m b/test/TDSymbolStateTest.m new file mode 100644 index 0000000..83839c7 --- /dev/null +++ b/test/TDSymbolStateTest.m @@ -0,0 +1,578 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDSymbolStateTest.h" + +@implementation TDSymbolStateTest + +- (void)setUp { + symbolState = [[PKSymbolState alloc] init]; +} + + +- (void)tearDown { + [symbolState release]; + [r release]; +} + + +- (void)testDot { + s = @"."; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testDotA { + s = @".a"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testDotSpace { + s = @". "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testDotDot { + s = @".."; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)'.', [r read]); +} + + + +- (void)testAddDotDot { + s = @".."; + [symbolState add:s]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"..", tok.stringValue); + TDEqualObjects(@"..", tok.value); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testAddDotDotSpace { + s = @".. "; + [symbolState add:@".."]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"..", tok.stringValue); + TDEqualObjects(@"..", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testAddColonEqual { + s = @":="; + [symbolState add:s]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@":=", tok.stringValue); + TDEqualObjects(@":=", tok.value); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testAddColonEqualSpace { + s = @":= "; + [symbolState add:@":="]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@":=", tok.stringValue); + TDEqualObjects(@":=", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testAddGtEqualLtSpace { + s = @">=< "; + [symbolState add:@">=<"]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testAddGtEqualLt { + s = @">=<"; + [symbolState add:s]; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [symbolState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + TDEquals(PKEOF, [r read]); +} + + +- (void)testTokenzierAddGtEqualLt { + s = @">=<"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:s]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddGtEqualLtSpaceFoo { + s = @">=< foo"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@">=<"]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + tok = [t nextToken]; + TDEqualObjects(@"foo", tok.stringValue); + TDEqualObjects(@"foo", tok.value); + TDTrue(tok.isWord); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddGtEqualLtFoo { + s = @">==<"]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + tok = [t nextToken]; + TDEqualObjects(@"foo", tok.stringValue); + TDEqualObjects(@"foo", tok.value); + TDTrue(tok.isWord); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddGtEqualLtDot { + s = @">=<."; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@">=<"]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddGtEqualLtSpaceDot { + s = @">=< ."; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@">=<"]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddGtEqualLtSpaceDotSpace { + s = @">=< . "; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@">=<"]; + PKToken *tok = [t nextToken]; + TDEqualObjects(@">=<", tok.stringValue); + TDEqualObjects(@">=<", tok.value); + TDTrue(tok.isSymbol); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddLtBangDashDashSpaceDotSpace { + s = @""; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"-->"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"-->", tok.stringValue); + TDEqualObjects(@"-->", tok.value); + + tok = [t nextToken]; + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddDashDashGtSpaceDot { + s = @"--> ."; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"-->"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"-->", tok.stringValue); + TDEqualObjects(@"-->", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddDashDashGtSpaceDotSpace { + s = @"--> . "; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"-->"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"-->", tok.stringValue); + TDEqualObjects(@"-->", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddDashDash { + s = @"--"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"--"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"--", tok.stringValue); + TDEqualObjects(@"--", tok.value); + + tok = [t nextToken]; + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddDashDashSpaceDot { + s = @"-- ."; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"--"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"--", tok.stringValue); + TDEqualObjects(@"--", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierAddDashDashSpaceDotSpace { + s = @"-- . "; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"--"]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"--", tok.stringValue); + TDEqualObjects(@"--", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDEqualObjects(@".", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualButNotEqual { + s = @"="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"==="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualButNotEqualEqual { + s = @"=="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"==="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualCompareEqualEqualEqualEqual { + s = @"===="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"==="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"===", tok.stringValue); + TDEqualObjects(@"===", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualCompareEqualEqualEqualEqualEqual { + s = @"====="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"==="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"===", tok.stringValue); + TDEqualObjects(@"===", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualCompareEqualEqualEqualEqualEqualSpaceEqual { + s = @"===== ="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"==="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"===", tok.stringValue); + TDEqualObjects(@"===", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualEqualEqualEqual { + s = @"===="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualColonEqualButNotEqualColon { + s = @"=:"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"=:="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@":", tok.stringValue); + TDEqualObjects(@":", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierRemoveEqualEqual { + s = @"=="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState remove:@"=="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierRemoveEqualEqualAddEqualEqual { + s = @"===="; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState remove:@"=="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=", tok.stringValue); + TDEqualObjects(@"=", tok.value); + + [t.symbolState add:@"=="]; + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"==", tok.stringValue); + TDEqualObjects(@"==", tok.value); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTokenzierEqualColonEqualAndThenEqualColonEqualColon { + s = @"=:=:"; + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"=:="]; + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"=:=", tok.stringValue); + TDEqualObjects(@"=:=", tok.value); + + tok = [t nextToken]; + TDEqualObjects(@":", tok.stringValue); + TDEqualObjects(@":", tok.value); + TDTrue(tok.isSymbol); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testTrickyCase { + s = @"+++\n+++-\n+++-+"; + + PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; + [t.symbolState add:@"+++"]; + [t.symbolState add:@"+++-+"]; + + PKToken *eof = [PKToken EOFToken]; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+++"); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+++"); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+++-+"); + + tok = [t nextToken]; + TDEquals(eof, tok); +} + +@end diff --git a/test/TDSymbolTest.h b/test/TDSymbolTest.h new file mode 100644 index 0000000..13ae93b --- /dev/null +++ b/test/TDSymbolTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDSymbolTest : SenTestCase { + PKParser *p; + PKAssembly *a; + NSString *s; +} + +@end diff --git a/test/TDSymbolTest.m b/test/TDSymbolTest.m new file mode 100644 index 0000000..b5d15fe --- /dev/null +++ b/test/TDSymbolTest.m @@ -0,0 +1,72 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDSymbolTest.h" + + +@implementation TDSymbolTest + +- (void)tearDown { +} + + +- (void)testDash { + s = @"-"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSymbol symbolWithString:s]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[-]-^", [result description]); +} + + +- (void)testFalseDash { + s = @"-"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSymbol symbolWithString:@"+"]; + + PKAssembly *result = [p bestMatchFor:a]; + TDNil(result); +} + + +- (void)testTrueDash { + s = @"-"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [PKSymbol symbol]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[-]-^", [result description]); +} + + +- (void)testDiscardDash { + s = @"-"; + a = [PKTokenAssembly assemblyWithString:s]; + + p = [[PKSymbol symbolWithString:s] discard]; + + PKAssembly *result = [p bestMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[]-^", [result description]); +} +@end diff --git a/test/TDSyntaxHighlighter.h b/test/TDSyntaxHighlighter.h new file mode 100644 index 0000000..142c738 --- /dev/null +++ b/test/TDSyntaxHighlighter.h @@ -0,0 +1,35 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class PKParser; +@class PKTokenizer; +@class PKParserFactory; +@class TDMiniCSSAssembler; +@class TDGenericAssembler; + +@interface TDSyntaxHighlighter : NSObject { + PKParserFactory *parserFactory; + PKParser *miniCSSParser; + TDMiniCSSAssembler *miniCSSAssembler; + TDGenericAssembler *genericAssembler; + BOOL cacheParsers; + NSMutableDictionary *parserCache; + NSMutableDictionary *tokenizerCache; +} +- (NSAttributedString *)highlightedStringForString:(NSString *)s ofGrammar:(NSString *)grammarName; + +@property (nonatomic) BOOL cacheParsers; // default is NO +@end diff --git a/test/TDSyntaxHighlighter.m b/test/TDSyntaxHighlighter.m new file mode 100644 index 0000000..8c8d70d --- /dev/null +++ b/test/TDSyntaxHighlighter.m @@ -0,0 +1,174 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDSyntaxHighlighter.h" +#import +#import "PKParserFactory.h" +#import "TDMiniCSSAssembler.h" +#import "TDGenericAssembler.h" + +@interface TDSyntaxHighlighter () +- (NSMutableDictionary *)attributesForGrammarNamed:(NSString *)grammarName; +- (PKParser *)parserForGrammarNamed:(NSString *)grammarName; + +// all of the ivars for these properties are lazy loaded in the getters. +// thats so that if an application has syntax highlighting turned off, this class will +// consume much less memory/fewer resources. +@property (nonatomic, retain) PKParserFactory *parserFactory; +@property (nonatomic, retain) PKParser *miniCSSParser; +@property (nonatomic, retain) TDMiniCSSAssembler *miniCSSAssembler; +@property (nonatomic, retain) TDGenericAssembler *genericAssembler; +@property (nonatomic, retain) NSMutableDictionary *parserCache; +@property (nonatomic, retain) NSMutableDictionary *tokenizerCache; +@end + +@implementation TDSyntaxHighlighter + +- (id)init { + if (self = [super init]) { + + } + return self; +} + + +- (void)dealloc { + PKReleaseSubparserTree(miniCSSParser); + for (PKParser *p in parserCache) { + PKReleaseSubparserTree(p); + } + + self.parserFactory = nil; + self.miniCSSParser = nil; + self.miniCSSAssembler = nil; + self.genericAssembler = nil; + self.parserCache = nil; + self.tokenizerCache = nil; + [super dealloc]; +} + + +- (PKParserFactory *)parserFactory { + if (!parserFactory) { + self.parserFactory = [PKParserFactory factory]; + } + return parserFactory; +} + + +- (TDMiniCSSAssembler *)miniCSSAssembler { + if (!miniCSSAssembler) { + self.miniCSSAssembler = [[[TDMiniCSSAssembler alloc] init] autorelease]; + } + return miniCSSAssembler; +} + + +- (PKParser *)miniCSSParser { + if (!miniCSSParser) { + // create mini-css parser + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"mini_css" ofType:@"grammar"]; + NSString *grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + self.miniCSSParser = [self.parserFactory parserFromGrammar:grammarString assembler:self.miniCSSAssembler]; + } + return miniCSSParser; +} + + +- (TDGenericAssembler *)genericAssembler { + if (!genericAssembler) { + self.genericAssembler = [[[TDGenericAssembler alloc] init] autorelease]; + } + return genericAssembler; +} + + +- (NSMutableDictionary *)parserCache { + if (!parserCache) { + self.parserCache = [NSMutableDictionary dictionary]; + } + return parserCache; +} + + +- (NSMutableDictionary *)attributesForGrammarNamed:(NSString *)grammarName { + // parse CSS + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:grammarName ofType:@"css"]; + NSString *s = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + [self.miniCSSParser bestMatchFor:a]; // produce dict of attributes from the CSS + return self.miniCSSAssembler.attributes; +} + + +- (PKParser *)parserForGrammarNamed:(NSString *)grammarName { + // create parser or the grammar requested or fetch parser from cache + PKParser *parser = nil; + if (cacheParsers) { + parser = [self.parserCache objectForKey:grammarName]; + } + + if (!parser) { + // get attributes from css && give to the generic assembler + parserFactory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnAll; + self.genericAssembler.attributes = [self attributesForGrammarNamed:grammarName]; + + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:grammarName ofType:@"grammar"]; + NSString *grammarString = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + + // generate a parser for the requested grammar + parserFactory.assemblerSettingBehavior = PKParserFactoryAssemblerSettingBehaviorOnTerminals; + parser = [self.parserFactory parserFromGrammar:grammarString assembler:self.genericAssembler]; + + if (cacheParsers) { + [self.parserCache setObject:parser forKey:grammarName]; + [self.tokenizerCache setObject:parser.tokenizer forKey:grammarName]; + } + } + + return parser; +} + + +- (NSAttributedString *)highlightedStringForString:(NSString *)s ofGrammar:(NSString *)grammarName { + // create or fetch the parser & tokenizer for this grammar + PKParser *parser = [self parserForGrammarNamed:grammarName]; + + // parse the string. take care to preseve the whitespace and comments in the string + parser.tokenizer.string = s; + parser.tokenizer.whitespaceState.reportsWhitespaceTokens = YES; + parser.tokenizer.commentState.reportsCommentTokens = YES; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:parser.tokenizer]; + a.preservesWhitespaceTokens = YES; + + PKAssembly *resultAssembly = [parser completeMatchFor:a]; // finally, parse the input. stores attributed string in resultAssembly.target + + if (!cacheParsers) { + PKReleaseSubparserTree(parser); + } + + id result = [[resultAssembly.target copy] autorelease]; + return result; +} + +@synthesize parserFactory; +@synthesize miniCSSParser; +@synthesize miniCSSAssembler; +@synthesize genericAssembler; +@synthesize cacheParsers; +@synthesize parserCache; +@synthesize tokenizerCache; +@end diff --git a/test/TDTestScaffold.h b/test/TDTestScaffold.h new file mode 100644 index 0000000..4aad9f3 --- /dev/null +++ b/test/TDTestScaffold.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import +#import + +#define TDTrue(e) STAssertTrue((e), @"") +#define TDFalse(e) STAssertFalse((e), @"") +#define TDNil(e) STAssertNil((e), @"") +#define TDNotNil(e) STAssertNotNil((e), @"") +#define TDEquals(e1, e2) STAssertEquals((e1), (e2), @"") +#define TDEqualObjects(e1, e2) STAssertEqualObjects((e1), (e2), @"") diff --git a/test/TDTestScaffold.m b/test/TDTestScaffold.m new file mode 100644 index 0000000..4154388 --- /dev/null +++ b/test/TDTestScaffold.m @@ -0,0 +1,159 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +#define RUN_ALL_TEST_CASES 1 +#define SOLO_TEST_CASE @"TDParserBlocksTest" + +@interface SenTestSuite (TDAdditions) +- (void)addSuitesForClassNames:(NSArray *)classNames; +@end + +SenTestSuite *TDSoloTestSuite() { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Solo Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObject:SOLO_TEST_CASE]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + +SenTestSuite *TDTokensTestSuite() { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Tokens Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDReaderTest", + @"TDTokenizerTest", + @"TDTokenizerTest", + @"TDNumberStateTest", + @"TDQuoteStateTest", + @"TDWhitespaceStateTest", + @"TDWordStateTest", + @"TDSlashStateTest", + @"TDSymbolStateTest", + @"TDCommentStateTest", + @"TDDelimitStateTest", + @"TDTokenizerStateTest", +#ifdef TARGET_OS_SNOW_LEOPARD + @"TDTokenizerBlocksTest", + @"TDParserBlocksTest", +#endif + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + +SenTestSuite *TDCharsTestSuite() { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Chars Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDCharacterAssemblyTest", + @"TDDigitTest", + @"TDCharTest", + @"TDLetterTest", + @"TDSpecificCharTest", + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + +SenTestSuite *TDParseTestSuite() { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"Parse Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDParserTest", + @"TDTokenAssemblyTest", + @"TDLiteralTest", + @"TDPatternTest", + @"TDRepetitionTest", + @"TDSequenceTest", + @"TDAlternationTest", + @"TDSymbolTest", + @"TDRobotCommandTest", + @"TDXmlParserTest", + @"TDJsonParserTest", + @"TDFastJsonParserTest", + @"TDRegularParserTest", + @"SRGSParserTest", + @"EBNFParserTest", + @"TDPlistParserTest", + @"TDXmlNameTest", + @"XPathParserTest", + @"XMLReaderTest", + @"TDXmlTokenizerTest", + @"TDArithmeticParserTest", + @"TDScientificNumberStateTest", + @"TDTokenArraySourceTest", + @"TDDifferenceTest", + @"TDNegationTest", + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + +SenTestSuite *TDParserFactoryTestSuite() { + SenTestSuite *suite = [SenTestSuite testSuiteWithName:@"ParserFactory Test Suite"]; + + NSArray *classNames = [NSArray arrayWithObjects: + @"TDParserFactoryTest", + @"TDParserFactoryTest2", + @"TDParserFactoryPatternTest", + @"TDMiniCSSAssemblerTest", + @"TDPredicateEvaluatorTest", + @"TDNSPredicateEvaluatorTest", + @"TDNSPredicateBuilderTest", + @"TDJavaScriptParserTest", + @"TDXMLParserTest", + @"XPathParserGrammarTest", + @"ERBTest", + @"TDParseTreeTest", + @"SAXTest", + nil]; + + [suite addSuitesForClassNames:classNames]; + return suite; +} + +@implementation SenTestSuite (TDAdditions) + ++ (id)testSuiteForBundlePath:(NSString *)path { + SenTestSuite *suite = nil; + +#if RUN_ALL_TEST_CASES + suite = [self defaultTestSuite]; +#else + suite = [self testSuiteWithName:@"My Tests"]; + // [suite addTest:TDCharsTestSuite()]; + // [suite addTest:TDTokensTestSuite()]; + // [suite addTest:TDParseTestSuite()]; + // [suite addTest:TDParserFactoryTestSuite()]; + [suite addTest:TDSoloTestSuite()]; +#endif + + return suite; +} + + +- (void)addSuitesForClassNames:(NSArray *)classNames { + for (NSString *className in classNames) { + SenTestSuite *suite = [SenTestSuite testSuiteForTestCaseWithName:className]; + [self addTest:suite]; + } +} + +@end \ No newline at end of file diff --git a/test/TDToken+Blob.h b/test/TDToken+Blob.h new file mode 100644 index 0000000..5e2a09a --- /dev/null +++ b/test/TDToken+Blob.h @@ -0,0 +1,16 @@ +// +// PKToken+Blob.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +extern const NSInteger PKTokenTypeBlob; + +@interface PKToken (Blob) +- (BOOL)isBlob; +@end + diff --git a/test/TDToken+Blob.m b/test/TDToken+Blob.m new file mode 100644 index 0000000..dea88e7 --- /dev/null +++ b/test/TDToken+Blob.m @@ -0,0 +1,20 @@ +// +// PKToken+Blob.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKToken+Blob.h" + +const NSInteger PKTokenTypeBlob = 200; + +@implementation PKToken (Blob) + +- (BOOL)isBlob { + return PKTokenTypeBlob == self.tokenType; +} + +@end + diff --git a/test/TDTokenArraySourceTest.h b/test/TDTokenArraySourceTest.h new file mode 100644 index 0000000..9542385 --- /dev/null +++ b/test/TDTokenArraySourceTest.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDTokenArraySourceTest : SenTestCase { + PKTokenizer *t; + NSString *d; + NSString *s; + PKTokenArraySource *tas; +} + +@end diff --git a/test/TDTokenArraySourceTest.m b/test/TDTokenArraySourceTest.m new file mode 100644 index 0000000..34f2910 --- /dev/null +++ b/test/TDTokenArraySourceTest.m @@ -0,0 +1,57 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTokenArraySourceTest.h" + +@implementation TDTokenArraySourceTest + +- (void)setUp { +} + + +- (void)testFoo { + d = @";"; + s = @"I came; I saw; I left in peace.;"; + t = [[[PKTokenizer alloc] initWithString:s] autorelease]; + tas = [[[PKTokenArraySource alloc] initWithTokenizer:t delimiter:d] autorelease]; + + TDTrue([tas hasMore]); + NSArray *a = [tas nextTokenArray]; + TDNotNil(a); + TDEquals((NSUInteger)2, [a count]); + TDEqualObjects(@"I", [[a objectAtIndex:0] stringValue]); + TDEqualObjects(@"came", [[a objectAtIndex:1] stringValue]); + + TDTrue([tas hasMore]); + a = [tas nextTokenArray]; + TDNotNil(a); + TDEquals((NSUInteger)2, [a count]); + TDEqualObjects(@"I", [[a objectAtIndex:0] stringValue]); + TDEqualObjects(@"saw", [[a objectAtIndex:1] stringValue]); + + TDTrue([tas hasMore]); + a = [tas nextTokenArray]; + TDNotNil(a); + TDEquals((NSUInteger)5, [a count]); + TDEqualObjects(@"I", [[a objectAtIndex:0] stringValue]); + TDEqualObjects(@"left", [[a objectAtIndex:1] stringValue]); + TDEqualObjects(@"in", [[a objectAtIndex:2] stringValue]); + TDEqualObjects(@"peace", [[a objectAtIndex:3] stringValue]); + TDEqualObjects(@".", [[a objectAtIndex:4] stringValue]); + + TDFalse([tas hasMore]); + a = [tas nextTokenArray]; + TDNil(a); +} +@end diff --git a/test/TDTokenAssemblyTest.h b/test/TDTokenAssemblyTest.h new file mode 100644 index 0000000..d669cb9 --- /dev/null +++ b/test/TDTokenAssemblyTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDTokenAssemblyTest : SenTestCase { + PKAssembly *a; + NSString *s; + PKParser *p; +} + +@end diff --git a/test/TDTokenAssemblyTest.m b/test/TDTokenAssemblyTest.m new file mode 100644 index 0000000..1d78e9a --- /dev/null +++ b/test/TDTokenAssemblyTest.m @@ -0,0 +1,298 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTokenAssemblyTest.h" + +@interface PKAssembly () +- (id)next; +- (BOOL)hasMore; +@property (nonatomic, readonly) NSUInteger length; +@property (nonatomic, readonly) NSUInteger objectsConsumed; +@property (nonatomic, readonly) NSUInteger objectsRemaining; +@end + +@implementation TDTokenAssemblyTest + +- (void)setUp { +} + + +- (void)tearDown { + [p release]; +} + + +#pragma mark - + +- (void)testWordOhSpaceHaiExclamation { + s = @"oh hai!"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)3, [a length]); + + TDEquals((NSUInteger)0, a.objectsConsumed); + TDEquals((NSUInteger)3, a.objectsRemaining); + TDEqualObjects(@"[]^oh/hai/!", [a description]); + TDTrue([a hasMore]); + TDEqualObjects(@"oh", [[a next] stringValue]); + + TDEquals((NSUInteger)1, a.objectsConsumed); + TDEquals((NSUInteger)2, a.objectsRemaining); + TDEqualObjects(@"[]oh^hai/!", [a description]); + TDTrue([a hasMore]); + TDEqualObjects(@"hai", [[a next] stringValue]); + + TDEquals((NSUInteger)2, a.objectsConsumed); + TDEquals((NSUInteger)1, a.objectsRemaining); + TDEqualObjects(@"[]oh/hai^!", [a description]); + TDTrue([a hasMore]); + TDEqualObjects(@"!", [[a next] stringValue]); + + TDEquals((NSUInteger)3, a.objectsConsumed); + TDEquals((NSUInteger)0, a.objectsRemaining); + TDEqualObjects(@"[]oh/hai/!^", [a description]); + TDFalse([a hasMore]); + TDNil([[a next] stringValue]); + + TDEquals((NSUInteger)3, a.objectsConsumed); + TDEquals((NSUInteger)0, a.objectsRemaining); + TDEqualObjects(@"[]oh/hai/!^", [a description]); + TDFalse([a hasMore]); + TDNil([[a next] stringValue]); + + TDEquals((NSUInteger)3, [a length]); +} + + +- (void)testBestMatchForWordFoobar { + s = @"foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^foobar", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[foobar]foobar^", [result description]); + TDFalse(result == a); + + + result = [p bestMatchFor:result]; + TDNil(result); +} + + +- (void)testCompleteMatchForWordFoobar { + s = @"foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^foobar", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDEqualObjects(@"[foobar]foobar^", [result description]); + TDFalse(result == a); +} + + +- (void)testBestMatchForWordFooSpaceBar { + s = @"foo bar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^foo/bar", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[foo]foo^bar", [result description]); + TDFalse(result == a); +} + + +- (void)testCompleteMatchForWordFooSpaceBar { + s = @"foo bar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^foo/bar", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testBestMatchForNumFoobar { + s = @"foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^foobar", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDNil(result); +} + + +- (void)testCompleteMatchForNumFoobar { + s = @"foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^foobar", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testBestMatchForWord123 { + s = @"123"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^123", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDNil(result); +} + + +- (void)testCompleteMatchForWord123 { + s = @"123"; + a = [PKTokenAssembly assemblyWithString:s]; + + + p = [[PKWord alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^123", [a description]); +} + + +- (void)testBestMatchForNum123 { + s = @"123"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^123", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[123]123^", [result description]); + TDFalse(result == a); +} + + +- (void)testCompleteMatchForNum123 { + s = @"123"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)1, [a length]); + TDEqualObjects(@"[]^123", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[123]123^", [result description]); + TDFalse(result == a); +} + + +- (void)testBestMatchForNum123Space456 { + s = @"123 456"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^123/456", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[123]123^456", [result description]); + TDFalse(result == a); +} + + +- (void)testCompleteMatchForNum123Space456 { + s = @"123 456"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^123/456", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testBestMatchForWordFoobarSpace123 { + s = @"foobar 123"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^foobar/123", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[foobar]foobar^123", [result description]); + TDFalse(result == a); +} + + +- (void)testCompleteMatchForWordFoobarSpace123 { + s = @"foobar 123"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)2, [a length]); + TDEqualObjects(@"[]^foobar/123", [a description]); + + p = [[PKWord alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + + +- (void)testBestMatchForNum123Space456Foobar { + s = @"123 456 foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)3, [a length]); + TDEqualObjects(@"[]^123/456/foobar", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p bestMatchFor:a]; + TDEqualObjects(@"[123]123^456/foobar", [result description]); + TDFalse(result == a); +} + + +- (void)testCompleteMatchForNum123Space456Foobar { + s = @"123 456 foobar"; + a = [PKTokenAssembly assemblyWithString:s]; + + TDEquals((NSUInteger)3, [a length]); + TDEqualObjects(@"[]^123/456/foobar", [a description]); + + p = [[PKNumber alloc] init]; + PKAssembly *result = [p completeMatchFor:a]; + TDNil(result); +} + +@end + diff --git a/test/TDTokenTest.h b/test/TDTokenTest.h new file mode 100644 index 0000000..017ac8a --- /dev/null +++ b/test/TDTokenTest.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDTokenTest : SenTestCase { + PKToken *eof; +} + +@end diff --git a/test/TDTokenTest.m b/test/TDTokenTest.m new file mode 100644 index 0000000..0f3ba00 --- /dev/null +++ b/test/TDTokenTest.m @@ -0,0 +1,94 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTokenTest.h" + +@implementation TDTokenTest + +- (void)setUp { + eof = [PKToken EOFToken]; +} + + +- (void)testEOFTokenReleaseOnce1 { + TDNotNil(eof); + [eof release]; +} + + +- (void)testEOFTokenReleaseOnce2 { + TDNotNil(eof); + [eof release]; +} + + +- (void)testEOFTokenReleaseTwice1 { + TDNotNil(eof); + [eof release]; + TDNotNil(eof); + [eof release]; +} + + +- (void)testEOFTokenReleaseTwice2 { + TDNotNil(eof); + [eof release]; + TDNotNil(eof); + [eof release]; +} + + +- (void)testEOFTokenAutoreleaseOnce1 { + TDNotNil(eof); + [eof autorelease]; +} + + +- (void)testEOFTokenAutoreleaseOnce2 { + TDNotNil(eof); + [eof autorelease]; +} + + +- (void)testEOFTokenAutoreleaseTwice1 { + TDNotNil(eof); + [eof autorelease]; + TDNotNil(eof); + [eof autorelease]; +} + + +- (void)testEOFTokenAutoreleaseTwice2 { + TDNotNil(eof); + [eof autorelease]; + TDNotNil(eof); + [eof autorelease]; +} + + +- (void)testEOFTokenRetainCount { + TDTrue([eof retainCount] >= 17035104); + // NO IDEA WHY THIS WONT PASS + //TDEquals(UINT_MAX, [eof retainCount]); /*17035104 4294967295*/ +// TDEqualObjects([NSNumber numberWithUnsignedInt:4294967295], [NSNumber numberWithUnsignedInt:[eof retainCount]]); +} + + +- (void)testCopyIdentity { + id copy = [eof copy]; + TDTrue(copy == eof); + [copy release]; // appease clang sa +} + +@end diff --git a/test/TDTokenizer+BlobState.h b/test/TDTokenizer+BlobState.h new file mode 100644 index 0000000..fa2d019 --- /dev/null +++ b/test/TDTokenizer+BlobState.h @@ -0,0 +1,15 @@ +// +// PKTokenizer+BlobState.h +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import + +@class TDBlobState; + +@interface PKTokenizer (BlobState) +- (TDBlobState *)blobState; +@end diff --git a/test/TDTokenizer+BlobState.m b/test/TDTokenizer+BlobState.m new file mode 100644 index 0000000..f880358 --- /dev/null +++ b/test/TDTokenizer+BlobState.m @@ -0,0 +1,36 @@ +// +// PKTokenizer+BlobState.m +// ParseKit +// +// Created by Todd Ditchendorf on 6/7/09. +// Copyright 2009 Todd Ditchendorf. All rights reserved. +// + +#import "PKTokenizer+BlobState.h" +#import "TDBlobState.h" + +static NSMutableDictionary *sBlobCache = nil; + +@implementation PKTokenizer (BlobState) + +- (TDBlobState *)blobState { + TDBlobState *bs = nil; + + @synchronized (self) { + if (!sBlobCache) { + sBlobCache = [[NSMutableDictionary alloc] init]; + } + + NSString *key = [NSString stringWithFormat:@"%p", self]; + bs = [sBlobCache objectForKey:key]; + + if (!bs) { + bs = [[[TDBlobState alloc] init] autorelease]; + [sBlobCache setObject:bs forKey:key]; + } + } + + return bs; +} + +@end diff --git a/test/TDTokenizerBlocksTest.h b/test/TDTokenizerBlocksTest.h new file mode 100644 index 0000000..9b695bb --- /dev/null +++ b/test/TDTokenizerBlocksTest.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@class PKTokenizer; + +@interface TDTokenizerBlocksTest : SenTestCase { + PKTokenizer *t; + NSString *s; +} + +@end diff --git a/test/TDTokenizerBlocksTest.m b/test/TDTokenizerBlocksTest.m new file mode 100644 index 0000000..13df4f4 --- /dev/null +++ b/test/TDTokenizerBlocksTest.m @@ -0,0 +1,44 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTokenizerBlocksTest.h" + +@implementation TDTokenizerBlocksTest + +- (void)setUp { +} + + +- (void)tearDown { +} + + +#ifdef TARGET_OS_SNOW_LEOPARD +- (void)testBlastOff { + s = @"\"It's 123 blast-off!\", she said, // watch out!\n" + @"and <= 3 'ticks' later /* wince */, it's blast-off!"; + t = [PKTokenizer tokenizerWithString:s]; + + NSLog(@"\n\n starting!!! \n\n"); + + [t enumerateTokensUsingBlock:^(PKToken *tok, BOOL *stop) { + NSLog(@"(%@)", tok.stringValue); + }]; + + + NSLog(@"\n\n done!!! \n\n"); +} +#endif + +@end diff --git a/test/TDTokenizerStateTest.h b/test/TDTokenizerStateTest.h new file mode 100644 index 0000000..368a931 --- /dev/null +++ b/test/TDTokenizerStateTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDTokenizerStateTest : SenTestCase { + PKTokenizer *t; + NSString *s; + PKToken *tok; +} + +@end diff --git a/test/TDTokenizerStateTest.m b/test/TDTokenizerStateTest.m new file mode 100644 index 0000000..d1f9699 --- /dev/null +++ b/test/TDTokenizerStateTest.m @@ -0,0 +1,178 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTokenizerStateTest.h" + +@implementation TDTokenizerStateTest + +- (void)setUp { + t = [[PKTokenizer alloc] init]; +} + + +- (void)tearDown { + [t release]; +} + + +- (void)testFallbackStateCast { + [t setTokenizerState:t.symbolState from:'c' to:'c']; + [t.symbolState setFallbackState:t.wordState from:'c' to:'c']; + [t.symbolState add:@"cast"]; + + t.string = @"foo cast cat"; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"cast", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"c", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"at", tok.stringValue); + + tok = [t nextToken]; + TDEqualObjects(nil, tok.stringValue); + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testFallbackStateCastAs { + [t setTokenizerState:t.symbolState from:'c' to:'c']; + [t.symbolState setFallbackState:t.wordState from:'c' to:'c']; + [t.symbolState add:@"cast as"]; + + t.string = @"foo cast as cat"; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"cast as", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"c", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"at", tok.stringValue); + + tok = [t nextToken]; + TDEqualObjects(nil, tok.stringValue); + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testTrickyFwdSlash { + [t.delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:nil]; + + [t setTokenizerState:t.commentState from:'#' to:'#']; + [t setTokenizerState:t.commentState from:'/' to:'/']; + + [t.commentState addSingleLineStartMarker:@"##"]; + [t.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + t.commentState.fallbackState = t.symbolState; + [t.commentState setFallbackState:t.delimitState from:'/' to:'/']; + + t.string = @"foo /bar/ /*## */ # baz ## ja"; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(@"/bar/", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"#", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"baz", tok.stringValue); + + tok = [t nextToken]; + TDEqualObjects(nil, tok.stringValue); + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testTrickyFwdSlash2 { + [t.delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:nil]; + + [t setTokenizerState:t.commentState from:'#' to:'#']; + [t setTokenizerState:t.commentState from:'/' to:'/']; + + [t.commentState addSingleLineStartMarker:@"##"]; + [t.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + t.commentState.fallbackState = t.symbolState; + [t.commentState setFallbackState:t.delimitState from:'/' to:'/']; + + t.string = @"## ja"; + + tok = [t nextToken]; + TDEqualObjects(nil, tok.stringValue); + TDTrue([PKToken EOFToken] == tok); +} + + +- (void)testTrickyFwdSlash3 { + [t.delimitState addStartMarker:@"/" endMarker:@"/" allowedCharacterSet:nil]; + + [t setTokenizerState:t.commentState from:'#' to:'#']; + [t setTokenizerState:t.commentState from:'/' to:'/']; + + [t.commentState addSingleLineStartMarker:@"##"]; + [t.commentState addMultiLineStartMarker:@"/*" endMarker:@"*/"]; + + t.commentState.fallbackState = t.delimitState; + [t.commentState setFallbackState:t.symbolState from:'#' to:'#']; + + t.string = @"foo /bar/ /*## */ # baz ## ja"; + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"foo", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isDelimitedString); + TDEqualObjects(@"/bar/", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(@"#", tok.stringValue); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(@"baz", tok.stringValue); + + tok = [t nextToken]; + TDEqualObjects(nil, tok.stringValue); + TDTrue([PKToken EOFToken] == tok); +} + +@end diff --git a/test/TDTokenizerTest.h b/test/TDTokenizerTest.h new file mode 100644 index 0000000..bdd2c38 --- /dev/null +++ b/test/TDTokenizerTest.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@class PKTokenizer; + +@interface TDTokenizerTest : SenTestCase { + PKTokenizer *t; + NSString *s; +} + +@end diff --git a/test/TDTokenizerTest.m b/test/TDTokenizerTest.m new file mode 100644 index 0000000..a168834 --- /dev/null +++ b/test/TDTokenizerTest.m @@ -0,0 +1,627 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTokenizerTest.h" +#import "ParseKit.h" + +@implementation TDTokenizerTest + +- (void)setUp { +} + + +- (void)tearDown { +} + + +- (void)testBlastOff { + s = @"\"It's 123 blast-off!\", she said, // watch out!\n" + @"and <= 3 'ticks' later /* wince */, it's blast-off!"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + //NSLog(@"\n\n starting!!! \n\n"); + while ((tok = [t nextToken]) != eof) { + //NSLog(@"(%@)", tok.stringValue); + } + //NSLog(@"\n\n done!!! \n\n"); + +} + +- (void)testStuff { + s = @"2 != 47. Blast-off!! 'Woo-hoo!'"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + while ((tok = [t nextToken]) != eof) { + //NSLog(@"(%@) (%.1f) : %@", tok.stringValue, tok.floatValue, [tok debugDescription]); + } +} + + +- (void)testStuff2 { + s = @"2 != 47. Blast-off!! 'Woo-hoo!'"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"2"); + TDEqualObjects(tok.value, [NSNumber numberWithFloat:2.0]); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"!="); + TDEqualObjects(tok.value, @"!="); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"47"); + TDEqualObjects(tok.value, [NSNumber numberWithFloat:47.0]); + TDEquals(tok.offset, (NSUInteger)5); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"."); + TDEqualObjects(tok.value, @"."); + TDEquals(tok.offset, (NSUInteger)7); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"Blast-off"); + TDEqualObjects(tok.value, @"Blast-off"); + TDEquals(tok.offset, (NSUInteger)9); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"!"); + TDEqualObjects(tok.value, @"!"); + TDEquals(tok.offset, (NSUInteger)18); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"!"); + TDEqualObjects(tok.value, @"!"); + TDEquals(tok.offset, (NSUInteger)19); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isQuotedString); + TDEqualObjects(tok.stringValue, @"'Woo-hoo!'"); + TDEqualObjects(tok.value, @"'Woo-hoo!'"); + TDEquals(tok.offset, (NSUInteger)21); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok == eof); + TDEquals(tok.offset, (NSUInteger)PKEOF); +} + + +- (void)testFortySevenDot { + s = @"47."; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"47"); + TDEqualObjects(tok.value, [NSNumber numberWithFloat:47.0]); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"."); + TDEqualObjects(tok.value, @"."); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok == eof); + TDEquals(tok.offset, (NSUInteger)PKEOF); +} + + +- (void)testFortySevenDotSpaceFoo { + s = @"47. foo"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"47"); + TDEqualObjects(tok.value, [NSNumber numberWithFloat:47.0]); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"."); + TDEqualObjects(tok.value, @"."); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok != eof); + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"foo"); + TDEqualObjects(tok.value, @"foo"); + TDEquals(tok.offset, (NSUInteger)4); + + tok = [t nextToken]; + TDNotNil(tok); + TDTrue(tok == eof); + TDEquals(tok.offset, (NSUInteger)PKEOF); +} + + +- (void)testDotOne { + s = @" .999"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + STAssertEqualsWithAccuracy((CGFloat)0.999, tok.floatValue, 0.01, @""); + TDTrue(tok.isNumber); + TDEquals(tok.offset, (NSUInteger)3); + +// if ([PKToken EOFToken] == token) break; + +} + + +- (void)testSpaceDotSpace { + s = @" . "; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDEqualObjects(@".", tok.stringValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)1); + + // if ([PKToken EOFToken] == token) break; + +} + + +- (void)testInitSig { + s = @"- (id)init {"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDEqualObjects(@"-", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(@"(", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)2); +} + + +- (void)testInitSig2 { + s = @"-(id)init {"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDEqualObjects(@"-", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(@"(", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)1); +} + + +- (void)testMinusSpaceTwo { + s = @"- 2"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDEqualObjects(@"-", tok.stringValue); + TDEquals((CGFloat)0.0, tok.floatValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(@"2", tok.stringValue); + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEquals(tok.offset, (NSUInteger)2); +} + + +- (void)testMinusPlusTwo { + s = @"+2"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDEqualObjects(@"+", tok.stringValue); + TDTrue(tok.isSymbol); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"2", tok.stringValue); + TDEquals(tok.offset, (NSUInteger)1); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testMinusPlusTwoCustom { + s = @"+2"; + t = [PKTokenizer tokenizerWithString:s]; + [t setTokenizerState:t.numberState from:'+' to:'+']; + + PKToken *tok = [t nextToken]; + TDEquals((CGFloat)2.0, tok.floatValue); + TDTrue(tok.isNumber); + TDEqualObjects(@"+2", tok.stringValue); + TDEquals(tok.offset, (NSUInteger)0); + + TDEquals([PKToken EOFToken], [t nextToken]); +} + + +- (void)testSimpleAPIUsage { + s = @". , () 12.33333 .:= .456\n\n>=< 'boooo'fasa this should /* not*/ appear \r /*but */this should >==<"]; + + NSMutableArray *toks = [NSMutableArray array]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *token = nil; + while (token = [t nextToken]) { + if (eof == token) break; + + [toks addObject:token]; + + } + + //NSLog(@"\n\n\n\ntoks: %@\n\n\n\n", toks); +} + + +- (void)testKatakana1 { + s = @"ア"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = [t nextToken]; + + TDNotNil(tok); + TDTrue(tok.isWord); + TDEqualObjects(s, tok.stringValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(eof, tok); +} + + +- (void)testKatakana2 { + s = @"アア"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = [t nextToken]; + + TDNotNil(tok); + TDTrue(tok.isWord); + TDEqualObjects(s, tok.stringValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(eof, tok); +} + + +- (void)testKatakana3 { + s = @"アェ"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = [t nextToken]; + + TDNotNil(tok); + TDTrue(tok.isWord); + TDEqualObjects(s, tok.stringValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDEqualObjects(eof, tok); +} + + +- (void)testParenStuff { + s = @"-(ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)4); + + tok = [t nextToken]; + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"5"); + TDEquals((CGFloat)5.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)5); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @")"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)6); +} + + +- (void)testParenStuff2 { + s = @"- (ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"-"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)3); +} + + +- (void)testParenStuff3 { + s = @"+(ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)4); + + tok = [t nextToken]; + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"5"); + TDEquals((CGFloat)5.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)5); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @")"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)6); +} + + +- (void)testParenStuff4 { + s = @"+ (ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)3); +} + + +- (void)testParenStuff5 { + s = @".(ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"."); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"+"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)4); + + tok = [t nextToken]; + TDTrue(tok.isNumber); + TDEqualObjects(tok.stringValue, @"5"); + TDEquals((CGFloat)5.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)5); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @")"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)6); +} + + +- (void)testParenStuff6 { + s = @". (ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + t.whitespaceState.reportsWhitespaceTokens = YES; + + PKToken *tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"."); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)0); + + tok = [t nextToken]; + TDTrue(tok.isWhitespace); + TDEqualObjects(tok.stringValue, @" "); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)1); + + tok = [t nextToken]; + TDTrue(tok.isSymbol); + TDEqualObjects(tok.stringValue, @"("); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)2); + + tok = [t nextToken]; + TDTrue(tok.isWord); + TDEqualObjects(tok.stringValue, @"ab"); + TDEquals((CGFloat)0.0, tok.floatValue); + TDEquals(tok.offset, (NSUInteger)3); +} + + +- (void)testParenStuff7 { + s = @"-(ab+5)"; + t = [PKTokenizer tokenizerWithString:s]; + + NSMutableString *final = [NSMutableString string]; + + PKToken *eof = [PKToken EOFToken]; + PKToken *tok = nil; + while ((tok = [t nextToken]) != eof) { + [final appendString:[tok stringValue]]; + } + + TDNotNil(tok); + TDEqualObjects(final, s); + TDEqualObjects(eof, [t nextToken]); +} + +@end diff --git a/test/TDTrackTest.h b/test/TDTrackTest.h new file mode 100644 index 0000000..25ae2bb --- /dev/null +++ b/test/TDTrackTest.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDTrackTest : SenTestCase { + +} + +@end diff --git a/test/TDTrackTest.m b/test/TDTrackTest.m new file mode 100644 index 0000000..a080845 --- /dev/null +++ b/test/TDTrackTest.m @@ -0,0 +1,118 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTrackTest.h" +#import "ParseKit.h" + + +@implementation TDTrackTest + +// list = '(' contents ')' +// contents = empty | actualList +// actualList = Word (',' Word)* + + +- (PKParser *)listParser { + PKTrack *commaWord = [PKTrack track]; + [commaWord add:[[PKSymbol symbolWithString:@","] discard]]; + [commaWord add:[PKWord word]]; + + PKSequence *actualList = [PKSequence sequence]; + [actualList add:[PKWord word]]; + [actualList add:[PKRepetition repetitionWithSubparser:commaWord]]; + + PKAlternation *contents = [PKAlternation alternation]; + [contents add:[PKEmpty empty]]; + [contents add:actualList]; + + PKTrack *list = [PKTrack track]; + [list add:[[PKSymbol symbolWithString:@"("] discard]]; + [list add:contents]; + [list add:[[PKSymbol symbolWithString:@")"] discard]]; + + return list; +} + + +#ifndef TARGET_CPU_X86_64 +- (void)testTrack { + + PKParser *list = [self listParser]; + + NSArray *test = [NSArray arrayWithObjects: + @"()", + @"(pilfer)", + @"(pilfer, pinch)", + @"(pilfer, pinch, purloin)", + @"(pilfer, pinch,, purloin)", + @"(", + @"(pilfer", + @"(pilfer, ", + @"(, pinch, purloin)", + @"pilfer, pinch", + nil]; + + for (NSString *s in test) { + //NSLog(@"\n----testing: %@", s); + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + @try { + PKAssembly *result = [list completeMatchFor:a]; + if (!result) { + //NSLog(@"[list completeMatchFor:] returns nil"); + } else { + //NSString *stack = [[[list completeMatchFor:a] stack] description]; + //NSLog(@"OK stack is: %@", stack); + } + } @catch (PKTrackException *e) { + //NSLog(@"\n\n%@\n\n", [e reason]); + } + } + +} + + +- (void)testMissingParen { + PKParser *open = [PKSymbol symbolWithString:@"("]; + PKParser *close = [PKSymbol symbolWithString:@")"]; + PKTrack *track = [PKTrack trackWithSubparsers:open, close, nil]; + + PKAssembly *a = [PKTokenAssembly assemblyWithString:@"("]; + STAssertThrowsSpecificNamed([track completeMatchFor:a], PKTrackException, PKTrackExceptionName, @""); + + @try { + [track completeMatchFor:a]; + STAssertTrue(0, @"Should not be reached"); + } @catch (PKTrackException *e) { + TDEqualObjects([e class], [PKTrackException class]); + TDEqualObjects([e name], PKTrackExceptionName); + + NSDictionary *userInfo = e.userInfo; + TDNotNil(userInfo); + + NSString *after = [userInfo objectForKey:@"after"]; + NSString *expected = [userInfo objectForKey:@"expected"]; + NSString *found = [userInfo objectForKey:@"found"]; + + TDNotNil(after); + TDNotNil(expected); + TDNotNil(found); + + TDEqualObjects(after, @"("); + TDEqualObjects(expected, @"Symbol )"); + TDEqualObjects(found, @"-nothing-"); + } +} +#endif + +@end diff --git a/test/TDUppercaseWordTest.h b/test/TDUppercaseWordTest.h new file mode 100644 index 0000000..1092cf5 --- /dev/null +++ b/test/TDUppercaseWordTest.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDUppercaseWordTest : SenTestCase { + +} + +@end diff --git a/test/TDUppercaseWordTest.m b/test/TDUppercaseWordTest.m new file mode 100644 index 0000000..04fcc94 --- /dev/null +++ b/test/TDUppercaseWordTest.m @@ -0,0 +1,64 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDUppercaseWordTest.h" +#import "ParseKit.h" + +@implementation TDUppercaseWordTest + +- (void)testFoobar { + NSString *s = @"Foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKUppercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNotNil(result); + TDEqualObjects(@"[Foobar]Foobar^", [result description]); +} + + +- (void)testfoobar { + NSString *s = @"foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKUppercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + + +- (void)test123 { + NSString *s = @"123"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKUppercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + + +- (void)testPercentFoobar { + NSString *s = @"%Foobar"; + PKAssembly *a = [PKTokenAssembly assemblyWithString:s]; + + PKParser *p = [PKUppercaseWord word]; + PKAssembly *result = [p completeMatchFor:a]; + + TDNil(result); +} + +@end diff --git a/test/TDWhitespaceStateTest.h b/test/TDWhitespaceStateTest.h new file mode 100644 index 0000000..f935871 --- /dev/null +++ b/test/TDWhitespaceStateTest.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDWhitespaceStateTest : SenTestCase { + PKWhitespaceState *whitespaceState; + PKReader *r; + NSString *s; +} +@end diff --git a/test/TDWhitespaceStateTest.m b/test/TDWhitespaceStateTest.m new file mode 100644 index 0000000..e21e429 --- /dev/null +++ b/test/TDWhitespaceStateTest.m @@ -0,0 +1,330 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDWhitespaceStateTest.h" + + +@implementation TDWhitespaceStateTest + +- (void)setUp { + whitespaceState = [[PKWhitespaceState alloc] init]; +} + + +- (void)tearDown { + [whitespaceState release]; + [r release]; +} + + +- (void)testSpace { + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testTwoSpaces { + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testNil { + s = nil; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testNull { + s = NULL; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testEmptyString { + s = @""; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testTab { + s = @"\t"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testNewLine { + s = @"\n"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testCarriageReturn { + s = @"\r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSpaceCarriageReturn { + s = @" \r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSpaceTabNewLineSpace { + s = @" \t\n "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSpaceA { + s = @" a"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + +- (void)testSpaceASpace { + s = @" a "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testTabA { + s = @"\ta"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testNewLineA { + s = @"\na"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testCarriageReturnA { + s = @"\ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testNewLineSpaceCarriageReturnA { + s = @"\n \ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNil(tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +#pragma mark - +#pragma mark Significant + +- (void)testSignificantSpace { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantTwoSpaces { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantEmptyString { + whitespaceState.reportsWhitespaceTokens = YES; + s = @""; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantTab { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\t"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantNewLine { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\n"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantCarriageReturn { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantSpaceCarriageReturn { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" \r"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantSpaceTabNewLineSpace { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" \t\n "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(s, tok.stringValue); + TDEquals(PKEOF, [r read]); +} + + +- (void)testSignificantSpaceA { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" a"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@" ", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSignificantSpaceASpace { + whitespaceState.reportsWhitespaceTokens = YES; + s = @" a "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@" ", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSignificantTabA { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\ta"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@"\t", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSignificantNewLineA { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\na"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@"\n", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSignificantCarriageReturnA { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@"\r", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + + +- (void)testSignificantNewLineSpaceCarriageReturnA { + whitespaceState.reportsWhitespaceTokens = YES; + s = @"\n \ra"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [whitespaceState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDNotNil(tok); + TDEqualObjects(@"\n \r", tok.stringValue); + TDEquals((PKUniChar)'a', [r read]); +} + +@end \ No newline at end of file diff --git a/test/TDWordOrReservedState.h b/test/TDWordOrReservedState.h new file mode 100644 index 0000000..19cea58 --- /dev/null +++ b/test/TDWordOrReservedState.h @@ -0,0 +1,31 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +#import + +/*! + @class TDWordOrReservedState + @brief Override PKWordState to return known reserved words as tokens of type TDTT_RESERVED. +*/ +@interface TDWordOrReservedState : PKWordState { + NSMutableSet *reservedWords; +} + +/*! + @brief Adds the specified string as a known reserved word. + @param s reserved word to add +*/ +- (void)addReservedWord:(NSString *)s; +@end diff --git a/test/TDWordOrReservedState.m b/test/TDWordOrReservedState.m new file mode 100644 index 0000000..b8ead74 --- /dev/null +++ b/test/TDWordOrReservedState.m @@ -0,0 +1,48 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface TDWordOrReservedState () +@property (nonatomic, retain) NSMutableSet *reservedWords; +@end + +@implementation TDWordOrReservedState + +- (id)init { + if (self = [super init]) { + self.reservedWords = [NSMutableSet set]; + } + return self; +} + + +- (void)dealloc { + self.reservedWords = nil; + [super dealloc]; +} + + +- (void)addReservedWord:(NSString *)s { + [reservedWords addObject:s]; +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + NSParameterAssert(r); + return nil; +} + +@synthesize reservedWords; +@end diff --git a/test/TDWordStateTest.h b/test/TDWordStateTest.h new file mode 100644 index 0000000..2e72a4a --- /dev/null +++ b/test/TDWordStateTest.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDWordStateTest : SenTestCase { + PKWordState *wordState; + PKReader *r; + NSString *s; +} +@end diff --git a/test/TDWordStateTest.m b/test/TDWordStateTest.m new file mode 100644 index 0000000..c751994 --- /dev/null +++ b/test/TDWordStateTest.m @@ -0,0 +1,118 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDWordStateTest.h" + + +@implementation TDWordStateTest + +- (void)setUp { + wordState = [[PKWordState alloc] init]; +} + + +- (void)tearDown { + [wordState release]; + [r release]; +} + + +- (void)testA { + s = @"a"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"a", tok.stringValue); + TDEqualObjects(@"a", tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testASpace { + s = @"a "; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(@"a", tok.stringValue); + TDEqualObjects(@"a", tok.value); + TDTrue(tok.isWord); + TDEquals((PKUniChar)' ', [r read]); +} + + +- (void)testAb { + s = @"ab"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testAbc { + s = @"abc"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testItApostropheS { + s = @"it's"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testTwentyDashFive { + s = @"twenty-five"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testTwentyUnderscoreFive { + s = @"twenty_five"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + + +- (void)testNumber1 { + s = @"number1"; + r = [[PKReader alloc] initWithString:s]; + PKToken *tok = [wordState nextTokenFromReader:r startingWith:[r read] tokenizer:nil]; + TDEqualObjects(s, tok.stringValue); + TDEqualObjects(s, tok.value); + TDTrue(tok.isWord); + TDEquals(PKEOF, [r read]); +} + +@end diff --git a/test/TDXMLParser.h b/test/TDXMLParser.h new file mode 100644 index 0000000..f1d3221 --- /dev/null +++ b/test/TDXMLParser.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface TDXMLParser : NSObject { + +} + +@end diff --git a/test/TDXMLParser.m b/test/TDXMLParser.m new file mode 100644 index 0000000..e1ba806 --- /dev/null +++ b/test/TDXMLParser.m @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXMLParser.h" + +@implementation TDXMLParser + + + +@end diff --git a/test/TDXMLParserTest.h b/test/TDXMLParserTest.h new file mode 100644 index 0000000..92cf2d5 --- /dev/null +++ b/test/TDXMLParserTest.h @@ -0,0 +1,27 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface TDXMLParserTest : SenTestCase { + NSString *s; + NSString *g; + PKParserFactory *factory; + PKTokenAssembly *a; + PKAssembly *res; + PKParser *p; + PKTokenizer *t; +} + +@end diff --git a/test/TDXMLParserTest.m b/test/TDXMLParserTest.m new file mode 100644 index 0000000..679f671 --- /dev/null +++ b/test/TDXMLParserTest.m @@ -0,0 +1,429 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXMLParserTest.h" + +@implementation TDXMLParserTest + +- (void)setUp { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"xml" ofType:@"grammar"]; + g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + factory = [PKParserFactory factory]; + p = [factory parserFromGrammar:g assembler:self]; + t = p.tokenizer; +} + + +- (void)testSTag { + PKParser *sTag = [p parserNamed:@"sTag"]; + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, , >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, \t, >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, \n , >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, , bar, =, 'baz', >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, , bar, =, 'baz', , baz, =, 'bat', >]^", [res description]); + + t.string = @""; + res = [sTag bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, , bar, =, 'baz', , baz, =, \t, 'bat', >]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + TDEqualObjects(@"[<, foo, />]^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, ]/^", [res description]); + + t.string = @" "; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, , ]/ /^", [res description]); + + t.string = @"&bar;"; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &, bar, ;, ]/&/bar/;/^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#, 20, ;, ]/&#/20/;/^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, ]/&#x/FF20/;/^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , ]/&#x/FF20/;/ /^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, , ]//^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , ]/&#x/FF20/;//^", [res description]); + + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , , ]/&#x/FF20/;/ //^", [res description]); +} + + +- (void)testSmallSTagGrammar { + g = @"@delimitState='<';@reportsWhitespaceTokens=YES;@start=sTag;sTag='<' name (S attribute)* S? '>';name=/[^-:\\.]\\w+/;attribute=name eq attValue;eq=S? '=' S?;attValue=QuotedString;"; + PKParser *sTag = [factory parserFromGrammar:g assembler:nil]; + t = sTag.tokenizer; + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [sTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, >]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [sTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, , >]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [sTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, \n, >]^", [res description]); + + t.string = @"< foo>"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [sTag bestMatchFor:a]; + TDNil(res); +} + + +- (void)testSmallETagGrammar { + g = @"@symbols = '&#' '&#x' '' '' nil; @delimitedString='' nil; @delimitedString='' nil;" + @"@reportsWhitespaceTokens = YES;" + @"@start = eTag;" + @"eTag='';" + @"name=/[^-:\\.]\\w+/;"; + + PKParser *eTag = [factory parserFromGrammar:g assembler:nil]; + t = eTag.tokenizer; + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eTag bestMatchFor:a]; + TDEqualObjects(@"[]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eTag bestMatchFor:a]; + TDEqualObjects(@"[]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eTag bestMatchFor:a]; + TDNil(res); + + t.string = @"< /foo>"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [eTag bestMatchFor:a]; + TDNil(res); +} + + +- (void)testETag { + t.string = @""; + res = [[p parserNamed:@"eTag"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); +} + + +- (void)test1 { + t.string = @""; + res = [[p parserNamed:@"element"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, ]/^", [res description]); + + t.string = @""; + res = [[p parserNamed:@"emptyElemTag"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, />]^", [res description]); +} + + +- (void)testSmallEmptyElemTagGrammar { + g = @"@delimitState='<';@symbols='/>';@reportsWhitespaceTokens=YES;@start=emptyElemTag;emptyElemTag='<' name (S attribute)* S? '/>';name=/[^-:\\.]\\w+/;attribute=name eq attValue;eq=S? '=' S?;attValue=QuotedString;"; + PKParser *emptyElemTag = [factory parserFromGrammar:g assembler:nil]; + t = emptyElemTag.tokenizer; + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [emptyElemTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, />]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [emptyElemTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, , />]^", [res description]); + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [emptyElemTag bestMatchFor:a]; + TDEqualObjects(@"[<, foo, , bar, =, 'baz', />]^", [res description]); +} + + +- (void)testSmallCharDataGrammar { + g = @"@symbols = '&#' '&#x' '' '' nil '' nil '' nil;" + @"@reportsWhitespaceTokens = YES;" + @"@start = charData+;" + @"charData = /[^<\\&]+/ - (/[^\\]]*\\]\\]>[^<\\&]*/);"; + + PKParser *charData = [factory parserFromGrammar:g assembler:nil]; + t = charData.tokenizer; + + t.string = @" "; + res = [charData bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[ ] ^", [res description]); + + t.string = @"foo % 1"; + res = [charData bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo, , %, , 1]foo/ /%/ /1^", [res description]); + + t.string = @"foo & 1"; + res = [charData bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo, ]foo/ ^&/ /1", [res description]); +} + + +- (void)testSmallElementGrammar { + g = @"@symbols = '&#' '&#x' '' '' nil '' nil '' nil;" + @"@reportsWhitespaceTokens = YES;" + @"@start = element;" + @"element = emptyElemTag | sTag content eTag;" + @"eTag = '';" + @"sTag = '<' name (S attribute)* S? '>';" + @"emptyElemTag = '<' name (S attribute)* S? '/>';" + //@"content = Empty | (element | reference | cdSect | pi | comment | charData)+;" + @"content = Empty | (element | reference | cdSect | charData)+;" + @"name = /[^-:\\.]\\w+/;" + @"attribute = name eq attValue;" + @"eq=S? '=' S?;" + @"attValue = QuotedString;" + @"charData = /[^<\\&]+/ - (/[^\\]]*\\]\\]>[^<\\&]*/);" + @"reference = entityRef | charRef;" + @"entityRef = '&' name ';';" + @"charRef = '&#' /[0-9]+/ ';' | '&#x' /[0-9a-fA-F]+/ ';';" + @"cdSect = DelimitedString('');" + ; + + PKParser *element = [factory parserFromGrammar:g assembler:nil]; + t = element.tokenizer; + + t.string = @""; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [element bestMatchFor:a]; + TDEqualObjects(@"[<, foo, />]^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, ]/^", [res description]); + + t.string = @" "; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, , ]/ /^", [res description]); + + t.string = @"&bar;"; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &, bar, ;, ]/&/bar/;/^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#, 20, ;, ]/&#/20/;/^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, ]/&#x/FF20/;/^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , ]/&#x/FF20/;/ /^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, , ]//^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , ]/&#x/FF20/;//^", [res description]); + + t.string = @""; + res = [element bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[<, foo, >, &#x, FF20, ;, , , ]/&#x/FF20/;/ //^", [res description]); +} + + +// [1] +- (void)testDocument { + // xmlDecl = ''; + t.string = @""; + res = [[p parserNamed:@"document"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[, <, foo, >, ]//^", [res description]); + + // xmlDecl = ''; + t.string = @""; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[, <, foo, >, ]//^", [res description]); + + // xmlDecl = ''; + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"xml"]; + t.string = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + NSDate *d = [NSDate date]; + res = [p bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + NSLog(@"time: %d", [d timeIntervalSinceNow]); + TDNotNil(res); + TDTrue([[res description] hasSuffix:@"^"]); +} + + +// [2] +- (void)test { + +} + + +// [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) +// charData = /[^<\&]+/ - (/[^\]]*\]\]>[^<\&]*/); +- (void)testCharData { + t.string = @"foo"; + res = [[p parserNamed:@"charData"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[foo]foo^", [res description]); + + t.string = @"fo' +// comment = DelimitedString(''); +- (void)testComment { + t.string = @""; + res = [[p parserNamed:@"comment"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + + +} + + +// [16] PI ::= '' Char*)))? '?>' +// [17] PITarget ::= Name - (('X' | 'x') ('M' | 'm') ('L' | 'l')) +// pi = '/* '?>'; +// piTarget = name - /xml/i; + +- (void)testPI { + NSString *gram = + @"@reportsWhitespaceTokens=YES;" + @"@symbols='';" + @"@symbolState = '<';" + @"name=/[^-:\\.]\\w+/;" + @"piTarget = name - /xml/i;" + @"@wordState = ':' '.' '-' '_';" + @"@wordChars = ':' '.' '-' '_';" + @"pi = '/* '?>';" + @"@start = pi;"; + PKParser *pi = [[PKParserFactory factory] parserFromGrammar:gram assembler:nil]; + pi.tokenizer.string = @""; + res = [pi bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:pi.tokenizer]]; + TDEqualObjects(@"[]^", [res description]); + + t.string = @""; + res = [[p parserNamed:@"pi"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + + t.string = @""; + res = [[p parserNamed:@"pi"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + +} + + +// [23] XMLDecl ::= '' +// xmlDecl = ''; +- (void)testXmlDecl { +// versionNum = /(['"])1\.[0-9]\1/; +// versionInfo = S 'version' eq versionNum; + + t.string = @" version='1.0'"; + res = [[p parserNamed:@"versionInfo"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[ , version, =, '1.0'] /version/=/'1.0'^", [res description]); + + // encodingDecl = S 'encoding' eq QuotedString; # TODO + t.string = @" encoding='UTF-8'"; + res = [[p parserNamed:@"encodingDecl"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[ , encoding, =, 'UTF-8'] /encoding/=/'UTF-8'^", [res description]); + + // sdDecl = S 'standalone' eq QuotedString; # /(["'])(yes|no)\1/; # TODO + t.string = @" standalone='no'"; + res = [[p parserNamed:@"sdDecl"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[ , standalone, =, 'no'] /standalone/=/'no'^", [res description]); + + t.string = @"'; + t.string = @""; + res = [[p parserNamed:@"xmlDecl"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + + // xmlDecl = ''; + t.string = @""; + res = [[p parserNamed:@"xmlDecl"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + + // xmlDecl = ''; + t.string = @""; + res = [[p parserNamed:@"xmlDecl"] bestMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[]^", [res description]); + +} + + +@end diff --git a/test/TDXmlAttribute.h b/test/TDXmlAttribute.h new file mode 100644 index 0000000..4e11711 --- /dev/null +++ b/test/TDXmlAttribute.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlAttribute : TDXmlTerminal { + +} ++ (id)attribute; ++ (id)attributeWithString:(NSString *)s; +@end diff --git a/test/TDXmlAttribute.m b/test/TDXmlAttribute.m new file mode 100644 index 0000000..3258a9e --- /dev/null +++ b/test/TDXmlAttribute.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlAttribute.h" +#import "TDXmlToken.h" + +@implementation TDXmlAttribute + ++ (id)attribute { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)attributeWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_ATTRIBUTE stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isAttribute; + } +} + +@end diff --git a/test/TDXmlCdata.h b/test/TDXmlCdata.h new file mode 100644 index 0000000..7e6e1e6 --- /dev/null +++ b/test/TDXmlCdata.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlCdata : TDXmlTerminal { + +} ++ (id)cdata; ++ (id)cdataWithString:(NSString *)s; +@end diff --git a/test/TDXmlCdata.m b/test/TDXmlCdata.m new file mode 100644 index 0000000..397b425 --- /dev/null +++ b/test/TDXmlCdata.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlCdata.h" +#import "TDXmlToken.h" + +@implementation TDXmlCdata + ++ (id)cdata { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)cdataWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_CDATA stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isCdata; + } +} + +@end diff --git a/test/TDXmlComment.h b/test/TDXmlComment.h new file mode 100644 index 0000000..4988fac --- /dev/null +++ b/test/TDXmlComment.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlComment : TDXmlTerminal { + +} ++ (id)comment; ++ (id)commentWithString:(NSString *)s; +@end diff --git a/test/TDXmlComment.m b/test/TDXmlComment.m new file mode 100644 index 0000000..896da0d --- /dev/null +++ b/test/TDXmlComment.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlComment.h" +#import "TDXmlToken.h" + +@implementation TDXmlComment + ++ (id)comment { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)commentWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_COMMENT stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isComment; + } +} + +@end diff --git a/test/TDXmlDecl.h b/test/TDXmlDecl.h new file mode 100644 index 0000000..fefba57 --- /dev/null +++ b/test/TDXmlDecl.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlDecl : TDXmlTerminal { + +} ++ (id)xmlDecl; ++ (id)xmlDeclWithString:(NSString *)s; +@end diff --git a/test/TDXmlDecl.m b/test/TDXmlDecl.m new file mode 100644 index 0000000..cefd291 --- /dev/null +++ b/test/TDXmlDecl.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlDecl.h" +#import "TDXmlToken.h" + +@implementation TDXmlDecl + ++ (id)xmlDecl { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)xmlDeclWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_XML_DECL stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isXmlDecl; + } +} + +@end diff --git a/test/TDXmlDoctype.h b/test/TDXmlDoctype.h new file mode 100644 index 0000000..9509cd6 --- /dev/null +++ b/test/TDXmlDoctype.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlDoctype : TDXmlTerminal { + +} ++ (id)doctype; ++ (id)doctypeWithString:(NSString *)s; +@end diff --git a/test/TDXmlDoctype.m b/test/TDXmlDoctype.m new file mode 100644 index 0000000..217b0f3 --- /dev/null +++ b/test/TDXmlDoctype.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlDoctype.h" +#import "TDXmlToken.h" + +@implementation TDXmlDoctype + ++ (id)doctype { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)doctypeWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_DOCTYPE stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isDoctype; + } +} + +@end diff --git a/test/TDXmlDocument.h b/test/TDXmlDocument.h new file mode 100644 index 0000000..1ef5c71 --- /dev/null +++ b/test/TDXmlDocument.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlDocument : TDXmlTerminal { + +} ++ (id)document; ++ (id)documentWithString:(NSString *)s; +@end diff --git a/test/TDXmlDocument.m b/test/TDXmlDocument.m new file mode 100644 index 0000000..e57ab66 --- /dev/null +++ b/test/TDXmlDocument.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlDocument.h" +#import "TDXmlToken.h" + +@implementation TDXmlDocument + ++ (id)document { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)documentWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_DOCUMENT stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isDocument; + } +} + +@end diff --git a/test/TDXmlEndEntity.h b/test/TDXmlEndEntity.h new file mode 100644 index 0000000..dcbd4bd --- /dev/null +++ b/test/TDXmlEndEntity.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlEndEntity : TDXmlTerminal { + +} ++ (id)endEntity; ++ (id)endEntityWithString:(NSString *)s; +@end diff --git a/test/TDXmlEndEntity.m b/test/TDXmlEndEntity.m new file mode 100644 index 0000000..19123f7 --- /dev/null +++ b/test/TDXmlEndEntity.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlEndEntity.h" +#import "TDXmlToken.h" + +@implementation TDXmlEndEntity + ++ (id)endEntity { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)endEntityWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_END_ENTITY stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isEndEntity; + } +} + +@end diff --git a/test/TDXmlEndTag.h b/test/TDXmlEndTag.h new file mode 100644 index 0000000..71e8a7b --- /dev/null +++ b/test/TDXmlEndTag.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlEndTag : TDXmlTerminal { + +} ++ (id)endTag; ++ (id)endTagWithString:(NSString *)s; +@end diff --git a/test/TDXmlEndTag.m b/test/TDXmlEndTag.m new file mode 100644 index 0000000..df287cd --- /dev/null +++ b/test/TDXmlEndTag.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlEndTag.h" +#import "TDXmlToken.h" + +@implementation TDXmlEndTag + ++ (id)endTag { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)endTagWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_END_TAG stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isEndTag; + } +} + +@end diff --git a/test/TDXmlEntity.h b/test/TDXmlEntity.h new file mode 100644 index 0000000..6b7cd83 --- /dev/null +++ b/test/TDXmlEntity.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlEntity : TDXmlTerminal { + +} ++ (id)entity; ++ (id)entityWithString:(NSString *)s; +@end diff --git a/test/TDXmlEntity.m b/test/TDXmlEntity.m new file mode 100644 index 0000000..e4e0f17 --- /dev/null +++ b/test/TDXmlEntity.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlEntity.h" +#import "TDXmlToken.h" + +@implementation TDXmlEntity + ++ (id)entity { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)entityWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_ENTITY stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isEntity; + } +} + +@end diff --git a/test/TDXmlEntityRef.h b/test/TDXmlEntityRef.h new file mode 100644 index 0000000..d6b972c --- /dev/null +++ b/test/TDXmlEntityRef.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlEntityRef : TDXmlTerminal { + +} ++ (id)entityRef; ++ (id)entityRefWithString:(NSString *)s; +@end diff --git a/test/TDXmlEntityRef.m b/test/TDXmlEntityRef.m new file mode 100644 index 0000000..2a6bde5 --- /dev/null +++ b/test/TDXmlEntityRef.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlEntityRef.h" +#import "TDXmlToken.h" + +@implementation TDXmlEntityRef + ++ (id)entityRef { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)entityRefWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_ENTITY_REF stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isEntityRef; + } +} + +@end diff --git a/test/TDXmlFragment.h b/test/TDXmlFragment.h new file mode 100644 index 0000000..65172f1 --- /dev/null +++ b/test/TDXmlFragment.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlFragment : TDXmlTerminal { + +} ++ (id)doctype; ++ (id)doctypeWithString:(NSString *)s; +@end diff --git a/test/TDXmlFragment.m b/test/TDXmlFragment.m new file mode 100644 index 0000000..fb41f96 --- /dev/null +++ b/test/TDXmlFragment.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlFragment.h" +#import "TDXmlToken.h" + +@implementation TDXmlFragment + ++ (id)doctype { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)doctypeWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_FRAGMENT stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isFragment; + } +} + +@end diff --git a/test/TDXmlName.h b/test/TDXmlName.h new file mode 100644 index 0000000..32be5e5 --- /dev/null +++ b/test/TDXmlName.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKTerminal.h" + +@interface TDXmlName : PKTerminal { + +} ++ (id)name; +@end diff --git a/test/TDXmlName.m b/test/TDXmlName.m new file mode 100644 index 0000000..b2623d7 --- /dev/null +++ b/test/TDXmlName.m @@ -0,0 +1,39 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlName.h" +#import "PKToken.h" + +@implementation TDXmlName + ++ (id)name { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +- (BOOL)qualifies:(id)obj { + PKToken *tok = (PKToken *)obj; + if (!tok.isWord) { + return NO; + } + + //NSString *s = tok.stringValue; + if (YES) { + + } + + return YES; +} + +@end diff --git a/test/TDXmlNameState.h b/test/TDXmlNameState.h new file mode 100644 index 0000000..8400989 --- /dev/null +++ b/test/TDXmlNameState.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKTokenizerState.h" + +@interface TDXmlNameState : PKTokenizerState { + +} + +@end diff --git a/test/TDXmlNameState.m b/test/TDXmlNameState.m new file mode 100644 index 0000000..921812b --- /dev/null +++ b/test/TDXmlNameState.m @@ -0,0 +1,87 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlNameState.h" +#import "PKTokenizer.h" +#import "PKReader.h" +#import "TDXmlToken.h" + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface TDXmlNameState () ++ (BOOL)isNameChar:(PKUniChar)c; ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c; ++ (BOOL)isValidNonStartSymbolChar:(PKUniChar)c; +@end + +//Name ::= (Letter | '_' | ':') (NameChar)* +@implementation TDXmlNameState + +//- (BOOL)isWhitespace:(PKUniChar)c { +// return (' ' == c || '\n' == c || '\r' == c || '\t' == c); +//} + + +// NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender ++ (BOOL)isNameChar:(PKUniChar)c { + if (isalpha(c)) { + return YES; + } else if (isdigit(c)) { + return YES; + } else if ([[self class] isValidNonStartSymbolChar:c]) { + return YES; + } + // TODO CombiningChar & Extender + return NO; +} + + ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c { + return ('_' == c || ':' == c); +} + + ++ (BOOL)isValidNonStartSymbolChar:(PKUniChar)c { + return ('_' == c || '.' == c || '-' == c || ':' == c); +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + [self resetWithReader:r]; + + NSInteger c = cin; + do { + [self append:c]; + c = [r read]; + } while ([[self class] isNameChar:c]); + + if (PKEOF != c) { + [r unread]; + } + + if ([[self bufferedString] length] == 1 && [[self class] isValidStartSymbolChar:cin]) { + return [t.symbolState nextTokenFromReader:r startingWith:cin tokenizer:t]; + } else { +// return [[[TDXmlToken alloc] initWithTokenType:TDTT_NAME +// stringValue:[[stringbuf copy] autorelease] +// floatValue:0.0] autorelease]; + return nil; + } +} + +@end diff --git a/test/TDXmlNameTest.h b/test/TDXmlNameTest.h new file mode 100644 index 0000000..2ec72d3 --- /dev/null +++ b/test/TDXmlNameTest.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +// + +@interface TDXmlNameTest : SenTestCase { + +} + +@end diff --git a/test/TDXmlNameTest.m b/test/TDXmlNameTest.m new file mode 100644 index 0000000..5db6245 --- /dev/null +++ b/test/TDXmlNameTest.m @@ -0,0 +1,68 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlNameTest.h" +#import "TDXmlNameState.h" +#import "TDXmlNmtokenState.h" +#import "TDXmlToken.h" + +@implementation TDXmlNameTest +// +//- (void)test { +// NSString *s = @"_foob?ar _foobar 2baz"; +// PKTokenizer *t = [PKTokenizer tokenizerWithString:s]; +// +// //Name ::= (Letter | '_' | ':') (NameChar)* +// TDXmlNameState *nameState = [[[TDXmlNameState alloc] init] autorelease]; +// +// [t setTokenizerState:nameState from: '_' to: '_']; +// [t setTokenizerState:nameState from: ':' to: ':']; +// [t setTokenizerState:nameState from: 'a' to: 'z']; +// [t setTokenizerState:nameState from: 'A' to: 'Z']; +// [t setTokenizerState:nameState from:0xc0 to:0xff]; +// +// TDXmlNmtokenState *nmtokenState = [[[TDXmlNmtokenState alloc] init] autorelease]; +// [t setTokenizerState:nmtokenState from: '0' to: '9']; +// +// TDXmlToken *tok = nil; +// +// // _foob +// tok = (TDXmlToken *)[t nextToken]; +// TDNotNil(tok); +// TDTrue(tok.isName); +// +// // '?' +// tok = (TDXmlToken *)[t nextToken]; +// TDNotNil(tok); +// TDTrue(tok.isSymbol); +// +// // ar +// tok = (TDXmlToken *)[t nextToken]; +// TDNotNil(tok); +// TDTrue(tok.isName); +// +// // _foobar +// tok = (TDXmlToken *)[t nextToken]; +// TDNotNil(tok); +// TDTrue(tok.isName); +// +// // 2baz +// tok = (TDXmlToken *)[t nextToken]; +// TDNotNil(tok); +// TDTrue(tok.isNmtoken); +// NSLog(@"tok: %@", tok); +// +//} + +@end diff --git a/test/TDXmlNmtoken.h b/test/TDXmlNmtoken.h new file mode 100644 index 0000000..0a7e8c5 --- /dev/null +++ b/test/TDXmlNmtoken.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "PKTerminal.h" + +@interface TDXmlNmtoken : PKTerminal { + +} ++ (id)nmtoken; +@end diff --git a/test/TDXmlNmtoken.m b/test/TDXmlNmtoken.m new file mode 100644 index 0000000..f8ad21e --- /dev/null +++ b/test/TDXmlNmtoken.m @@ -0,0 +1,30 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlNmtoken.h" +#import "TDXmlToken.h" + +@implementation TDXmlNmtoken + ++ (id)nmtoken { + return [[[self alloc] initWithString:nil] autorelease]; +} + + +//- (BOOL)qualifies:(id)obj { +// TDXmlToken *tok = (TDXmlToken *)obj; +// return tok.isNmtoken; +//} + +@end diff --git a/test/TDXmlNmtokenState.h b/test/TDXmlNmtokenState.h new file mode 100644 index 0000000..7fb578d --- /dev/null +++ b/test/TDXmlNmtokenState.h @@ -0,0 +1,21 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlNameState.h" + +@interface TDXmlNmtokenState : TDXmlNameState { + +} + +@end diff --git a/test/TDXmlNmtokenState.m b/test/TDXmlNmtokenState.m new file mode 100644 index 0000000..bd8fd87 --- /dev/null +++ b/test/TDXmlNmtokenState.m @@ -0,0 +1,65 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlNmtokenState.h" +#import "PKTokenizer.h" +#import "PKReader.h" +#import "TDXmlToken.h" + +@interface PKTokenizerState () +- (void)resetWithReader:(PKReader *)r; +- (void)append:(PKUniChar)c; +- (NSString *)bufferedString; +@end + +@interface TDXmlNameState () ++ (BOOL)isNameChar:(PKUniChar)c; ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c; +@end + +// NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender +@implementation TDXmlNmtokenState + ++ (BOOL)isValidStartSymbolChar:(PKUniChar)c { + return ('_' == c || ':' == c || '-' == c || '.' == c); +} + + +- (PKToken *)nextTokenFromReader:(PKReader *)r startingWith:(PKUniChar)cin tokenizer:(PKTokenizer *)t { + [self resetWithReader:r]; + + NSInteger c = cin; + do { + [self append:c]; + c = [r read]; + } while ([[self class] isNameChar:c]); + + if (PKEOF != c) { + [r unread]; + } + + NSString *s = [self bufferedString]; + if ([s length] == 1 && [[self class] isValidStartSymbolChar:cin]) { + return [t.symbolState nextTokenFromReader:r startingWith:cin tokenizer:t]; + } else if ([s length] == 1 && isdigit(cin)) { + return [t.numberState nextTokenFromReader:r startingWith:cin tokenizer:t]; + } else { + return nil; +// return [[[TDXmlToken alloc] initWithTokenType:TDTT_NMTOKEN +// stringValue:[[stringbuf copy] autorelease] +// floatValue:0.0] autorelease]; + } +} + +@end diff --git a/test/TDXmlNotation.h b/test/TDXmlNotation.h new file mode 100644 index 0000000..1284667 --- /dev/null +++ b/test/TDXmlNotation.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlNotation : TDXmlTerminal { + +} ++ (id)notation; ++ (id)notationWithString:(NSString *)s; +@end diff --git a/test/TDXmlNotation.m b/test/TDXmlNotation.m new file mode 100644 index 0000000..846a850 --- /dev/null +++ b/test/TDXmlNotation.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlNotation.h" +#import "TDXmlToken.h" + +@implementation TDXmlNotation + ++ (id)notation { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)notationWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_NOTATION stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isNotation; + } +} + +@end diff --git a/test/TDXmlProcessingInstruction.h b/test/TDXmlProcessingInstruction.h new file mode 100644 index 0000000..a74335f --- /dev/null +++ b/test/TDXmlProcessingInstruction.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlProcessingInstruction : TDXmlTerminal { + +} ++ (id)processingInstruction; ++ (id)processingInstructionWithString:(NSString *)s; +@end diff --git a/test/TDXmlProcessingInstruction.m b/test/TDXmlProcessingInstruction.m new file mode 100644 index 0000000..f3e851e --- /dev/null +++ b/test/TDXmlProcessingInstruction.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlProcessingInstruction.h" +#import "TDXmlToken.h" + +@implementation TDXmlProcessingInstruction + ++ (id)processingInstruction { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)processingInstructionWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_PROCESSING_INSTRUCTION stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isProcessingInstruction; + } +} + +@end diff --git a/test/TDXmlSignificantWhitespace.h b/test/TDXmlSignificantWhitespace.h new file mode 100644 index 0000000..55c7ec2 --- /dev/null +++ b/test/TDXmlSignificantWhitespace.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlSignificantWhitespace : TDXmlTerminal { + +} ++ (id)significantWhitespace; ++ (id)significantWhitespaceWithString:(NSString *)s; +@end diff --git a/test/TDXmlSignificantWhitespace.m b/test/TDXmlSignificantWhitespace.m new file mode 100644 index 0000000..d226aa4 --- /dev/null +++ b/test/TDXmlSignificantWhitespace.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlSignificantWhitespace.h" +#import "TDXmlToken.h" + +@implementation TDXmlSignificantWhitespace + ++ (id)significantWhitespace { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)significantWhitespaceWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_SIGNIFICANT_WHITESPACE stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isSignificantWhitespace; + } +} + +@end diff --git a/test/TDXmlStartTag.h b/test/TDXmlStartTag.h new file mode 100644 index 0000000..b21efe0 --- /dev/null +++ b/test/TDXmlStartTag.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlStartTag : TDXmlTerminal { + +} ++ (id)startTag; ++ (id)startTagWithString:(NSString *)s; +@end diff --git a/test/TDXmlStartTag.m b/test/TDXmlStartTag.m new file mode 100644 index 0000000..8a04fd5 --- /dev/null +++ b/test/TDXmlStartTag.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlStartTag.h" +#import "TDXmlToken.h" + +@implementation TDXmlStartTag + ++ (id)startTag { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)startTagWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_START_TAG stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isStartTag; + } +} + +@end diff --git a/test/TDXmlTerminal.h b/test/TDXmlTerminal.h new file mode 100644 index 0000000..8b0cf9e --- /dev/null +++ b/test/TDXmlTerminal.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class TDXmlToken; + +@interface TDXmlTerminal : PKTerminal { + TDXmlToken *tok; +} +@property (nonatomic, retain) TDXmlToken *tok; +@end diff --git a/test/TDXmlTerminal.m b/test/TDXmlTerminal.m new file mode 100644 index 0000000..1f89b26 --- /dev/null +++ b/test/TDXmlTerminal.m @@ -0,0 +1,26 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" +#import "TDXmlToken.h" + +@implementation TDXmlTerminal + +- (void)dealloc { + self.tok = nil; + [super dealloc]; +} + +@synthesize tok; +@end diff --git a/test/TDXmlText.h b/test/TDXmlText.h new file mode 100644 index 0000000..5ca67db --- /dev/null +++ b/test/TDXmlText.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlText : TDXmlTerminal { + +} ++ (id)text; ++ (id)textWithString:(NSString *)s; +@end diff --git a/test/TDXmlText.m b/test/TDXmlText.m new file mode 100644 index 0000000..31d01bd --- /dev/null +++ b/test/TDXmlText.m @@ -0,0 +1,57 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlText.h" +#import "TDXmlToken.h" + +@implementation TDXmlText + ++ (id)text { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)textWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + NSLog(@"%s", _cmd); + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_TEXT stringValue:s]; + NSLog(@"tok : %@", tok); + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + NSLog(@"%s obj: %@ isText: %d", _cmd, obj, other.isText); + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isText; + } +} + +@end diff --git a/test/TDXmlToken.h b/test/TDXmlToken.h new file mode 100644 index 0000000..0afdc83 --- /dev/null +++ b/test/TDXmlToken.h @@ -0,0 +1,95 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +typedef enum { + TDTT_XML_NONE = 0, + TDTT_XML_START_TAG = 1, + TDTT_XML_ATTRIBUTE = 2, + TDTT_XML_TEXT = 3, + TDTT_XML_CDATA = 4, + TDTT_XML_ENTITY_REF = 5, + TDTT_XML_ENTITY = 6, + TDTT_XML_PROCESSING_INSTRUCTION = 7, + TDTT_XML_COMMENT = 8, + TDTT_XML_DOCUMENT = 9, + TDTT_XML_DOCTYPE = 10, + TDTT_XML_FRAGMENT = 11, + TDTT_XML_NOTATION = 12, + TDTT_XML_WHITESPACE = 13, + TDTT_XML_SIGNIFICANT_WHITESPACE = 14, + TDTT_XML_END_TAG = 15, + TDTT_XML_END_ENTITY = 16, + TDTT_XML_XML_DECL = 17, + TDTT_XML_EOF = 18 +} TDXmlTokenType; + +@interface TDXmlToken : NSObject { + NSString *stringValue; + TDXmlTokenType tokenType; + + BOOL none; + BOOL startTag; + BOOL attribute; + BOOL text; + BOOL cdata; + BOOL entityRef; + BOOL entity; + BOOL processingInstruction; + BOOL comment; + BOOL document; + BOOL doctype; + BOOL fragment; + BOOL notation; + BOOL whitespace; + BOOL significantWhitespace; + BOOL endTag; + BOOL endEntity; + BOOL xmlDecl; + + id value; +} ++ (TDXmlToken *)EOFToken; ++ (id)tokenWithTokenType:(TDXmlTokenType)t stringValue:(NSString *)s; + +// designated initializer +- (id)initWithTokenType:(TDXmlTokenType)t stringValue:(NSString *)s; + +- (BOOL)isEqualIgnoringCase:(id)obj; + +- (NSString *)debugDescription; + +@property (nonatomic, readonly, getter=isNone) BOOL none; +@property (nonatomic, readonly, getter=isStartTag) BOOL startTag; +@property (nonatomic, readonly, getter=isAttribute) BOOL attribute; +@property (nonatomic, readonly, getter=isText) BOOL text; +@property (nonatomic, readonly, getter=isCdata) BOOL cdata; +@property (nonatomic, readonly, getter=isEntityRef) BOOL entityRef; +@property (nonatomic, readonly, getter=isEntity) BOOL entity; +@property (nonatomic, readonly, getter=isProcessingInstruction) BOOL processingInstruction; +@property (nonatomic, readonly, getter=isComment) BOOL comment; +@property (nonatomic, readonly, getter=isDocument) BOOL document; +@property (nonatomic, readonly, getter=isDoctype) BOOL doctype; +@property (nonatomic, readonly, getter=isFragment) BOOL fragment; +@property (nonatomic, readonly, getter=isNotation) BOOL notation; +@property (nonatomic, readonly, getter=isWhitespace) BOOL whitespace; +@property (nonatomic, readonly, getter=isSignificantWhitespace) BOOL significantWhitespace; +@property (nonatomic, readonly, getter=isEndTag) BOOL endTag; +@property (nonatomic, readonly, getter=isEndEntity) BOOL endEntity; +@property (nonatomic, readonly, getter=isXmlDecl) BOOL xmlDecl; +@property (nonatomic, readonly, copy) NSString *stringValue; +@property (nonatomic, readonly) TDXmlTokenType tokenType; +@property (nonatomic, readonly, copy) id value; +@end diff --git a/test/TDXmlToken.m b/test/TDXmlToken.m new file mode 100644 index 0000000..28ef312 --- /dev/null +++ b/test/TDXmlToken.m @@ -0,0 +1,209 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlToken.h" + +@interface TDXmlTokenEOF : TDXmlToken {} +@end + +@implementation TDXmlTokenEOF +- (NSString *)description { + return [NSString stringWithFormat:@"", self]; +} +@end + +@interface TDXmlToken () +@property (nonatomic, readwrite, getter=isNone) BOOL none; +@property (nonatomic, readwrite, getter=isStartTag) BOOL startTag; +@property (nonatomic, readwrite, getter=isAttribute) BOOL attribute; +@property (nonatomic, readwrite, getter=isText) BOOL text; +@property (nonatomic, readwrite, getter=isCdata) BOOL cdata; +@property (nonatomic, readwrite, getter=isEntityRef) BOOL entityRef; +@property (nonatomic, readwrite, getter=isEntity) BOOL entity; +@property (nonatomic, readwrite, getter=isProcessingInstruction) BOOL processingInstruction; +@property (nonatomic, readwrite, getter=isComment) BOOL comment; +@property (nonatomic, readwrite, getter=isDocument) BOOL document; +@property (nonatomic, readwrite, getter=isDoctype) BOOL doctype; +@property (nonatomic, readwrite, getter=isFragment) BOOL fragment; +@property (nonatomic, readwrite, getter=isNotation) BOOL notation; +@property (nonatomic, readwrite, getter=isWhitespace) BOOL whitespace; +@property (nonatomic, readwrite, getter=isSignificantWhitespace) BOOL significantWhitespace; +@property (nonatomic, readwrite, getter=isEndTag) BOOL endTag; +@property (nonatomic, readwrite, getter=isEndEntity) BOOL endEntity; +@property (nonatomic, readwrite, getter=isXmlDecl) BOOL xmlDecl; +@property (nonatomic, readwrite, copy) NSString *stringValue; +@property (nonatomic, readwrite) TDXmlTokenType tokenType; +@property (nonatomic, readwrite, copy) id value; +@end + +@implementation TDXmlToken + ++ (TDXmlToken *)EOFToken { + static TDXmlToken *EOFToken = nil; + @synchronized (self) { + if (!EOFToken) { + EOFToken = [[TDXmlTokenEOF alloc] initWithTokenType:TDTT_XML_EOF stringValue:nil]; + } + } + return EOFToken; +} + + ++ (id)tokenWithTokenType:(TDXmlTokenType)t stringValue:(NSString *)s { + return [[[self alloc] initWithTokenType:t stringValue:s] autorelease]; +} + + +#pragma mark - + +// designated initializer +- (id)initWithTokenType:(TDXmlTokenType)t stringValue:(NSString *)s { + if (self = [super init]) { + self.tokenType = t; + self.stringValue = s; + + self.none = (TDTT_XML_NONE == t); + self.startTag = (TDTT_XML_START_TAG == t); + self.attribute = (TDTT_XML_ATTRIBUTE == t); + self.text = (TDTT_XML_TEXT == t); + self.cdata = (TDTT_XML_CDATA == t); + self.entityRef = (TDTT_XML_ENTITY_REF == t); + self.entity = (TDTT_XML_ENTITY == t); + self.processingInstruction = (TDTT_XML_PROCESSING_INSTRUCTION == t); + self.comment = (TDTT_XML_COMMENT == t); + self.document = (TDTT_XML_DOCUMENT == t); + self.doctype = (TDTT_XML_DOCTYPE == t); + self.fragment = (TDTT_XML_FRAGMENT == t); + self.notation = (TDTT_XML_NOTATION == t); + self.whitespace = (TDTT_XML_WHITESPACE == t); + self.significantWhitespace = (TDTT_XML_SIGNIFICANT_WHITESPACE == t); + self.endTag = (TDTT_XML_END_TAG == t); + self.endEntity = (TDTT_XML_END_ENTITY == t); + self.xmlDecl = (TDTT_XML_XML_DECL == t); + + self.value = stringValue; + } + return self; +} + + +- (void)dealloc { + self.stringValue = nil; + self.value = nil; + [super dealloc]; +} + + +- (NSUInteger)hash { + return [stringValue hash]; +} + + +- (BOOL)isEqual:(id)rhv { + if (![rhv isMemberOfClass:[TDXmlToken class]]) { + return NO; + } + + TDXmlToken *that = (TDXmlToken *)rhv; + if (tokenType != that.tokenType) { + return NO; + } + + return [stringValue isEqualToString:that.stringValue]; +} + + +- (BOOL)isEqualIgnoringCase:(id)rhv { + if (![rhv isMemberOfClass:[TDXmlToken class]]) { + return NO; + } + + TDXmlToken *that = (TDXmlToken *)rhv; + if (tokenType != that.tokenType) { + return NO; + } + + return [stringValue.lowercaseString isEqualToString:that.stringValue.lowercaseString]; +} + + +- (NSString *)debugDescription { + NSString *typeString = nil; + if (self.isNone) { + typeString = @"None"; + } else if (self.isStartTag) { + typeString = @"Start Tag"; + } else if (self.isAttribute) { + typeString = @"Attribute"; + } else if (self.isText) { + typeString = @"Text"; + } else if (self.isCdata) { + typeString = @"CData"; + } else if (self.isEntityRef) { + typeString = @"Entity Reference"; + } else if (self.isEntity) { + typeString = @"Entity"; + } else if (self.isProcessingInstruction) { + typeString = @"Processing Instruction"; + } else if (self.isComment) { + typeString = @"Comment"; + } else if (self.isDocument) { + typeString = @"Document"; + } else if (self.isDoctype) { + typeString = @"Doctype"; + } else if (self.isFragment) { + typeString = @"Fragment"; + } else if (self.isNotation) { + typeString = @"Notation"; + } else if (self.isWhitespace) { + typeString = @"Whitespace"; + } else if (self.isSignificantWhitespace) { + typeString = @"Significant Whitespace"; + } else if (self.isEndTag) { + typeString = @"End Tag"; + } else if (self.isEndEntity) { + typeString = @"End Entity"; + } else if (self.isXmlDecl) { + typeString = @"XML Declaration"; + } + return [NSString stringWithFormat:@"<%@ %C%@%C>", typeString, 0x00ab, self.value, 0x00bb]; +} + + +- (NSString *)description { + return [self debugDescription]; +} + +@synthesize none; +@synthesize startTag; +@synthesize attribute; +@synthesize text; +@synthesize cdata; +@synthesize entityRef; +@synthesize entity; +@synthesize processingInstruction; +@synthesize comment; +@synthesize document; +@synthesize doctype; +@synthesize fragment; +@synthesize notation; +@synthesize whitespace; +@synthesize significantWhitespace; +@synthesize endTag; +@synthesize endEntity; +@synthesize xmlDecl; +@synthesize stringValue; +@synthesize tokenType; +@synthesize value; +@end diff --git a/test/TDXmlTokenAssembly.h b/test/TDXmlTokenAssembly.h new file mode 100644 index 0000000..eda4ab1 --- /dev/null +++ b/test/TDXmlTokenAssembly.h @@ -0,0 +1,24 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class TDXmlTokenizer; + +@interface TDXmlTokenAssembly : PKAssembly { + TDXmlTokenizer *tokenizer; + NSMutableArray *tokens; +} +@property (nonatomic, retain) TDXmlTokenizer *tokenizer; +@end diff --git a/test/TDXmlTokenAssembly.m b/test/TDXmlTokenAssembly.m new file mode 100644 index 0000000..41dc364 --- /dev/null +++ b/test/TDXmlTokenAssembly.m @@ -0,0 +1,156 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTokenAssembly.h" +#import "TDXmlTokenizer.h" +#import "TDXmlToken.h" + +@interface TDXmlTokenAssembly () +- (void)tokenize; + +@property (nonatomic, retain) NSMutableArray *tokens; +@end + +@implementation TDXmlTokenAssembly + +- (id)init { + return nil; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tokenizer = [[[TDXmlTokenizer alloc] initWithContentsOfFile:s] autorelease]; + } + return self; +} + + +- (void)dealloc { + self.tokenizer = nil; + self.tokens = nil; + [super dealloc]; +} + + +- (id)copyWithZone:(NSZone *)zone { + TDXmlTokenAssembly *a = (TDXmlTokenAssembly *)[super copyWithZone:zone]; + a->tokens = [self.tokens mutableCopy]; + return a; +} + + +- (NSMutableArray *)tokens { + if (!tokens) { + [self tokenize]; + } + return [[tokens retain] autorelease]; +} + + +- (void)setTokens:(NSMutableArray *)inArray { + if (inArray != tokens) { + [tokens autorelease]; + tokens = [inArray retain]; + } +} + + +- (void)tokenize { + self.tokens = [NSMutableArray array]; + + TDXmlToken *eof = [TDXmlToken EOFToken]; + TDXmlToken *tok = nil; + while ((tok = [tokenizer nextToken]) != eof) { + [tokens addObject:tok]; + } +} + + +- (id)peek { + if (index >= [self.tokens count]) { + return nil; + } + id tok = [self.tokens objectAtIndex:index]; + + return tok; +} + + +- (id)next { + id tok = [self peek]; + if (tok) { + index++; + } + return tok; +} + + +- (BOOL)hasMore { + return (index < [self.tokens count]); +} + + +- (NSUInteger)length { + return [self.tokens count]; +} + + +- (NSUInteger)consumedObjectCount { + return index; +} + + +- (NSUInteger)remainingObjectCount { + return ([self.tokens count] - index); +} + + +- (NSString *)consumedObjectsJoinedByString:(NSString *)delimiter { + NSMutableString *s = [NSMutableString string]; + + NSInteger i = 0; + NSInteger len = self.consumedObjectCount; + + for ( ; i < len; i++) { + TDXmlToken *tok = [self.tokens objectAtIndex:i]; + [s appendString:tok.stringValue]; + if (i != len - 1) { + [s appendString:delimiter]; + } + } + + return [[s copy] autorelease]; +} + + +- (NSString *)remainingObjectsJoinedByString:(NSString *)delimiter { + NSMutableString *s = [NSMutableString string]; + + NSInteger i = self.consumedObjectCount; + NSInteger len = [self length]; + + for ( ; i < len; i++) { + TDXmlToken *tok = [self.tokens objectAtIndex:i]; + [s appendString:tok.stringValue]; + if (i != len - 1) { + [s appendString:delimiter]; + } + } + return [[s copy] autorelease]; +} + +@synthesize tokenizer; +@end diff --git a/test/TDXmlTokenizer.h b/test/TDXmlTokenizer.h new file mode 100644 index 0000000..a7e6e86 --- /dev/null +++ b/test/TDXmlTokenizer.h @@ -0,0 +1,27 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class TDXmlToken; +@class XMLReader; + +@interface TDXmlTokenizer : NSObject { + XMLReader *reader; +} ++ (id)tokenizerWithContentsOfFile:(NSString *)path; + +- (id)initWithContentsOfFile:(NSString *)path; +- (TDXmlToken *)nextToken; +@end diff --git a/test/TDXmlTokenizer.m b/test/TDXmlTokenizer.m new file mode 100644 index 0000000..59f42bc --- /dev/null +++ b/test/TDXmlTokenizer.m @@ -0,0 +1,69 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTokenizer.h" +#import "XMLReader.h" +#import "TDXmlToken.h" + +@interface TDXmlTokenizer () +@property (nonatomic, retain) XMLReader *reader; +@end + +@implementation TDXmlTokenizer + ++ (id)tokenizerWithContentsOfFile:(NSString *)path { + return [[[self alloc] initWithContentsOfFile:path] autorelease]; +} + + +- (id)init { + return nil; +} + + +- (id)initWithContentsOfFile:(NSString *)path { + if (self = [super init]) { + self.reader = [[[XMLReader alloc] initWithContentsOfFile:path] autorelease]; + } + return self; +} + + +- (void)dealloc { + self.reader = nil; + [super dealloc]; +} + + +- (TDXmlToken *)nextToken { + TDXmlToken *tok = nil; + NSInteger ret = -1; + NSInteger nodeType = -1; + + do { + ret = [reader read]; + nodeType = reader.nodeType; + } while (nodeType == TDTT_XML_SIGNIFICANT_WHITESPACE || nodeType == TDTT_XML_WHITESPACE); + + if (ret <= 0) { + tok = [TDXmlToken EOFToken]; + } else { + tok = [TDXmlToken tokenWithTokenType:reader.nodeType stringValue:reader.name]; + } + + return tok; +} + +@synthesize reader; +@end diff --git a/test/TDXmlTokenizerTest.h b/test/TDXmlTokenizerTest.h new file mode 100644 index 0000000..a4a5eb5 --- /dev/null +++ b/test/TDXmlTokenizerTest.h @@ -0,0 +1,23 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "TDXmlTokenizer.h" +#import "TDXmlToken.h" + +@interface TDXmlTokenizerTest : SenTestCase { + +} + +@end diff --git a/test/TDXmlTokenizerTest.m b/test/TDXmlTokenizerTest.m new file mode 100644 index 0000000..cb15bc7 --- /dev/null +++ b/test/TDXmlTokenizerTest.m @@ -0,0 +1,57 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTokenizerTest.h" +#import "TDXmlDecl.h" +#import "TDXmlStartTag.h" +#import "TDXmlEndTag.h" +#import "TDXmlText.h" +#import "TDXmlSignificantWhitespace.h" +#import "TDXmlTokenAssembly.h" + + +@implementation TDXmlTokenizerTest + +- (void)testFoo { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"xml"]; + + TDXmlTokenizer *t = [TDXmlTokenizer tokenizerWithContentsOfFile:path]; + NSLog(@"\n\n %@\n\n", t); + + TDXmlToken *eof = [TDXmlToken EOFToken]; + TDXmlToken *tok = nil; + + while ((tok = [t nextToken]) != eof) { + //NSLog(@" %@", [tok debugDescription]); + } +} + + +- (void)testAppleBoss { + PKSequence *s = [PKSequence sequence]; + s.name = @"parent sequence"; + [s add:[TDXmlStartTag startTagWithString:@"result"]]; + [s add:[TDXmlStartTag startTagWithString:@"url"]]; + [s add:[TDXmlText text]]; + [s add:[TDXmlEndTag endTagWithString:@"url"]]; + [s add:[TDXmlEndTag endTagWithString:@"result"]]; + + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"small-xml-file" ofType:@"xml"]; + TDXmlTokenAssembly *a = [TDXmlTokenAssembly assemblyWithString:path]; + + PKAssembly *result = [s bestMatchFor:a]; + NSLog(@"\n\n\n result: %@ \n\n\n", result); +} + +@end diff --git a/test/TDXmlWhitespace.h b/test/TDXmlWhitespace.h new file mode 100644 index 0000000..5f2662e --- /dev/null +++ b/test/TDXmlWhitespace.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlTerminal.h" + +@interface TDXmlWhitespace : TDXmlTerminal { + +} ++ (id)whitespace; ++ (id)whitespaceWithString:(NSString *)s; +@end diff --git a/test/TDXmlWhitespace.m b/test/TDXmlWhitespace.m new file mode 100644 index 0000000..366b46b --- /dev/null +++ b/test/TDXmlWhitespace.m @@ -0,0 +1,54 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDXmlWhitespace.h" +#import "TDXmlToken.h" + +@implementation TDXmlWhitespace + ++ (id)whitespace { + return [[[self alloc] initWithString:nil] autorelease]; +} + + ++ (id)whitespaceWithString:(NSString *)s { + return [[[self alloc] initWithString:s] autorelease]; +} + + +- (id)initWithString:(NSString *)s { + self = [super initWithString:s]; + if (self) { + self.tok = [TDXmlToken tokenWithTokenType:TDTT_XML_WHITESPACE stringValue:s]; + } + return self; +} + + +- (void)dealloc { + [super dealloc]; +} + + +- (BOOL)qualifies:(id)obj { + TDXmlToken *other = (TDXmlToken *)obj; + + if ([string length]) { + return [tok isEqual:other]; + } else { + return other.isWhitespace; + } +} + +@end diff --git a/test/Tests-Info.plist b/test/Tests-Info.plist new file mode 100644 index 0000000..2e46062 --- /dev/null +++ b/test/Tests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.yourcompany.Tests + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + NSPrincipalClass + TDTestScaffold + + diff --git a/test/XMLReader.h b/test/XMLReader.h new file mode 100755 index 0000000..46ece02 --- /dev/null +++ b/test/XMLReader.h @@ -0,0 +1,251 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import +//#import +#import + +/** + * XMLReaderMode: + * + * Internal state values for the reader. + */ +typedef enum { + XMLReaderReadStateInitial = 0, + XMLReaderReadStateInteractive = 1, + XMLReaderReadStateError = 2, + XMLReaderReadStateEOF = 3, + XMLReaderReadStateClosed = 4, + XMLReaderReadStateReading = 5 +} XMLReaderReadState; + +/** + * xmlParserProperties: + * + * Some common options to use with xmlTextReaderSetParserProp, but it + * is better to use xmlParserOption and the xmlReaderNewxxx and + * xmlReaderForxxx APIs now. + * +typedef enum { + XML_PARSER_LOADDTD = 1, + XML_PARSER_DEFAULTATTRS = 2, + XML_PARSER_VALIDATE = 3, + XML_PARSER_SUBST_ENTITIES = 4 +} xmlParserProperties; +*/ + +/** + * xmlParserSeverities: + * + * How severe an error callback is when the per-reader error callback API + * is used. + */ +typedef enum { + XMLReaderSeverityValidityWarning = 1, + XMLReaderSeverityValidityError = 2, + XMLReaderSeverityWarning = 3, + XMLReaderSeverityError = 4 +} XMLReaderSeverity; + +/** + * XMLReaderNodeType: + * + * Predefined constants for the different types of nodes. + */ +typedef enum { + XMLReaderNodeTypeNone = 0, + XMLReaderNodeTypeElement = 1, + XMLReaderNodeTypeAttribute = 2, + XMLReaderNodeTypeText = 3, + XMLReaderNodeTypeCDATA = 4, + XMLReaderNodeTypeEntityReference = 5, + XMLReaderNodeTypeEntity = 6, + XMLReaderNodeTypeProcessingInstruction = 7, + XMLReaderNodeTypeComment = 8, + XMLReaderNodeTypeDocument = 9, + XMLReaderNodeTypeDocumentType = 10, + XMLReaderNodeTypeDocumentFragment = 11, + XMLReaderNodeTypeNotation = 12, + XMLReaderNodeTypeWhitespace = 13, + XMLReaderNodeTypeSignificantWhitespace = 14, + XMLReaderNodeTypeEndElement = 15, + XMLReaderNodeTypeEndEntity = 16, + XMLReaderNodeTypeXmlDeclaration = 17 +} XMLReaderNodeType; + + +@interface NSObject (XMLReaderErrorHandler) +- (void)validityWarning:(NSString *)msg lineNumber:(NSInteger)n; +- (void)validityError:(NSString *)msg lineNumber:(NSInteger)n; +- (void)warning:(NSString *)msg lineNumber:(NSInteger)n; +- (void)error:(NSString *)msg lineNumber:(NSInteger)n; +- (void)fatalError:(NSString *)msg lineNumber:(NSInteger)n; +@end + +@interface XMLReader : NSObject { + xmlTextReaderPtr _reader; + xmlRelaxNGPtr _schema; + NSString *path; + id errorHandler; + NSString *relaxNGSchemaPath; +} + ++ (id)parserWithContentsOfFile:(NSString *)newPath; +//+ (id)parserWithXMLString:(NSString *)XMLString; + +- (id)initWithContentsOfFile:(NSString *)path; +//- (id)initWithXMLString:(NSString *)XMLString; + +// Gets the number of attributes on the current node. +@property (nonatomic, readonly) NSInteger attributeCount; +//- (NSInteger)attributeCount; + +// Gets the base Uniform Resource Identifier (URI) of the current node. +@property (nonatomic, readonly, copy) NSString *baseURI; +//- (NSString *)baseURI; + +// Gets a value indicating whether this reader can parse and resolve entities. +//@property (nonatomic, readonly) BOOL canResolveEntity; +//- (BOOL)canResolveEntity; + +// Gets the depth of the current node in the XML document. +@property (nonatomic, readonly) NSInteger depth; +//- (NSInteger)depth; + +// Gets a value indicating whether the XMLReader.ReadState is ReadState.EndOfFile, signifying the reader is positioned at the end of the stream. +@property (nonatomic, readonly) BOOL isEOF; +//- (BOOL)isEOF; + +// Gets a value indicating whether the current node has any attributes. +@property (nonatomic, readonly) BOOL hasAttributes; +//- (BOOL)hasAttributes; + +// Gets a value indicating whether the current node can have an associated text value. +@property (nonatomic, readonly) BOOL hasValue; +//- (BOOL)hasValue; + +// Gets a value indicating whether the current node is an attribute that was generated from the default value defined in the DTD or schema. +@property (nonatomic, readonly) BOOL isDefault; +//- (BOOL)isDefault; + +// Gets a value indicating whether the current node is an empty element (for example, ). +@property (nonatomic, readonly) BOOL isEmptyElement; +//- (BOOL)isEmptyElement; + +// Gets the local name of the current node. +@property (nonatomic, readonly, copy) NSString *localName; +//- (NSString *)localName; + +// Gets the qualified name of the current node. +@property (nonatomic, readonly, copy) NSString *name; +//- (NSString *)name; + +// Gets the namespace URI associated with the node on which the reader is positioned. +@property (nonatomic, readonly, copy) NSString *namespaceURI; +//- (NSString *)namespaceURI; + +// Gets the name table used by the current instance to store and look up element and attribute names, prefixes, and namespaces. +//- (XmlNameTable)NameTable; + +// Gets the type of the current node. +@property (nonatomic, readonly) XMLReaderNodeType nodeType; +//- (XMLReaderNodeType)nodeType; + +// Gets the namespace prefix associated with the current node. +@property (nonatomic, readonly, copy) NSString *prefix; +//- (NSString *)prefix; + +// Gets the quotation mark character used to enclose the value of an attribute. +@property (nonatomic, readonly) char quoteChar; +//- (char)quoteChar; + +// Gets the read state of the reader. +@property (nonatomic, readonly) XMLReaderReadState readState; +//- (XMLReaderReadState)readState; + +// Gets the text value of the current node. +@property (nonatomic, readonly, copy) NSString *value; +//- (NSString *)value; + +// Gets the current xml:lang scope. +@property (nonatomic, readonly, copy) NSString *XMLLang; +//- (NSString *)XMLLang; + +// Gets the current xml:space scope. +//- (XMLSpace)XMLSpace; + +// Changes the XMLReader.ReadState to XMLReaderReadState.Closed. +- (void)close; + +// Returns the value of the attribute with the specified index relative to the containing element. +- (NSString *)attributeAtIndex:(NSInteger)index; + +// Returns the value of the attribute with the specified qualified name. +- (NSString *)attributeWithQName:(NSString *)qName; + +// Returns the value of the attribute with the specified local name and namespace URI. +- (NSString *)attributeWithLocalName:(NSString *)localName namespaceURI:(NSString *)nsURI; + +// Determines whether the specified string is a valid XML name. ++ (BOOL)isName:(NSString *)str; + +// Determines whether the specified string is a valid XML name token (Nmtoken). ++ (BOOL)isNameToken:(NSString *)str; + +// Resolves a namespace prefix in the scope of the current element. +- (NSString *)lookupNamespace:(NSString *)prefix; + +// Moves the position of the current instance to the attribute with the specified index relative to the containing element. +- (void)moveToAttributeAtIndex:(NSInteger)index; + +// Moves the position of the current instance to the attribute with the specified qualified name. +- (BOOL)moveToAttributeWithQName:(NSString *)qName; + +// Moves the position of the current instance to the attribute with the specified local name and namespace URI. +- (BOOL)moveToAttributeWithLocalName:(NSString *)localName namespaceURI:(NSString *)nsURI; + +// Moves the position of the current instance to the node that contains the current Attribute node. +- (BOOL)moveToElement; + +// Moves the position of the current instance to the first attribute associated with the current node. +- (BOOL)moveToFirstAttribute; + +// Moves the position of the current instance to the next attribute associated with the current node. +- (BOOL)moveToNextAttribute; + +// Moves the position of the current instance to the next node in the stream, exposing its properties. +- (BOOL)read; + +// Parses an attribute value into one or more Text, EntityReference, and EndEntity nodes. +- (BOOL)readAttributeValue; + +// Reads the contents of a text-only element. +- (NSString *)readElementString; + +// Reads the contents of the current node, including child nodes and markup. +- (NSString *)readInnerXML; + +// Reads the current node and its contents, including child nodes and markup. +- (NSString *)readOuterXML; + +// Reads the contents of an element or text node as a string. +- (NSString *)readString; + +// Skips over the current element and moves the position of the current instance to the next node in the stream. +- (void)skip; + +@property (nonatomic, copy) NSString *relaxNGSchemaPath; +@property (nonatomic, readonly) BOOL isValid; +@property (nonatomic, retain) id errorHandler; +@end diff --git a/test/XMLReader.m b/test/XMLReader.m new file mode 100755 index 0000000..2ae9812 --- /dev/null +++ b/test/XMLReader.m @@ -0,0 +1,425 @@ + +#import "XMLReader.h" +//#import +#import + +@interface NSString (libxml2Support) ++ (id)stringWithXmlChar:(xmlChar *)xc; +- (xmlChar *)xmlChar; +@end + +@implementation NSString (libxml2Support) + ++ (id)stringWithXmlChar:(xmlChar *)xc { + if (!xc) { + return nil; + } + return [NSString stringWithUTF8String:(char *)xc]; +} + + +- (xmlChar *)xmlChar { + return (unsigned char *)[self UTF8String]; +} + +@end + + +@interface XMLReader () +@property (nonatomic, copy) NSString *path; +@end + + +@implementation XMLReader + +// don't know what this handles. can't get it to fire +static void readerErr(XMLReader *self, const char *msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator) { + NSString *str = [NSString stringWithUTF8String:msg]; + int line = xmlTextReaderLocatorLineNumber(locator); + NSLog(@"some kinda error! %s, severity: %i, line: %i", msg, severity, line); + + switch (severity) { + case XMLReaderSeverityValidityWarning: + [self.errorHandler validityWarning:str lineNumber:line]; + break; + case XMLReaderSeverityValidityError: + [self.errorHandler validityError:str lineNumber:line]; + break; + case XMLReaderSeverityWarning: + [self.errorHandler warning:str lineNumber:line]; + break; + case XMLReaderSeverityError: + [self.errorHandler error:str lineNumber:line]; + break; + } + +} + + +// handles well-formedness errors in instance document +// and handles validity errors in instance doc +static void structErr(XMLReader *self, xmlErrorPtr error) { + const char *msg = error->message; + int line = error->line; + int level = error->level; + + NSLog(@"Instance doc well-formedness or validity error, level: %i", level); + NSLog(@"message: = %s", msg); + NSLog(@"line: = %i", line); + + NSString *str = [NSString stringWithUTF8String:msg]; + + switch (level) { + case XML_ERR_WARNING: + [self.errorHandler warning:str lineNumber:line]; + break; + case XML_ERR_ERROR: + [self.errorHandler error:str lineNumber:line]; + break; + case XML_ERR_FATAL: + [self.errorHandler fatalError:str lineNumber:line]; + break; + } +} + + ++ (id)parserWithContentsOfFile:(NSString *)path { + return [[[XMLReader alloc] initWithContentsOfFile:path] autorelease]; +} + +/* ++ (id)parserWithXMLString:(NSString *)XMLString { + return [[[self alloc] initWithXMLString:XMLStirng] autorelease]; +} +*/ + +- (id)initWithContentsOfFile:(NSString *)newPath { + if (self = [super init]) { + self.path = newPath; + + _reader = xmlNewTextReaderFilename([path UTF8String]); + xmlTextReaderSetParserProp(_reader, XML_PARSE_RECOVER, 1); + xmlTextReaderSetParserProp(_reader, XML_PARSE_XINCLUDE, 1); + xmlTextReaderSetErrorHandler(_reader, (xmlTextReaderErrorFunc)readerErr, (void *)self); + xmlTextReaderSetStructuredErrorHandler(_reader, (xmlStructuredErrorFunc)structErr, (void *)self); + } + return self; +} + + +- (void)dealloc { + self.path = nil; + self.errorHandler = nil; + self.relaxNGSchemaPath = nil; + if (_reader) { + xmlFreeTextReader(_reader); + } + if (_schema) { + xmlRelaxNGFree(_schema); + } + [super dealloc]; +} + + +#pragma mark - +#pragma mark Properties + +- (NSInteger)attributeCount { + return xmlTextReaderAttributeCount(_reader); +} + + +- (NSString *)baseURI { + return [NSString stringWithXmlChar:xmlTextReaderBaseUri(_reader)]; +} + + +//- (BOOL)canResolveEntity { +// return YES; +//} + + +- (NSInteger)depth { + return xmlTextReaderDepth(_reader); +} + + +- (BOOL)isEOF { + return XMLReaderReadStateEOF == [self readState]; +} + + +- (BOOL)hasAttributes { + return xmlTextReaderHasAttributes(_reader); +} + + +- (BOOL)hasValue { + return xmlTextReaderHasValue(_reader); +} + + +- (BOOL)isDefault { + return xmlTextReaderIsDefault(_reader); +} + + +- (BOOL)isEmptyElement { + return xmlTextReaderIsEmptyElement(_reader); +} + + +- (NSString *)localName { + xmlChar *c = xmlTextReaderLocalName(_reader); + if (c) { + return [NSString stringWithXmlChar:c]; + } + return nil; +} + + +- (NSString *)name { + xmlChar *c = xmlTextReaderName(_reader); + if (c) { + return [NSString stringWithXmlChar:c]; + } + return nil; +} + + +- (NSString *)namespaceURI { + xmlChar *c = xmlTextReaderNamespaceUri(_reader); + if (c) { + return [NSString stringWithXmlChar:c]; + } + return nil; +} + + +#pragma mark - +#pragma mark Methods + +- (XMLReaderNodeType)nodeType { + return xmlTextReaderNodeType(_reader); +} + + +- (NSString *)prefix { + return [NSString stringWithXmlChar:xmlTextReaderPrefix(_reader)]; +} + + +- (char)quoteChar { + return xmlTextReaderQuoteChar(_reader); +} + + +- (XMLReaderReadState)readState { + return xmlTextReaderReadState(_reader); +} + + +- (NSString *)value { + return [NSString stringWithXmlChar:xmlTextReaderValue(_reader)]; +} + + +- (NSString *)XMLLang { + return [NSString stringWithXmlChar:xmlTextReaderXmlLang(_reader)]; +} + + +- (void)close { + xmlTextReaderClose(_reader); +} + + +- (NSString *)attributeAtIndex:(NSInteger)index { + return [NSString stringWithXmlChar:xmlTextReaderGetAttributeNo(_reader, index)]; +} + + +- (NSString *)attributeWithQName:(NSString *)qName { + return [NSString stringWithXmlChar:xmlTextReaderGetAttribute(_reader, [qName xmlChar])]; +} + + +- (NSString *)attributeWithLocalName:(NSString *)localName namespaceURI:(NSString *)nsURI { + return [NSString stringWithXmlChar:xmlTextReaderGetAttributeNs(_reader, [localName xmlChar], [nsURI xmlChar])]; +} + + ++ (BOOL)isName:(NSString *)str { + return YES; +} + + ++ (BOOL)isNameToken:(NSString *)str { + return YES; +} + + +- (NSString *)lookupNamespace:(NSString *)prefix { + return [NSString stringWithXmlChar:xmlTextReaderLookupNamespace(_reader, [prefix xmlChar])]; +} + + +- (void)moveToAttributeAtIndex:(NSInteger)index { + xmlTextReaderMoveToAttributeNo(_reader, index); +} + + +- (BOOL)moveToAttributeWithQName:(NSString *)qName { + return xmlTextReaderMoveToAttribute(_reader, [qName xmlChar]); +} + + +- (BOOL)moveToAttributeWithLocalName:(NSString *)localName namespaceURI:(NSString *)nsURI { + return xmlTextReaderMoveToAttributeNs(_reader, [localName xmlChar], [nsURI xmlChar]); +} + + +- (BOOL)moveToElement { + return xmlTextReaderMoveToElement(_reader); +} + + +- (BOOL)moveToFirstAttribute { + return xmlTextReaderMoveToFirstAttribute(_reader); +} + + +- (BOOL)moveToNextAttribute { + return xmlTextReaderMoveToNextAttribute(_reader); +} + + +- (BOOL)read { + return xmlTextReaderRead(_reader); +} + + +- (BOOL)readAttributeValue { + return xmlTextReaderReadAttributeValue(_reader); +} + + +- (NSString *)readElementString { + return [NSString stringWithXmlChar:xmlTextReaderReadString(_reader)]; +} + + +- (NSString *)readInnerXML { + return [NSString stringWithXmlChar:xmlTextReaderReadInnerXml(_reader)]; +} + + +- (NSString *)readOuterXML { + return [NSString stringWithXmlChar:xmlTextReaderReadOuterXml(_reader)]; +} + + +- (NSString *)readString { + return [NSString stringWithXmlChar:xmlTextReaderReadString(_reader)]; +} + + +- (void)skip { + xmlTextReaderNextSibling(_reader); +} + + +// handles warnings encountered while parsing RNG schema +static void rngWarn(XMLReader *self, const char *msg, ...) { + va_list ap; + va_start(ap, msg); + + NSMutableString *str = [NSMutableString stringWithFormat:[NSString stringWithUTF8String:msg], ap]; + NSLog(@"RELAX NG warn: %s", msg); + va_end(ap); + + [str replaceOccurrencesOfString:@"<" + withString:@"<" + options:0 + range:NSMakeRange(0, [str length])]; + + str = [NSString stringWithFormat:@"Warning while parsing RELAX NG schema: %s",msg]; + [self.errorHandler validityWarning:str lineNumber:-1]; +} + + +// handles errors encountered while parsing RNG schema +static void rngErr(XMLReader *self, const char *msg, ...) { + va_list ap; + va_start(ap, msg); + + NSMutableString *str = [NSMutableString stringWithFormat:[NSString stringWithUTF8String:msg], ap]; + NSLog(@"RELAX NG err %@",str); + va_end(ap); + + [str replaceOccurrencesOfString:@"<" + withString:@"<" + options:0 + range:NSMakeRange(0, [str length])]; + + str = [NSString stringWithFormat:@"Error while parsing RELAX NG schema:
%@
",str]; + [self.errorHandler validityError:str lineNumber:-1]; + +} + + +- (NSString *)relaxNGSchemaPath { + return [[relaxNGSchemaPath retain] autorelease]; +} + + +- (void)setRelaxNGSchemaPath:(NSString *)newPath { + if (relaxNGSchemaPath != newPath) { + [relaxNGSchemaPath autorelease]; + relaxNGSchemaPath = [newPath retain]; + + const char *schemafurl = [relaxNGSchemaPath UTF8String]; + + // RELAX NG Parser Context + xmlRelaxNGParserCtxtPtr ctxt = xmlRelaxNGNewParserCtxt(schemafurl); + xmlRelaxNGSetParserErrors(ctxt, + (xmlRelaxNGValidityErrorFunc)rngErr, + (xmlRelaxNGValidityWarningFunc)rngWarn, + (void *)self); + // xmlRelaxNGSetParserStructuredErrors(ctxt, (xmlStructuredErrorFunc)structErr, NULL); + + if (_schema) { + xmlRelaxNGFree(_schema); + _schema = NULL; + } + + NSLog(@"gonna parse schema"); + _schema = xmlRelaxNGParse(ctxt); + NSLog(@"did parse schema"); + xmlRelaxNGFreeParserCtxt(ctxt); + + if (_reader) { + xmlFreeTextReader(_reader); + } + _reader = xmlNewTextReaderFilename([path UTF8String]); + xmlTextReaderSetParserProp(_reader, XML_PARSE_RECOVER, 1); + xmlTextReaderSetParserProp(_reader, XML_PARSE_XINCLUDE, 1); + + xmlTextReaderRelaxNGSetSchema(_reader, _schema); + + xmlTextReaderSetErrorHandler(_reader, (xmlTextReaderErrorFunc)readerErr, (void *)self); + + xmlTextReaderSetStructuredErrorHandler(_reader, (xmlStructuredErrorFunc)structErr, (void *)self); + } + +} + + +- (BOOL)isValid { + return xmlTextReaderIsValid(_reader); +} + +@synthesize path; +@synthesize errorHandler; +@synthesize relaxNGSchemaPath; +@end diff --git a/test/XMLReaderTest.h b/test/XMLReaderTest.h new file mode 100644 index 0000000..7938eaa --- /dev/null +++ b/test/XMLReaderTest.h @@ -0,0 +1,22 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" +#import "XMLReader.h" + +@interface XMLReaderTest : SenTestCase { + +} + +@end diff --git a/test/XMLReaderTest.m b/test/XMLReaderTest.m new file mode 100644 index 0000000..128602a --- /dev/null +++ b/test/XMLReaderTest.m @@ -0,0 +1,33 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "XMLReaderTest.h" + +@implementation XMLReaderTest + +- (void)test { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"apple-boss" ofType:@"xml"]; + + NSLog(@"\n\npath: %@\n\n", path); + + XMLReader *p = [XMLReader parserWithContentsOfFile:path]; + NSInteger ret = [p read]; + while (ret == 1) { + //NSLog(@"nodeType: %d, name: %@", p.nodeType, p.name); + ret = [p read]; + + } +} + +@end diff --git a/test/XPathAssembler.h b/test/XPathAssembler.h new file mode 100644 index 0000000..5ae79af --- /dev/null +++ b/test/XPathAssembler.h @@ -0,0 +1,25 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class XPathContext; +@class PKReader; + +@interface XPathAssembler : NSObject { + XPathContext *context; +} +- (void)resetWithReader:(PKReader *)r; +@property (retain) XPathContext *context; +@end diff --git a/test/XPathAssembler.m b/test/XPathAssembler.m new file mode 100644 index 0000000..3ca6a41 --- /dev/null +++ b/test/XPathAssembler.m @@ -0,0 +1,65 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "XPathAssembler.h" +#import +#import "XPathContext.h" + +@implementation XPathAssembler + +- (id)init { + if (self = [super init]) { + self.context = [[[XPathContext alloc] init] autorelease]; + } + return self; +} + + +- (void)dealloc { + self.context = nil; + [super dealloc]; +} + + +- (void)resetWithReader:(PKReader *)r { + [context resetWithCurrentNode:nil]; +} + + +- (void)didMatchAxisSpecifier:(PKAssembly *)a { + //NSLog(@"\n\n %s\n\n %@ \n\n", _cmd, a); + + //PKToken *tok = [a pop]; + +} + + +- (void)didMatchNodeTest:(PKAssembly *)a { + //NSLog(@"\n\n %s\n\n %@ \n\n", _cmd, a); +} + + +- (void)didMatchPredicate:(PKAssembly *)a { + //NSLog(@"\n\n %s\n\n %@ \n\n", _cmd, a); +} + +// [4] Step ::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep +- (void)didMatchStep:(PKAssembly *)a { + //NSLog(@"\n\n %s\n\n %@ \n\n", _cmd, a); +} + + + +@synthesize context; +@end diff --git a/test/XPathContext.h b/test/XPathContext.h new file mode 100644 index 0000000..6a017ef --- /dev/null +++ b/test/XPathContext.h @@ -0,0 +1,35 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@interface XPathContext : NSObject { + // static context + NSString *baseURIString; + NSMutableDictionary *namespaces; + NSMutableDictionary *variables; + NSMutableDictionary *functions; + + // dynamic context + NSXMLNode *currentNode; + NSXMLNode *contextNode; + NSArray *contextNodeSet; + + // +} +- (void)resetWithCurrentNode:(NSXMLNode *)n; +@property (retain) NSXMLNode *currentNode; +@property (retain) NSXMLNode *contextNode; +@property (retain) NSArray *contextNodeSet; +@end diff --git a/test/XPathContext.m b/test/XPathContext.m new file mode 100644 index 0000000..987d728 --- /dev/null +++ b/test/XPathContext.m @@ -0,0 +1,43 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "XPathContext.h" + +@implementation XPathContext + +- (id)init { + if (self = [super init]) { + } + return self; +} + + +- (void)resetWithCurrentNode:(NSXMLNode *)n { + self.currentNode = n; + self.contextNode = nil; + self.contextNodeSet = nil; +} + + +- (void)dealloc { + self.currentNode = nil; + self.contextNode = nil; + self.contextNodeSet = nil; + [super dealloc]; +} + +@synthesize currentNode; +@synthesize contextNode; +@synthesize contextNodeSet; +@end diff --git a/test/XPathParser.h b/test/XPathParser.h new file mode 100644 index 0000000..ece099f --- /dev/null +++ b/test/XPathParser.h @@ -0,0 +1,102 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import + +@class XPathAssembler; +@class PKAssembly; + +@interface XPathParser : PKSequence { + XPathAssembler *xpathAssembler; + PKCollectionParser *locationPath; + PKCollectionParser *absoluteLocationPath; + PKCollectionParser *relativeLocationPath; + PKCollectionParser *step; + PKCollectionParser *axisSpecifier; + PKCollectionParser *axisName; + PKCollectionParser *nodeTest; + PKCollectionParser *predicate; + PKCollectionParser *predicateExpr; + PKCollectionParser *abbreviatedAbsoluteLocationPath; + PKCollectionParser *abbreviatedRelativeLocationPath; + PKCollectionParser *abbreviatedStep; + PKCollectionParser *abbreviatedAxisSpecifier; + PKCollectionParser *expr; + PKCollectionParser *primaryExpr; + PKCollectionParser *functionCall; + PKCollectionParser *argument; + PKCollectionParser *unionExpr; + PKCollectionParser *pathExpr; + PKCollectionParser *filterExpr; + PKCollectionParser *orExpr; + PKCollectionParser *andExpr; + PKCollectionParser *equalityExpr; + PKCollectionParser *relationalExpr; + PKCollectionParser *additiveExpr; + PKCollectionParser *multiplicativeExpr; + PKCollectionParser *unaryExpr; + PKCollectionParser *exprToken; + PKParser *literal; + PKParser *number; + PKCollectionParser *operator; + PKCollectionParser *operatorName; + PKParser *multiplyOperator; + PKParser *functionName; + PKCollectionParser *variableReference; + PKCollectionParser *nameTest; + PKCollectionParser *nodeType; + PKCollectionParser *QName; +} +- (id)parse:(NSString *)s; +- (PKAssembly *)assemblyWithString:(NSString *)s; + +@property (retain) PKCollectionParser *locationPath; +@property (retain) PKCollectionParser *absoluteLocationPath; +@property (retain) PKCollectionParser *relativeLocationPath; +@property (retain) PKCollectionParser *step; +@property (retain) PKCollectionParser *axisSpecifier; +@property (retain) PKCollectionParser *axisName; +@property (retain) PKCollectionParser *nodeTest; +@property (retain) PKCollectionParser *predicate; +@property (retain) PKCollectionParser *predicateExpr; +@property (retain) PKCollectionParser *abbreviatedAbsoluteLocationPath; +@property (retain) PKCollectionParser *abbreviatedRelativeLocationPath; +@property (retain) PKCollectionParser *abbreviatedStep; +@property (retain) PKCollectionParser *abbreviatedAxisSpecifier; +@property (retain) PKCollectionParser *expr; +@property (retain) PKCollectionParser *primaryExpr; +@property (retain) PKCollectionParser *functionCall; +@property (retain) PKCollectionParser *argument; +@property (retain) PKCollectionParser *unionExpr; +@property (retain) PKCollectionParser *pathExpr; +@property (retain) PKCollectionParser *filterExpr; +@property (retain) PKCollectionParser *orExpr; +@property (retain) PKCollectionParser *andExpr; +@property (retain) PKCollectionParser *equalityExpr; +@property (retain) PKCollectionParser *relationalExpr; +@property (retain) PKCollectionParser *additiveExpr; +@property (retain) PKCollectionParser *multiplicativeExpr; +@property (retain) PKCollectionParser *unaryExpr; +@property (retain) PKCollectionParser *exprToken; +@property (retain) PKParser *literal; +@property (retain) PKParser *number; +@property (retain) PKCollectionParser *operator; +@property (retain) PKCollectionParser *operatorName; +@property (retain) PKParser *multiplyOperator; +@property (retain) PKParser *functionName; +@property (retain) PKCollectionParser *variableReference; +@property (retain) PKCollectionParser *nameTest; +@property (retain) PKCollectionParser *nodeType; +@property (retain) PKCollectionParser *QName; +@end diff --git a/test/XPathParser.m b/test/XPathParser.m new file mode 100644 index 0000000..9739d0d --- /dev/null +++ b/test/XPathParser.m @@ -0,0 +1,979 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "XPathParser.h" +//#import "TDNCName.h" + +#import "TDNCNameState.h" +#import "XPathAssembler.h" + +@interface XPathParser () +@property (retain) XPathAssembler *xpathAssembler; +@end + +@implementation XPathParser + +- (id)init { + if (self = [super init]) { + self.xpathAssembler = [[[XPathAssembler alloc] init] autorelease]; + [self add:self.locationPath]; + } + return self; +} + + +- (void)dealloc { + self.xpathAssembler = nil; + self.locationPath = nil; + self.absoluteLocationPath = nil; + self.relativeLocationPath = nil; + self.step = nil; + self.axisSpecifier = nil; + self.axisName = nil; + self.nodeTest = nil; + self.predicate = nil; + self.predicateExpr = nil; + self.abbreviatedAbsoluteLocationPath = nil; + self.abbreviatedRelativeLocationPath = nil; + self.abbreviatedStep = nil; + self.abbreviatedAxisSpecifier = nil; + self.expr = nil; + self.primaryExpr = nil; + self.functionCall = nil; + self.argument = nil; + self.unionExpr = nil; + self.pathExpr = nil; + self.filterExpr = nil; + self.orExpr = nil; + self.andExpr = nil; + self.equalityExpr = nil; + self.relationalExpr = nil; + self.additiveExpr = nil; + self.multiplicativeExpr = nil; + self.unaryExpr = nil; + self.exprToken = nil; + self.literal = nil; + self.number = nil; + self.operator = nil; + self.operatorName = nil; + self.multiplyOperator = nil; + self.functionName = nil; + self.variableReference = nil; + self.nameTest = nil; + self.nodeType = nil; + self.QName = nil; + [super dealloc]; +} + + +- (PKAssembly *)assemblyWithString:(NSString *)s { + PKTokenizer *t = [[[PKTokenizer alloc] initWithString:s] autorelease]; + [t.symbolState add:@"::"]; + [t.symbolState add:@"!="]; + [t.symbolState add:@"<="]; + [t.symbolState add:@">="]; + [t.symbolState add:@".."]; + [t.symbolState add:@"//"]; + [t setTokenizerState:t.wordState from: '_' to: '_']; +// [t setTokenizerState:NCNameState from: 'a' to: 'z']; +// [t setTokenizerState:NCNameState from: 'A' to: 'Z']; +// [t setTokenizerState:NCNameState from:0xc0 to:0xff]; + + PKTokenAssembly *a = [PKTokenAssembly assemblyWithTokenizer:t]; +// TDNCNameState *NCNameState = [[[TDNCNameState alloc] init] autorelease]; + + return a; +} + + +- (id)parse:(NSString *)s { + [xpathAssembler resetWithReader:nil]; + PKAssembly *a = [self assemblyWithString:s]; + id result = [self completeMatchFor:a]; + return result; +} + + +// [1] LocationPath ::= RelativeLocationPath | AbsoluteLocationPath +- (PKCollectionParser *)locationPath { + //NSLog(@"%s", _cmd); + if (!locationPath) { + self.locationPath = [PKAlternation alternation]; + locationPath.name = @"locationPath"; + + [locationPath add:self.relativeLocationPath]; + [locationPath add:self.absoluteLocationPath]; + } + return locationPath; +} + + +//[2] AbsoluteLocationPath ::= '/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath +- (PKCollectionParser *)absoluteLocationPath { + //NSLog(@"%s", _cmd); + if (!absoluteLocationPath) { + self.absoluteLocationPath = [PKAlternation alternation]; + absoluteLocationPath.name = @"absoluteLocationPath"; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.relativeLocationPath]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"/"]]; + [s add:a]; + + [absoluteLocationPath add:s]; + [absoluteLocationPath add:self.abbreviatedAbsoluteLocationPath]; + } + return absoluteLocationPath; +} + +#pragma mark - +#pragma mark left recursion + +//[3] RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath + +// avoiding left recursion by changing to this +//[3] RelativeLocationPath ::= Step SlashStep* | AbbreviatedRelativeLocationPath + +- (PKCollectionParser *)relativeLocationPath { + //NSLog(@"%s", _cmd); + if (!relativeLocationPath) { + self.relativeLocationPath = [PKAlternation alternation]; + relativeLocationPath.name = @"relativeLocationPath"; + + PKSequence *s = [PKSequence sequence]; + [s add:self.step]; + + PKSequence *slashStep = [PKSequence sequence]; + [slashStep add:[PKSymbol symbolWithString:@"/"]]; + [slashStep add:self.step]; + [s add:[PKRepetition repetitionWithSubparser:slashStep]]; + + [relativeLocationPath add:s]; + // TODO this is causing and infinite loop! +// [relativeLocationPath add:self.abbreviatedRelativeLocationPath]; + } + return relativeLocationPath; +} + + +// [4] Step ::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep +- (PKCollectionParser *)step { + NSLog(@"%s", _cmd); + if (!step) { + self.step = [PKAlternation alternation]; + step.name = @"step"; + + PKSequence *s = [PKSequence sequence]; + [s add:self.axisSpecifier]; + [s add:self.nodeTest]; + [s add:[PKRepetition repetitionWithSubparser:self.predicate]]; + + [step add:s]; + [step add:self.abbreviatedStep]; + + [step setAssembler:xpathAssembler selector:@selector(didMatchStep:)]; + } + return step; +} + + +// [5] AxisSpecifier ::= AxisName '::' | AbbreviatedAxisSpecifier +- (PKCollectionParser *)axisSpecifier { + //NSLog(@"%s", _cmd); + if (!axisSpecifier) { + self.axisSpecifier = [PKAlternation alternation]; + axisSpecifier.name = @"axisSpecifier"; + + PKSequence *s = [PKSequence sequence]; + [s add:self.axisName]; + [s add:[PKSymbol symbolWithString:@"::"]]; + + [axisSpecifier add:s]; + [axisSpecifier add:self.abbreviatedAxisSpecifier]; + [axisSpecifier setAssembler:xpathAssembler selector:@selector(didMatchAxisSpecifier:)]; + } + return axisSpecifier; +} + + +// [6] AxisName ::= 'ancestor' | 'ancestor-or-self' | 'attribute' | 'child' | 'descendant' | 'descendant-or-self' +// | 'following' | 'following-sibling' | 'namespace' | 'parent' | 'preceding' | 'preceding-sibling' | 'self' +- (PKCollectionParser *)axisName { + //NSLog(@"%s", _cmd); + if (!axisName) { + self.axisName = [PKAlternation alternation]; + axisName.name = @"axisName"; + [axisName add:[PKLiteral literalWithString:@"ancestor"]]; + [axisName add:[PKLiteral literalWithString:@"ancestor-or-self"]]; + [axisName add:[PKLiteral literalWithString:@"attribute"]]; + [axisName add:[PKLiteral literalWithString:@"child"]]; + [axisName add:[PKLiteral literalWithString:@"descendant"]]; + [axisName add:[PKLiteral literalWithString:@"descendant-or-self"]]; + [axisName add:[PKLiteral literalWithString:@"following"]]; + [axisName add:[PKLiteral literalWithString:@"following-sibling"]]; + [axisName add:[PKLiteral literalWithString:@"preceeding"]]; + [axisName add:[PKLiteral literalWithString:@"preceeding-sibling"]]; + [axisName add:[PKLiteral literalWithString:@"namespace"]]; + [axisName add:[PKLiteral literalWithString:@"parent"]]; + [axisName add:[PKLiteral literalWithString:@"self"]]; + } + return axisName; +} + + +// [7] NodeTest ::= NameTest | NodeType '(' ')' | 'processing-instruction' '(' Literal ')' +- (PKCollectionParser *)nodeTest { + //NSLog(@"%s", _cmd); + if (!nodeTest) { + self.nodeTest = [PKAlternation alternation]; + nodeTest.name = @"nodeTest"; + [nodeTest add:self.nameTest]; + + PKSequence *s = [PKSequence sequence]; + [s add:self.nodeType]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:[PKSymbol symbolWithString:@")"]]; + [nodeTest add:s]; + + s = [PKSequence sequence]; + [s add:[PKLiteral literalWithString:@"processing-instruction"]]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:self.literal]; + [s add:[PKSymbol symbolWithString:@")"]]; + [nodeTest add:s]; + } + return nodeTest; +} + + +// [8] Predicate ::= '[' PredicateExpr ']' +- (PKCollectionParser *)predicate { + //NSLog(@"%s", _cmd); + if (!predicate) { + self.predicate = [PKSequence sequence]; + predicate.name = @"predicate"; + [predicate add:[PKSymbol symbolWithString:@"["]]; + [predicate add:self.predicateExpr]; + [predicate add:[PKSymbol symbolWithString:@"]"]]; + } + return predicate; +} + + +// [9] PredicateExpr ::= Expr +- (PKCollectionParser *)predicateExpr { + //NSLog(@"%s", _cmd); + if (!predicateExpr) { + self.predicateExpr = self.expr; + predicateExpr.name = @"predicateExpr"; + } + return predicateExpr; +} + + +// [10] AbbreviatedAbsoluteLocationPath ::= '//' RelativeLocationPath +- (PKCollectionParser *)abbreviatedAbsoluteLocationPath { + //NSLog(@"%s", _cmd); + if (!abbreviatedAbsoluteLocationPath) { + self.abbreviatedAbsoluteLocationPath = [PKSequence sequence]; + abbreviatedAbsoluteLocationPath.name = @"abbreviatedAbsoluteLocationPath"; + [abbreviatedAbsoluteLocationPath add:[PKSymbol symbolWithString:@"//"]]; + [abbreviatedAbsoluteLocationPath add:self.relativeLocationPath]; + } + return abbreviatedAbsoluteLocationPath; +} + + +// [11] AbbreviatedRelativeLocationPath ::= RelativeLocationPath '//' Step +- (PKCollectionParser *)abbreviatedRelativeLocationPath { + //NSLog(@"%s", _cmd); + if (!abbreviatedRelativeLocationPath) { + self.abbreviatedRelativeLocationPath = [PKSequence sequence]; + abbreviatedRelativeLocationPath.name = @"abbreviatedRelativeLocationPath"; + [abbreviatedRelativeLocationPath add:self.relativeLocationPath]; + [abbreviatedRelativeLocationPath add:[PKSymbol symbolWithString:@"//"]]; + [abbreviatedRelativeLocationPath add:self.step]; + } + return abbreviatedRelativeLocationPath; +} + + +// [12] AbbreviatedStep ::= '.' | '..' +- (PKCollectionParser *)abbreviatedStep { + //NSLog(@"%s", _cmd); + if (!abbreviatedStep) { + self.abbreviatedStep = [PKAlternation alternation]; + abbreviatedStep.name = @"abbreviatedStep"; + [abbreviatedStep add:[PKSymbol symbolWithString:@"."]]; + [abbreviatedStep add:[PKSymbol symbolWithString:@".."]]; + } + return abbreviatedStep; +} + + +// [13] AbbreviatedAxisSpecifier ::= '@'? +- (PKCollectionParser *)abbreviatedAxisSpecifier { + //NSLog(@"%s", _cmd); + if (!abbreviatedAxisSpecifier) { + self.abbreviatedAxisSpecifier = [PKAlternation alternation]; + abbreviatedAxisSpecifier.name = @"abbreviatedAxisSpecifier"; + [abbreviatedAxisSpecifier add:[PKEmpty empty]]; + [abbreviatedAxisSpecifier add:[PKSymbol symbolWithString:@"@"]]; + } + return abbreviatedAxisSpecifier; +} + + +// [14] Expr ::= OrExpr +- (PKCollectionParser *)expr { + //NSLog(@"%s", _cmd); + if (!expr) { + self.expr = self.orExpr; + expr.name = @"expr"; + } + return expr; +} + + +// [15] PrimaryExpr ::= VariableReference +// | '(' Expr ')' +// | Literal +// | Number +// | FunctionCall +- (PKCollectionParser *)primaryExpr { + //NSLog(@"%s", _cmd); + if (!primaryExpr) { + self.primaryExpr = [PKAlternation alternation]; + primaryExpr.name = @"primaryExpr"; + [primaryExpr add:self.variableReference]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKSymbol symbolWithString:@"("]]; + [s add:self.expr]; + [s add:[PKSymbol symbolWithString:@")"]]; + [primaryExpr add:s]; + + [primaryExpr add:self.literal]; + [primaryExpr add:self.number]; + [primaryExpr add:self.functionCall]; + } + return primaryExpr; +} + + +// [16] FunctionCall ::= FunctionName '(' ( Argument ( ',' Argument )* )? ')' + +// commaArg ::= ',' Argument +// [16] FunctionCall ::= FunctionName '(' ( Argument commaArg* )? ')' +- (PKCollectionParser *)functionCall { + //NSLog(@"%s", _cmd); + if (!functionCall) { + self.functionCall = [PKSequence sequence]; + functionCall.name = @"functionCall"; + [functionCall add:self.functionName]; + [functionCall add:[PKSymbol symbolWithString:@"("]]; + + PKSequence *commaArg = [PKSequence sequence]; + [commaArg add:[PKSymbol symbolWithString:@","]]; + [commaArg add:self.argument]; + + PKSequence *args = [PKSequence sequence]; + [args add:self.argument]; + [args add:[PKRepetition repetitionWithSubparser:commaArg]]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:args]; + + [functionCall add:a]; + [functionCall add:[PKSymbol symbolWithString:@")"]]; + } + return functionCall; +} + + +// [17] Argument ::= Expr +- (PKCollectionParser *)argument { + //NSLog(@"%s", _cmd); + if (!argument) { + self.argument = self.expr; + argument.name = @"argument"; + } + return argument; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [18] UnionExpr ::= PathExpr | UnionExpr '|' PathExpr + +// pipePathExpr :: = | PathExpr +// [18] UnionExpr ::= PathExpr PipePathExpr* +- (PKCollectionParser *)unionExpr { + //NSLog(@"%s", _cmd); + if (!unionExpr) { + self.unionExpr = [PKSequence sequence]; + unionExpr.name = @"unionExpr"; + + PKSequence *pipePathExpr = [PKSequence sequence]; + [pipePathExpr add:[PKSymbol symbolWithString:@"|"]]; + [pipePathExpr add:self.pathExpr]; + + [unionExpr add:self.pathExpr]; + [unionExpr add:[PKRepetition repetitionWithSubparser:pipePathExpr]]; + } + return unionExpr; +} + + +//[19] PathExpr ::= LocationPath +// | FilterExpr +// | FilterExpr '/' RelativeLocationPath +// | FilterExpr '//' RelativeLocationPath +- (PKCollectionParser *)pathExpr { + //NSLog(@"%s", _cmd); + if (!pathExpr) { + self.pathExpr = [PKAlternation alternation]; + pathExpr.name = @"pathExpr"; + [pathExpr add:self.locationPath]; + [pathExpr add:self.filterExpr]; + + PKSequence *s = [PKSequence sequence]; + [s add:self.filterExpr]; + [s add:[PKSymbol symbolWithString:@"/"]]; + [s add:self.relativeLocationPath]; + [pathExpr add:s]; + + s = [PKSequence sequence]; + [s add:self.filterExpr]; + [s add:[PKSymbol symbolWithString:@"//"]]; + [s add:self.relativeLocationPath]; + [pathExpr add:s]; + } + return pathExpr; +} + + +#pragma mark - +#pragma mark Left Recursion???????????? + +// [20] FilterExpr ::= PrimaryExpr | FilterExpr Predicate + + +// [20] FilterExpr ::= PrimaryExpr Predicate? +- (PKCollectionParser *)filterExpr { + //NSLog(@"%s", _cmd); + if (!filterExpr) { + self.filterExpr = [PKSequence sequence]; + filterExpr.name = @"filterExpr"; + [filterExpr add:self.primaryExpr]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:self.predicate]; + [filterExpr add:a]; + } + return filterExpr; +} + + +#pragma mark - +#pragma mark Left Recursion +// [21] OrExpr ::= AndExpr | OrExpr 'or' AndExpr + +// orAndExpr ::= 'or' AndExpr +// me: AndExpr orAndExpr* +- (PKCollectionParser *)orExpr { + //NSLog(@"%s", _cmd); + if (!orExpr) { + self.orExpr = [PKSequence sequence]; + orExpr.name = @"orExpr"; + + [orExpr add:self.andExpr]; + + PKSequence *orAndExpr = [PKSequence sequence]; + [orAndExpr add:[PKLiteral literalWithString:@"or"]]; + [orAndExpr add:self.andExpr]; + + [orExpr add:[PKRepetition repetitionWithSubparser:orAndExpr]]; + } + return orExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [22] AndExpr ::= EqualityExpr | AndExpr 'and' EqualityExpr + + +// andEqualityExpr +// EqualityExpr andEqualityExpr + +- (PKCollectionParser *)andExpr { + //NSLog(@"%s", _cmd); + if (!andExpr) { + self.andExpr = [PKSequence sequence]; + andExpr.name = @"andExpr"; + [andExpr add:self.equalityExpr]; + + PKSequence *andEqualityExpr = [PKSequence sequence]; + [andEqualityExpr add:[PKLiteral literalWithString:@"and"]]; + [andEqualityExpr add:self.equalityExpr]; + + [andExpr add:[PKRepetition repetitionWithSubparser:andEqualityExpr]]; + } + return andExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [23] EqualityExpr ::= RelationalExpr +// | EqualityExpr '=' RelationalExpr +// | EqualityExpr '!=' RelationalExpr + +// RelationalExpr (equalsRelationalExpr | notEqualsRelationalExpr)? + +- (PKCollectionParser *)equalityExpr { + //NSLog(@"%s", _cmd); + if (!equalityExpr) { + self.equalityExpr = [PKSequence sequence]; + equalityExpr.name = @"equalityExpr"; + [equalityExpr add:self.relationalExpr]; + + PKSequence *equalsRelationalExpr = [PKSequence sequence]; + [equalsRelationalExpr add:[PKSymbol symbolWithString:@"="]]; + [equalsRelationalExpr add:self.relationalExpr]; + + PKSequence *notEqualsRelationalExpr = [PKSequence sequence]; + [notEqualsRelationalExpr add:[PKSymbol symbolWithString:@"!="]]; + [notEqualsRelationalExpr add:self.relationalExpr]; + + PKAlternation *a = [PKAlternation alternation]; + [a add:equalsRelationalExpr]; + [a add:notEqualsRelationalExpr]; + + PKAlternation *a1 = [PKAlternation alternation]; + [a1 add:[PKEmpty empty]]; + [a1 add:a]; + + [equalityExpr add:a1]; + } + return equalityExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [24] RelationalExpr ::= AdditiveExpr +// | RelationalExpr '<' AdditiveExpr +// | RelationalExpr '>' AdditiveExpr +// | RelationalExpr '<=' AdditiveExpr +// | RelationalExpr '>=' AdditiveExpr + +// RelationalExpr = AdditiveExpr (ltAdditiveExpr | gtAdditiveExpr | lteAdditiveExpr | gteAdditiveExpr)? +- (PKCollectionParser *)relationalExpr { + //NSLog(@"%s", _cmd); + if (!relationalExpr) { + + self.relationalExpr = [PKSequence sequence]; + relationalExpr.name = @"relationalExpr"; + [relationalExpr add:self.additiveExpr]; + + PKAlternation *a = [PKAlternation alternation]; + + PKSequence *ltAdditiveExpr = [PKSequence sequence]; + [ltAdditiveExpr add:[PKSymbol symbolWithString:@"<"]]; + [a add:ltAdditiveExpr]; + + PKSequence *gtAdditiveExpr = [PKSequence sequence]; + [gtAdditiveExpr add:[PKSymbol symbolWithString:@">"]]; + [a add:gtAdditiveExpr]; + + PKSequence *lteAdditiveExpr = [PKSequence sequence]; + [lteAdditiveExpr add:[PKSymbol symbolWithString:@"<="]]; + [a add:lteAdditiveExpr]; + + PKSequence *gteAdditiveExpr = [PKSequence sequence]; + [gteAdditiveExpr add:[PKSymbol symbolWithString:@">="]]; + [a add:gteAdditiveExpr]; + + PKAlternation *a1 = [PKAlternation alternation]; + [a1 add:[PKEmpty empty]]; + [a1 add:a]; + + [relationalExpr add:a1]; + } + return relationalExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [25] AdditiveExpr ::= MultiplicativeExpr +// | AdditiveExpr '+' MultiplicativeExpr +// | AdditiveExpr '-' MultiplicativeExpr + +// AdditiveExpr ::= MultiplicativeExpr (plusMultiplicativeExpr | minusMultiplicativeExpr)? +- (PKCollectionParser *)additiveExpr { + //NSLog(@"%s", _cmd); + if (!additiveExpr) { + self.additiveExpr = [PKSequence sequence]; + additiveExpr.name = @"additiveExpr"; + [additiveExpr add:self.multiplicativeExpr]; + + PKAlternation *a = [PKAlternation alternation]; + + PKSequence *plusMultiplicativeExpr = [PKSequence sequence]; + [plusMultiplicativeExpr add:[PKSymbol symbolWithString:@"+"]]; + [plusMultiplicativeExpr add:self.multiplicativeExpr]; + [a add:plusMultiplicativeExpr]; + + PKSequence *minusMultiplicativeExpr = [PKSequence sequence]; + [minusMultiplicativeExpr add:[PKSymbol symbolWithString:@"-"]]; + [minusMultiplicativeExpr add:self.multiplicativeExpr]; + [a add:minusMultiplicativeExpr]; + + PKAlternation *a1 = [PKAlternation alternation]; + [a1 add:[PKEmpty empty]]; + [a1 add:a]; + + [additiveExpr add:a1]; + } + return additiveExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [26] MultiplicativeExpr ::= UnaryExpr +// | MultiplicativeExpr MultiplyOperator UnaryExpr +// | MultiplicativeExpr 'div' UnaryExpr +// | MultiplicativeExpr 'mod' UnaryExpr + +// MultiplicativeExpr :: = UnaryExpr (multiplyUnaryExpr | divUnaryExpr | modUnaryExpr)? +- (PKCollectionParser *)multiplicativeExpr { + //NSLog(@"%s", _cmd); + if (!multiplicativeExpr) { + self.multiplicativeExpr = [PKSequence sequence]; + multiplicativeExpr.name = @"multiplicativeExpr"; + [multiplicativeExpr add:self.unaryExpr]; + + PKAlternation *a = [PKAlternation alternation]; + + PKSequence *multiplyUnaryExpr = [PKSequence sequence]; + [multiplyUnaryExpr add:self.multiplyOperator]; + [multiplyUnaryExpr add:self.unaryExpr]; + [a add:multiplyUnaryExpr]; + + PKSequence *divUnaryExpr = [PKSequence sequence]; + [divUnaryExpr add:[PKLiteral literalWithString:@"div"]]; + [divUnaryExpr add:self.unaryExpr]; + [a add:divUnaryExpr]; + + PKSequence *modUnaryExpr = [PKSequence sequence]; + [modUnaryExpr add:[PKLiteral literalWithString:@"mod"]]; + [modUnaryExpr add:self.unaryExpr]; + [a add:modUnaryExpr]; + + PKAlternation *a1 = [PKAlternation alternation]; + [a1 add:[PKEmpty empty]]; + [a1 add:a]; + + [multiplicativeExpr add:a1]; + } + return multiplicativeExpr; +} + + +#pragma mark - +#pragma mark Left Recursion + +// [27] UnaryExpr ::= UnionExpr | '-' UnaryExpr + +// UnaryExpr ::= '-'? UnionExpr +- (PKCollectionParser *)unaryExpr { + //NSLog(@"%s", _cmd); + if (!unaryExpr) { + self.unaryExpr = [PKSequence sequence]; + unaryExpr.name = @"unaryExpr"; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKEmpty empty]]; + [a add:[PKSymbol symbolWithString:@"-"]]; + + [unaryExpr add:a]; + [unaryExpr add:self.unionExpr]; + + // self.unaryExpr = [PKAlternation alternation]; +// [unaryExpr add:self.unionExpr]; +// +// PKSequence *s = [PKSequence sequence]; +// [s add:[PKSymbol symbolWithString:@"-"]]; +// [s add:unaryExpr]; +// [unionExpr add:s]; + } + return unaryExpr; +} + + +// [28] ExprToken ::= '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::' +// | NameTest +// | NodeType +// | Operator +// | FunctionName +// | AxisName +// | Literal +// | Number +// | VariableReference +- (PKCollectionParser *)exprToken { + //NSLog(@"%s", _cmd); + if (!exprToken) { + self.exprToken = [PKAlternation alternation]; + exprToken.name = @"exprToken"; + + PKAlternation *a = [PKAlternation alternation]; + [a add:[PKSymbol symbolWithString:@"("]]; + [a add:[PKSymbol symbolWithString:@")"]]; + [a add:[PKSymbol symbolWithString:@"["]]; + [a add:[PKSymbol symbolWithString:@"]"]]; + [a add:[PKSymbol symbolWithString:@"."]]; + [a add:[PKSymbol symbolWithString:@".."]]; + [a add:[PKSymbol symbolWithString:@"@"]]; + [a add:[PKSymbol symbolWithString:@","]]; + [a add:[PKSymbol symbolWithString:@"::"]]; + [exprToken add:a]; + + [exprToken add:self.nameTest]; + [exprToken add:self.nodeType]; + [exprToken add:self.operator]; + [exprToken add:self.functionName]; + [exprToken add:self.axisName]; + [exprToken add:self.literal]; + [exprToken add:self.number]; + [exprToken add:self.variableReference]; + } + return exprToken; +} + + +- (PKParser *)literal { + //NSLog(@"%s", _cmd); + if (!literal) { + self.literal = [PKQuotedString quotedString]; + literal.name = @"literal"; + } + return literal; +} + + +- (PKParser *)number { + //NSLog(@"%s", _cmd); + if (!number) { + self.number = [PKNumber number]; + number.name = @"number"; + } + return number; +} + + +// [32] Operator ::= OperatorName +// | MultiplyOperator +// | '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>=' +- (PKCollectionParser *)operator { + //NSLog(@"%s", _cmd); + if (!operator) { + self.operator = [PKAlternation alternation]; + operator.name = @"operator"; + [operator add:self.operatorName]; + [operator add:self.multiplyOperator]; + [operator add:[PKSymbol symbolWithString: @"/"]]; + [operator add:[PKSymbol symbolWithString:@"//"]]; + [operator add:[PKSymbol symbolWithString: @"|"]]; + [operator add:[PKSymbol symbolWithString: @"+"]]; + [operator add:[PKSymbol symbolWithString: @"-"]]; + [operator add:[PKSymbol symbolWithString: @"="]]; + [operator add:[PKSymbol symbolWithString:@"!="]]; + [operator add:[PKSymbol symbolWithString: @"<"]]; + [operator add:[PKSymbol symbolWithString:@"<="]]; + [operator add:[PKSymbol symbolWithString: @">"]]; + [operator add:[PKSymbol symbolWithString:@">="]]; + } + return operator; +} + + +// [33] OperatorName ::= 'and' | 'or' | 'mod' | 'div' +- (PKCollectionParser *)operatorName { + //NSLog(@"%s", _cmd); + if (!operatorName) { + self.operatorName = [PKAlternation alternation]; + operatorName.name = @"operatorName"; + [operatorName add:[PKLiteral literalWithString:@"and"]]; + [operatorName add:[PKLiteral literalWithString: @"or"]]; + [operatorName add:[PKLiteral literalWithString:@"mod"]]; + [operatorName add:[PKLiteral literalWithString:@"div"]]; + } + return operatorName; +} + + +// [34] MultiplyOperator ::= '*' +- (PKParser *)multiplyOperator { + //NSLog(@"%s", _cmd); + if (!multiplyOperator) { + self.multiplyOperator = [PKSymbol symbolWithString:@"*"]; + multiplyOperator.name = @"multiplyOperator"; + } + return multiplyOperator; +} + + +//[7] QName ::= PrefixedName| UnprefixedName +//[8] PrefixedName ::= Prefix ':' LocalPart +//[9] UnprefixedName ::= LocalPart +//[10] Prefix ::= NCName +//[11] LocalPart ::= NCName +- (PKCollectionParser *)QName { + //NSLog(@"%s", _cmd); + if (!QName) { + self.QName = [PKAlternation alternation]; + QName.name = @"QName"; + + PKParser *prefix = [PKWord word]; + PKParser *localPart = [PKWord word]; + PKParser *unprefixedName = localPart; + + PKSequence *prefixedName = [PKSequence sequence]; + [prefixedName add:prefix]; + [prefixedName add:[PKSymbol symbolWithString:@":"]]; + [prefixedName add:localPart]; + + [QName add:prefixedName]; + [QName add:unprefixedName]; + } + return QName; +} + + +// [35] FunctionName ::= QName - NodeType +- (PKParser *)functionName { + //NSLog(@"%s", _cmd); + if (!functionName) { + self.functionName = self.QName; // TODO QName - NodeType + functionName.name = @"functionName"; + } + return functionName; +} + + +// [36] VariableReference ::= '$' QName +- (PKCollectionParser *)variableReference { + //NSLog(@"%s", _cmd); + if (!variableReference) { + self.variableReference = [PKSequence sequence]; + variableReference.name = @"variableReference"; + [variableReference add:[PKSymbol symbolWithString:@"$"]]; + [variableReference add:self.QName]; + } + return variableReference; +} + + +// [37] NameTest ::= '*' | NCName ':' '*' | QName +- (PKCollectionParser *)nameTest { + //NSLog(@"%s", _cmd); + if (!nameTest) { + self.nameTest = [PKAlternation alternation]; + nameTest.name = @"nameTest"; + [nameTest add:[PKSymbol symbolWithString:@"*"]]; + + PKSequence *s = [PKSequence sequence]; + [s add:[PKWord word]]; + [s add:[PKSymbol symbolWithString:@":"]]; + [s add:[PKSymbol symbolWithString:@"*"]]; + [nameTest add:s]; + + [nameTest add:self.QName]; + } + return nameTest; +} + + +// [38] NodeType ::= 'comment' +// | 'text' +// | 'processing-instruction' +// | 'node' +- (PKCollectionParser *)nodeType { + //NSLog(@"%s", _cmd); + if (!nodeType) { + self.nodeType = [PKAlternation alternation]; + nodeType.name = @"nodeType"; + [nodeType add:[PKLiteral literalWithString:@"comment"]]; + [nodeType add:[PKLiteral literalWithString:@"text"]]; + [nodeType add:[PKLiteral literalWithString:@"processing-instruction"]]; + [nodeType add:[PKLiteral literalWithString:@"node"]]; + } + return nodeType; +} + +@synthesize xpathAssembler; +@synthesize locationPath; +@synthesize absoluteLocationPath; +@synthesize relativeLocationPath; +@synthesize step; +@synthesize axisSpecifier; +@synthesize axisName; +@synthesize nodeTest; +@synthesize predicate; +@synthesize predicateExpr; +@synthesize abbreviatedAbsoluteLocationPath; +@synthesize abbreviatedRelativeLocationPath; +@synthesize abbreviatedStep; +@synthesize abbreviatedAxisSpecifier; +@synthesize expr; +@synthesize primaryExpr; +@synthesize functionCall; +@synthesize argument; +@synthesize unionExpr; +@synthesize pathExpr; +@synthesize filterExpr; +@synthesize orExpr; +@synthesize andExpr; +@synthesize equalityExpr; +@synthesize relationalExpr; +@synthesize additiveExpr; +@synthesize multiplicativeExpr; +@synthesize unaryExpr; +@synthesize exprToken; +@synthesize literal; +@synthesize number; +@synthesize operator; +@synthesize operatorName; +@synthesize multiplyOperator; +@synthesize functionName; +@synthesize variableReference; +@synthesize nameTest; +@synthesize nodeType; +@synthesize QName; +@end diff --git a/test/XPathParserGrammarTest.h b/test/XPathParserGrammarTest.h new file mode 100644 index 0000000..2fc3388 --- /dev/null +++ b/test/XPathParserGrammarTest.h @@ -0,0 +1,26 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +@interface XPathParserGrammarTest : SenTestCase { + NSString *s; + PKParser *p; + PKTokenizer *t; + PKAssembly *a; + PKAssembly *res; + PKToken *tok; +} + +@end diff --git a/test/XPathParserGrammarTest.m b/test/XPathParserGrammarTest.m new file mode 100644 index 0000000..58c6108 --- /dev/null +++ b/test/XPathParserGrammarTest.m @@ -0,0 +1,292 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "XPathParserGrammarTest.h" + +@implementation XPathParserGrammarTest + +- (void)setUp { + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"xpath1_0" ofType:@"grammar"]; + NSString *g = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil]; + p = [[PKParserFactory factory] parserFromGrammar:g assembler:nil]; + t = p.tokenizer; +} + + +- (void)testFoo { + t.string = @"foo"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDNotNil(res); + TDEqualObjects(@"[foo]foo^", [res description]); +} + + +- (void)test { + t.string = @"child::foo"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + // NSLog(@"\n\n res: %@ \n\n", res); + //TDEqualObjects(@"[/, foo]//foo^", [res description]); + + + t.string = @"/foo"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; +// NSLog(@"\n\n res: %@ \n\n", res); + TDEqualObjects(@"[/, foo]//foo^", [res description]); + + t.string = @"/foo/bar"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar]//foo///bar^", [res description]); + + t.string = @"/foo/bar/baz"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar, /, baz]//foo///bar///baz^", [res description]); + + t.string = @"/foo/bar[baz]"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar, [, baz, ]]//foo///bar/[/baz/]^", [res description]); + + t.string = @"/foo/bar[@baz]"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar, [, @, baz, ]]//foo///bar/[/@/baz/]^", [res description]); + + t.string = @"/foo/bar[@baz='foo']"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar, [, @, baz, =, 'foo', ]]//foo///bar/[/@/baz/=/'foo'/]^", [res description]); + + t.string = @"/foo/bar[baz]/foo"; + res = [p completeMatchFor:[PKTokenAssembly assemblyWithTokenizer:t]]; + TDEqualObjects(@"[/, foo, /, bar, [, baz, ], /, foo]//foo///bar/[/baz/]///foo^", [res description]); + + // not supported + t.string = @"//foo"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + NSLog(@"\n\n res: %@ \n\n", res); + TDEqualObjects(@"[//, foo]///foo^", [res description]); +} + + +- (void)testAxisName { + t.string = @"child"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"axisName"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[child]child^", [res description]); + + t.string = @"preceding-sibling"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"axisName"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[preceding-sibling]preceding-sibling^", [res description]); +} + + +- (void)testAxisSpecifier { + t.string = @"child::"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"axisSpecifier"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[child, ::]child/::^", [res description]); + t.string = @"preceding-sibling::"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"axisSpecifier"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[preceding-sibling, ::]preceding-sibling/::^", [res description]); +} + + +- (void)testQName { + t.string = @"foo:bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"qName"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, :, bar]foo/:/bar^", [res description]); + + t.string = @"foo:bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + //TDAssertThrowsSpecificNamed([p.QName bestMatchFor:a], [NSException class], @"PKTrackException"); +} + + +- (void)testNameTest { + t.string = @"foo:bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nameTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, :, bar]foo/:/bar^", [res description]); + + t.string = @"*"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nameTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[*]*^", [res description]); + + t.string = @"foo:*"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nameTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, :, *]foo/:/*^", [res description]); + + t.string = @"*:bar"; // NOT ALLOWED + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nameTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[*]*^:/bar", [res description]); + + t.string = @"foo"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nameTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo]foo^", [res description]); + + t.string = @"foo:bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + //TDAssertThrowsSpecificNamed([p.nameTest bestMatchFor:a], [NSException class], @"PKTrackException"); +} + + +- (void)testNodeType { + t.string = @"comment"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeType"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[comment]comment^", [res description]); + + t.string = @"node"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeType"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[node]node^", [res description]); + +} + + +- (void)testNodeTest { + t.string = @"comment()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[comment, (, )]comment/(/)^", [res description]); + + t.string = @"processing-instruction()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[processing-instruction, (, )]processing-instruction/(/)^", [res description]); + + t.string = @"processing-instruction('baz')"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[processing-instruction, (, 'baz', )]processing-instruction/(/'baz'/)^", [res description]); + + t.string = @"node()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[node, (, )]node/(/)^", [res description]); + + t.string = @"text()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[text, (, )]text/(/)^", [res description]); + + t.string = @"*"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[*]*^", [res description]); + + t.string = @"foo:*"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, :, *]foo/:/*^", [res description]); + + t.string = @"bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"nodeTest"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[bar]bar^", [res description]); +} + + +- (void)testVariableReference { + t.string = @"$foo"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + p = [p parserNamed:@"pathExpr"]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[$, foo]$/foo^", [res description]); + + t.string = @"$bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + p = [p parserNamed:@"pathExpr"]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[$, bar]$/bar^", [res description]); +} + + +- (void)testFunctionCall { + t.string = @"foo()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, (, )]foo/(/)^", [res description]); + + t.string = @"foo('bar')"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, (, 'bar', )]foo/(/'bar'/)^", [res description]); + + t.string = @"foo('bar', 'baz')"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, (, 'bar', ,, 'baz', )]foo/(/'bar'/,/'baz'/)^", [res description]); + + t.string = @"foo('bar', 1)"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [p bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, (, 'bar', ,, 1, )]foo/(/'bar'/,/1/)^", [res description]); +} + +- (void)testOrExpr { + t.string = @"foo or bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"orExpr"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, or, bar]foo/or/bar^", [res description]); +} + + +- (void)testAndExpr { + t.string = @"foo() and bar()"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"andExpr"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, (, ), and, bar, (, )]foo/(/)/and/bar/(/)^", [res description]); + + t.string = @"foo and bar"; + a = [PKTokenAssembly assemblyWithTokenizer:t]; + res = [[p parserNamed:@"andExpr"] bestMatchFor:a]; + TDNotNil(res); + TDEqualObjects(@"[foo, and, bar]foo/and/bar^", [res description]); +} + +@end diff --git a/test/XPathParserTest.h b/test/XPathParserTest.h new file mode 100644 index 0000000..513f85c --- /dev/null +++ b/test/XPathParserTest.h @@ -0,0 +1,26 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "TDTestScaffold.h" + +#import "XPathParser.h" + +@interface XPathParserTest : SenTestCase { + NSString *s; + XPathParser *p; + PKAssembly *a; + PKAssembly *result; +} + +@end diff --git a/test/XPathParserTest.m b/test/XPathParserTest.m new file mode 100644 index 0000000..f262d5b --- /dev/null +++ b/test/XPathParserTest.m @@ -0,0 +1,309 @@ +// Copyright 2010 Todd Ditchendorf +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +#import "XPathParserTest.h" +#import "TDNCName.h" + +@implementation XPathParserTest + +- (void)setUp { + p = [[[XPathParser alloc] init] autorelease]; +} + +- (void)test { + s = @"child::foo"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; +// NSLog(@"\n\n result: %@ \n\n", result); + //TDEqualObjects(@"[/, foo]//foo^", [result description]); + + + s = @"/foo"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + NSLog(@"\n\n result: %@ \n\n", result); + TDEqualObjects(@"[/, foo]//foo^", [result description]); + + s = @"/foo/bar"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar]//foo///bar^", [result description]); + + s = @"/foo/bar/baz"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar, /, baz]//foo///bar///baz^", [result description]); + + s = @"/foo/bar[baz]"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar, [, baz, ]]//foo///bar/[/baz/]^", [result description]); + + s = @"/foo/bar[@baz]"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar, [, @, baz, ]]//foo///bar/[/@/baz/]^", [result description]); + + s = @"/foo/bar[@baz='foo']"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar, [, @, baz, =, 'foo', ]]//foo///bar/[/@/baz/=/'foo'/]^", [result description]); + + s = @"/foo/bar[baz]/foo"; + a = [p assemblyWithString:s]; + result = [p bestMatchFor:a]; + TDEqualObjects(@"[/, foo, /, bar, [, baz, ], /, foo]//foo///bar/[/baz/]///foo^", [result description]); + + // not supported +// s = @"//foo"; +// a = [p assemblyWithString:s]; +// result = [p bestMatchFor:a]; +// NSLog(@"\n\n result: %@ \n\n", result); +// TDEqualObjects(@"[//, foo]///foo^", [result description]); +} + + +- (void)testAxisName { + s = @"child"; + a = [p assemblyWithString:s]; + NSLog(@"\n\n a: %@ \n\n", a); + result = [p.axisName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[child]child^", [result description]); + + s = @"preceeding-sibling"; + a = [p assemblyWithString:s]; + result = [p.axisName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[preceeding-sibling]preceeding-sibling^", [result description]); +} + + +- (void)testAxisSpecifier { + s = @"child::"; + a = [p assemblyWithString:s]; + result = [p.axisSpecifier bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[child, ::]child/::^", [result description]); + s = @"preceeding-sibling::"; + a = [p assemblyWithString:s]; + result = [p.axisSpecifier bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[preceeding-sibling, ::]preceeding-sibling/::^", [result description]); +} + + +- (void)testOperatorName { + s = @"and"; + a = [p assemblyWithString:s]; + result = [p.operatorName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[and]and^", [result description]); + + s = @"or"; + a = [p assemblyWithString:s]; + result = [p.operatorName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[or]or^", [result description]); +} + + +- (void)testQName { + s = @"foo:bar"; + a = [p assemblyWithString:s]; + result = [p.QName bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, :, bar]foo/:/bar^", [result description]); + + s = @"foo:bar"; + a = [p assemblyWithString:s]; + //TDAssertThrowsSpecificNamed([p.QName bestMatchFor:a], [NSException class], @"PKTrackException"); +} + + +- (void)testNameTest { + s = @"foo:bar"; + a = [p assemblyWithString:s]; + result = [p.nameTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, :, bar]foo/:/bar^", [result description]); + + s = @"*"; + a = [p assemblyWithString:s]; + result = [p.nameTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[*]*^", [result description]); + + s = @"foo:*"; + a = [p assemblyWithString:s]; + result = [p.nameTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, :, *]foo/:/*^", [result description]); + + s = @"*:bar"; // NOT ALLOWED + a = [p assemblyWithString:s]; + result = [p.nameTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[*]*^:/bar", [result description]); + + s = @"foo"; + a = [p assemblyWithString:s]; + result = [p.nameTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo]foo^", [result description]); + + s = @"foo:bar"; + a = [p assemblyWithString:s]; + //TDAssertThrowsSpecificNamed([p.nameTest bestMatchFor:a], [NSException class], @"PKTrackException"); +} + + +- (void)testNodeType { + s = @"comment"; + a = [p assemblyWithString:s]; + result = [p.nodeType bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[comment]comment^", [result description]); + + s = @"node"; + a = [p assemblyWithString:s]; + result = [p.nodeType bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[node]node^", [result description]); + +} + + +- (void)testNodeTest { + s = @"comment()"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[comment, (, )]comment/(/)^", [result description]); + + s = @"processing-instruction()"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[processing-instruction, (, )]processing-instruction/(/)^", [result description]); + + s = @"processing-instruction('baz')"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[processing-instruction, (, 'baz', )]processing-instruction/(/'baz'/)^", [result description]); + + s = @"node()"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[node, (, )]node/(/)^", [result description]); + + s = @"text()"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[text, (, )]text/(/)^", [result description]); + + s = @"*"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[*]*^", [result description]); + + s = @"foo:*"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, :, *]foo/:/*^", [result description]); + + s = @"bar"; + a = [p assemblyWithString:s]; + result = [p.nodeTest bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[bar]bar^", [result description]); +} + + +- (void)testVariableReference { + s = @"$foo"; + a = [p assemblyWithString:s]; + result = [p.variableReference bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[$, foo]$/foo^", [result description]); + + s = @"$bar"; + a = [p assemblyWithString:s]; + result = [p.variableReference bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[$, bar]$/bar^", [result description]); + + s = @"$foo:bar"; + a = [p assemblyWithString:s]; + result = [p.variableReference bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[$, foo, :, bar]$/foo/:/bar^", [result description]); +} + + +- (void)testFunctionCall { + s = @"foo()"; + a = [p assemblyWithString:s]; + result = [p.functionCall bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, (, )]foo/(/)^", [result description]); + + s = @"foo('bar')"; + a = [p assemblyWithString:s]; + result = [p.functionCall bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, (, 'bar', )]foo/(/'bar'/)^", [result description]); + + s = @"foo('bar', 'baz')"; + a = [p assemblyWithString:s]; + result = [p.functionCall bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, (, 'bar', ,, 'baz', )]foo/(/'bar'/,/'baz'/)^", [result description]); + + s = @"foo('bar', 1)"; + a = [p assemblyWithString:s]; + result = [p.functionCall bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, (, 'bar', ,, 1, )]foo/(/'bar'/,/1/)^", [result description]); +} + +- (void)testOrExpr { + s = @"foo or bar"; + a = [p assemblyWithString:s]; + result = [p.orExpr bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, or, bar]foo/or/bar^", [result description]); +} + + +- (void)testAndExpr { + s = @"foo() and bar()"; + a = [p assemblyWithString:s]; + result = [p.andExpr bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, (, ), and, bar, (, )]foo/(/)/and/bar/(/)^", [result description]); + + s = @"foo and bar"; + a = [p assemblyWithString:s]; + result = [p.andExpr bestMatchFor:a]; + TDNotNil(result); + TDEqualObjects(@"[foo, and, bar]foo/and/bar^", [result description]); +} + +@end