├── .gitignore ├── .travis.yml ├── Cargo.toml ├── LICENSE ├── README.md ├── build.rs ├── doc ├── LICENSE ├── README.md └── talks │ └── sf-rust-2016-02-18 │ ├── index.html │ ├── pictures │ ├── fxos │ │ ├── 3dview.mp4 │ │ ├── 3dview.webm │ │ ├── appmanager.mp4 │ │ ├── appmanager.webm │ │ ├── apps.png │ │ ├── boilerplate.jpg │ │ ├── brick.jpg │ │ ├── buildingblocks.png │ │ ├── buildingfirefoxos.png │ │ ├── console.png │ │ ├── debugger.png │ │ ├── devhub.jpg │ │ ├── devtools.jpg │ │ ├── devtools.png │ │ ├── dynamicsearch.mp4 │ │ ├── dynamicsearch.ogv │ │ ├── dynamicsearch.webm │ │ ├── enduser-fxos.jpg │ │ ├── everythingme.jpg │ │ ├── firefox-oct-2013.png │ │ ├── firefox-os-emulator.jpg │ │ ├── firefoxos.png │ │ ├── flathead.png │ │ ├── foxkeh-android.png │ │ ├── fxosvideos.jpg │ │ ├── fxoswiki.jpg │ │ ├── hacksblog.jpg │ │ ├── hobbes-earth.jpg │ │ ├── inspector.png │ │ ├── keep-calm-and-trust-html5.jpg │ │ ├── marketplace.jpg │ │ ├── mobiletools.png │ │ ├── network-details.png │ │ ├── network.png │ │ ├── nokia-photos.jpg │ │ ├── phonegapdiagram.png │ │ ├── pick-activity.jpg │ │ ├── profiler.png │ │ ├── reflow.mp4 │ │ ├── reflow.webm │ │ ├── remote-debugging-overview.png │ │ ├── responsive.mp4 │ │ ├── responsive.webm │ │ ├── scratchpad.png │ │ ├── simulator.png │ │ ├── simulator40.png │ │ ├── styleeditor.png │ │ └── webapiwiki.png │ ├── mozillaoverview │ │ └── redpanda.jpg │ ├── parsell │ │ └── parsell-github.png │ └── templatedemos │ │ ├── earthphases.gif │ │ ├── high-five.jpg │ │ ├── phones.jpg │ │ ├── smallphones.jpg │ │ ├── wave.mp4 │ │ └── wave.webm │ ├── scripts │ └── script.js │ ├── template.html │ └── themes │ └── mozilla │ ├── fonts │ ├── OpenSans-Bold.eot │ ├── OpenSans-Bold.svg │ ├── OpenSans-Bold.ttf │ ├── OpenSans-Bold.woff │ ├── OpenSans-Bold.woff2 │ ├── OpenSans-BoldItalic.eot │ ├── OpenSans-BoldItalic.svg │ ├── OpenSans-BoldItalic.ttf │ ├── OpenSans-BoldItalic.woff │ ├── OpenSans-BoldItalic.woff2 │ ├── OpenSans-ExtraBold.eot │ ├── OpenSans-ExtraBold.svg │ ├── OpenSans-ExtraBold.ttf │ ├── OpenSans-ExtraBold.woff │ ├── OpenSans-ExtraBold.woff2 │ ├── OpenSans-ExtraBoldItalic.eot │ ├── OpenSans-ExtraBoldItalic.svg │ ├── OpenSans-ExtraBoldItalic.ttf │ ├── OpenSans-ExtraBoldItalic.woff │ ├── OpenSans-ExtraBoldItalic.woff2 │ ├── OpenSans-Light.eot │ ├── OpenSans-Light.svg │ ├── OpenSans-Light.ttf │ ├── OpenSans-Light.woff │ ├── OpenSans-Light.woff2 │ ├── OpenSans-LightItalic.eot │ ├── OpenSans-LightItalic.svg │ ├── OpenSans-LightItalic.ttf │ ├── OpenSans-LightItalic.woff │ ├── OpenSans-LightItalic.woff2 │ ├── OpenSans-Regular.eot │ ├── OpenSans-Regular.svg │ ├── OpenSans-Regular.ttf │ ├── OpenSans-Regular.woff │ ├── OpenSans-Regular.woff2 │ ├── OpenSans-RegularItalic.eot │ ├── OpenSans-RegularItalic.svg │ ├── OpenSans-RegularItalic.ttf │ ├── OpenSans-RegularItalic.woff │ ├── OpenSans-RegularItalic.woff2 │ ├── OpenSans-SemiBold.eot │ ├── OpenSans-SemiBold.svg │ ├── OpenSans-SemiBold.ttf │ ├── OpenSans-SemiBold.woff │ ├── OpenSans-SemiBold.woff2 │ ├── OpenSans-SemiBoldItalic.eot │ ├── OpenSans-SemiBoldItalic.svg │ ├── OpenSans-SemiBoldItalic.ttf │ ├── OpenSans-SemiBoldItalic.woff │ ├── OpenSans-SemiBoldItalic.woff2 │ ├── TargetBlank.otf │ └── TargetBlank.svg │ ├── images │ ├── Fx-logo.png │ ├── bg-blue-2.png │ ├── bg-darkgrey-2.png │ ├── bg-red-2.png │ ├── bg-sandstone-2.png │ ├── mozilla-logo-white.png │ ├── mozilla-logo.png │ └── tab-2.png │ └── styles │ ├── fonts.css │ ├── print.css │ ├── reset.css │ └── style.css ├── src ├── impls.rs └── lib.rs └── tests ├── skeptic.rs ├── typecheck-time1.rs ├── typecheck-time2.rs ├── typecheck-time3.rs └── typecheck-time4.rs /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled files 2 | *.o 3 | *.so 4 | *.rlib 5 | *.dll 6 | 7 | # Executables 8 | *.exe 9 | 10 | # Generated by Cargo 11 | /target/ 12 | Cargo.lock 13 | 14 | # Backup files 15 | *~ 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | rust: 3 | - nightly 4 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | 3 | name = "parsell" 4 | version = "0.6.6-SNAPSHOT" 5 | authors = [ "Alan Jeffrey " ] 6 | 7 | description = "Parsell LL(1) streaming parser combinators" 8 | repository = "https://github.com/asajeffrey/parsell" 9 | documentation = "http://asajeffrey.github.io/parsell" 10 | readme = "README.md" 11 | keywords = [ "parser", "parsing", "streaming", "parser-combinators" ] 12 | license = "MPL-2.0" 13 | 14 | build = "build.rs" 15 | 16 | exclude = [ "doc/*" ] 17 | 18 | [build-dependencies] 19 | skeptic = "0.4.0" 20 | 21 | [dev-dependencies] 22 | skeptic = "0.4.0" 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License, version 2.0 2 | 3 | 1. Definitions 4 | 5 | 1.1. "Contributor" 6 | 7 | means each individual or legal entity that creates, contributes to the 8 | creation of, or owns Covered Software. 9 | 10 | 1.2. "Contributor Version" 11 | 12 | means the combination of the Contributions of others (if any) used by a 13 | Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | 17 | means Covered Software of a particular Contributor. 18 | 19 | 1.4. "Covered Software" 20 | 21 | means Source Code Form to which the initial Contributor has attached the 22 | notice in Exhibit A, the Executable Form of such Source Code Form, and 23 | Modifications of such Source Code Form, in each case including portions 24 | thereof. 25 | 26 | 1.5. "Incompatible With Secondary Licenses" 27 | means 28 | 29 | a. that the initial Contributor has attached the notice described in 30 | Exhibit B to the Covered Software; or 31 | 32 | b. that the Covered Software was made available under the terms of 33 | version 1.1 or earlier of the License, but not also under the terms of 34 | a Secondary License. 35 | 36 | 1.6. "Executable Form" 37 | 38 | means any form of the work other than Source Code Form. 39 | 40 | 1.7. "Larger Work" 41 | 42 | means a work that combines Covered Software with other material, in a 43 | separate file or files, that is not Covered Software. 44 | 45 | 1.8. "License" 46 | 47 | means this document. 48 | 49 | 1.9. "Licensable" 50 | 51 | means having the right to grant, to the maximum extent possible, whether 52 | at the time of the initial grant or subsequently, any and all of the 53 | rights conveyed by this License. 54 | 55 | 1.10. "Modifications" 56 | 57 | means any of the following: 58 | 59 | a. any file in Source Code Form that results from an addition to, 60 | deletion from, or modification of the contents of Covered Software; or 61 | 62 | b. any new file in Source Code Form that contains any Covered Software. 63 | 64 | 1.11. "Patent Claims" of a Contributor 65 | 66 | means any patent claim(s), including without limitation, method, 67 | process, and apparatus claims, in any patent Licensable by such 68 | Contributor that would be infringed, but for the grant of the License, 69 | by the making, using, selling, offering for sale, having made, import, 70 | or transfer of either its Contributions or its Contributor Version. 71 | 72 | 1.12. "Secondary License" 73 | 74 | means either the GNU General Public License, Version 2.0, the GNU Lesser 75 | General Public License, Version 2.1, the GNU Affero General Public 76 | License, Version 3.0, or any later versions of those licenses. 77 | 78 | 1.13. "Source Code Form" 79 | 80 | means the form of the work preferred for making modifications. 81 | 82 | 1.14. "You" (or "Your") 83 | 84 | means an individual or a legal entity exercising rights under this 85 | License. For legal entities, "You" includes any entity that controls, is 86 | controlled by, or is under common control with You. For purposes of this 87 | definition, "control" means (a) the power, direct or indirect, to cause 88 | the direction or management of such entity, whether by contract or 89 | otherwise, or (b) ownership of more than fifty percent (50%) of the 90 | outstanding shares or beneficial ownership of such entity. 91 | 92 | 93 | 2. License Grants and Conditions 94 | 95 | 2.1. Grants 96 | 97 | Each Contributor hereby grants You a world-wide, royalty-free, 98 | non-exclusive license: 99 | 100 | a. under intellectual property rights (other than patent or trademark) 101 | Licensable by such Contributor to use, reproduce, make available, 102 | modify, display, perform, distribute, and otherwise exploit its 103 | Contributions, either on an unmodified basis, with Modifications, or 104 | as part of a Larger Work; and 105 | 106 | b. under Patent Claims of such Contributor to make, use, sell, offer for 107 | sale, have made, import, and otherwise transfer either its 108 | Contributions or its Contributor Version. 109 | 110 | 2.2. Effective Date 111 | 112 | The licenses granted in Section 2.1 with respect to any Contribution 113 | become effective for each Contribution on the date the Contributor first 114 | distributes such Contribution. 115 | 116 | 2.3. Limitations on Grant Scope 117 | 118 | The licenses granted in this Section 2 are the only rights granted under 119 | this License. No additional rights or licenses will be implied from the 120 | distribution or licensing of Covered Software under this License. 121 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 122 | Contributor: 123 | 124 | a. for any code that a Contributor has removed from Covered Software; or 125 | 126 | b. for infringements caused by: (i) Your and any other third party's 127 | modifications of Covered Software, or (ii) the combination of its 128 | Contributions with other software (except as part of its Contributor 129 | Version); or 130 | 131 | c. under Patent Claims infringed by Covered Software in the absence of 132 | its Contributions. 133 | 134 | This License does not grant any rights in the trademarks, service marks, 135 | or logos of any Contributor (except as may be necessary to comply with 136 | the notice requirements in Section 3.4). 137 | 138 | 2.4. Subsequent Licenses 139 | 140 | No Contributor makes additional grants as a result of Your choice to 141 | distribute the Covered Software under a subsequent version of this 142 | License (see Section 10.2) or under the terms of a Secondary License (if 143 | permitted under the terms of Section 3.3). 144 | 145 | 2.5. Representation 146 | 147 | Each Contributor represents that the Contributor believes its 148 | Contributions are its original creation(s) or it has sufficient rights to 149 | grant the rights to its Contributions conveyed by this License. 150 | 151 | 2.6. Fair Use 152 | 153 | This License is not intended to limit any rights You have under 154 | applicable copyright doctrines of fair use, fair dealing, or other 155 | equivalents. 156 | 157 | 2.7. Conditions 158 | 159 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in 160 | Section 2.1. 161 | 162 | 163 | 3. Responsibilities 164 | 165 | 3.1. Distribution of Source Form 166 | 167 | All distribution of Covered Software in Source Code Form, including any 168 | Modifications that You create or to which You contribute, must be under 169 | the terms of this License. You must inform recipients that the Source 170 | Code Form of the Covered Software is governed by the terms of this 171 | License, and how they can obtain a copy of this License. You may not 172 | attempt to alter or restrict the recipients' rights in the Source Code 173 | Form. 174 | 175 | 3.2. Distribution of Executable Form 176 | 177 | If You distribute Covered Software in Executable Form then: 178 | 179 | a. such Covered Software must also be made available in Source Code Form, 180 | as described in Section 3.1, and You must inform recipients of the 181 | Executable Form how they can obtain a copy of such Source Code Form by 182 | reasonable means in a timely manner, at a charge no more than the cost 183 | of distribution to the recipient; and 184 | 185 | b. You may distribute such Executable Form under the terms of this 186 | License, or sublicense it under different terms, provided that the 187 | license for the Executable Form does not attempt to limit or alter the 188 | recipients' rights in the Source Code Form under this License. 189 | 190 | 3.3. Distribution of a Larger Work 191 | 192 | You may create and distribute a Larger Work under terms of Your choice, 193 | provided that You also comply with the requirements of this License for 194 | the Covered Software. If the Larger Work is a combination of Covered 195 | Software with a work governed by one or more Secondary Licenses, and the 196 | Covered Software is not Incompatible With Secondary Licenses, this 197 | License permits You to additionally distribute such Covered Software 198 | under the terms of such Secondary License(s), so that the recipient of 199 | the Larger Work may, at their option, further distribute the Covered 200 | Software under the terms of either this License or such Secondary 201 | License(s). 202 | 203 | 3.4. Notices 204 | 205 | You may not remove or alter the substance of any license notices 206 | (including copyright notices, patent notices, disclaimers of warranty, or 207 | limitations of liability) contained within the Source Code Form of the 208 | Covered Software, except that You may alter any license notices to the 209 | extent required to remedy known factual inaccuracies. 210 | 211 | 3.5. Application of Additional Terms 212 | 213 | You may choose to offer, and to charge a fee for, warranty, support, 214 | indemnity or liability obligations to one or more recipients of Covered 215 | Software. However, You may do so only on Your own behalf, and not on 216 | behalf of any Contributor. You must make it absolutely clear that any 217 | such warranty, support, indemnity, or liability obligation is offered by 218 | You alone, and You hereby agree to indemnify every Contributor for any 219 | liability incurred by such Contributor as a result of warranty, support, 220 | indemnity or liability terms You offer. You may include additional 221 | disclaimers of warranty and limitations of liability specific to any 222 | jurisdiction. 223 | 224 | 4. Inability to Comply Due to Statute or Regulation 225 | 226 | If it is impossible for You to comply with any of the terms of this License 227 | with respect to some or all of the Covered Software due to statute, 228 | judicial order, or regulation then You must: (a) comply with the terms of 229 | this License to the maximum extent possible; and (b) describe the 230 | limitations and the code they affect. Such description must be placed in a 231 | text file included with all distributions of the Covered Software under 232 | this License. Except to the extent prohibited by statute or regulation, 233 | such description must be sufficiently detailed for a recipient of ordinary 234 | skill to be able to understand it. 235 | 236 | 5. Termination 237 | 238 | 5.1. The rights granted under this License will terminate automatically if You 239 | fail to comply with any of its terms. However, if You become compliant, 240 | then the rights granted under this License from a particular Contributor 241 | are reinstated (a) provisionally, unless and until such Contributor 242 | explicitly and finally terminates Your grants, and (b) on an ongoing 243 | basis, if such Contributor fails to notify You of the non-compliance by 244 | some reasonable means prior to 60 days after You have come back into 245 | compliance. Moreover, Your grants from a particular Contributor are 246 | reinstated on an ongoing basis if such Contributor notifies You of the 247 | non-compliance by some reasonable means, this is the first time You have 248 | received notice of non-compliance with this License from such 249 | Contributor, and You become compliant prior to 30 days after Your receipt 250 | of the notice. 251 | 252 | 5.2. If You initiate litigation against any entity by asserting a patent 253 | infringement claim (excluding declaratory judgment actions, 254 | counter-claims, and cross-claims) alleging that a Contributor Version 255 | directly or indirectly infringes any patent, then the rights granted to 256 | You by any and all Contributors for the Covered Software under Section 257 | 2.1 of this License shall terminate. 258 | 259 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user 260 | license agreements (excluding distributors and resellers) which have been 261 | validly granted by You or Your distributors under this License prior to 262 | termination shall survive termination. 263 | 264 | 6. Disclaimer of Warranty 265 | 266 | Covered Software is provided under this License on an "as is" basis, 267 | without warranty of any kind, either expressed, implied, or statutory, 268 | including, without limitation, warranties that the Covered Software is free 269 | of defects, merchantable, fit for a particular purpose or non-infringing. 270 | The entire risk as to the quality and performance of the Covered Software 271 | is with You. Should any Covered Software prove defective in any respect, 272 | You (not any Contributor) assume the cost of any necessary servicing, 273 | repair, or correction. This disclaimer of warranty constitutes an essential 274 | part of this License. No use of any Covered Software is authorized under 275 | this License except under this disclaimer. 276 | 277 | 7. Limitation of Liability 278 | 279 | Under no circumstances and under no legal theory, whether tort (including 280 | negligence), contract, or otherwise, shall any Contributor, or anyone who 281 | distributes Covered Software as permitted above, be liable to You for any 282 | direct, indirect, special, incidental, or consequential damages of any 283 | character including, without limitation, damages for lost profits, loss of 284 | goodwill, work stoppage, computer failure or malfunction, or any and all 285 | other commercial damages or losses, even if such party shall have been 286 | informed of the possibility of such damages. This limitation of liability 287 | shall not apply to liability for death or personal injury resulting from 288 | such party's negligence to the extent applicable law prohibits such 289 | limitation. Some jurisdictions do not allow the exclusion or limitation of 290 | incidental or consequential damages, so this exclusion and limitation may 291 | not apply to You. 292 | 293 | 8. Litigation 294 | 295 | Any litigation relating to this License may be brought only in the courts 296 | of a jurisdiction where the defendant maintains its principal place of 297 | business and such litigation shall be governed by laws of that 298 | jurisdiction, without reference to its conflict-of-law provisions. Nothing 299 | in this Section shall prevent a party's ability to bring cross-claims or 300 | counter-claims. 301 | 302 | 9. Miscellaneous 303 | 304 | This License represents the complete agreement concerning the subject 305 | matter hereof. If any provision of this License is held to be 306 | unenforceable, such provision shall be reformed only to the extent 307 | necessary to make it enforceable. Any law or regulation which provides that 308 | the language of a contract shall be construed against the drafter shall not 309 | be used to construe this License against a Contributor. 310 | 311 | 312 | 10. Versions of the License 313 | 314 | 10.1. New Versions 315 | 316 | Mozilla Foundation is the license steward. Except as provided in Section 317 | 10.3, no one other than the license steward has the right to modify or 318 | publish new versions of this License. Each version will be given a 319 | distinguishing version number. 320 | 321 | 10.2. Effect of New Versions 322 | 323 | You may distribute the Covered Software under the terms of the version 324 | of the License under which You originally received the Covered Software, 325 | or under the terms of any subsequent version published by the license 326 | steward. 327 | 328 | 10.3. Modified Versions 329 | 330 | If you create software not governed by this License, and you want to 331 | create a new license for such software, you may create and use a 332 | modified version of this License if you rename the license and remove 333 | any references to the name of the license steward (except to note that 334 | such modified license differs from this License). 335 | 336 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 337 | Licenses If You choose to distribute Source Code Form that is 338 | Incompatible With Secondary Licenses under the terms of this version of 339 | the License, the notice described in Exhibit B of this License must be 340 | attached. 341 | 342 | Exhibit A - Source Code Form License Notice 343 | 344 | This Source Code Form is subject to the 345 | terms of the Mozilla Public License, v. 346 | 2.0. If a copy of the MPL was not 347 | distributed with this file, You can 348 | obtain one at 349 | http://mozilla.org/MPL/2.0/. 350 | 351 | If it is not possible or desirable to put the notice in a particular file, 352 | then You may include the notice in a location (such as a LICENSE file in a 353 | relevant directory) where a recipient would be likely to look for such a 354 | notice. 355 | ======= 356 | Mozilla Public License Version 2.0 357 | ================================== 358 | 359 | 1. Definitions 360 | -------------- 361 | 362 | 1.1. "Contributor" 363 | means each individual or legal entity that creates, contributes to 364 | the creation of, or owns Covered Software. 365 | 366 | 1.2. "Contributor Version" 367 | means the combination of the Contributions of others (if any) used 368 | by a Contributor and that particular Contributor's Contribution. 369 | 370 | 1.3. "Contribution" 371 | means Covered Software of a particular Contributor. 372 | 373 | 1.4. "Covered Software" 374 | means Source Code Form to which the initial Contributor has attached 375 | the notice in Exhibit A, the Executable Form of such Source Code 376 | Form, and Modifications of such Source Code Form, in each case 377 | including portions thereof. 378 | 379 | 1.5. "Incompatible With Secondary Licenses" 380 | means 381 | 382 | (a) that the initial Contributor has attached the notice described 383 | in Exhibit B to the Covered Software; or 384 | 385 | (b) that the Covered Software was made available under the terms of 386 | version 1.1 or earlier of the License, but not also under the 387 | terms of a Secondary License. 388 | 389 | 1.6. "Executable Form" 390 | means any form of the work other than Source Code Form. 391 | 392 | 1.7. "Larger Work" 393 | means a work that combines Covered Software with other material, in 394 | a separate file or files, that is not Covered Software. 395 | 396 | 1.8. "License" 397 | means this document. 398 | 399 | 1.9. "Licensable" 400 | means having the right to grant, to the maximum extent possible, 401 | whether at the time of the initial grant or subsequently, any and 402 | all of the rights conveyed by this License. 403 | 404 | 1.10. "Modifications" 405 | means any of the following: 406 | 407 | (a) any file in Source Code Form that results from an addition to, 408 | deletion from, or modification of the contents of Covered 409 | Software; or 410 | 411 | (b) any new file in Source Code Form that contains any Covered 412 | Software. 413 | 414 | 1.11. "Patent Claims" of a Contributor 415 | means any patent claim(s), including without limitation, method, 416 | process, and apparatus claims, in any patent Licensable by such 417 | Contributor that would be infringed, but for the grant of the 418 | License, by the making, using, selling, offering for sale, having 419 | made, import, or transfer of either its Contributions or its 420 | Contributor Version. 421 | 422 | 1.12. "Secondary License" 423 | means either the GNU General Public License, Version 2.0, the GNU 424 | Lesser General Public License, Version 2.1, the GNU Affero General 425 | Public License, Version 3.0, or any later versions of those 426 | licenses. 427 | 428 | 1.13. "Source Code Form" 429 | means the form of the work preferred for making modifications. 430 | 431 | 1.14. "You" (or "Your") 432 | means an individual or a legal entity exercising rights under this 433 | License. For legal entities, "You" includes any entity that 434 | controls, is controlled by, or is under common control with You. For 435 | purposes of this definition, "control" means (a) the power, direct 436 | or indirect, to cause the direction or management of such entity, 437 | whether by contract or otherwise, or (b) ownership of more than 438 | fifty percent (50%) of the outstanding shares or beneficial 439 | ownership of such entity. 440 | 441 | 2. License Grants and Conditions 442 | -------------------------------- 443 | 444 | 2.1. Grants 445 | 446 | Each Contributor hereby grants You a world-wide, royalty-free, 447 | non-exclusive license: 448 | 449 | (a) under intellectual property rights (other than patent or trademark) 450 | Licensable by such Contributor to use, reproduce, make available, 451 | modify, display, perform, distribute, and otherwise exploit its 452 | Contributions, either on an unmodified basis, with Modifications, or 453 | as part of a Larger Work; and 454 | 455 | (b) under Patent Claims of such Contributor to make, use, sell, offer 456 | for sale, have made, import, and otherwise transfer either its 457 | Contributions or its Contributor Version. 458 | 459 | 2.2. Effective Date 460 | 461 | The licenses granted in Section 2.1 with respect to any Contribution 462 | become effective for each Contribution on the date the Contributor first 463 | distributes such Contribution. 464 | 465 | 2.3. Limitations on Grant Scope 466 | 467 | The licenses granted in this Section 2 are the only rights granted under 468 | this License. No additional rights or licenses will be implied from the 469 | distribution or licensing of Covered Software under this License. 470 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 471 | Contributor: 472 | 473 | (a) for any code that a Contributor has removed from Covered Software; 474 | or 475 | 476 | (b) for infringements caused by: (i) Your and any other third party's 477 | modifications of Covered Software, or (ii) the combination of its 478 | Contributions with other software (except as part of its Contributor 479 | Version); or 480 | 481 | (c) under Patent Claims infringed by Covered Software in the absence of 482 | its Contributions. 483 | 484 | This License does not grant any rights in the trademarks, service marks, 485 | or logos of any Contributor (except as may be necessary to comply with 486 | the notice requirements in Section 3.4). 487 | 488 | 2.4. Subsequent Licenses 489 | 490 | No Contributor makes additional grants as a result of Your choice to 491 | distribute the Covered Software under a subsequent version of this 492 | License (see Section 10.2) or under the terms of a Secondary License (if 493 | permitted under the terms of Section 3.3). 494 | 495 | 2.5. Representation 496 | 497 | Each Contributor represents that the Contributor believes its 498 | Contributions are its original creation(s) or it has sufficient rights 499 | to grant the rights to its Contributions conveyed by this License. 500 | 501 | 2.6. Fair Use 502 | 503 | This License is not intended to limit any rights You have under 504 | applicable copyright doctrines of fair use, fair dealing, or other 505 | equivalents. 506 | 507 | 2.7. Conditions 508 | 509 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 510 | in Section 2.1. 511 | 512 | 3. Responsibilities 513 | ------------------- 514 | 515 | 3.1. Distribution of Source Form 516 | 517 | All distribution of Covered Software in Source Code Form, including any 518 | Modifications that You create or to which You contribute, must be under 519 | the terms of this License. You must inform recipients that the Source 520 | Code Form of the Covered Software is governed by the terms of this 521 | License, and how they can obtain a copy of this License. You may not 522 | attempt to alter or restrict the recipients' rights in the Source Code 523 | Form. 524 | 525 | 3.2. Distribution of Executable Form 526 | 527 | If You distribute Covered Software in Executable Form then: 528 | 529 | (a) such Covered Software must also be made available in Source Code 530 | Form, as described in Section 3.1, and You must inform recipients of 531 | the Executable Form how they can obtain a copy of such Source Code 532 | Form by reasonable means in a timely manner, at a charge no more 533 | than the cost of distribution to the recipient; and 534 | 535 | (b) You may distribute such Executable Form under the terms of this 536 | License, or sublicense it under different terms, provided that the 537 | license for the Executable Form does not attempt to limit or alter 538 | the recipients' rights in the Source Code Form under this License. 539 | 540 | 3.3. Distribution of a Larger Work 541 | 542 | You may create and distribute a Larger Work under terms of Your choice, 543 | provided that You also comply with the requirements of this License for 544 | the Covered Software. If the Larger Work is a combination of Covered 545 | Software with a work governed by one or more Secondary Licenses, and the 546 | Covered Software is not Incompatible With Secondary Licenses, this 547 | License permits You to additionally distribute such Covered Software 548 | under the terms of such Secondary License(s), so that the recipient of 549 | the Larger Work may, at their option, further distribute the Covered 550 | Software under the terms of either this License or such Secondary 551 | License(s). 552 | 553 | 3.4. Notices 554 | 555 | You may not remove or alter the substance of any license notices 556 | (including copyright notices, patent notices, disclaimers of warranty, 557 | or limitations of liability) contained within the Source Code Form of 558 | the Covered Software, except that You may alter any license notices to 559 | the extent required to remedy known factual inaccuracies. 560 | 561 | 3.5. Application of Additional Terms 562 | 563 | You may choose to offer, and to charge a fee for, warranty, support, 564 | indemnity or liability obligations to one or more recipients of Covered 565 | Software. However, You may do so only on Your own behalf, and not on 566 | behalf of any Contributor. You must make it absolutely clear that any 567 | such warranty, support, indemnity, or liability obligation is offered by 568 | You alone, and You hereby agree to indemnify every Contributor for any 569 | liability incurred by such Contributor as a result of warranty, support, 570 | indemnity or liability terms You offer. You may include additional 571 | disclaimers of warranty and limitations of liability specific to any 572 | jurisdiction. 573 | 574 | 4. Inability to Comply Due to Statute or Regulation 575 | --------------------------------------------------- 576 | 577 | If it is impossible for You to comply with any of the terms of this 578 | License with respect to some or all of the Covered Software due to 579 | statute, judicial order, or regulation then You must: (a) comply with 580 | the terms of this License to the maximum extent possible; and (b) 581 | describe the limitations and the code they affect. Such description must 582 | be placed in a text file included with all distributions of the Covered 583 | Software under this License. Except to the extent prohibited by statute 584 | or regulation, such description must be sufficiently detailed for a 585 | recipient of ordinary skill to be able to understand it. 586 | 587 | 5. Termination 588 | -------------- 589 | 590 | 5.1. The rights granted under this License will terminate automatically 591 | if You fail to comply with any of its terms. However, if You become 592 | compliant, then the rights granted under this License from a particular 593 | Contributor are reinstated (a) provisionally, unless and until such 594 | Contributor explicitly and finally terminates Your grants, and (b) on an 595 | ongoing basis, if such Contributor fails to notify You of the 596 | non-compliance by some reasonable means prior to 60 days after You have 597 | come back into compliance. Moreover, Your grants from a particular 598 | Contributor are reinstated on an ongoing basis if such Contributor 599 | notifies You of the non-compliance by some reasonable means, this is the 600 | first time You have received notice of non-compliance with this License 601 | from such Contributor, and You become compliant prior to 30 days after 602 | Your receipt of the notice. 603 | 604 | 5.2. If You initiate litigation against any entity by asserting a patent 605 | infringement claim (excluding declaratory judgment actions, 606 | counter-claims, and cross-claims) alleging that a Contributor Version 607 | directly or indirectly infringes any patent, then the rights granted to 608 | You by any and all Contributors for the Covered Software under Section 609 | 2.1 of this License shall terminate. 610 | 611 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 612 | end user license agreements (excluding distributors and resellers) which 613 | have been validly granted by You or Your distributors under this License 614 | prior to termination shall survive termination. 615 | 616 | ************************************************************************ 617 | * * 618 | * 6. Disclaimer of Warranty * 619 | * ------------------------- * 620 | * * 621 | * Covered Software is provided under this License on an "as is" * 622 | * basis, without warranty of any kind, either expressed, implied, or * 623 | * statutory, including, without limitation, warranties that the * 624 | * Covered Software is free of defects, merchantable, fit for a * 625 | * particular purpose or non-infringing. The entire risk as to the * 626 | * quality and performance of the Covered Software is with You. * 627 | * Should any Covered Software prove defective in any respect, You * 628 | * (not any Contributor) assume the cost of any necessary servicing, * 629 | * repair, or correction. This disclaimer of warranty constitutes an * 630 | * essential part of this License. No use of any Covered Software is * 631 | * authorized under this License except under this disclaimer. * 632 | * * 633 | ************************************************************************ 634 | 635 | ************************************************************************ 636 | * * 637 | * 7. Limitation of Liability * 638 | * -------------------------- * 639 | * * 640 | * Under no circumstances and under no legal theory, whether tort * 641 | * (including negligence), contract, or otherwise, shall any * 642 | * Contributor, or anyone who distributes Covered Software as * 643 | * permitted above, be liable to You for any direct, indirect, * 644 | * special, incidental, or consequential damages of any character * 645 | * including, without limitation, damages for lost profits, loss of * 646 | * goodwill, work stoppage, computer failure or malfunction, or any * 647 | * and all other commercial damages or losses, even if such party * 648 | * shall have been informed of the possibility of such damages. This * 649 | * limitation of liability shall not apply to liability for death or * 650 | * personal injury resulting from such party's negligence to the * 651 | * extent applicable law prohibits such limitation. Some * 652 | * jurisdictions do not allow the exclusion or limitation of * 653 | * incidental or consequential damages, so this exclusion and * 654 | * limitation may not apply to You. * 655 | * * 656 | ************************************************************************ 657 | 658 | 8. Litigation 659 | ------------- 660 | 661 | Any litigation relating to this License may be brought only in the 662 | courts of a jurisdiction where the defendant maintains its principal 663 | place of business and such litigation shall be governed by laws of that 664 | jurisdiction, without reference to its conflict-of-law provisions. 665 | Nothing in this Section shall prevent a party's ability to bring 666 | cross-claims or counter-claims. 667 | 668 | 9. Miscellaneous 669 | ---------------- 670 | 671 | This License represents the complete agreement concerning the subject 672 | matter hereof. If any provision of this License is held to be 673 | unenforceable, such provision shall be reformed only to the extent 674 | necessary to make it enforceable. Any law or regulation which provides 675 | that the language of a contract shall be construed against the drafter 676 | shall not be used to construe this License against a Contributor. 677 | 678 | 10. Versions of the License 679 | --------------------------- 680 | 681 | 10.1. New Versions 682 | 683 | Mozilla Foundation is the license steward. Except as provided in Section 684 | 10.3, no one other than the license steward has the right to modify or 685 | publish new versions of this License. Each version will be given a 686 | distinguishing version number. 687 | 688 | 10.2. Effect of New Versions 689 | 690 | You may distribute the Covered Software under the terms of the version 691 | of the License under which You originally received the Covered Software, 692 | or under the terms of any subsequent version published by the license 693 | steward. 694 | 695 | 10.3. Modified Versions 696 | 697 | If you create software not governed by this License, and you want to 698 | create a new license for such software, you may create and use a 699 | modified version of this License if you rename the license and remove 700 | any references to the name of the license steward (except to note that 701 | such modified license differs from this License). 702 | 703 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 704 | Licenses 705 | 706 | If You choose to distribute Source Code Form that is Incompatible With 707 | Secondary Licenses under the terms of this version of the License, the 708 | notice described in Exhibit B of this License must be attached. 709 | 710 | Exhibit A - Source Code Form License Notice 711 | ------------------------------------------- 712 | 713 | This Source Code Form is subject to the terms of the Mozilla Public 714 | License, v. 2.0. If a copy of the MPL was not distributed with this 715 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 716 | 717 | If it is not possible or desirable to put the notice in a particular 718 | file, then You may include the notice in a location (such as a LICENSE 719 | file in a relevant directory) where a recipient would be likely to look 720 | for such a notice. 721 | 722 | This Source Code Form is "Incompatible 723 | With Secondary Licenses", as defined by 724 | the Mozilla Public License, v. 2.0. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Parsell: an LL(1) streaming parser combinator library for Rust 2 | 3 | The goal of this library is to provide parser combinators that: 4 | 5 | * are optimized for LL(1) grammars, 6 | * support streaming input, 7 | * do as little buffering or copying as possible, and 8 | * do as little dynamic method dispatch as possible. 9 | 10 | It is based on: 11 | 12 | * [Monadic Parsing in Haskell](http://www.cs.nott.ac.uk/~pszgmh/pearl.pdf) by G. Hutton and E. Meijer, JFP 8(4) pp. 437-444, 13 | * [Nom, eating data byte by byte](https://github.com/Geal/nom) by G. Couprie. 14 | 15 | [Rustdoc](http://asajeffrey.github.io/parsell) | 16 | [Video](https://air.mozilla.org/bay-area-rust-meetup-february-2016/) | 17 | [Slides](http://asajeffrey.github.io/parsell/doc/talks/sf-rust-2016-02-18/) | 18 | [Crate](https://crates.io/crates/parsell) | 19 | [CI](https://travis-ci.org/asajeffrey/parsell) 20 | 21 | ## Example 22 | 23 | ```rust 24 | extern crate parsell; 25 | use parsell::{character,Parser,UncommittedStr,StatefulStr}; 26 | use parsell::ParseResult::{Done,Continue}; 27 | #[allow(non_snake_case)] 28 | fn main() { 29 | 30 | // A sequence of alphanumerics, saved in a string buffer 31 | let ALPHANUMERIC = character(char::is_alphanumeric); 32 | let ALPHANUMERICS = ALPHANUMERIC.plus(String::new); 33 | 34 | // If you provide unmatching input to the parser, you'll get back a None response: 35 | match ALPHANUMERICS.init_str("!$?") { 36 | None => (), 37 | _ => panic!("Can't happen."), 38 | } 39 | 40 | // If you provide complete input to the parser, you'll get back a Done response: 41 | match ALPHANUMERICS.init_str("abc123!") { 42 | Some(Done(result)) => assert_eq!(result, "abc123"), 43 | _ => panic!("Can't happen."), 44 | } 45 | 46 | // If you provide incomplete input to the parser, you'll get back a Continue response: 47 | match ALPHANUMERICS.init_str("abc") { 48 | Some(Continue(parsing)) => match parsing.more_str("123!") { 49 | Done(result) => assert_eq!(result, "abc123"), 50 | _ => panic!("Can't happen."), 51 | }, 52 | _ => panic!("Can't happen."), 53 | } 54 | 55 | } 56 | ``` 57 | 58 | Example tested with [Skeptic](https://github.com/brson/rust-skeptic). 59 | -------------------------------------------------------------------------------- /build.rs: -------------------------------------------------------------------------------- 1 | extern crate skeptic; 2 | 3 | fn main() { 4 | skeptic::generate_doc_tests(&["README.md"]); 5 | } 6 | -------------------------------------------------------------------------------- /doc/LICENSE: -------------------------------------------------------------------------------- 1 | Attribution 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution 4.0 International Public License 58 | 59 | By exercising the Licensed Rights (defined below), You accept and agree 60 | to be bound by the terms and conditions of this Creative Commons 61 | Attribution 4.0 International Public License ("Public License"). To the 62 | extent this Public License may be interpreted as a contract, You are 63 | granted the Licensed Rights in consideration of Your acceptance of 64 | these terms and conditions, and the Licensor grants You such rights in 65 | consideration of benefits the Licensor receives from making the 66 | Licensed Material available under these terms and conditions. 67 | 68 | 69 | Section 1 -- Definitions. 70 | 71 | a. Adapted Material means material subject to Copyright and Similar 72 | Rights that is derived from or based upon the Licensed Material 73 | and in which the Licensed Material is translated, altered, 74 | arranged, transformed, or otherwise modified in a manner requiring 75 | permission under the Copyright and Similar Rights held by the 76 | Licensor. For purposes of this Public License, where the Licensed 77 | Material is a musical work, performance, or sound recording, 78 | Adapted Material is always produced where the Licensed Material is 79 | synched in timed relation with a moving image. 80 | 81 | b. Adapter's License means the license You apply to Your Copyright 82 | and Similar Rights in Your contributions to Adapted Material in 83 | accordance with the terms and conditions of this Public License. 84 | 85 | c. Copyright and Similar Rights means copyright and/or similar rights 86 | closely related to copyright including, without limitation, 87 | performance, broadcast, sound recording, and Sui Generis Database 88 | Rights, without regard to how the rights are labeled or 89 | categorized. For purposes of this Public License, the rights 90 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 91 | Rights. 92 | 93 | d. Effective Technological Measures means those measures that, in the 94 | absence of proper authority, may not be circumvented under laws 95 | fulfilling obligations under Article 11 of the WIPO Copyright 96 | Treaty adopted on December 20, 1996, and/or similar international 97 | agreements. 98 | 99 | e. Exceptions and Limitations means fair use, fair dealing, and/or 100 | any other exception or limitation to Copyright and Similar Rights 101 | that applies to Your use of the Licensed Material. 102 | 103 | f. Licensed Material means the artistic or literary work, database, 104 | or other material to which the Licensor applied this Public 105 | License. 106 | 107 | g. Licensed Rights means the rights granted to You subject to the 108 | terms and conditions of this Public License, which are limited to 109 | all Copyright and Similar Rights that apply to Your use of the 110 | Licensed Material and that the Licensor has authority to license. 111 | 112 | h. Licensor means the individual(s) or entity(ies) granting rights 113 | under this Public License. 114 | 115 | i. Share means to provide material to the public by any means or 116 | process that requires permission under the Licensed Rights, such 117 | as reproduction, public display, public performance, distribution, 118 | dissemination, communication, or importation, and to make material 119 | available to the public including in ways that members of the 120 | public may access the material from a place and at a time 121 | individually chosen by them. 122 | 123 | j. Sui Generis Database Rights means rights other than copyright 124 | resulting from Directive 96/9/EC of the European Parliament and of 125 | the Council of 11 March 1996 on the legal protection of databases, 126 | as amended and/or succeeded, as well as other essentially 127 | equivalent rights anywhere in the world. 128 | 129 | k. You means the individual or entity exercising the Licensed Rights 130 | under this Public License. Your has a corresponding meaning. 131 | 132 | 133 | Section 2 -- Scope. 134 | 135 | a. License grant. 136 | 137 | 1. Subject to the terms and conditions of this Public License, 138 | the Licensor hereby grants You a worldwide, royalty-free, 139 | non-sublicensable, non-exclusive, irrevocable license to 140 | exercise the Licensed Rights in the Licensed Material to: 141 | 142 | a. reproduce and Share the Licensed Material, in whole or 143 | in part; and 144 | 145 | b. produce, reproduce, and Share Adapted Material. 146 | 147 | 2. Exceptions and Limitations. For the avoidance of doubt, where 148 | Exceptions and Limitations apply to Your use, this Public 149 | License does not apply, and You do not need to comply with 150 | its terms and conditions. 151 | 152 | 3. Term. The term of this Public License is specified in Section 153 | 6(a). 154 | 155 | 4. Media and formats; technical modifications allowed. The 156 | Licensor authorizes You to exercise the Licensed Rights in 157 | all media and formats whether now known or hereafter created, 158 | and to make technical modifications necessary to do so. The 159 | Licensor waives and/or agrees not to assert any right or 160 | authority to forbid You from making technical modifications 161 | necessary to exercise the Licensed Rights, including 162 | technical modifications necessary to circumvent Effective 163 | Technological Measures. For purposes of this Public License, 164 | simply making modifications authorized by this Section 2(a) 165 | (4) never produces Adapted Material. 166 | 167 | 5. Downstream recipients. 168 | 169 | a. Offer from the Licensor -- Licensed Material. Every 170 | recipient of the Licensed Material automatically 171 | receives an offer from the Licensor to exercise the 172 | Licensed Rights under the terms and conditions of this 173 | Public License. 174 | 175 | b. No downstream restrictions. You may not offer or impose 176 | any additional or different terms or conditions on, or 177 | apply any Effective Technological Measures to, the 178 | Licensed Material if doing so restricts exercise of the 179 | Licensed Rights by any recipient of the Licensed 180 | Material. 181 | 182 | 6. No endorsement. Nothing in this Public License constitutes or 183 | may be construed as permission to assert or imply that You 184 | are, or that Your use of the Licensed Material is, connected 185 | with, or sponsored, endorsed, or granted official status by, 186 | the Licensor or others designated to receive attribution as 187 | provided in Section 3(a)(1)(A)(i). 188 | 189 | b. Other rights. 190 | 191 | 1. Moral rights, such as the right of integrity, are not 192 | licensed under this Public License, nor are publicity, 193 | privacy, and/or other similar personality rights; however, to 194 | the extent possible, the Licensor waives and/or agrees not to 195 | assert any such rights held by the Licensor to the limited 196 | extent necessary to allow You to exercise the Licensed 197 | Rights, but not otherwise. 198 | 199 | 2. Patent and trademark rights are not licensed under this 200 | Public License. 201 | 202 | 3. To the extent possible, the Licensor waives any right to 203 | collect royalties from You for the exercise of the Licensed 204 | Rights, whether directly or through a collecting society 205 | under any voluntary or waivable statutory or compulsory 206 | licensing scheme. In all other cases the Licensor expressly 207 | reserves any right to collect such royalties. 208 | 209 | 210 | Section 3 -- License Conditions. 211 | 212 | Your exercise of the Licensed Rights is expressly made subject to the 213 | following conditions. 214 | 215 | a. Attribution. 216 | 217 | 1. If You Share the Licensed Material (including in modified 218 | form), You must: 219 | 220 | a. retain the following if it is supplied by the Licensor 221 | with the Licensed Material: 222 | 223 | i. identification of the creator(s) of the Licensed 224 | Material and any others designated to receive 225 | attribution, in any reasonable manner requested by 226 | the Licensor (including by pseudonym if 227 | designated); 228 | 229 | ii. a copyright notice; 230 | 231 | iii. a notice that refers to this Public License; 232 | 233 | iv. a notice that refers to the disclaimer of 234 | warranties; 235 | 236 | v. a URI or hyperlink to the Licensed Material to the 237 | extent reasonably practicable; 238 | 239 | b. indicate if You modified the Licensed Material and 240 | retain an indication of any previous modifications; and 241 | 242 | c. indicate the Licensed Material is licensed under this 243 | Public License, and include the text of, or the URI or 244 | hyperlink to, this Public License. 245 | 246 | 2. You may satisfy the conditions in Section 3(a)(1) in any 247 | reasonable manner based on the medium, means, and context in 248 | which You Share the Licensed Material. For example, it may be 249 | reasonable to satisfy the conditions by providing a URI or 250 | hyperlink to a resource that includes the required 251 | information. 252 | 253 | 3. If requested by the Licensor, You must remove any of the 254 | information required by Section 3(a)(1)(A) to the extent 255 | reasonably practicable. 256 | 257 | 4. If You Share Adapted Material You produce, the Adapter's 258 | License You apply must not prevent recipients of the Adapted 259 | Material from complying with this Public License. 260 | 261 | 262 | Section 4 -- Sui Generis Database Rights. 263 | 264 | Where the Licensed Rights include Sui Generis Database Rights that 265 | apply to Your use of the Licensed Material: 266 | 267 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 268 | to extract, reuse, reproduce, and Share all or a substantial 269 | portion of the contents of the database; 270 | 271 | b. if You include all or a substantial portion of the database 272 | contents in a database in which You have Sui Generis Database 273 | Rights, then the database in which You have Sui Generis Database 274 | Rights (but not its individual contents) is Adapted Material; and 275 | 276 | c. You must comply with the conditions in Section 3(a) if You Share 277 | all or a substantial portion of the contents of the database. 278 | 279 | For the avoidance of doubt, this Section 4 supplements and does not 280 | replace Your obligations under this Public License where the Licensed 281 | Rights include other Copyright and Similar Rights. 282 | 283 | 284 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 285 | 286 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 287 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 288 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 289 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 290 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 291 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 292 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 293 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 294 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 295 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 296 | 297 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 298 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 299 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 300 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 301 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 302 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 303 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 304 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 305 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 306 | 307 | c. The disclaimer of warranties and limitation of liability provided 308 | above shall be interpreted in a manner that, to the extent 309 | possible, most closely approximates an absolute disclaimer and 310 | waiver of all liability. 311 | 312 | 313 | Section 6 -- Term and Termination. 314 | 315 | a. This Public License applies for the term of the Copyright and 316 | Similar Rights licensed here. However, if You fail to comply with 317 | this Public License, then Your rights under this Public License 318 | terminate automatically. 319 | 320 | b. Where Your right to use the Licensed Material has terminated under 321 | Section 6(a), it reinstates: 322 | 323 | 1. automatically as of the date the violation is cured, provided 324 | it is cured within 30 days of Your discovery of the 325 | violation; or 326 | 327 | 2. upon express reinstatement by the Licensor. 328 | 329 | For the avoidance of doubt, this Section 6(b) does not affect any 330 | right the Licensor may have to seek remedies for Your violations 331 | of this Public License. 332 | 333 | c. For the avoidance of doubt, the Licensor may also offer the 334 | Licensed Material under separate terms or conditions or stop 335 | distributing the Licensed Material at any time; however, doing so 336 | will not terminate this Public License. 337 | 338 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 339 | License. 340 | 341 | 342 | Section 7 -- Other Terms and Conditions. 343 | 344 | a. The Licensor shall not be bound by any additional or different 345 | terms or conditions communicated by You unless expressly agreed. 346 | 347 | b. Any arrangements, understandings, or agreements regarding the 348 | Licensed Material not stated herein are separate from and 349 | independent of the terms and conditions of this Public License. 350 | 351 | 352 | Section 8 -- Interpretation. 353 | 354 | a. For the avoidance of doubt, this Public License does not, and 355 | shall not be interpreted to, reduce, limit, restrict, or impose 356 | conditions on any use of the Licensed Material that could lawfully 357 | be made without permission under this Public License. 358 | 359 | b. To the extent possible, if any provision of this Public License is 360 | deemed unenforceable, it shall be automatically reformed to the 361 | minimum extent necessary to make it enforceable. If the provision 362 | cannot be reformed, it shall be severed from this Public License 363 | without affecting the enforceability of the remaining terms and 364 | conditions. 365 | 366 | c. No term or condition of this Public License will be waived and no 367 | failure to comply consented to unless expressly agreed to by the 368 | Licensor. 369 | 370 | d. Nothing in this Public License constitutes or may be interpreted 371 | as a limitation upon, or waiver of, any privileges and immunities 372 | that apply to the Licensor or You, including from the legal 373 | processes of any jurisdiction or authority. 374 | 375 | 376 | ======================================================================= 377 | 378 | Creative Commons is not a party to its public 379 | licenses. Notwithstanding, Creative Commons may elect to apply one of 380 | its public licenses to material it publishes and in those instances 381 | will be considered the “Licensor.” The text of the Creative Commons 382 | public licenses is dedicated to the public domain under the CC0 Public 383 | Domain Dedication. Except for the limited purpose of indicating that 384 | material is shared under a Creative Commons public license or as 385 | otherwise permitted by the Creative Commons policies published at 386 | creativecommons.org/policies, Creative Commons does not authorize the 387 | use of the trademark "Creative Commons" or any other trademark or logo 388 | of Creative Commons without its prior written consent including, 389 | without limitation, in connection with any unauthorized modifications 390 | to any of its public licenses or any other arrangements, 391 | understandings, or agreements concerning use of licensed material. For 392 | the avoidance of doubt, this paragraph does not form part of the 393 | public licenses. 394 | 395 | Creative Commons may be contacted at creativecommons.org. 396 | 397 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # Parsell documentation 2 | 3 | Currently this is pretty sparse. 4 | 5 | [Rustdoc](http://asajeffrey.github.io/parsell) | 6 | [Video](https://air.mozilla.org/bay-area-rust-meetup-february-2016/) | 7 | [Slides](http://asajeffrey.github.io/parsell/doc/talks/sf-rust-2016-02-18/) 8 | 9 | [![Creative Commons License](http://i.creativecommons.org/l/by/4.0/88x31.png)](http://creativecommons.org/licenses/by/4.0/) 10 | -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Parsell: streaming parsers in Rust 6 | 7 | 8 | 9 | 10 |
11 |

Parsell: streaming parsers in Rust

12 | 15 |
16 | 25 | 26 |
27 |
28 |
29 |

Parsell: streaming parsers in Rust

30 |
31 | Parsell on github. 34 | 39 |
40 |
41 | 42 |
43 |
44 |
45 |

Goals

46 |
47 |
48 |
49 | 50 |
51 |
52 |
53 |

Goals

54 |
55 |
    56 |
  1. Parse streaming input
  2. 57 |
  3. No memory allocation
  4. 58 |
  5. Infer complex types
  6. 59 |
  7. No dynamic method calls
  8. 60 |
61 |
62 |
63 | 64 |
65 |
66 |
67 |

Goal 1: Parse streaming input

68 |
69 |

Regular parsing is all-at-once:

70 |

71 | let parser = ···;
72 | let mut test_data = "(x + 37) + y".chars();
73 | match parser.init(&mut test_data).unwrap() {
74 |   Done(parsed) ⇒ ··· // yay, parsed it!
75 | } 76 |

77 |
78 |
79 | 80 |
81 |
82 |
83 |

Goal 1: Parse streaming input

84 |
85 |

Streaming parsing is bit-by-bit:

86 |

87 | let mut test_data1 = "(x + ".chars();
88 | let mut test_data2 = "37) + y".chars();
89 | match parser.init(&mut test_data1).unwrap() {
90 |   Continue(parsing) ⇒ match parsing.more(&mut test_data2) {
91 |     Done(parsed) ⇒ ··· // yay, parsed it!
92 | } ··· } 93 |

94 |
95 |
96 | 97 |
98 |
99 |
100 |

Goal 1: Parse streaming input

101 |
102 |

Streaming parsing is painful.

103 |

Input arrives in chunks (e.g. from the network).

104 |

Pain: save/restore parser state at chunk boundaries.

105 |

Gain: much less buffering.

106 |
107 |
108 | 109 |
110 |
111 |
112 |

Goal 2: no memory allocation

113 |
114 |

We’d like the parsing library to use zero heap.

115 |

User code (e.g. building an AST) can do what it likes.

116 |

Can the library work with no memory allocation?

117 |
118 |
119 | 120 |
121 |
122 |
123 |

Goal 2: no memory allocation

124 |
125 |

No.

126 |

Contradicts goal 1.

127 |
128 |
129 | 130 |
131 |
132 |
133 |

Goal 2: no memory allocation

134 |
135 |

Remember save/restore parser state at chunk boundaries?

136 |

That state has to go somewhere.

137 |

Can’t go on the stack (not fixed size).

138 |

This just leaves the heap.

139 |
140 |
141 | 142 |
143 |
144 |
145 |

Revised goal 2

146 |
147 |

No memory allocation between chunk boundaries.

148 |
149 |
150 | 151 |
152 |
153 |
154 |

Goal 3: infer complex types

155 |
156 |

Parser libraries often have complex types.

157 |

For example, the parser “foo.or_else(bar).and_then(baz)”
158 | has type “AndThen〈OrElse〈Foo,Bar〉,Baz〉”.
159 | This is very similar to the Rust iterator library.

160 |

Users should not have to see complex types.

161 |

Yay type inference!

162 |
163 |
164 | 165 |
166 |
167 |
168 |

Goal 4: no dynamic method calls

169 |
170 |

Dynamic method calls can be expensive.

171 |
    172 |
  • Can mess up instruction pipelining / prefetching.
  • 173 |
  • Can mess up optimizations from inlining.
  • 174 |
175 |

Can we do everything with static method calls?

176 |
177 |
178 | 179 |
180 |
181 |
182 |

Goal 4: no dynamic method calls

183 |
184 |

AFAIK no, at least not in Rust.

185 |

Contradicts previous goal.

186 |
187 |
188 | 189 |
190 |
191 |
192 |

Goal 4: no dynamic method calls

193 |
194 |

Rust does static method dispatch by type.

195 |

You write “this.that()”, 196 | rustc works out (this: SomeType)
197 | and looks up (impl ThatTrait for SomeType),
198 | at compile time.

199 |
200 |
201 | 202 |
203 |
204 |
205 |

Goal 4: no dynamic method calls

206 |
207 |

Imagine a parser for expressions like "(x + 37) + y".

208 |

Expressions are arbitrarily deep, so the parser is recursive.

209 |

Imagine a type Exp1P〉 that can parse expressions of depth 1,
210 | and uses parser P each time it reaches parentheses.

211 |

We’re looking for the type Exp1Exp1Exp1〈···〉〉〉.

212 |
213 |
214 | 215 |
216 |
217 |
218 |

Goal 4: no dynamic method calls

219 |
220 |

Yay, Rust has recursive types, using Box.

221 |

struct Exp(Box〈Exp1〈Exp〉〉);

222 |

Yay! Recursive parsers, static dispatch, we’re good?

223 |
224 |
225 | 226 |
227 |
228 |
229 |

Goal 4: no dynamic method calls

230 |
231 |

Remember Users should not have to see complex types?

232 |

struct Exp(Box〈Exp1〈Exp〉〉);

233 |

Exp1 is one of those complex types.

234 |

AFAIK, Rust doesn’t allow type inference to make these invisible,
235 | (e.g. in supertrait type arguments or associated type definitions).

236 |
237 |
238 | 239 |
240 |
241 |
242 |

Goal 4: no dynamic method calls

243 |
244 |

Trait objects to the rescue!

245 |

struct Exp(Box〈SomeParserTrait〉);

246 |

Yay: parser traits much are simpler than the complex parser types.

247 |

But: trait objects use dynamic dispatch.

248 |

249 |
250 | 251 |
252 |
253 |
254 |

Revised goal 4

255 |
256 |

No dynamic method calls between chunk boundaries.

257 |
258 |
259 | 260 |
261 |
262 |
263 |

Revised goals

264 |
265 |
    266 |
  1. Parse streaming input
  2. 267 |
  3. No memory allocation between chunk boundaries
  4. 268 |
  5. Infer complex types
  6. 269 |
  7. No dynamic method calls between chunk boundaries
  8. 270 |
271 |
272 |
273 | 274 |
275 |
276 |
277 |

State of the art

278 |
279 |
280 |
281 | 282 |
283 |
284 |
285 |

Rust parser libraries

286 |
287 |
    288 |
  • LALRPOP (Niko Matsakis)
  • 289 |
  • Nom (Geoffroy Couprie)
  • 290 |
  • Parsell (me)
  • 291 |
  • ···
  • 292 |
293 |
294 |
295 | 296 |
297 |
298 |
299 |

Rust parser libraries: LALRPOP

300 |
301 |
    302 |
  • Domain-specific language (à la yacc, Bison, JavaCC, ...).
  • 303 |
  • Recognizes a rich class of languages (LALR).
  • 304 |
  • All-at-once parsing.
  • 305 |
306 |
307 |
308 | 309 |
310 |
311 |
312 |

Rust parser libraries: Nom

313 |
314 |
    315 |
  • Parser library, makes heavy use of macros.
  • 316 |
  • Recognizes a rich class of languages (CFG).
  • 317 |
  • Streaming parsers.
  • 318 |
  • Does some allocation / dynamic calls.
  • 319 |
  • Hides complex types behind macros.
  • 320 |
321 |
322 |
323 | 324 |
325 |
326 |
327 |

Rust parser libraries: Parsell

328 |
329 |
    330 |
  • Parser library, no macros.
  • 331 |
  • Recognizes a limited class of languages (LL(1)).
  • 332 |
  • Streaming parsers.
  • 333 |
  • Only does allocation / dynamic calls at chunk boundaries.
  • 334 |
  • Inspired by Nom and Hutton/Meijer monadic parsing.
  • 335 |
336 |
337 |
338 | 339 |
340 |
341 |
342 |

Parsell

343 |
344 |
345 |
346 | 347 |
348 |
349 |
350 |

Parsell: meets goals

351 |
352 |
    353 |
  1. Parse streaming input
  2. 354 |
  3. No memory allocation between chunk boundaries
  4. 355 |
  5. Infer complex types
  6. 356 |
  7. No dynamic method calls between chunk boundaries
  8. 357 |
358 |
359 |
360 | 361 |
362 |
363 |
364 |

Parsell: example

365 |
366 |

367 | let ALPHABETIC = character(char::is_alphabetic);
368 | let ALPHANUMERIC = character(char::is_alphanumeric);
369 | let parser = ALPHABETIC
  370 | .and_then(ALPHANUMERIC.star(String::new));
371 | let mut test_data = "abc123!".chars();
372 | match parser.init(&mut test_data).unwrap() {
373 |   Done(result) ⇒ assert_eq!(result, ('a', "bc123")), ...
374 | }
375 | assert_eq!(test_data.as_str(), "!"); 376 |

377 |
378 |
379 | 380 |
381 |
382 |
383 |

Parsell: example with no copying

384 |
385 |

386 | let parser = ALPHABETIC
  387 | .and_then(ALPHANUMERIC.star(ignore))
  388 | .buffer(); // Returns a Cow<'a,str>
389 | let mut test_data = "abc123!".chars();
390 | match parser.init(&mut test_data).unwrap() {
391 |   Done(result) ⇒ assert_eq!(result, Borrowed("abc123")), ...
392 | }
393 |

394 |
395 |
396 | 397 |
398 |
399 |
400 |

Parsell: example with copying

401 |
402 |

403 | let parser = ALPHABETIC
  404 | .and_then(ALPHANUMERIC.star(ignore))
  405 | .buffer(); // Returns a Cow<'a,str>
406 | let mut test_data1 = "abc".chars();
407 | let mut test_data2 = "123!".chars();
408 | match parser.init(&mut test_data1).unwrap() {
409 |   Continue(parsing) ⇒ match parsing.more(&mut test_data2) {
410 |     Done(result) ⇒ assert_eq!(result, Owned(String::from("abc123"))), ... 411 | }, ... }
412 |

413 |
414 |
415 | 416 |
417 |
418 |
419 |

Parsell: implementation fragment

420 |
421 |

422 | trait Stateful〈Ch, Strwhere Str: Iterator〈Item=Ch〉{
423 |   type Output;
424 |   fn more(self, data: &mut Str) → ParseResult〈Self, Self::Output〉;
425 | } 426 |

427 |

428 | enum ParseResult〈State, Output〉{
429 |   Continue(State),
430 |   Done(Output),
431 | } 432 |

433 |
434 |
435 | 436 |
437 |
438 |
439 |

Parsell: lessons learned

440 |
441 |
    442 |
  1. Goals can be met (I wasn’t sure about this when I started!)
  2. 443 |
  3. Rust borrowchk catches bugs that testing wouldn’t.
  4. 444 |
  5. Linearity enforces safety (can’t call more after done).
  6. 445 |
  7. Lifetime polymorphism / HRTB is tricky. (Thanks :eddyb!)
  8. 446 |
  9. Needed traits PeekableIterator and ToStatic.
  10. 447 |
  11. Hack without fear!
  12. 448 |
449 |
450 |
451 | 452 |
453 |
454 |
455 |

Thanks

456 |
457 |
    458 |
  • IRL: Alan Jeffrey
  • 459 |
  • EMail: ajeffrey@mozilla.com
  • 460 |
  • Twitter: @asajeffrey
  • 461 |
  • Repo: https://github.com/asajeffrey/parsell
  • 462 |
  • Doc: http://asajeffrey.github.io/parsell
  • 463 |
  • Crate: https://crates.io/crates/parsell
  • 464 |
465 |
466 |
467 | 468 |
469 | 470 | 471 | 472 | -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/3dview.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/3dview.mp4 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/3dview.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/3dview.webm -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/appmanager.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/appmanager.mp4 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/appmanager.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/appmanager.webm -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/apps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/apps.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/boilerplate.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/boilerplate.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/brick.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/brick.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/buildingblocks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/buildingblocks.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/buildingfirefoxos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/buildingfirefoxos.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/console.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/console.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/debugger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/debugger.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/devhub.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/devhub.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/devtools.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/devtools.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/devtools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/devtools.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/dynamicsearch.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/dynamicsearch.mp4 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/dynamicsearch.ogv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/dynamicsearch.ogv -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/dynamicsearch.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/dynamicsearch.webm -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/enduser-fxos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/enduser-fxos.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/everythingme.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/everythingme.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/firefox-oct-2013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/firefox-oct-2013.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/firefox-os-emulator.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/firefox-os-emulator.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/firefoxos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/firefoxos.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/flathead.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/flathead.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/foxkeh-android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/foxkeh-android.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/fxosvideos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/fxosvideos.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/fxoswiki.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/fxoswiki.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/hacksblog.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/hacksblog.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/hobbes-earth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/hobbes-earth.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/inspector.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/keep-calm-and-trust-html5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/keep-calm-and-trust-html5.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/marketplace.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/marketplace.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/mobiletools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/mobiletools.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/network-details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/network-details.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/network.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/nokia-photos.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/nokia-photos.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/phonegapdiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/phonegapdiagram.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/pick-activity.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/pick-activity.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/profiler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/profiler.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/reflow.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/reflow.mp4 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/reflow.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/reflow.webm -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/remote-debugging-overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/remote-debugging-overview.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/responsive.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/responsive.mp4 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/responsive.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/responsive.webm -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/scratchpad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/scratchpad.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/simulator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/simulator.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/simulator40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/simulator40.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/styleeditor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/styleeditor.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/fxos/webapiwiki.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/fxos/webapiwiki.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/mozillaoverview/redpanda.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/mozillaoverview/redpanda.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/parsell/parsell-github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/parsell/parsell-github.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/templatedemos/earthphases.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/templatedemos/earthphases.gif -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/templatedemos/high-five.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/templatedemos/high-five.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/templatedemos/phones.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/templatedemos/phones.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/templatedemos/smallphones.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/templatedemos/smallphones.jpg -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/templatedemos/wave.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/templatedemos/wave.mp4 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/pictures/templatedemos/wave.webm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/pictures/templatedemos/wave.webm -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/scripts/script.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var url = window.location, 3 | body = document.body, 4 | slides = document.querySelectorAll('div.slide'), 5 | progress = document.querySelector('div.progress div'), 6 | slideList = [], 7 | l = slides.length, 8 | i; 9 | if (typeof keysalive === 'undefined') { 10 | keysalive = true; 11 | } 12 | 13 | for (i = 0; i < l; i++) { 14 | var cb = document.createElement('button'); 15 | cb.className = 'cb'; 16 | cb.innerHTML = 'x'; 17 | slides[i].appendChild(cb); 18 | slideList.push({ 19 | id: slides[i].id, 20 | hasInnerNavigation: null !== slides[i].querySelector('.inner') 21 | }); 22 | } 23 | 24 | /* Encode code blocks */ 25 | function encode() { 26 | var codes = document.querySelectorAll('code'); 27 | var all = codes.length; 28 | while (all--) { 29 | var tc = codes[all].innerHTML; 30 | if (tc.indexOf('<') !== -1) { 31 | tc = tc.replace(//g, '>'); 33 | codes[all].innerHTML = tc; 34 | } 35 | } 36 | } 37 | encode(); 38 | 39 | var demos = document.querySelectorAll('[contenteditable]'), 40 | alldemos = demos.length; 41 | 42 | function dokeys(ev) { 43 | keysalive = true; 44 | } 45 | 46 | function stopkeys(ev) { 47 | keysalive = false; 48 | } 49 | while (alldemos--) { 50 | demos[alldemos].addEventListener('focus', stopkeys, false); 51 | demos[alldemos].addEventListener('blur', dokeys, false); 52 | } 53 | 54 | function getTransform() { 55 | var denominator = Math.max( 56 | body.clientWidth / window.innerWidth, 57 | body.clientHeight / window.innerHeight 58 | ); 59 | 60 | return 'scale(' + (1 / denominator) + ')'; 61 | } 62 | 63 | function applyTransform(transform) { 64 | body.style.WebkitTransform = transform; 65 | body.style.MozTransform = transform; 66 | body.style.msTransform = transform; 67 | body.style.OTransform = transform; 68 | body.style.transform = transform; 69 | } 70 | 71 | function enterSlideMode() { 72 | body.className = 'full'; 73 | applyTransform(getTransform()); 74 | } 75 | 76 | function enterListMode() { 77 | body.className = 'list'; 78 | applyTransform('none'); 79 | } 80 | 81 | function getCurrentSlideNumber() { 82 | var i, l = slideList.length, 83 | currentSlideId = url.hash.substr(1); 84 | 85 | for (i = 0; i < l; ++i) { 86 | if (currentSlideId === slideList[i].id) { 87 | return i; 88 | } 89 | } 90 | 91 | return -1; 92 | } 93 | 94 | function scrollToSlide(slideNumber) { 95 | if (-1 === slideNumber) { 96 | return; 97 | } 98 | var currentSlide = document.getElementById(slideList[slideNumber].id); 99 | if (null !== currentSlide) { 100 | window.scrollTo(0, currentSlide.offsetTop); 101 | } 102 | } 103 | 104 | function isListMode() { 105 | return 'full' !== url.search.substr(1, 4); 106 | } 107 | 108 | function normalizeSlideNumber(slideNumber) { 109 | if (0 > slideNumber) { 110 | return slideList.length - 1; 111 | } else if (slideList.length <= slideNumber) { 112 | return 0; 113 | } else { 114 | return slideNumber; 115 | } 116 | } 117 | 118 | function updateProgress(slideNumber) { 119 | if (null === progress) { 120 | return; 121 | } 122 | progress.style.width = (100 / (slideList.length - 1) * normalizeSlideNumber(slideNumber)).toFixed(2) + '%'; 123 | } 124 | 125 | function getSlideHash(slideNumber) { 126 | return '#' + slideList[normalizeSlideNumber(slideNumber)].id; 127 | } 128 | 129 | function goToSlide(slideNumber) { 130 | var currentSlide = document.getElementById(slideList[slideNumber].id); 131 | if (currentSlide.classList.contains('inactive')) { 132 | goToSlide(slides[slideNumber + 1] ? slideNumber + 1 : 0); 133 | } else { 134 | url.hash = getSlideHash(slideNumber); 135 | lognotes(slideNumber); 136 | if (!isListMode()) { 137 | updateProgress(slideNumber); 138 | GIFrefresh(slideNumber); 139 | playVideoIfAutoplay(slideNumber); 140 | } 141 | } 142 | } 143 | 144 | function GIFrefresh(slideNumber) { 145 | if (slides[slideNumber]) { 146 | var img = slides[slideNumber].querySelector('img'); 147 | if (img && img.src.indexOf('gif') !== -1) { 148 | img.src = img.src; 149 | } 150 | } 151 | } 152 | 153 | function playVideoIfAutoplay(slideNumber) { 154 | if (slides[slideNumber] && 155 | slides[slideNumber].className.indexOf('autoplay') !== -1) { 156 | var video = slides[slideNumber].querySelector('video'); 157 | if (video) { 158 | video.play(); 159 | } 160 | } 161 | } 162 | 163 | function getContainingSlideId(el) { 164 | var node = el; 165 | while ('BODY' !== node.nodeName && 'HTML' !== node.nodeName) { 166 | if (node.classList.contains('slide')) { 167 | return node.id; 168 | } else { 169 | node = node.parentNode; 170 | } 171 | } 172 | 173 | return ''; 174 | } 175 | 176 | function dispatchSingleSlideMode(e) { 177 | var slideId = getContainingSlideId(e.target); 178 | 179 | if ('' !== slideId && isListMode()) { 180 | e.preventDefault(); 181 | 182 | if (e.target.tagName === 'BUTTON' && e.target.className === 'cb') { 183 | toggleSlide(e.target.parentNode); 184 | } else { 185 | // NOTE: we should update hash to get things work properly 186 | url.hash = '#' + slideId; 187 | history.replaceState(null, null, url.pathname + '?full#' + slideId); 188 | enterSlideMode(); 189 | 190 | updateProgress(getCurrentSlideNumber()); 191 | } 192 | } 193 | } 194 | 195 | function toggleSlide(elm) { 196 | if (elm.classList.contains('inactive')) { 197 | elm.classList.remove('inactive'); 198 | } else { 199 | elm.classList.add('inactive'); 200 | } 201 | } 202 | 203 | // Increases inner navigation by adding 'active' class to next inactive inner navigation item 204 | function increaseInnerNavigation(slideNumber) { 205 | // Shortcut for slides without inner navigation 206 | if (true !== slideList[slideNumber].hasInnerNavigation) { 207 | return -1; 208 | } 209 | 210 | var activeNodes = document.querySelectorAll(getSlideHash(slideNumber) + ' .active'), 211 | // NOTE: we assume there is no other elements in inner navigation 212 | node = activeNodes[activeNodes.length - 1].nextElementSibling; 213 | 214 | if (null !== node) { 215 | node.classList.add('active'); 216 | return activeNodes.length + 1; 217 | } else { 218 | return -1; 219 | } 220 | } 221 | 222 | function lognotes(slideNumber) { 223 | if (window.console && slideList[slideNumber]) { 224 | var notes = document.querySelector('#' + slideList[slideNumber].id + ' .notes'); 225 | if (notes) { 226 | console.info(notes.innerHTML.replace(/\n\s+/g, '\n')); 227 | } 228 | if (slideList[slideNumber + 1]) { 229 | var next = document.querySelector('#' + slideList[slideNumber + 1].id + ' header'); 230 | if (next) { 231 | next = next.innerHTML.replace(/^\s+|<[^>]+>/g, ''); 232 | console.info('NEXT: ' + next); 233 | } 234 | } 235 | } 236 | } 237 | 238 | 239 | // Event handlers 240 | 241 | window.addEventListener('DOMContentLoaded', function() { 242 | if (!isListMode()) { 243 | // "?full" is present without slide hash, so we should display first slide 244 | if (-1 === getCurrentSlideNumber()) { 245 | history.replaceState(null, null, url.pathname + '?full' + getSlideHash(0)); 246 | } 247 | enterSlideMode(); 248 | updateProgress(getCurrentSlideNumber()); 249 | } 250 | }, false); 251 | 252 | window.addEventListener('popstate', function(e) { 253 | if (isListMode()) { 254 | enterListMode(); 255 | scrollToSlide(getCurrentSlideNumber()); 256 | } else { 257 | enterSlideMode(); 258 | } 259 | }, false); 260 | 261 | window.addEventListener('resize', function(e) { 262 | if (!isListMode()) { 263 | applyTransform(getTransform()); 264 | } 265 | }, false); 266 | 267 | document.addEventListener('keydown', function(e) { 268 | if (!keysalive) { 269 | return; 270 | } 271 | // Shortcut for alt, shift and meta keys 272 | if (e.altKey || e.ctrlKey || e.metaKey) { 273 | return; 274 | } 275 | 276 | var currentSlideNumber = getCurrentSlideNumber(); 277 | switch (e.which) { 278 | case 116: // F5 279 | case 13: // Enter 280 | if (isListMode() && -1 !== currentSlideNumber) { 281 | e.preventDefault(); 282 | 283 | history.pushState(null, null, url.pathname + '?full' + getSlideHash(currentSlideNumber)); 284 | enterSlideMode(); 285 | 286 | updateProgress(currentSlideNumber); 287 | } 288 | break; 289 | 290 | case 27: // Esc 291 | if (!isListMode()) { 292 | e.preventDefault(); 293 | 294 | history.pushState(null, null, url.pathname + getSlideHash(currentSlideNumber)); 295 | enterListMode(); 296 | scrollToSlide(currentSlideNumber); 297 | } 298 | break; 299 | 300 | case 33: // PgUp 301 | case 38: // Up 302 | case 37: // Left 303 | case 72: // h 304 | case 75: // k 305 | e.preventDefault(); 306 | 307 | currentSlideNumber--; 308 | goToSlide(currentSlideNumber); 309 | break; 310 | 311 | case 34: // PgDown 312 | case 40: // Down 313 | case 39: // Right 314 | case 76: // l 315 | case 74: // j 316 | e.preventDefault(); 317 | 318 | // Only go to next slide if current slide have no inner 319 | // navigation or inner navigation is fully shown 320 | // NOTE: But first of all check if there is no current slide 321 | if (-1 === currentSlideNumber || 322 | !slideList[currentSlideNumber].hasInnerNavigation || 323 | -1 === increaseInnerNavigation(currentSlideNumber) 324 | ) { 325 | currentSlideNumber++; 326 | goToSlide(currentSlideNumber); 327 | } 328 | break; 329 | 330 | case 36: // Home 331 | e.preventDefault(); 332 | 333 | currentSlideNumber = 0; 334 | goToSlide(currentSlideNumber); 335 | break; 336 | 337 | case 35: // End 338 | e.preventDefault(); 339 | 340 | currentSlideNumber = slideList.length - 1; 341 | goToSlide(currentSlideNumber); 342 | break; 343 | 344 | case 9: // Tab = +1; Shift + Tab = -1 345 | case 32: // Space = +1; Shift + Space = -1 346 | e.preventDefault(); 347 | 348 | currentSlideNumber += e.shiftKey ? -1 : 1; 349 | goToSlide(currentSlideNumber); 350 | break; 351 | case 78: 352 | slides[currentSlideNumber].classList.toggle('peek'); 353 | break; 354 | default: 355 | // Behave as usual 356 | } 357 | }, false); 358 | 359 | document.addEventListener('click', dispatchSingleSlideMode, false); 360 | document.addEventListener('touchend', dispatchSingleSlideMode, false); 361 | 362 | document.addEventListener('touchstart', function(e) { 363 | if (!isListMode()) { 364 | var currentSlideNumber = getCurrentSlideNumber(), 365 | x = e.touches[0].pageX; 366 | if (x > window.innerWidth / 2) { 367 | currentSlideNumber++; 368 | } else { 369 | currentSlideNumber--; 370 | } 371 | 372 | goToSlide(currentSlideNumber); 373 | } 374 | }, false); 375 | 376 | document.addEventListener('touchmove', function(e) { 377 | if (!isListMode()) { 378 | e.preventDefault(); 379 | } 380 | }, false); 381 | 382 | }()); 383 | 384 | function goFullScreen() { 385 | document.fullscreenEnabled = document.fullscreenEnabled || 386 | document.mozFullScreenEnabled || 387 | document.documentElement.webkitRequestFullScreen; 388 | 389 | function requestFullscreen(element) { 390 | if (element.requestFullscreen) { 391 | element.requestFullscreen(); 392 | } else if (element.mozRequestFullScreen) { 393 | element.mozRequestFullScreen(); 394 | } else if (element.webkitRequestFullScreen) { 395 | element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); 396 | } 397 | } 398 | if (document.fullscreenEnabled) { 399 | requestFullscreen(document.documentElement); 400 | } 401 | } 402 | 403 | var lang = 'en-US'; 404 | try { 405 | lang = new URL(window.location).searchParams.get('lang'); 406 | } catch (ex) { 407 | // searchParams isn't supported in all browsers 408 | } 409 | 410 | // Pre-selects the correct current language on the dropdown menu 411 | document.getElementById('langMenuId').value = lang; 412 | 413 | function changeLanguage() { 414 | var langObj = document.getElementById('langMenuId'); 415 | document.documentElement.lang = langObj.value; 416 | 417 | // Update the language code in the URL bar 418 | try { 419 | var url = new URL(window.location); 420 | url.searchParams.set('lang', langObj.value); 421 | history.replaceState({}, document.title, url); 422 | } catch (ex) { 423 | // This might not be supported in all browsers 424 | } 425 | } 426 | 427 | changeLanguage(); 428 | -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/template.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 13 | 14 | 15 | Your talk title here 16 | 21 | 22 | 23 | 24 | 25 |
26 |

Your talk title here

27 | 32 |
33 | 40 | 41 | 46 | 47 |
48 |
49 |
50 |

The cover slide

51 |
52 | High-five at the Mozilla Festival! 55 | 58 |
59 | This is a simple cover slide with an image in the middle 60 |
61 |
62 |
63 | 64 | 65 | 66 |
67 |
68 |
69 |

Callout slide styles

70 |
71 |

The following are callout slide styles – either a large word, or a one sentence headline. Use them to chunk your presentation into logical units.

72 |

Multilingual content:

73 |
This is English.
74 |
这是中文(简体)。
75 |
這是中文(繁體)。
76 |
これは日本語です。
77 |
78 |
79 |
80 |
81 | 82 |
83 |
84 |
85 |

86 |
Shout slide
87 |
标题
88 |
標題
89 |
タイトル
90 |

91 |
92 |
93 |
94 |
95 |
96 | 97 |
98 |
99 |
100 |

Imagine: One line slide

101 |
102 |
103 |
104 |
105 |
106 | 107 |
108 |
109 |
110 |

Image slide styles

111 |
112 |
    113 |
  • Images are either backgrounds or part of the page.
  • 114 |
  • Background images need a "cover" class on on the slide DIV.
  • 115 |
  • In-page images need a class of "middle" to get centered
  • 116 |
  • Adding "left" or "right" classes floats the image and you can use text next to them
  • 117 |
  • Adding a "shadow" class adds a drop-shadow.
  • 118 |
  • FIGURE elements around the image allow for a "swinging frame" effect
  • 119 |
  • Images can also be videos or SVG. :)
  • 120 |
121 |
122 |
123 |
124 |
125 | 126 |
127 |
128 |
129 |

Image slide (stretched horizontal)

130 |
131 | Firefox OS phones 134 | 135 | 136 | Image by Chris Heilmann 137 | 138 | 139 |
140 |
141 |
142 |
143 | 144 |
145 |
146 |
147 |

Image slide (stretched vertical)

148 |
149 | Firefox OS phones 152 | 153 | 154 | Image by Chris Heilmann 155 | 156 | 157 |
158 | Introduce yourself, who you are and why you are the person to give that talk 159 |
160 |
161 |
162 | 163 |
164 |
165 |
166 |

Image slide (centered, resized)

167 |
168 | Firefox OS phones 171 | 172 | 173 | Image by Chris Heilmann 174 | 175 | 176 |
177 | Introduce yourself, who you are and why you are the person to give that talk 178 |
179 |
180 |
181 | 182 |
183 |
184 |
185 |

Image slide (right)

186 |
187 | Firefox OS phones 190 | 191 |
    192 |
  • Item 1
  • 193 |
  • Item 2
  • 194 |
  • Item 3
  • 195 |
196 | 197 | 198 | 199 | Image by Chris Heilmann 200 | 201 | 202 |
203 | Introduce yourself, who you are and why you are the person to give that talk 204 |
205 |
206 |
207 | 208 |
209 |
210 |
211 |

Image slide (left)

212 |
213 | Firefox OS phones 216 | 217 |
    218 |
  • Item 1
  • 219 |
  • Item 2
  • 220 |
  • Item 3
  • 221 |
222 | 223 | 224 | 225 | Image by Chris Heilmann 226 | 227 | 228 |
229 |
230 |
231 |
232 | 233 |
234 |
235 |
236 |

Image slide (centered, shadow)

237 |
238 | Firefox OS phones 241 | 242 | 243 | Image by Chris Heilmann 244 | 245 | 246 |
247 |
248 |
249 |
250 | 251 |
252 |
253 |
254 |

Image slide (framed)

255 |
256 |
257 | Firefox OS phones 259 |
260 | 261 | 262 | Image by Chris Heilmann 263 | 264 | 265 |
266 |
267 |
268 |
269 | 270 |
271 |
272 |
273 |

Image slide (framed, swinging)

274 |
275 |
276 | Firefox OS phones 278 |
279 | 280 | 281 | Image by Chris Heilmann 282 | 283 | 284 |
285 |
286 |
287 |
288 | 289 |
290 |
291 |
292 |

Image slide (GIF)

293 |
294 | Earthphases 296 |

GIFs animate from the start when the slide shows.

297 |
298 |
299 |
300 |
301 | 302 |
303 |
304 |
305 |

Image slide (video)

306 |
307 | 311 | 312 | 313 | Image by Chris Heilmann 314 | 315 | 316 |
317 |
318 |
319 |
320 | 321 |
322 |
323 |
324 |

Image slide (video autoplay)

325 |
326 | 330 | 331 | 332 | Image by Chris Heilmann 333 | 334 | 335 |
336 |
337 |
338 |
339 | 340 | 341 |
342 |
343 |
344 |

List style types

345 |
346 |

The following are the different kinds of list styles available to you. Always remember that bullets kill – both people and audiences. If people can read ahead of your narrative, they will. And you made yourself redundant as a speaker.

347 |
348 |
349 |
350 |
351 | 352 |
353 |
354 |
355 |

Numbered list

356 |
357 |
    358 |
  1. Collect underpants
  2. 359 |
  3. ???
  4. 360 |
  5. Profit
  6. 361 |
362 |
363 |
364 |
365 |
366 | 367 |
368 |
369 |
370 |

Unordered List

371 |
372 |
    373 |
  • Tigers
  • 374 |
  • Elephants
  • 375 |
  • Bears 376 |
      377 |
    • Koalas
    • 378 |
    • Polar
    • 379 |
    • Panda
    • 380 |
    381 |
  • 382 |
  • Oh my…
  • 383 |
384 |
385 |
386 |
387 |
388 | 389 |
390 |
391 |
392 |

Ordered List

393 |
394 |
    395 |
  1. Tigers
  2. 396 |
  3. Elephants
  4. 397 |
  5. Bears 398 |
      399 |
    1. Koalas
    2. 400 |
    3. Polar
    4. 401 |
    5. Panda
    6. 402 |
    403 |
  6. 404 |
  7. Oh my…
  8. 405 |
406 |
407 |
408 |
409 |
410 | 411 |
412 |
413 |
414 |

Long List

415 |
416 |
    417 |
  1. Tigers
  2. 418 |
  3. Elephants
  4. 419 |
  5. Bears 420 |
      421 |
    1. Koalas
    2. 422 |
    3. Polar
    4. 423 |
    5. Panda
    6. 424 |
    425 |
  6. 426 |
  7. Hedgehogs
  8. 427 |
  9. Opossums
  10. 428 |
  11. Hyrax
  12. 429 |
  13. Capybara
  14. 430 |
  15. Oh my…
  16. 431 |
432 |
433 |
434 |
435 |
436 | 437 |
438 |
439 |
440 |

Inline List

441 |
442 |
    443 |
  • Tigers
  • 444 |
  • Elephants
  • 445 |
  • Bears
  • 446 |
  • Hedgehogs
  • 447 |
  • Opossums
  • 448 |
  • Hyrax
  • 449 |
  • Capybara
  • 450 |
  • Oh my…
  • 451 |
452 |
moo 453 |
454 |
455 |
456 | 457 |
458 |
459 |
460 |

Animated List

461 |
462 |
    463 |
  • Tigers
  • 464 |
  • Elephants
  • 465 |
  • Bears
  • 466 |
  • Hedgehogs
  • 467 |
  • Opossums
  • 468 |
  • Hyrax
  • 469 |
  • Capybara
  • 470 |
  • Oh my…
  • 471 |
472 |
473 |
474 |
475 |
476 | 477 |
478 |
479 |
480 |

One line list

481 |
482 |
    483 |
  • Elephants
  • 484 |
  • Aardvarks
  • 485 |
  • Hedgehogs
  • 486 |
  • Kittens
  • 487 |
  • Puppies
  • 488 |
489 |
490 |
491 |
492 |
493 | 494 |
495 |
496 |
497 |

Long list

498 |
499 |
    500 |
  • Elephants
  • 501 |
  • Aardvarks
  • 502 |
  • Hedgehogs
  • 503 |
  • Kittens
  • 504 |
  • Puppies
  • 505 |
  • Axolotls
  • 506 |
  • Elephants
  • 507 |
  • Aardvarks
  • 508 |
  • Hedgehogs
  • 509 |
  • Kittens
  • 510 |
  • Puppies
  • 511 |
  • Axolotls
  • 512 |
  • Elephants
  • 513 |
  • Aardvarks
  • 514 |
  • Hedgehogs
  • 515 |
  • Kittens
  • 516 |
  • Puppies
  • 517 |
  • Axolotls
  • 518 |
  • Elephants
  • 519 |
  • Aardvarks
  • 520 |
  • Hedgehogs
  • 521 |
  • Kittens
  • 522 |
  • Puppies
  • 523 |
  • Axolotls
  • 524 |
  • Elephants
  • 525 |
  • Aardvarks
  • 526 |
  • Hedgehogs
  • 527 |
  • Kittens
  • 528 |
  • Puppies
  • 529 |
  • Axolotls
  • 530 |
531 |
532 |
533 |
534 |
535 | 536 |
537 |
538 |
539 |

Code styles

540 |
541 |

Code is not automatically encoded and colour coded. The space you have for code is also limited. This is by design: presentations are not there to drench audiences with code. Switch to your editor if needed and link to live, maintained code so people don't copy+paste.

542 |
543 |
544 |
545 |
546 | 547 |
548 |
549 |
550 |

code

551 |
552 |
553 |         var installapp = navigator.mozApps.install(manifestURL);
554 |         installapp.onsuccess = function(data) {
555 |           // App is installed
556 |         };
557 |         installapp.onerror = function() {
558 |          // App wasn't installed, info is in 
559 |          // installapp.error.name
560 |         };
561 |         
562 |
563 |
564 |
565 |
566 | 567 |
568 |
569 |
570 |

Markup is encoded

571 |
572 |
573 |         

Paragraph without encode

574 | <p>Paragraph without encode</p> 575 | 576 |
577 |
578 |
579 |
580 |
581 | 582 |
583 |
584 |
585 |

Live CSS code

586 |
587 |
588 | 593 |
594 |
595 |
596 |
597 | 598 |
599 |
600 |
601 |

Live CSS code (smooth)

602 |
603 |
604 | 609 |
610 |
611 |
612 |
613 | 614 |
615 |
616 |
617 |

Quote styles

618 |
619 |

Quotes are a superb way to look clever and get more kudos for being in the know. Make sure you attribute them correctly and do not quote out of context.

620 |
621 |
622 |
623 |
624 | 625 |
626 |
627 |
628 |

Quote

629 |
630 |
631 |

The worst part of internet quotes is that you can never be sure that they are attributed correctly.

632 | 633 |
634 |
635 |
636 |
637 |
638 | 639 |
640 |
641 |
642 |

Long quote is long…

643 |
644 |
645 | But there's no doubt that, we went for this approach, we built this internal framework that we called Faceweb, which is basically this idea that we can take the infrastructure that we built out for pushing code everyday, not having to submit to an app store, building web code on the web stack that we have, and that we can translate that into mobile development. We just were never able to get the quality of it we wanted… 646 |
647 |
648 | It seems the main failure was Facebook's approach and internal system creating HTML5 apps - not the technology itself. 649 |
650 |
651 |
652 | 653 |
654 |
655 |
656 |

Thanks

657 |
658 | Red panda (Firefox) 659 |
    660 |
  • {name}
  • 661 |
  • {title}
  • 662 |
  • {@twitter}
  • 663 |
  • Slides: {slideurl}
  • 664 |
665 | 666 | Photo by Yortw 667 | 668 | 669 |
670 |
671 | 672 |
673 |
674 | 675 | 679 |
680 |
681 | 682 | 688 |
689 | 690 | 691 | 692 | 693 | -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Bold.eot -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Bold.ttf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Bold.woff -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Bold.woff2 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-BoldItalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-BoldItalic.eot -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-BoldItalic.ttf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-BoldItalic.woff -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-BoldItalic.woff2 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBold.eot -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBold.ttf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBold.woff -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBold.woff2 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBoldItalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBoldItalic.eot -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBoldItalic.ttf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBoldItalic.woff -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-ExtraBoldItalic.woff2 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Light.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Light.eot -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Light.ttf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Light.woff -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Light.woff2 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-LightItalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-LightItalic.eot -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-LightItalic.ttf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-LightItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-LightItalic.woff -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-LightItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-LightItalic.woff2 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Regular.eot -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Regular.woff -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-Regular.woff2 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-RegularItalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-RegularItalic.eot -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-RegularItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-RegularItalic.ttf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-RegularItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-RegularItalic.woff -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-RegularItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-RegularItalic.woff2 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBold.eot -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBold.ttf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBold.woff -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBold.woff2 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBoldItalic.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBoldItalic.eot -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBoldItalic.ttf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBoldItalic.woff -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/OpenSans-SemiBoldItalic.woff2 -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/TargetBlank.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/TargetBlank.otf -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/fonts/TargetBlank.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Designer: Vadim Makeev 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/images/Fx-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/images/Fx-logo.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/images/bg-blue-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/images/bg-blue-2.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/images/bg-darkgrey-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/images/bg-darkgrey-2.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/images/bg-red-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/images/bg-red-2.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/images/bg-sandstone-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/images/bg-sandstone-2.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/images/mozilla-logo-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/images/mozilla-logo-white.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/images/mozilla-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/images/mozilla-logo.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/images/tab-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asajeffrey/parsell/d97a55d58b72415a372004cd258c36c3ed712463/doc/talks/sf-rust-2016-02-18/themes/mozilla/images/tab-2.png -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/styles/fonts.css: -------------------------------------------------------------------------------- 1 | 2 | @font-face { 3 | font-family: 'Open Sans'; 4 | src: url('../fonts/OpenSans-Light.eot'); 5 | src: url('../fonts/OpenSans-Light.eot?#iefix') format('embedded-opentype'), 6 | url('../fonts/OpenSans-Light.woff2') format('woff2'), 7 | url('../fonts/OpenSans-Light.woff') format('woff'), 8 | url('../fonts/OpenSans-Light.ttf') format('truetype'), 9 | url('../fonts/OpenSans-Light.svg#open_sanslight') format('svg'); 10 | font-weight: 300; 11 | font-style: normal; 12 | 13 | } 14 | 15 | @font-face { 16 | font-family: 'Open Sans'; 17 | src: url('../fonts/OpenSans-LightItalic.eot'); 18 | src: url('../fonts/OpenSans-LightItalic.eot?#iefix') format('embedded-opentype'), 19 | url('../fonts/OpenSans-LightItalic.woff2') format('woff2'), 20 | url('../fonts/OpenSans-LightItalic.woff') format('woff'), 21 | url('../fonts/OpenSans-LightItalic.ttf') format('truetype'), 22 | url('../fonts/OpenSans-LightItalic.svg#open_sanslight_italic') format('svg'); 23 | font-weight: 300; 24 | font-style: italic; 25 | 26 | } 27 | 28 | @font-face { 29 | font-family: 'Open Sans'; 30 | src: url('../fonts/OpenSans-Regular.eot'); 31 | src: url('../fonts/OpenSans-Regular.eot?#iefix') format('embedded-opentype'), 32 | url('../fonts/OpenSans-Regular.woff2') format('woff2'), 33 | url('../fonts/OpenSans-Regular.woff') format('woff'), 34 | url('../fonts/OpenSans-Regular.ttf') format('truetype'), 35 | url('../fonts/OpenSans-Regular.svg#open_sansregular') format('svg'); 36 | font-weight: 400; 37 | font-style: normal; 38 | 39 | } 40 | 41 | @font-face { 42 | font-family: 'Open Sans'; 43 | src: url('../fonts/OpenSans-RegularItalic.eot'); 44 | src: url('../fonts/OpenSans-RegularItalic.eot?#iefix') format('embedded-opentype'), 45 | url('../fonts/OpenSans-RegularItalic.woff2') format('woff2'), 46 | url('../fonts/OpenSans-RegularItalic.woff') format('woff'), 47 | url('../fonts/OpenSans-RegularItalic.ttf') format('truetype'), 48 | url('../fonts/OpenSans-RegularItalic.svg#open_sansitalic') format('svg'); 49 | font-weight: 400; 50 | font-style: italic; 51 | 52 | } 53 | 54 | @font-face { 55 | font-family: 'Open Sans'; 56 | src: url('../fonts/OpenSans-Semibold.eot'); 57 | src: url('../fonts/OpenSans-Semibold.eot?#iefix') format('embedded-opentype'), 58 | url('../fonts/OpenSans-Semibold.woff') format('woff'), 59 | url('../fonts/OpenSans-Semibold.woff2') format('woff2'), 60 | url('../fonts/OpenSans-Semibold.ttf') format('truetype'), 61 | url('../fonts/OpenSans-Semibold.svg#open_sanssemibold') format('svg'); 62 | font-weight: 600; 63 | font-style: normal; 64 | 65 | } 66 | 67 | @font-face { 68 | font-family: 'Open Sans'; 69 | src: url('../fonts/OpenSans-SemiboldItalic.eot'); 70 | src: url('../fonts/OpenSans-SemiboldItalic.eot?#iefix') format('embedded-opentype'), 71 | url('../fonts/OpenSans-SemiboldItalic.woff') format('woff'), 72 | url('../fonts/OpenSans-SemiboldItalic.woff2') format('woff2'), 73 | url('../fonts/OpenSans-SemiboldItalic.ttf') format('truetype'), 74 | url('../fonts/OpenSans-SemiboldItalic.svg#open_sanssemibold_italic') format('svg'); 75 | font-weight: 600; 76 | font-style: italic; 77 | 78 | } 79 | 80 | @font-face { 81 | font-family: 'Open Sans'; 82 | src: url('../fonts/OpenSans-Bold.eot'); 83 | src: url('../fonts/OpenSans-Bold.eot?#iefix') format('embedded-opentype'), 84 | url('../fonts/OpenSans-Bold.woff') format('woff'), 85 | url('../fonts/OpenSans-Bold.woff2') format('woff2'), 86 | url('../fonts/OpenSans-Bold.ttf') format('truetype'), 87 | url('../fonts/OpenSans-Bold.svg#open_sansbold') format('svg'); 88 | font-weight: 700; 89 | font-style: normal; 90 | 91 | } 92 | 93 | @font-face { 94 | font-family: 'Open Sans'; 95 | src: url('../fonts/OpenSans-BoldItalic.eot'); 96 | src: url('../fonts/OpenSans-BoldItalic.eot?#iefix') format('embedded-opentype'), 97 | url('../fonts/OpenSans-BoldItalic.woff') format('woff'), 98 | url('../fonts/OpenSans-BoldItalic.woff2') format('woff2'), 99 | url('../fonts/OpenSans-BoldItalic.ttf') format('truetype'), 100 | url('../fonts/OpenSans-BoldItalic.svg#open_sansbold_italic') format('svg'); 101 | font-weight: 700; 102 | font-style: italic; 103 | 104 | } 105 | 106 | @font-face { 107 | font-family: 'Open Sans'; 108 | src: url('../fonts/OpenSans-ExtraBold.eot'); 109 | src: url('../fonts/OpenSans-ExtraBold.eot?#iefix') format('embedded-opentype'), 110 | url('../fonts/OpenSans-ExtraBold.woff') format('woff'), 111 | url('../fonts/OpenSans-ExtraBold.woff2') format('woff2'), 112 | url('../fonts/OpenSans-ExtraBold.ttf') format('truetype'), 113 | url('../fonts/OpenSans-ExtraBold.svg#open_sansextrabold') format('svg'); 114 | font-weight: 800; 115 | font-style: normal; 116 | 117 | } 118 | 119 | @font-face { 120 | font-family: 'Open Sans'; 121 | src: url('../fonts/OpenSans-ExtraBoldItalic.eot'); 122 | src: url('../fonts/OpenSans-ExtraBoldItalic.eot?#iefix') format('embedded-opentype'), 123 | url('../fonts/OpenSans-ExtraBoldItalic.woff') format('woff'), 124 | url('../fonts/OpenSans-ExtraBoldItalic.woff2') format('woff2'), 125 | url('../fonts/OpenSans-ExtraBoldItalic.ttf') format('truetype'), 126 | url('../fonts/OpenSans-ExtraBoldItalic.svg#open_sansextrabold_italic') format('svg'); 127 | font-weight: 800; 128 | font-style: italic; 129 | 130 | } 131 | 132 | 133 | /* Linker */ 134 | @font-face { 135 | font-family:'Target Blank'; 136 | src:url(../fonts/TargetBlank.otf) format('opentype'), 137 | url(../fonts/TargetBlank.svg#TargetBlank) format('svg'); 138 | } 139 | -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/styles/print.css: -------------------------------------------------------------------------------- 1 | /* 2 | Ribbon theme for Shower presentation template: http://github.com/pepelsbey/shower 3 | Copyright © 2010–2011 Vadim Makeev, http://pepelsbey.net/ 4 | Licensed under MIT license: https://github.com/pepelsbey/shower/wiki/License 5 | */ 6 | 7 | @page { 8 | margin:0; 9 | size:1024px 640px; 10 | } 11 | 12 | /* List 13 | ---------------------------------------- */ 14 | .list { 15 | float:none; 16 | padding:0; 17 | background:#888; 18 | } 19 | 20 | /* Caption */ 21 | .list .caption { 22 | display:none; 23 | } 24 | 25 | /* Slide */ 26 | .list .slide { 27 | float:none; 28 | margin:0; 29 | padding:0; 30 | } 31 | .list .slide > DIV { 32 | width:1024px; 33 | height:640px; 34 | background:none; 35 | } 36 | .list .slide > div, 37 | .list .slide > div:hover { 38 | -webkit-box-shadow:none; 39 | -moz-box-shadow:none; 40 | box-shadow:none; 41 | } 42 | .list .slide section { 43 | -webkit-transform:none; 44 | -moz-transform:none; 45 | -ms-transform:none; 46 | -o-transform:none; 47 | transform:none; 48 | } 49 | .list .slide:after { 50 | position:absolute; 51 | bottom:85px; 52 | left:120px; 53 | color:#BBB; 54 | line-height:1; 55 | text-shadow:none; 56 | } 57 | -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/styles/reset.css: -------------------------------------------------------------------------------- 1 | html, body, div, span, applet, object, iframe, 2 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 3 | a, abbr, acronym, address, big, cite, code, 4 | del, dfn, em, img, ins, kbd, q, s, samp, 5 | small, strike, strong, sub, sup, tt, var, 6 | b, u, i, center, 7 | dl, dt, dd, ol, ul, li, 8 | fieldset, form, label, legend, 9 | table, caption, tbody, tfoot, thead, tr, th, td, 10 | article, aside, canvas, details, embed, 11 | figure, figcaption, footer, header, hgroup, 12 | menu, nav, output, ruby, section, summary, 13 | time, mark, audio, video { 14 | margin:0; 15 | padding:0; 16 | border:0; 17 | font-size:100%; 18 | font:inherit; 19 | vertical-align:baseline; 20 | } 21 | article, aside, details, figcaption, figure, 22 | footer, header, hgroup, menu, nav, section { 23 | display:block; 24 | } 25 | body { 26 | line-height:1; 27 | } 28 | ol, ul { 29 | list-style:none; 30 | } 31 | blockquote, q { 32 | quotes:none; 33 | } 34 | blockquote:before, blockquote:after, 35 | q:before, q:after { 36 | content:''; 37 | content:none; 38 | } 39 | table { 40 | border-collapse:collapse; 41 | border-spacing:0; 42 | } -------------------------------------------------------------------------------- /doc/talks/sf-rust-2016-02-18/themes/mozilla/styles/style.css: -------------------------------------------------------------------------------- 1 | /* 2 | Mozilla theme for Shower presentation template: http://github.com/pepelsbey/shower 3 | Copyright © 2010–2011 Vadim Makeev, http://pepelsbey.net/ 4 | Licensed under MIT license: https://github.com/pepelsbey/shower/wiki/License 5 | Theme by Chris Heilmann http://christianheilmann.com @codepo8 6 | */ 7 | 8 | @import url(fonts.css); 9 | @import url(reset.css); 10 | 11 | BODY { 12 | font:25px/1.8 'Open Sans', sans-serif; 13 | counter-reset:paging; 14 | } 15 | 16 | body:after { 17 | position:absolute; 18 | top:0; 19 | right:10px; 20 | width:153px; 21 | height:41px; 22 | background:url(../images/tab-2.png); 23 | content:''; 24 | } 25 | 26 | 27 | /* Slide 28 | ---------------------------------------- */ 29 | .slide button.cb { 30 | position: absolute; 31 | top: 80px; 32 | right: 0; 33 | } 34 | .full .slide button.cb { 35 | display: none; 36 | } 37 | .inactive { 38 | opacity: .5; 39 | } 40 | .slide:after { 41 | counter-increment:paging; 42 | content:counter(paging, decimal-leading-zero); 43 | } 44 | .slide section { 45 | padding:80px 120px 0; 46 | width:784px; 47 | height:560px; 48 | background:url(../images/bg-sandstone-2.png); 49 | color:rgb(62,62,62); 50 | } 51 | 52 | /* 53 | No numbering in the progress bar: 54 | add "nonumbers" class to 55 | */ 56 | .nonumbers .full .slide:after{ 57 | content: ''; 58 | } 59 | 60 | /* 61 | Smooth fading in between slides: 62 | add "fade" class to 63 | */ 64 | .fade .full .slide section { 65 | -webkit-transition: opacity 1s; 66 | -moz-transition: opacity 1s; 67 | -ms-transition: opacity 1s; 68 | -o-transition: opacity 1s; 69 | transition: opacity 1s; 70 | opacity: 0; 71 | } 72 | .fade .full .slide:target section { 73 | opacity: 1; 74 | } 75 | .fade .full .slide { 76 | background: url(../images/bg-sandstone-2.png); 77 | } 78 | /* 79 | Picture frame 80 | */ 81 | .frame { 82 | display:block; 83 | } 84 | .shadow { 85 | box-shadow: 5px 10px 10px rgba(0,0,0,.35); 86 | } 87 | .frame img { 88 | 89 | border: 5px solid #f8f8f8; z-index: 2; display: block; 90 | } 91 | .frame::after { 92 | content: ''; 93 | display: block; 94 | position: absolute; 95 | top: -10px; 96 | left: 50%; 97 | margin-left: -10px; 98 | width: 20px; 99 | height: 20px; 100 | -webkit-transform: rotate(45deg); 101 | -moz-transform: rotate(45deg ); 102 | -ms-transform: rotate(45deg ); 103 | -o-transform: rotate(45deg ); 104 | transform: rotate(45deg); 105 | border-style: solid; 106 | border-color: #666; 107 | border-width: 1px 0 0 1px; 108 | } 109 | .frame::before { 110 | content: ''; 111 | display: block; 112 | width: 5px; 113 | height: 5px; 114 | background-image: 115 | -webkit-linear-gradient(top, #f1f1f1 0%, #333 80%, #000 95%); 116 | background-image: 117 | -moz-linear-gradient(to bottom, #f1f1f1 0%, #333 80%, #000 95%); 118 | background-image: 119 | linear-gradient(to bottom, #f1f1f1 0%, #333 80%, #000 95%); 120 | border-radius: 50%; 121 | border: 1px solid #666; 122 | position: absolute; 123 | top: -15px; 124 | left: 50%; 125 | margin-left: -3px; 126 | } 127 | 128 | 129 | 130 | /* Header */ 131 | .slide header { 132 | margin:0 0 58px; 133 | color:rgb(62,62,62); 134 | text-transform: uppercase; 135 | font:lighter 40px/1.13 'Open Sans', sans-serif; 136 | } 137 | 138 | /* Elements */ 139 | .slide p { 140 | margin:0 0 45px; 141 | } 142 | .slide p.note { 143 | color:#888; 144 | } 145 | .slide a { 146 | border-bottom:0.1em solid; 147 | color:#0174A7; 148 | text-decoration:none; 149 | } 150 | .slide a[target=_blank] { 151 | margin-right:22px; 152 | } 153 | .slide a[target=_blank]:after { 154 | position:absolute; 155 | margin-left:7px; 156 | font-family:'Target Blank'; 157 | content:'\005E'; 158 | } 159 | .slide b, 160 | .slide strong { 161 | font-weight:bold; 162 | } 163 | .slide i, 164 | .slide em { 165 | font-style:italic; 166 | } 167 | .slide kbd, 168 | .slide code { 169 | padding:3px 8px; 170 | -webkit-border-radius:8px; 171 | -moz-border-radius:8px; 172 | border-radius:8px; 173 | background:#FAFAA2; 174 | color:#000; 175 | -webkit-tab-size:4; 176 | -moz-tab-size:4; 177 | -o-tab-size:4; 178 | tab-size:4; 179 | font-family:'monaco', 'courier', monospace; 180 | } 181 | 182 | /* Quote */ 183 | .slide blockquote { 184 | font-style:italic; 185 | font-size: 40px; 186 | } 187 | .slide blockquote.lots { 188 | font-style:italic; 189 | font-size: 30px; 190 | } 191 | .slide blockquote:before { 192 | position:absolute; 193 | margin:-15px 0 0 -80px; 194 | color:#666; 195 | font:200px/1 'Open Sans', sans-serif; 196 | content:'\201C'; /* ldquo */ 197 | } 198 | blockquote .quotesource { 199 | font-size: 20px; 200 | text-align: right; 201 | } 202 | 203 | /* Lists */ 204 | .slide ol, 205 | .slide ul { 206 | margin:0 0 45px; 207 | counter-reset:list; 208 | } 209 | .slide ul ul, 210 | .slide ol ul, 211 | .slide ol ol, 212 | .slide ul ol { 213 | margin:0 0 0 38px; 214 | } 215 | .slide ol > li:before, 216 | .slide ul > li:before { 217 | position:absolute; 218 | margin-left:-120px; 219 | width:100px; 220 | color:rgb(62,62,62); 221 | text-align:right; 222 | } 223 | .slide ul > li:before { 224 | content:'\2022'; /* bull */ 225 | line-height:1.1; 226 | font-size:40px; 227 | } 228 | .slide ol > li:before { 229 | counter-increment:list; 230 | content:counter(list)'.'; 231 | } 232 | /* Inner navigation */ 233 | .inner li { 234 | opacity: 0.05; 235 | -webkit-transition: opacity 1s; 236 | -moz-transition: opacity 1s; 237 | -o-transition: opacity 1s; 238 | transition: opacity 1s; 239 | } 240 | .inner .active { 241 | opacity: 1; 242 | } 243 | 244 | /* Code */ 245 | .slide pre { 246 | margin:0 0 45px; 247 | counter-reset:code; 248 | white-space:normal; 249 | } 250 | .slide pre code { 251 | display:block; 252 | padding:0; 253 | background:none; 254 | white-space:pre; 255 | } 256 | .slide pre code:before { 257 | position:absolute; 258 | margin:0 0 0 -120px; 259 | width:110px; 260 | color:rgb(182, 182, 182); 261 | text-align:right; 262 | counter-increment:code; 263 | content:counter(code, decimal-leading-zero)'.'; 264 | } 265 | .slide pre mark { 266 | padding:3px 8px; 267 | -webkit-border-radius:8px; 268 | -moz-border-radius:8px; 269 | border-radius:8px; 270 | background:#FAFAA2; 271 | color:#000; 272 | font-style:normal; 273 | } 274 | .slide pre .important { 275 | background:#C00; 276 | color:#FFF; 277 | font-weight:normal; 278 | } 279 | .slide pre .comment { 280 | padding:0; 281 | background:none; 282 | color:#888; 283 | } 284 | 285 | /* Cover */ 286 | .slide.cover section { 287 | background:#000; 288 | overflow:hidden; 289 | } 290 | .slide.cover section:before { 291 | display:none; 292 | } 293 | .slide.cover .byline { 294 | color: #fff; 295 | text-align: right; 296 | position: absolute; 297 | bottom: 10px; 298 | right: 10px; 299 | } 300 | .slide.cover img, 301 | .slide.cover svg, 302 | .slide.cover video, 303 | .slide.cover object { 304 | position:absolute; 305 | top:0; 306 | left:50%; 307 | z-index:-1; 308 | height:100%; 309 | -webkit-transform:translateX(-50%); 310 | -moz-transform:translateX(-50%); 311 | -ms-transform:translateX(-50%); 312 | -o-transform:translateX(-50%); 313 | transform:translateX(-50%); 314 | } 315 | .slide.cover.w img, 316 | .slide.cover.w svg, 317 | .slide.cover.w video, 318 | .slide.cover.w object { 319 | top:50%; 320 | left:0; 321 | width:100%; 322 | height:auto; 323 | -webkit-transform:translateY(-50%); 324 | -moz-transform:translateY(-50%); 325 | -ms-transform:translateY(-50%); 326 | -o-transform:translateY(-50%); 327 | transform:translateY(-50%); 328 | } 329 | 330 | /* Shout */ 331 | .slide.shout section:before { 332 | display:none; 333 | } 334 | .slide.shout h2 { 335 | position:absolute; 336 | top:50%; 337 | left:0; 338 | width:100%; 339 | text-align:center; 340 | line-height:1; 341 | font-size:150px; 342 | -webkit-transform:translateY(-50%); 343 | -moz-transform:translateY(-50%); 344 | -ms-transform:translateY(-50%); 345 | -o-transform:translateY(-50%); 346 | transform:translateY(-50%); 347 | } 348 | .slide.shout h2 a[target=_blank] { 349 | margin:0; 350 | } 351 | .slide.shout h2 a[target=_blank]:after { 352 | content:''; 353 | } 354 | 355 | .slide.oneline section:before { 356 | display:none; 357 | } 358 | .slide.oneline h2 { 359 | position:absolute; 360 | top:50%; 361 | text-align:left; 362 | line-height:1; 363 | font-size:70px; 364 | -webkit-transform:translateY(-50%); 365 | -moz-transform:translateY(-50%); 366 | -ms-transform:translateY(-50%); 367 | -o-transform:translateY(-50%); 368 | transform:translateY(-50%); 369 | } 370 | .slide.oneline h2 a[target=_blank] { 371 | margin:0; 372 | } 373 | .slide.oneline h2 a[target=_blank]:after { 374 | content:''; 375 | } 376 | 377 | 378 | /* Middle */ 379 | .middle { 380 | position:absolute; 381 | top:50%; 382 | left:50%; 383 | -webkit-transform:translate(-50%, -50%); 384 | -moz-transform:translate(-50%, -50%); 385 | -ms-transform:translate(-50%, -50%); 386 | -o-transform:translate(-50%, -50%); 387 | transform:translate(-50%, -50%); 388 | } 389 | 390 | 391 | /* List 392 | ---------------------------------------- */ 393 | .list { 394 | float:left; 395 | padding:80px 0 80px 100px; 396 | background:#585A5E url(../images/bg-darkgrey-2.png) fixed; 397 | } 398 | 399 | /* Caption */ 400 | .list .caption { 401 | color:#fff; 402 | text-shadow:0 1px 1px #000; 403 | } 404 | .list .caption h1 { 405 | font:bold 50px/1 'Open Sans', sans-serif; 406 | } 407 | .list .caption a { 408 | color:#fff; 409 | text-shadow:0 -1px 1px #1F3F60; 410 | text-decoration:none; 411 | } 412 | .list .caption a:hover { 413 | color:#5ca4ed; 414 | } 415 | 416 | /* Slide */ 417 | .list .slide { 418 | position:relative; 419 | float:left; 420 | margin:0 50px 0 0; 421 | padding:80px 0 0; 422 | } 423 | .list .slide:after { 424 | position:absolute; 425 | bottom:-45px; 426 | left:60px; 427 | color:#3C3D40; 428 | text-shadow:0 1px 1px #8D8E90; 429 | line-height:1; 430 | font-weight:bold; 431 | font-size:25px; 432 | } 433 | .list .slide:target:after { 434 | text-shadow:0 -1px 1px #1F3F60; 435 | color:#fff; 436 | } 437 | .list .slide > div { 438 | position:relative; 439 | overflow:hidden; 440 | width:512px; 441 | height:320px; 442 | box-shadow:0 0 50px #3C3D40; 443 | border-radius:1px; 444 | background:rgba(0, 0, 0, 0.3); 445 | } 446 | .list .slide > div:hover { 447 | box-shadow: 448 | 0 0 0 10px rgba(60, 61, 64, 0.6), 449 | 0 0 50px #3C3D40; 450 | } 451 | .list .slide:target > div { 452 | box-shadow: 453 | 0 0 0 10px rgba(240,240,240, 1), 454 | 0 0 50px #3C3D40; 455 | } 456 | .list .slide section { 457 | -webkit-transform-origin:0 0; 458 | -webkit-transform:scale(0.5); 459 | -moz-transform-origin:0 0; 460 | -moz-transform:scale(0.5); 461 | -ms-transform-origin:0 0; 462 | -ms-transform:scale(0.5); 463 | -o-transform-origin:0 0; 464 | -o-transform:scale(0.5); 465 | transform-origin:0 0; 466 | transform:scale(0.5); 467 | } 468 | .list .slide section:after { 469 | position:absolute; 470 | top:0; 471 | right:0; 472 | bottom:0; 473 | left:0; 474 | content:''; 475 | } 476 | 477 | /* Small */ 478 | @media all and (max-width:1274px) { 479 | .list .slide:after { 480 | left:30px; 481 | } 482 | .list .slide > div { 483 | width:256px; 484 | height:160px; 485 | } 486 | .list .slide section { 487 | -webkit-transform:scale(0.25); 488 | -moz-transform:scale(0.25); 489 | -ms-transform:scale(0.25); 490 | -o-transform:scale(0.25); 491 | transform:scale(0.25); 492 | } 493 | } 494 | 495 | /* Full 496 | ---------------------------------------- */ 497 | .full { 498 | position:absolute; 499 | top:50%; 500 | left:50%; 501 | overflow:hidden; 502 | margin:-320px 0 0 -512px; 503 | width:1024px; 504 | height:640px; 505 | background:#000; 506 | } 507 | .full .caption { 508 | display:none; 509 | } 510 | .full .slide { 511 | position:absolute; 512 | visibility:hidden; 513 | } 514 | .full .slide:target { 515 | visibility:visible; 516 | } 517 | .full .slide:after { 518 | position:absolute; 519 | bottom:20px; 520 | right:90px; 521 | font-size: 16px; 522 | color:rgba(62,62,62,0.6); 523 | line-height:1; 524 | } 525 | .full .slide section { 526 | -webkit-transform:scale(1); 527 | -moz-transform:scale(1); 528 | -ms-transform:scale(1); 529 | -o-transform:scale(1); 530 | transform:scale(1); 531 | padding: 40px 120px; 532 | } 533 | .full .slide.cover { 534 | z-index:1; 535 | } 536 | .full .slide.cover:after, 537 | .full .slide.shout:after { 538 | content:''; 539 | } 540 | 541 | /* Progress */ 542 | .full .progress { 543 | position:absolute; 544 | right:118px; 545 | bottom:20px; 546 | left:118px; 547 | border-radius:2px; 548 | border:2px solid rgba(62,62,62, 0.3); 549 | } 550 | .full .progress DIV { 551 | width:0; 552 | height:10px; 553 | border-radius:2px; 554 | background:rgba(62, 62, 62, 0.2); 555 | -webkit-transition:width 0.2s linear; 556 | -moz-transition:width 0.2s linear; 557 | -ms-transition:width 0.2s linear; 558 | -o-transition:width 0.2s linear; 559 | transition:width 0.2s linear; 560 | } 561 | .full .progress-off { 562 | z-index:1; 563 | } 564 | 565 | /* special content styles */ 566 | .byline{ 567 | font-size: 20px; 568 | text-align: right; 569 | } 570 | 571 | small.byline{ 572 | position: absolute; 573 | font-size: 15px; 574 | text-align: right; 575 | bottom: 70px; 576 | right: 125px; 577 | } 578 | .right { 579 | float: right; 580 | position: relative; 581 | } 582 | .left { 583 | float: left; 584 | position: relative; 585 | padding-right: 80px; 586 | } 587 | .credits { 588 | font-size: 12px; 589 | position: absolute; 590 | bottom: 40px; 591 | left: 120px; 592 | } 593 | .demourl { 594 | font-size: 18px; 595 | position: absolute; 596 | bottom: 40px; 597 | width: 800px; 598 | text-align: center; 599 | } 600 | .demourl a { 601 | color:inherit; 602 | } 603 | .cover h2, .cover a { 604 | color:#fff; 605 | background: rgba(0,0,0,0.6); 606 | padding: 5px 10px; 607 | border-bottom: none; 608 | text-decoration: none; 609 | } 610 | .longlist { 611 | font-size: 20px; 612 | } 613 | .slide ul.longlist li:before { 614 | content:'\2022'; /* bull */ 615 | line-height:1.1; 616 | font-size:30px; 617 | } 618 | .lots li { 619 | float: left; 620 | width: 33%; 621 | font-size: 24px; 622 | } 623 | .slide ul.lots li:before { 624 | content:'\2022'; /* bull */ 625 | line-height:1.3; 626 | font-size:30px; 627 | } 628 | 629 | ul.oneline li { 630 | display: inline; 631 | padding-right: 1em; 632 | } 633 | ul.oneline li::before, ul.nobull li::before { 634 | content: ''; 635 | } 636 | ul.inline li { 637 | display: inline; 638 | padding-right: 0.2em; 639 | } 640 | ul.inline li::before { 641 | content: ''; 642 | } 643 | ul.inline li::after { 644 | content: ', '; 645 | } 646 | ul.inline li:last-child::after { 647 | content: '.'; 648 | } 649 | 650 | /* Notes */ 651 | .full .slide .notes { 652 | display:none; 653 | } 654 | .full .peek .notes { 655 | display: block; 656 | z-index: 20; 657 | font-size: 15px; 658 | } 659 | .full .notes, .list .notes { 660 | background: #fff; 661 | padding: 5px 10px; 662 | z-index: 10; 663 | display: block; 664 | position: absolute; 665 | bottom: -500px; 666 | left: 50px; 667 | right: 50px; 668 | -webkit-transition: bottom .5s; 669 | -moz-transition: bottom .5s; 670 | -ms-transition: bottom .5s; 671 | -o-transition: bottom .5s; 672 | transition: bottom .5s; 673 | } 674 | .list .slide:hover .notes { 675 | bottom: 15px; 676 | } 677 | .full .notes { 678 | bottom: 70px; 679 | } 680 | 681 | /* Live demos */ 682 | 683 | * [contenteditable] { 684 | display: block; 685 | white-space: pre; 686 | padding: 10px; 687 | transition: 1s; 688 | -webkit-transition: 1s; 689 | } 690 | * [contenteditable]:focus { 691 | background: #f8f8f8; 692 | 693 | } 694 | 695 | /* Meta */ 696 | .talkdescription { 697 | font-size: 12px; 698 | color: #fff; 699 | width: 80%; 700 | } 701 | .full .talkdescription { 702 | display: none; 703 | } 704 | .abstract { 705 | margin: 1em 0; 706 | font-size: 14px; 707 | background: rgba(0,0,0, .7); 708 | padding: .5em; 709 | } 710 | 711 | /* Animations */ 712 | 713 | .smoothdemo { 714 | transition: 0.5s; 715 | -webkit-transition: 0.5s; 716 | } 717 | 718 | .full .slide:target .swing { 719 | -moz-animation: swing linear 2s infinite; 720 | -moz-transform-origin: 0 -55%; 721 | -webkit-animation: swing ease-in-out 2s infinite; 722 | -webkit-transform-origin: 0 -55%; 723 | -o-animation: swing ease-in-out 2s infinite; 724 | -o-transform-origin: 0 -55%; 725 | animation: swing ease-in-out 2s infinite; 726 | transform-origin: 0 -55%; 727 | } 728 | @-moz-keyframes swing { 729 | 0% { -moz-transform: rotate3d(0deg,0,0) translate3d(-50%, -50%, 0); } 730 | 25% { -moz-transform: rotate(3deg) translate(-50%, -50%); } 731 | 50% { -moz-transform: rotate(0deg) translate(-50%, -50%); } 732 | 75% { -moz-transform: rotate(-3deg) translate(-50%, -50%); } 733 | 100% { -moz-transform: rotate(0deg) translate(-50%, -50%); } 734 | } 735 | @-webkit-keyframes swing { 736 | 0% {-webkit-transform: rotate(-3deg) translate(-50%, -50%); } 737 | 50% {-webkit-transform: rotate(3deg) translate(-50%, -50%); } 738 | 100% {-webkit-transform: rotate(-3deg) translate(-50%, -50%); } 739 | } 740 | 741 | @-o-keyframes swing { 742 | 0% { -o-transform: rotate(-3deg) translate(-50%, -50%); } 743 | 50% { -o-transform: rotate(3deg) translate(-50%, -50%); } 744 | 100% { -o-transform: rotate(-3deg) translate(-50%, -50%); } 745 | } 746 | @keyframes swing { 747 | 0% { transform: rotate(-3deg) translate(-50%, -50%); } 748 | 50% { transform: rotate(3deg) translate(-50%, -50%); } 749 | 100% { transform: rotate(-3deg) translate(-50%, -50%); } 750 | } 751 | 752 | /* Multilingual support */ 753 | 754 | .en-US, 755 | .zh-CN, 756 | .zh-TW, 757 | .ja-JP { 758 | display: none; 759 | } 760 | 761 | :lang(en-US) .en-US, 762 | :lang(zh-CN) .zh-CN, 763 | :lang(zh-TW) .zh-TW, 764 | :lang(ja-JP) .ja-JP { 765 | display: block; 766 | } 767 | 768 | #langMenuId { 769 | pointer-events: auto; 770 | } 771 | 772 | #langMenuDivId { 773 | position: absolute; 774 | left: 0px; 775 | right: 0px; 776 | text-align: center; 777 | bottom: 36px; 778 | pointer-events: none; 779 | } 780 | 781 | .list #langMenuDivId { 782 | display: none; 783 | } 784 | -------------------------------------------------------------------------------- /src/impls.rs: -------------------------------------------------------------------------------- 1 | //! Provide implementations of parser traits. 2 | 3 | use super::{Parser, ParseResult}; 4 | use super::{HasOutput, StatefulInfer, Stateful, CommittedInfer, Committed, UncommittedInfer, Uncommitted, Boxable}; 5 | use super::{Function, VariantFunction, Consumer, Factory, PeekableIterator}; 6 | use super::{Upcast, Downcast, ToStatic}; 7 | use super::ParseResult::{Done, Continue}; 8 | 9 | use self::OrElseState::{Lhs, Rhs}; 10 | use self::AndThenState::{InLhs, InBetween, InRhs}; 11 | 12 | use std::borrow::Cow; 13 | use std::borrow::Cow::{Borrowed, Owned}; 14 | use std::str::Chars; 15 | use std::fmt::{Formatter, Debug}; 16 | use std; 17 | 18 | // ----------- N-argument functions --------------- 19 | 20 | #[derive(Copy, Clone, Debug)] 21 | pub struct Function2(F); 22 | 23 | impl Function2 { 24 | pub fn new(f: F) -> Self { 25 | Function2(f) 26 | } 27 | } 28 | 29 | // NOTE(eddyb): a generic over U where F: Fn(T) -> U doesn't allow HRTB in both T and U. 30 | // See https://github.com/rust-lang/rust/issues/30867 for more details. 31 | impl Function<(S1, S2)> for Function2 where F: Fn<(S1, S2, )> 32 | { 33 | type Output = F::Output; 34 | fn apply(&self, args: (S1, S2)) -> F::Output { 35 | (self.0)(args.0, args.1) 36 | } 37 | } 38 | 39 | #[derive(Copy, Clone, Debug)] 40 | pub struct Function3(F); 41 | 42 | impl Function3 { 43 | pub fn new(f: F) -> Self { 44 | Function3(f) 45 | } 46 | } 47 | 48 | // NOTE(eddyb): a generic over U where F: Fn(T) -> U doesn't allow HRTB in both T and U. 49 | // See https://github.com/rust-lang/rust/issues/30867 for more details. 50 | impl Function<((S1, S2), S3)> for Function3 where F: Fn<(S1, S2, S3, )> 51 | { 52 | type Output = F::Output; 53 | fn apply(&self, args: ((S1, S2), S3)) -> F::Output { 54 | (self.0)((args.0).0, (args.0).1, args.1) 55 | } 56 | } 57 | 58 | #[derive(Copy, Clone, Debug)] 59 | pub struct Function4(F); 60 | 61 | impl Function4 { 62 | pub fn new(f: F) -> Self { 63 | Function4(f) 64 | } 65 | } 66 | 67 | // NOTE(eddyb): a generic over U where F: Fn(T) -> U doesn't allow HRTB in both T and U. 68 | // See https://github.com/rust-lang/rust/issues/30867 for more details. 69 | impl Function<(((S1, S2), S3), S4)> for Function4 70 | where F: Fn<(S1, S2, S3, S4, )> 71 | { 72 | type Output = F::Output; 73 | fn apply(&self, args: (((S1, S2), S3), S4)) -> F::Output { 74 | (self.0)(((args.0).0).0, ((args.0).0).1, (args.0).1, args.1) 75 | } 76 | } 77 | 78 | #[derive(Copy, Clone, Debug)] 79 | pub struct Function5(F); 80 | 81 | impl Function5 { 82 | pub fn new(f: F) -> Self { 83 | Function5(f) 84 | } 85 | } 86 | 87 | // NOTE(eddyb): a generic over U where F: Fn(T) -> U doesn't allow HRTB in both T and U. 88 | // See https://github.com/rust-lang/rust/issues/30867 for more details. 89 | impl Function<((((S1, S2), S3), S4), S5)> for Function5 90 | where F: Fn<(S1, S2, S3, S4, S5, )> 91 | { 92 | type Output = F::Output; 93 | fn apply(&self, args: ((((S1, S2), S3), S4), S5)) -> F::Output { 94 | (self.0)((((args.0).0).0).0, 95 | (((args.0).0).0).1, 96 | ((args.0).0).1, 97 | (args.0).1, 98 | args.1) 99 | } 100 | } 101 | 102 | #[derive(Copy, Clone, Debug)] 103 | pub struct Function6(F); 104 | 105 | impl Function6 { 106 | pub fn new(f: F) -> Self { 107 | Function6(f) 108 | } 109 | } 110 | 111 | // NOTE(eddyb): a generic over U where F: Fn(T) -> U doesn't allow HRTB in both T and U. 112 | // See https://github.com/rust-lang/rust/issues/30867 for more details. 113 | impl Function<(((((S1, S2), S3), S4), S5), S6)> for Function6 114 | where F: Fn<(S1, S2, S3, S4, S5, S6, )> 115 | { 116 | type Output = F::Output; 117 | fn apply(&self, args: (((((S1, S2), S3), S4), S5), S6)) -> F::Output { 118 | (self.0)(((((args.0).0).0).0).0, 119 | ((((args.0).0).0).0).1, 120 | (((args.0).0).0).1, 121 | ((args.0).0).1, 122 | (args.0).1, 123 | args.1) 124 | } 125 | } 126 | 127 | // ----------- Deal with errors --------------- 128 | 129 | #[derive(Copy, Clone, Debug)] 130 | pub struct Try(F); 131 | impl Function> for Try where F: Function 132 | { 133 | type Output = Result; 134 | fn apply(&self, args: Result) -> Result { 135 | Ok(self.0.apply(try!(args))) 136 | } 137 | } 138 | impl VariantFunction> for Try where F: VariantFunction 139 | { 140 | type Input = Result; 141 | fn apply(&self, args: Result) -> Result { 142 | Ok(self.0.apply(try!(args))) 143 | } 144 | } 145 | impl Try { 146 | pub fn new(f: F) -> Try { 147 | Try(f) 148 | } 149 | } 150 | 151 | #[derive(Copy, Clone, Debug)] 152 | pub struct TryDiscard; 153 | impl Function> for TryDiscard { 154 | type Output = Result<(),E>; 155 | fn apply(&self, arg: Result) -> Result<(), E> { 156 | try!(arg); Ok(()) 157 | } 158 | } 159 | 160 | #[derive(Copy, Clone, Debug)] 161 | pub struct TryZip; 162 | impl Function<(Result, T)> for TryZip { 163 | type Output = Result<(S,T),E>; 164 | fn apply(&self, args: (Result, T)) -> Result<(S, T), E> { 165 | Ok((try!(args.0), args.1)) 166 | } 167 | } 168 | 169 | #[derive(Copy, Clone, Debug)] 170 | pub struct ZipTry; 171 | impl Function<(S, Result)> for ZipTry { 172 | type Output = Result<(S,T),E>; 173 | fn apply(&self, args: (S, Result)) -> Result<(S, T), E> { 174 | Ok((args.0, try!(args.1))) 175 | } 176 | } 177 | 178 | #[derive(Copy, Clone, Debug)] 179 | pub struct TryZipTry; 180 | impl Function<(Result, Result)> for TryZipTry { 181 | type Output = Result<(S,T),E>; 182 | fn apply(&self, args: (Result, Result)) -> Result<(S, T), E> { 183 | Ok((try!(args.0), try!(args.1))) 184 | } 185 | } 186 | impl VariantFunction> for TryZipTry { 187 | type Input = (Result, Result); 188 | fn apply(&self, args: (Result, Result)) -> Result<(S, T), E> { 189 | Ok((try!(args.0), try!(args.1))) 190 | } 191 | } 192 | 193 | #[derive(Copy, Clone, Debug)] 194 | pub struct TryOpt; 195 | impl Function>> for TryOpt { 196 | type Output = Result,E>; 197 | fn apply(&self, arg: Option>) -> Result,E> { 198 | match arg { 199 | Some(Ok(res)) => Ok(Some(res)), 200 | Some(Err(err)) => Err(err), 201 | None => Ok(None), 202 | } 203 | } 204 | } 205 | impl VariantFunction, E>> for TryOpt { 206 | type Input = Option>; 207 | fn apply(&self, arg: Option>) -> Result,E> { 208 | match arg { 209 | Some(Ok(res)) => Ok(Some(res)), 210 | Some(Err(err)) => Err(err), 211 | None => Ok(None), 212 | } 213 | } 214 | } 215 | 216 | // ----------- Deal with options --------------- 217 | 218 | #[derive(Copy, Clone, Debug)] 219 | pub struct MkSome; 220 | impl Function for MkSome 221 | { 222 | type Output = Option; 223 | fn apply(&self, arg: T) -> Option { 224 | Some(arg) 225 | } 226 | } 227 | 228 | #[derive(Copy, Clone, Debug)] 229 | pub struct IsSome(F); 230 | impl Function for IsSome 231 | where F: Function> 232 | { 233 | type Output = bool; 234 | fn apply(&self, arg: S) -> bool { 235 | self.0.apply(arg).is_some() 236 | } 237 | } 238 | impl IsSome { 239 | pub fn new(f: F) -> IsSome { 240 | IsSome(f) 241 | } 242 | } 243 | 244 | #[derive(Copy, Clone, Debug)] 245 | pub struct Unwrap(F); 246 | impl Function for Unwrap 247 | where F: Function> 248 | { 249 | type Output = T; 250 | fn apply(&self, arg: S) -> T { 251 | self.0.apply(arg).unwrap() 252 | } 253 | } 254 | impl Unwrap { 255 | pub fn new(f: F) -> Unwrap { 256 | Unwrap(f) 257 | } 258 | } 259 | 260 | // ----------- Deal with dereferencing --------------- 261 | 262 | #[derive(Copy, Clone, Debug)] 263 | pub struct Dereference(F); 264 | impl Function for Dereference 265 | where F: for<'a> Function<&'a S, Output = T> 266 | { 267 | type Output = T; 268 | fn apply(&self, arg: S) -> T { 269 | self.0.apply(&arg) 270 | } 271 | } 272 | impl Dereference { 273 | pub fn new(f: F) -> Dereference { 274 | Dereference(f) 275 | } 276 | } 277 | 278 | 279 | // ----------- Deal with pairs --------------- 280 | 281 | #[derive(Copy, Clone, Debug)] 282 | pub struct First; 283 | impl Function<(S, T)> for First 284 | { 285 | type Output = S; 286 | fn apply(&self, arg: (S, T)) -> S { 287 | arg.0 288 | } 289 | } 290 | impl VariantFunction for First 291 | { 292 | type Input = (T, ()); 293 | fn apply(&self, arg: (T, ())) -> T { 294 | arg.0 295 | } 296 | } 297 | 298 | #[derive(Copy, Clone, Debug)] 299 | pub struct Second; 300 | impl Function<(S, T)> for Second 301 | { 302 | type Output = T; 303 | fn apply(&self, arg: (S, T)) -> T { 304 | arg.1 305 | } 306 | } 307 | impl VariantFunction for Second 308 | { 309 | type Input = ((), T); 310 | fn apply(&self, arg: ((), T)) -> T { 311 | arg.1 312 | } 313 | } 314 | 315 | 316 | // ----------- Map --------------- 317 | 318 | pub struct Map(P, F); 319 | 320 | // A work around for functions implmenting copy but not clone 321 | // https://github.com/rust-lang/rust/issues/28229 322 | impl Copy for Map 323 | where P: Copy, 324 | F: Copy 325 | {} 326 | impl Clone for Map 327 | where P: Clone, 328 | F: Copy 329 | { 330 | fn clone(&self) -> Self { 331 | Map(self.0.clone(), self.1) 332 | } 333 | } 334 | 335 | // A work around for named functions not implmenting Debug 336 | // https://github.com/rust-lang/rust/issues/31522 337 | impl Debug for Map 338 | where P: Debug 339 | { 340 | fn fmt(&self, fmt: &mut Formatter) -> std::fmt::Result { 341 | write!(fmt, "Map({:?}, ...)", self.0) 342 | } 343 | } 344 | 345 | impl Parser for Map {} 346 | 347 | impl Stateful for Map 348 | where P: StatefulInfer, 349 | F: Function, 350 | { 351 | 352 | fn done(self) -> Output { 353 | self.1.apply(self.0.done()) 354 | } 355 | 356 | fn more(self, string: &mut Str) -> ParseResult { 357 | match self.0.more(string) { 358 | Done(result) => Done(self.1.apply(result)), 359 | Continue(state) => Continue(Map(state, self.1)), 360 | } 361 | } 362 | 363 | } 364 | 365 | impl HasOutput for Map 366 | where P: HasOutput, 367 | F: Function, 368 | { 369 | 370 | type Output = F::Output; 371 | 372 | } 373 | 374 | impl Committed for Map 375 | where P: CommittedInfer, 376 | F: 'static + Copy + Function, 377 | { 378 | 379 | fn empty(&self) -> Output { 380 | self.1.apply(self.0.empty()) 381 | } 382 | 383 | } 384 | 385 | impl Uncommitted for Map 386 | where P: UncommittedInfer, 387 | F: 'static + Copy + Function, 388 | { 389 | type State = Map; 390 | 391 | fn init(&self, string: &mut Str) -> Option> { 392 | match self.0.init(string) { 393 | None => None, 394 | Some(Done(result)) => Some(Done(self.1.apply(result))), 395 | Some(Continue(state)) => Some(Continue(Map(state, self.1))), 396 | } 397 | } 398 | 399 | } 400 | 401 | impl Map { 402 | pub fn new(p: P, f: F) -> Self { 403 | Map(p, f) 404 | } 405 | } 406 | 407 | // ----------- Variant map --------------- 408 | 409 | // A version of map for functions that can comute their input types from their output types 410 | 411 | pub struct VariantMap(P, F); 412 | 413 | // A work around for functions implmenting copy but not clone 414 | // https://github.com/rust-lang/rust/issues/28229 415 | impl Copy for VariantMap 416 | where P: Copy, 417 | F: Copy 418 | {} 419 | impl Clone for VariantMap 420 | where P: Clone, 421 | F: Copy 422 | { 423 | fn clone(&self) -> Self { 424 | VariantMap(self.0.clone(), self.1) 425 | } 426 | } 427 | 428 | // A work around for named functions not implmenting Debug 429 | // https://github.com/rust-lang/rust/issues/31522 430 | impl Debug for VariantMap 431 | where P: Debug 432 | { 433 | fn fmt(&self, fmt: &mut Formatter) -> std::fmt::Result { 434 | write!(fmt, "VariantMap({:?}, ...)", self.0) 435 | } 436 | } 437 | 438 | impl Parser for VariantMap {} 439 | 440 | impl Stateful for VariantMap 441 | where P: Stateful, 442 | F: VariantFunction, 443 | { 444 | 445 | fn done(self) -> Output { 446 | self.1.apply(self.0.done()) 447 | } 448 | 449 | fn more(self, string: &mut Str) -> ParseResult { 450 | match self.0.more(string) { 451 | Done(result) => Done(self.1.apply(result)), 452 | Continue(state) => Continue(VariantMap(state, self.1)), 453 | } 454 | } 455 | 456 | } 457 | 458 | impl HasOutput for VariantMap 459 | where P: HasOutput, 460 | F: Function, 461 | { 462 | 463 | type Output = F::Output; 464 | 465 | } 466 | 467 | impl Committed for VariantMap 468 | where P: Committed, 469 | F: 'static + Copy + VariantFunction, 470 | 471 | { 472 | 473 | fn empty(&self) -> Output { 474 | self.1.apply(self.0.empty()) 475 | } 476 | 477 | } 478 | 479 | impl Uncommitted for VariantMap 480 | where P: Uncommitted, 481 | F: 'static + Copy + VariantFunction, 482 | { 483 | type State = VariantMap; 484 | 485 | fn init(&self, string: &mut Str) -> Option> { 486 | match self.0.init(string) { 487 | None => None, 488 | Some(Done(result)) => Some(Done(self.1.apply(result))), 489 | Some(Continue(state)) => Some(Continue(VariantMap(state, self.1))), 490 | } 491 | } 492 | 493 | } 494 | 495 | impl VariantMap { 496 | pub fn new(p: P, f: F) -> Self { 497 | VariantMap(p, f) 498 | } 499 | } 500 | 501 | // ----------- Sequencing --------------- 502 | 503 | #[derive(Copy, Clone, Debug)] 504 | pub struct AndThen(P, Q); 505 | 506 | impl Parser for AndThen {} 507 | 508 | impl Committed for AndThen 509 | where P: Committed, 510 | Q: 'static + Copy + Committed, 511 | POutput: ToStatic + Downcast, 512 | { 513 | 514 | fn empty(&self) -> (POutput, QOutput) { 515 | (self.0.empty(), self.1.empty()) 516 | } 517 | 518 | } 519 | 520 | impl Uncommitted for AndThen 521 | where P: Uncommitted, 522 | Q: 'static + Copy + Committed, 523 | POutput: ToStatic + Downcast, 524 | { 525 | 526 | type State = AndThenState; 527 | 528 | fn init(&self, string: &mut Str) -> Option> { 529 | match self.0.init(string) { 530 | None => None, 531 | Some(Done(fst)) => match self.1.init(string) { 532 | None => Some(Continue(InBetween(fst.downcast(), self.1))), 533 | Some(Done(snd)) => Some(Done((fst, snd))), 534 | Some(Continue(snd)) => Some(Continue(InRhs(fst.downcast(), snd))), 535 | }, 536 | Some(Continue(fst)) => Some(Continue(InLhs(fst, self.1))), 537 | } 538 | } 539 | 540 | } 541 | 542 | impl HasOutput for AndThen 543 | where P: HasOutput, 544 | Q: HasOutput, 545 | { 546 | 547 | type Output = (P::Output, Q::Output); 548 | 549 | } 550 | 551 | impl AndThen { 552 | pub fn new(p: P, q: Q) -> Self { 553 | AndThen(p, q) 554 | } 555 | } 556 | 557 | #[derive(Copy, Clone, Debug)] 558 | pub enum AndThenState { 559 | InLhs(PState, Q), 560 | InBetween(PStaticOutput, Q), 561 | InRhs(PStaticOutput, QState), 562 | } 563 | 564 | impl Stateful for AndThenState 565 | where PState: Stateful, 566 | Q: Committed, 567 | QState: Stateful, 568 | POutput: Downcast, 569 | PStaticOutput: 'static + Upcast, 570 | { 571 | 572 | fn done(self) -> (POutput, QOutput) 573 | { 574 | match self { 575 | InLhs(fst, snd) => (fst.done(), snd.empty()), 576 | InBetween(fst, snd) => (fst.upcast(), snd.empty()), 577 | InRhs(fst, snd) => (fst.upcast(), snd.done()), 578 | } 579 | } 580 | 581 | fn more(self, string: &mut Str) -> ParseResult 582 | { 583 | match self { 584 | InLhs(fst, snd) => { 585 | match fst.more(string) { 586 | Done(fst) => match snd.init(string) { 587 | None => Continue(InBetween(fst.downcast(), snd)), 588 | Some(Done(snd)) => Done((fst, snd)), 589 | Some(Continue(snd)) => Continue(InRhs(fst.downcast(), snd)), 590 | }, 591 | Continue(fst) => Continue(InLhs(fst, snd)), 592 | } 593 | } 594 | InBetween(fst, snd) => { 595 | match snd.init(string) { 596 | None => Continue(InBetween(fst, snd)), 597 | Some(Done(snd)) => Done((fst.upcast(), snd)), 598 | Some(Continue(snd)) => Continue(InRhs(fst, snd)), 599 | } 600 | } 601 | InRhs(fst, snd) => { 602 | match snd.more(string) { 603 | Done(snd) => Done((fst.upcast(), snd)), 604 | Continue(snd) => Continue(InRhs(fst, snd)), 605 | } 606 | } 607 | } 608 | } 609 | 610 | } 611 | 612 | impl HasOutput for AndThenState 613 | where PState: HasOutput, 614 | Q: HasOutput, 615 | { 616 | 617 | type Output = (PState::Output, Q::Output); 618 | 619 | } 620 | 621 | // ----------- Choice --------------- 622 | 623 | #[derive(Copy, Clone, Debug)] 624 | pub struct OrElse(P, Q); 625 | 626 | impl Parser for OrElse {} 627 | 628 | impl Committed for OrElse 629 | where P: Uncommitted, 630 | Q: Committed, 631 | { 632 | 633 | fn empty(&self) -> Output { 634 | self.1.empty() 635 | } 636 | 637 | } 638 | 639 | impl Uncommitted for OrElse 640 | where P: Uncommitted, 641 | Q: Uncommitted, 642 | { 643 | 644 | type State = OrElseState; 645 | 646 | fn init(&self, string: &mut Str) -> Option> { 647 | match self.0.init(string) { 648 | Some(Done(result)) => Some(Done(result)), 649 | Some(Continue(lhs)) => Some(Continue(Lhs(lhs))), 650 | None => match self.1.init(string) { 651 | Some(Done(result)) => Some(Done(result)), 652 | Some(Continue(rhs)) => Some(Continue(Rhs(rhs))), 653 | None => None, 654 | }, 655 | } 656 | } 657 | 658 | } 659 | 660 | impl HasOutput for OrElse 661 | where P: HasOutput, 662 | { 663 | 664 | type Output = P::Output; 665 | 666 | } 667 | 668 | impl OrElse { 669 | pub fn new(lhs: P, rhs: Q) -> Self { 670 | OrElse(lhs, rhs) 671 | } 672 | } 673 | 674 | #[derive(Copy, Clone, Debug)] 675 | pub enum OrElseState { 676 | Lhs(P), 677 | Rhs(Q), 678 | } 679 | 680 | impl Stateful for OrElseState 681 | where P: Stateful, 682 | Q: Stateful, 683 | { 684 | fn more(self, string: &mut Str) -> ParseResult { 685 | match self { 686 | Lhs(lhs) => match lhs.more(string) { 687 | Done(result) => Done(result), 688 | Continue(lhs) => Continue(Lhs(lhs)), 689 | }, 690 | Rhs(rhs) => match rhs.more(string) { 691 | Done(result) => Done(result), 692 | Continue(rhs) => Continue(Rhs(rhs)), 693 | }, 694 | } 695 | } 696 | 697 | fn done(self) -> Output { 698 | match self { 699 | Lhs(lhs) => lhs.done(), 700 | Rhs(rhs) => rhs.done(), 701 | } 702 | } 703 | 704 | } 705 | 706 | impl HasOutput for OrElseState 707 | where P: HasOutput, 708 | { 709 | type Output = P::Output; 710 | } 711 | 712 | // ----------- Kleene star --------------- 713 | 714 | #[derive(Clone,Debug)] 715 | pub struct StarState(P, Option, T); 716 | 717 | impl Stateful for StarState 718 | where P: Copy + UncommittedInfer, 719 | PState: Stateful, 720 | T: Consumer, 721 | Str: PeekableIterator, 722 | { 723 | fn more(mut self, string: &mut Str) -> ParseResult { 724 | loop { 725 | match self.1.take() { 726 | None => { 727 | match self.0.init(string) { 728 | Some(Continue(state)) => return Continue(StarState(self.0, Some(state), self.2)), 729 | Some(Done(result)) => self.2.accept(result), 730 | None => return if string.is_empty() { 731 | Continue(self) 732 | } else { 733 | Done(self.2) 734 | }, 735 | } 736 | } 737 | Some(state) => { 738 | match state.more(string) { 739 | Continue(state) => return Continue(StarState(self.0, Some(state), self.2)), 740 | Done(result) => self.2.accept(result), 741 | } 742 | } 743 | } 744 | } 745 | } 746 | fn done(self) -> T { 747 | self.2 748 | } 749 | } 750 | 751 | impl HasOutput for StarState 752 | { 753 | type Output = T; 754 | } 755 | 756 | pub struct Plus(P, F); 757 | 758 | // A work around for functions implmenting copy but not clone 759 | // https://github.com/rust-lang/rust/issues/28229 760 | impl Copy for Plus 761 | where P: Copy, 762 | F: Copy 763 | {} 764 | impl Clone for Plus 765 | where P: Clone, 766 | F: Copy 767 | { 768 | fn clone(&self) -> Self { 769 | Plus(self.0.clone(), self.1) 770 | } 771 | } 772 | 773 | // A work around for named functions not implmenting Debug 774 | // https://github.com/rust-lang/rust/issues/31522 775 | impl Debug for Plus 776 | where P: Debug 777 | { 778 | fn fmt(&self, fmt: &mut Formatter) -> std::fmt::Result { 779 | write!(fmt, "Plus({:?}, ...)", self.0) 780 | } 781 | } 782 | 783 | impl Parser for Plus {} 784 | 785 | impl Uncommitted for Plus 786 | where P: 'static + Copy + UncommittedInfer, 787 | F: 'static + Factory, 788 | Str: PeekableIterator, 789 | P::State: Stateful>::Output>, 790 | F::Output: Consumer, 791 | { 792 | type State = StarState; 793 | 794 | fn init(&self, string: &mut Str) -> Option> { 795 | match self.0.init(string) { 796 | None => None, 797 | Some(Continue(state)) => Some(Continue(StarState(self.0, Some(state), self.1.build()))), 798 | Some(Done(result)) => { 799 | let mut buffer = self.1.build(); 800 | buffer.accept(result); 801 | Some(StarState(self.0, None, buffer).more(string)) 802 | }, 803 | } 804 | } 805 | } 806 | 807 | impl HasOutput for Plus 808 | where F: Factory, 809 | { 810 | type Output = F::Output; 811 | } 812 | 813 | impl Plus { 814 | pub fn new(parser: P, factory: F) -> Self { 815 | Plus(parser, factory) 816 | } 817 | } 818 | 819 | pub struct Star(P, F); 820 | 821 | // A work around for functions implmenting copy but not clone 822 | // https://github.com/rust-lang/rust/issues/28229 823 | impl Copy for Star 824 | where P: Copy, 825 | F: Copy 826 | {} 827 | impl Clone for Star 828 | where P: Clone, 829 | F: Copy 830 | { 831 | fn clone(&self) -> Self { 832 | Star(self.0.clone(), self.1) 833 | } 834 | } 835 | 836 | // A work around for named functions not implmenting Debug 837 | // https://github.com/rust-lang/rust/issues/31522 838 | impl Debug for Star 839 | where P: Debug 840 | { 841 | fn fmt(&self, fmt: &mut Formatter) -> std::fmt::Result { 842 | write!(fmt, "Star({:?}, ...)", self.0) 843 | } 844 | } 845 | 846 | impl Parser for Star {} 847 | 848 | impl HasOutput for Star 849 | where F: Factory, 850 | { 851 | 852 | type Output = F::Output; 853 | 854 | } 855 | 856 | impl Uncommitted for Star 857 | where P: 'static + Copy + UncommittedInfer, 858 | F: 'static + Factory, 859 | Str: PeekableIterator, 860 | P::State: Stateful>::Output>, 861 | F::Output: Consumer, 862 | { 863 | 864 | type State = StarState; 865 | 866 | fn init(&self, string: &mut Str) -> Option> { 867 | if string.is_empty() { 868 | None 869 | } else { 870 | Some(StarState(self.0, None, self.1.build()).more(string)) 871 | } 872 | } 873 | 874 | } 875 | 876 | impl Committed for Star 877 | where P: 'static + Copy + UncommittedInfer, 878 | F: 'static + Factory, 879 | Str: PeekableIterator, 880 | P::State: Stateful>::Output>, 881 | F::Output: Consumer, 882 | { 883 | 884 | fn empty(&self) -> F::Output { 885 | self.1.build() 886 | } 887 | 888 | } 889 | 890 | impl Star { 891 | pub fn new(parser: P, factory: F) -> Self { 892 | Star(parser, factory) 893 | } 894 | } 895 | 896 | // ----------- Optional parse ------------- 897 | 898 | #[derive(Copy, Clone, Debug)] 899 | pub struct Opt

(P); 900 | 901 | impl

Parser for Opt

where P: Parser {} 902 | 903 | impl Stateful> for Opt

904 | where P: Stateful, 905 | { 906 | 907 | fn more(self, string: &mut Str) -> ParseResult> { 908 | match self.0.more(string) { 909 | Done(result) => Done(Some(result)), 910 | Continue(parsing) => Continue(Opt(parsing)), 911 | } 912 | } 913 | 914 | fn done(self) -> Option { 915 | Some(self.0.done()) 916 | } 917 | 918 | } 919 | 920 | impl HasOutput for Opt

921 | where P: HasOutput, 922 | { 923 | 924 | type Output = Option; 925 | 926 | } 927 | 928 | impl Uncommitted> for Opt

929 | where Str: PeekableIterator, 930 | P: Uncommitted, 931 | { 932 | 933 | type State = Opt; 934 | 935 | fn init(&self, string: &mut Str) -> Option>> { 936 | match self.0.init(string) { 937 | None => if string.is_empty() { 938 | None 939 | } else { 940 | Some(Done(None)) 941 | }, 942 | Some(Done(result)) => Some(Done(Some(result))), 943 | Some(Continue(parsing)) => Some(Continue(Opt(parsing))), 944 | } 945 | } 946 | 947 | } 948 | 949 | impl Committed> for Opt

950 | where Str: PeekableIterator, 951 | P: Uncommitted, 952 | { 953 | 954 | fn empty(&self) -> Option{ 955 | None 956 | } 957 | 958 | } 959 | 960 | impl

Opt

{ 961 | pub fn new(parser: P) -> Self { 962 | Opt(parser) 963 | } 964 | } 965 | 966 | // ----------- Parse but discard the result ------------- 967 | 968 | #[derive(Copy, Clone, Debug)] 969 | pub struct Discard

(P); 970 | 971 | impl

Parser for Discard

where P: Parser {} 972 | 973 | impl Stateful for Discard

974 | where P: StatefulInfer, 975 | { 976 | 977 | fn more(self, string: &mut Str) -> ParseResult { 978 | match self.0.more(string) { 979 | Done(_) => Done(()), 980 | Continue(parsing) => Continue(Discard(parsing)), 981 | } 982 | } 983 | 984 | fn done(self) -> () { 985 | () 986 | } 987 | 988 | } 989 | 990 | impl HasOutput for Discard

991 | { 992 | 993 | type Output = (); 994 | 995 | } 996 | 997 | impl Uncommitted for Discard

998 | where P: UncommittedInfer, 999 | { 1000 | 1001 | type State = Discard; 1002 | 1003 | fn init(&self, string: &mut Str) -> Option> { 1004 | match self.0.init(string) { 1005 | None => None, 1006 | Some(Done(_)) => Some(Done(())), 1007 | Some(Continue(parsing)) => Some(Continue(Discard(parsing))), 1008 | } 1009 | } 1010 | 1011 | } 1012 | 1013 | impl Committed for Discard

1014 | where P: CommittedInfer, 1015 | { 1016 | 1017 | fn empty(&self) -> () { 1018 | () 1019 | } 1020 | 1021 | } 1022 | 1023 | impl

Discard

{ 1024 | pub fn new(parser: P) -> Self { 1025 | Discard(parser) 1026 | } 1027 | } 1028 | 1029 | // ----------- A type for parsers which immediately emit a result ------------- 1030 | 1031 | #[derive(Copy, Clone, Debug)] 1032 | pub struct Emit(F); 1033 | 1034 | impl Parser for Emit {} 1035 | 1036 | impl Stateful for Emit 1037 | where F: Factory, 1038 | { 1039 | 1040 | fn more(self, _: &mut Str) -> ParseResult { 1041 | Done(self.0.build()) 1042 | } 1043 | 1044 | fn done(self) -> F::Output { 1045 | self.0.build() 1046 | } 1047 | 1048 | } 1049 | 1050 | impl HasOutput for Emit 1051 | where F: Factory, 1052 | { 1053 | 1054 | type Output = F::Output; 1055 | 1056 | } 1057 | 1058 | impl Uncommitted for Emit 1059 | where Str: PeekableIterator, 1060 | F: 'static + Copy + Factory, 1061 | { 1062 | 1063 | type State = Self; 1064 | 1065 | fn init(&self, string: &mut Str) -> Option> { 1066 | if string.is_empty() { 1067 | None 1068 | } else { 1069 | Some(Done(self.0.build())) 1070 | } 1071 | } 1072 | 1073 | } 1074 | 1075 | impl Committed for Emit 1076 | where Str: PeekableIterator, 1077 | F: 'static + Copy + Factory, 1078 | { 1079 | 1080 | fn empty(&self) -> F::Output { 1081 | self.0.build() 1082 | } 1083 | } 1084 | 1085 | impl Emit { 1086 | pub fn new(t: T) -> Self { 1087 | Emit(t) 1088 | } 1089 | } 1090 | 1091 | // ----------- Character parsers ------------- 1092 | 1093 | #[derive(Copy, Clone, Debug)] 1094 | pub enum CharacterState {} 1095 | 1096 | impl Stateful for CharacterState 1097 | { 1098 | fn more(self, _: &mut Str) -> ParseResult { 1099 | match self {} 1100 | } 1101 | 1102 | fn done(self) -> Ch { 1103 | match self {} 1104 | } 1105 | } 1106 | 1107 | impl HasOutput for CharacterState 1108 | { 1109 | type Output = Ch; 1110 | } 1111 | 1112 | pub struct Character(F); 1113 | 1114 | // A work around for functions implmenting copy but not clone 1115 | // https://github.com/rust-lang/rust/issues/28229 1116 | impl Copy for Character where F: Copy {} 1117 | impl Clone for Character where F: Copy 1118 | { 1119 | fn clone(&self) -> Self { 1120 | Character(self.0) 1121 | } 1122 | } 1123 | 1124 | // A work around for named functions not implmenting Debug 1125 | // https://github.com/rust-lang/rust/issues/31522 1126 | impl Debug for Character 1127 | { 1128 | fn fmt(&self, fmt: &mut Formatter) -> std::fmt::Result { 1129 | write!(fmt, "Character(...)") 1130 | } 1131 | } 1132 | 1133 | impl Parser for Character {} 1134 | 1135 | impl HasOutput for Character 1136 | { 1137 | type Output = Ch; 1138 | } 1139 | 1140 | impl Uncommitted for Character 1141 | where Str: PeekableIterator, 1142 | F: Copy + Function, 1143 | Ch: Copy, 1144 | { 1145 | type State = CharacterState; 1146 | 1147 | fn init(&self, string: &mut Str) -> Option> { 1148 | match string.next_if(self.0) { 1149 | None => None, 1150 | Some(ch) => Some(Done(ch)), 1151 | } 1152 | } 1153 | 1154 | } 1155 | 1156 | impl Character { 1157 | pub fn new(function: F) -> Self { 1158 | Character(function) 1159 | } 1160 | } 1161 | 1162 | pub struct CharacterRef(F); 1163 | 1164 | // A work around for functions implmenting copy but not clone 1165 | // https://github.com/rust-lang/rust/issues/28229 1166 | impl Copy for CharacterRef where F: Copy {} 1167 | impl Clone for CharacterRef where F: Copy 1168 | { 1169 | fn clone(&self) -> Self { 1170 | CharacterRef(self.0) 1171 | } 1172 | } 1173 | 1174 | // A work around for named functions not implmenting Debug 1175 | // https://github.com/rust-lang/rust/issues/31522 1176 | impl Debug for CharacterRef 1177 | { 1178 | fn fmt(&self, fmt: &mut Formatter) -> std::fmt::Result { 1179 | write!(fmt, "CharacterRef(...)") 1180 | } 1181 | } 1182 | 1183 | impl Parser for CharacterRef {} 1184 | 1185 | impl HasOutput for CharacterRef 1186 | { 1187 | type Output = Ch; 1188 | } 1189 | 1190 | impl Uncommitted for CharacterRef 1191 | where Str: PeekableIterator, 1192 | F: Copy + for<'a> Function<&'a Ch, Output = bool>, 1193 | { 1194 | type State = CharacterState; 1195 | 1196 | fn init(&self, string: &mut Str) -> Option> { 1197 | match string.next_if_ref(self.0) { 1198 | None => None, 1199 | Some(ch) => Some(Done(ch)), 1200 | } 1201 | } 1202 | 1203 | } 1204 | 1205 | impl CharacterRef { 1206 | pub fn new(function: F) -> Self { 1207 | CharacterRef(function) 1208 | } 1209 | } 1210 | 1211 | #[derive(Copy,Clone,Debug)] 1212 | pub struct AnyCharacter; 1213 | 1214 | impl Parser for AnyCharacter {} 1215 | 1216 | impl Stateful> for AnyCharacter 1217 | where Str: Iterator, 1218 | { 1219 | fn more(self, string: &mut Str) -> ParseResult> { 1220 | match string.next() { 1221 | None => Continue(self), 1222 | Some(ch) => Done(Some(ch)), 1223 | } 1224 | } 1225 | 1226 | fn done(self) -> Option { 1227 | None 1228 | } 1229 | } 1230 | 1231 | impl HasOutput for AnyCharacter 1232 | where Str: Iterator, 1233 | { 1234 | type Output = Option; 1235 | } 1236 | 1237 | impl Uncommitted> for AnyCharacter 1238 | where Str: Iterator, 1239 | { 1240 | type State = AnyCharacter; 1241 | 1242 | fn init(&self, string: &mut Str) -> Option>> { 1243 | match string.next() { 1244 | None => None, 1245 | Some(ch) => Some(Done(Some(ch))), 1246 | } 1247 | } 1248 | 1249 | } 1250 | 1251 | impl Committed> for AnyCharacter 1252 | where Str: Iterator, 1253 | { 1254 | 1255 | fn empty(&self) -> Option { 1256 | None 1257 | } 1258 | 1259 | } 1260 | 1261 | // ----------- Buffering ------------- 1262 | 1263 | // If p is a UncommittedInfer>, then 1264 | // m.buffer() is a UncommittedInfer> with Output (char, Cow<'a,str>). 1265 | // It does as little buffering as it can, but it does allocate as buffer for the case 1266 | // where the boundary marker of the input is misaligned with that of the parser. 1267 | // For example, m is matching string literals, and the input is '"abc' followed by 'def"' 1268 | // we have to buffer up '"abc'. 1269 | 1270 | // TODO(ajeffrey): make this code generic. 1271 | 1272 | #[derive(Copy, Clone, Debug)] 1273 | pub struct Buffered

(P); 1274 | 1275 | impl

Parser for Buffered

where P: Parser {} 1276 | 1277 | impl<'a, P> HasOutput> for Buffered

1278 | { 1279 | type Output = Cow<'a, str>; 1280 | } 1281 | 1282 | impl<'a, P> Uncommitted, Cow<'a, str>> for Buffered

1283 | where P: UncommittedInfer>, 1284 | { 1285 | type State = BufferedState; 1286 | 1287 | fn init(&self, string: &mut Chars<'a>) -> Option>> { 1288 | let string0 = string.as_str(); 1289 | match self.0.init(string) { 1290 | Some(Done(_)) => Some(Done(Borrowed(&string0[..(string0.len() - string.as_str().len())]))), 1291 | Some(Continue(state)) => Some(Continue(BufferedState(state, String::from(string0)))), 1292 | None => None, 1293 | } 1294 | } 1295 | } 1296 | 1297 | impl<'a, P> Committed, Cow<'a, str>> for Buffered

1298 | where P: CommittedInfer>, 1299 | { 1300 | fn empty(&self) -> Cow<'a, str> { Borrowed("") } 1301 | } 1302 | 1303 | impl

Buffered

{ 1304 | pub fn new(parser: P) -> Self { 1305 | Buffered(parser) 1306 | } 1307 | } 1308 | 1309 | #[derive(Clone,Debug)] 1310 | pub struct BufferedState

(P, String); 1311 | 1312 | impl<'a, P> Stateful, Cow<'a, str>> for BufferedState

1313 | where P: StatefulInfer> 1314 | { 1315 | 1316 | fn more(mut self, string: &mut Chars<'a>) -> ParseResult> { 1317 | let string0 = string.as_str(); 1318 | match self.0.more(string) { 1319 | Done(_) => { 1320 | self.1.push_str(&string0[..(string0.len() - string.as_str().len())]); 1321 | Done(Owned(self.1)) 1322 | }, 1323 | Continue(state) => { 1324 | self.1.push_str(string0); 1325 | Continue(BufferedState(state, self.1)) 1326 | }, 1327 | } 1328 | } 1329 | 1330 | fn done(self) -> Cow<'a, str> { 1331 | Owned(self.1) 1332 | } 1333 | 1334 | } 1335 | 1336 | impl<'a, P> HasOutput> for BufferedState

1337 | where P: HasOutput> 1338 | { 1339 | 1340 | type Output = Cow<'a, str>; 1341 | 1342 | } 1343 | 1344 | // ----------- Parsers which are boxable ------------- 1345 | 1346 | #[derive(Debug)] 1347 | pub struct BoxableState

(Option

); 1348 | 1349 | impl Boxable for BoxableState

1350 | where P: Stateful, 1351 | { 1352 | fn more_boxable(&mut self, string: &mut Str) -> ParseResult<(), Output> { 1353 | match self.0.take().unwrap().more(string) { 1354 | Done(result) => Done(result), 1355 | Continue(state) => { 1356 | self.0 = Some(state); 1357 | Continue(()) 1358 | } 1359 | } 1360 | } 1361 | fn done_boxable(&mut self) -> Output { 1362 | self.0.take().unwrap().done() 1363 | } 1364 | } 1365 | 1366 | impl HasOutput for BoxableState

1367 | where P: HasOutput, 1368 | { 1369 | type Output = P::Output; 1370 | } 1371 | 1372 | impl Stateful for Box

1373 | where P: Boxable, 1374 | { 1375 | fn more(mut self, string: &mut Str) -> ParseResult { 1376 | match self.more_boxable(string) { 1377 | Done(result) => Done(result), 1378 | Continue(()) => Continue(self), 1379 | } 1380 | } 1381 | fn done(mut self) -> Output { 1382 | self.done_boxable() 1383 | } 1384 | } 1385 | 1386 | impl

BoxableState

{ 1387 | pub fn new(parser: P) -> Self { 1388 | BoxableState(Some(parser)) 1389 | } 1390 | } 1391 | 1392 | #[derive(Debug, Copy, Clone)] 1393 | pub struct Boxed(P, F); 1394 | 1395 | impl Parser for Boxed where P: Parser {} 1396 | 1397 | impl HasOutput for Boxed 1398 | where P: HasOutput, 1399 | { 1400 | type Output = P::Output; 1401 | } 1402 | 1403 | impl Uncommitted for Boxed 1404 | where P: Uncommitted, 1405 | F: Function>, 1406 | F::Output: 'static + Stateful, 1407 | { 1408 | type State = F::Output; 1409 | 1410 | fn init(&self, string: &mut Str) -> Option> { 1411 | match self.0.init(string) { 1412 | None => None, 1413 | Some(Done(result)) => Some(Done(result)), 1414 | Some(Continue(parsing)) => Some(Continue(self.1.apply(BoxableState::new(parsing)))), 1415 | } 1416 | } 1417 | } 1418 | 1419 | impl Committed for Boxed 1420 | where P: Committed, 1421 | F: Function>, 1422 | F::Output: 'static + Stateful, 1423 | { 1424 | fn empty(&self) -> Output { 1425 | self.0.empty() 1426 | } 1427 | } 1428 | 1429 | impl Boxed { 1430 | pub fn new(parser: P, function: F) -> Self { 1431 | Boxed(parser, function) 1432 | } 1433 | } 1434 | 1435 | // // ----------- Iterate over parse results ------------- 1436 | 1437 | // #[derive(Copy, Clone, Debug)] 1438 | // pub struct IterParser(P, Option<(Q, S)>); 1439 | 1440 | // impl Iterator for IterParser 1441 | // where P: Copy + CommittedInfer, 1442 | // Str: IntoPeekable, 1443 | // Str::Item: ToStatic, 1444 | // P::State: StatefulInfer, 1445 | // { 1446 | // type Item = >::Output; 1447 | // fn next(&mut self) -> Option { 1448 | // let (state, result) = match self.1.take() { 1449 | // None => (None, None), 1450 | // Some((parsing, data)) => { 1451 | // match parsing.parse(data) { 1452 | // Done(rest, result) => (Some((self.0.init(), rest)), Some(result)), 1453 | // Continue(rest, parsing) => (Some((parsing, rest)), None), 1454 | // } 1455 | // } 1456 | // }; 1457 | // *self = IterParser(self.0, state); 1458 | // result 1459 | // } 1460 | // } 1461 | 1462 | // impl IterParser 1463 | // where P: Copy + CommittedInfer, 1464 | // Str: IntoPeekable, 1465 | // Str::Item: ToStatic, 1466 | // { 1467 | // pub fn new(parser: P, data: Str) -> Self { 1468 | // IterParser(parser, Some((parser.init(), data))) 1469 | // } 1470 | // } 1471 | 1472 | // // ----------- Pipe parsers ------------- 1473 | 1474 | // TODO: restore these 1475 | 1476 | // #[derive(Copy, Clone, Debug)] 1477 | // pub struct PipeStatefulInfer(P, Q, R); 1478 | 1479 | // impl StatefulInfer for PipeStatefulInfer 1480 | // where P: Copy + CommittedInfer, 1481 | // Q: StatefulInfer>>, 1482 | // Str: IntoPeekable, 1483 | // Str::Item: ToStatic, 1484 | // P::State: StatefulInfer, 1485 | // { 1486 | // type Output = Q::Output; 1487 | // fn parse(self, data: Str) -> ParseResult { 1488 | // let iterator = Peekable::new(IterParser(self.0, Some((self.1, data)))); 1489 | // match self.2.parse(iterator) { 1490 | // Done(rest, result) => Done(rest.iter.1.unwrap().1, result), 1491 | // Continue(rest, parsing2) => { 1492 | // let (parsing1, data) = rest.iter.1.unwrap(); 1493 | // Continue(data, PipeStatefulInfer(self.0, parsing1, parsing2)) 1494 | // } 1495 | // } 1496 | // } 1497 | // fn done(self) -> Q::Output { 1498 | // // TODO: feed the output of self.1.done() into self.2. 1499 | // self.1.done(); 1500 | // self.2.done() 1501 | // } 1502 | // } 1503 | 1504 | // #[derive(Copy, Clone, Debug)] 1505 | // pub struct PipeParser(P, Q); 1506 | 1507 | // impl Parser for PipeParser 1508 | // where P: 'static + Parser, 1509 | // Q: Parser, 1510 | // { 1511 | // type State = PipeStatefulInfer; 1512 | // type StaticOutput = Q::StaticOutput; 1513 | // } 1514 | 1515 | // impl CommittedInfer for PipeParser 1516 | // where P: 'static + Copy + CommittedInfer, 1517 | // Q: for<'a> CommittedInfer>>, 1518 | // Str: IntoPeekable, 1519 | // Str::Item: ToStatic, 1520 | // P::State: StatefulInfer, 1521 | // { 1522 | // fn init(&self) -> Self::State { 1523 | // PipeStatefulInfer(self.0, self.0.init(), self.1.init()) 1524 | // } 1525 | // } 1526 | 1527 | // impl PipeParser { 1528 | // pub fn new(lhs: P, rhs: Q) -> Self { 1529 | // PipeParser(lhs, rhs) 1530 | // } 1531 | // } 1532 | 1533 | -------------------------------------------------------------------------------- /tests/skeptic.rs: -------------------------------------------------------------------------------- 1 | include!(concat!(env!("OUT_DIR"), "/skeptic-tests.rs")); 2 | -------------------------------------------------------------------------------- /tests/typecheck-time1.rs: -------------------------------------------------------------------------------- 1 | // Test for typechecking blow-up 2 | // https://github.com/rust-lang/rust/issues/31849 3 | 4 | extern crate parsell; 5 | use parsell::{Parser, UncommittedStr, CHARACTER}; 6 | 7 | #[test] 8 | fn test_typecheck_time() { 9 | CHARACTER 10 | .and_then(CHARACTER) 11 | .and_then(CHARACTER) 12 | .and_then(CHARACTER) 13 | .and_then(CHARACTER) 14 | .and_then(CHARACTER) 15 | .and_then(CHARACTER) 16 | .and_then(CHARACTER) 17 | .and_then(CHARACTER) 18 | .and_then(CHARACTER) 19 | .and_then(CHARACTER) 20 | .and_then(CHARACTER) 21 | .and_then(CHARACTER) 22 | .and_then(CHARACTER) 23 | .and_then(CHARACTER) 24 | .and_then(CHARACTER) 25 | .and_then(CHARACTER) 26 | .and_then(CHARACTER) 27 | .and_then(CHARACTER) 28 | .and_then(CHARACTER) 29 | .and_then(CHARACTER) 30 | .and_then(CHARACTER) 31 | .and_then(CHARACTER) 32 | .and_then(CHARACTER) 33 | .and_then(CHARACTER) 34 | .init_str("hello, world"); 35 | } 36 | -------------------------------------------------------------------------------- /tests/typecheck-time2.rs: -------------------------------------------------------------------------------- 1 | // Test for typechecking blow-up 2 | // https://github.com/rust-lang/rust/issues/31849 3 | 4 | #![recursion_limit="128"] 5 | extern crate parsell; 6 | use parsell::{Parser, UncommittedStr, CHARACTER}; 7 | 8 | #[test] 9 | fn test_typecheck_time() { 10 | CHARACTER 11 | .and_then_discard(CHARACTER) 12 | .and_then_discard(CHARACTER) 13 | .and_then_discard(CHARACTER) 14 | .and_then_discard(CHARACTER) 15 | .and_then_discard(CHARACTER) 16 | // .and_then_discard(CHARACTER) 17 | // .and_then_discard(CHARACTER) 18 | // .and_then_discard(CHARACTER) 19 | // .and_then_discard(CHARACTER) 20 | // .and_then_discard(CHARACTER) 21 | // .and_then_discard(CHARACTER) 22 | // .and_then_discard(CHARACTER) 23 | // .and_then_discard(CHARACTER) 24 | // .and_then_discard(CHARACTER) 25 | // .and_then_discard(CHARACTER) 26 | // .and_then_discard(CHARACTER) 27 | // .and_then_discard(CHARACTER) 28 | // .and_then_discard(CHARACTER) 29 | // .and_then_discard(CHARACTER) 30 | // .and_then_discard(CHARACTER) 31 | // .and_then_discard(CHARACTER) 32 | // .and_then_discard(CHARACTER) 33 | // .and_then_discard(CHARACTER) 34 | // .and_then_discard(CHARACTER) 35 | .init_str("hello, world"); 36 | } 37 | -------------------------------------------------------------------------------- /tests/typecheck-time3.rs: -------------------------------------------------------------------------------- 1 | // Test for typechecking blow-up 2 | // https://github.com/rust-lang/rust/issues/31849 3 | 4 | extern crate parsell; 5 | use parsell::{Parser, UncommittedStr, CHARACTER}; 6 | 7 | #[test] 8 | fn test_typecheck_time() { 9 | CHARACTER 10 | .or_else(CHARACTER) 11 | .or_else(CHARACTER) 12 | .or_else(CHARACTER) 13 | .or_else(CHARACTER) 14 | .or_else(CHARACTER) 15 | .or_else(CHARACTER) 16 | .or_else(CHARACTER) 17 | .or_else(CHARACTER) 18 | .or_else(CHARACTER) 19 | .or_else(CHARACTER) 20 | .or_else(CHARACTER) 21 | .or_else(CHARACTER) 22 | .or_else(CHARACTER) 23 | .or_else(CHARACTER) 24 | .or_else(CHARACTER) 25 | .or_else(CHARACTER) 26 | .or_else(CHARACTER) 27 | .or_else(CHARACTER) 28 | .or_else(CHARACTER) 29 | .or_else(CHARACTER) 30 | .or_else(CHARACTER) 31 | .or_else(CHARACTER) 32 | .or_else(CHARACTER) 33 | .or_else(CHARACTER) 34 | .or_else(CHARACTER) 35 | .or_else(CHARACTER) 36 | .init_str("hello, world"); 37 | } 38 | -------------------------------------------------------------------------------- /tests/typecheck-time4.rs: -------------------------------------------------------------------------------- 1 | // Test for typechecking blow-up 2 | // https://github.com/rust-lang/rust/issues/31849 3 | 4 | extern crate parsell; 5 | use parsell::{Parser, UncommittedStr, CHARACTER}; 6 | 7 | #[test] 8 | fn test_typecheck_time() { 9 | CHARACTER 10 | .or_else(CHARACTER 11 | .or_else(CHARACTER 12 | .or_else(CHARACTER 13 | .or_else(CHARACTER 14 | .or_else(CHARACTER 15 | .or_else(CHARACTER 16 | .or_else(CHARACTER 17 | .or_else(CHARACTER 18 | .or_else(CHARACTER 19 | .or_else(CHARACTER)))))))))) 20 | .init_str("hello, world"); 21 | } 22 | --------------------------------------------------------------------------------