Skip to content

Instantly share code, notes, and snippets.

@aengelberg
Forked from ndrew/instaparse-phpdocs.clj
Last active August 29, 2015 14:16
Show Gist options
  • Save aengelberg/146c0686efaa8b2f39d5 to your computer and use it in GitHub Desktop.
Save aengelberg/146c0686efaa8b2f39d5 to your computer and use it in GitHub Desktop.
(ns testo.repl
(:use [clojure.pprint])
(:require [instaparse.core :as insta]))
(def grammar "PHPDOC = '/**' {S|tag} '*/'
S = <'*'> #'.+'
tag = <{'*'} '@'> #'\\w*' params
params = #'.*'")
(def test-phpdoc "/**
* Lorem ipsum dolor sit amet, eu iisque disputando qui, ex ponderum invidunt prodesset cum.
* Tests:
* - Appetere invidunt sapientem ea eos, has ea dicta aeterno
* - ex his atqui saperet repudiandae
* - Et pri velit labore fastidii, est in quas albucius
* - Eruditi antiopam no usu, iuvaret fuisset has et. Rebum possit detracto sit cu
*
*
* @dataProvider tesopesto
* @group usa
*
* @author Some Guy <[email protected]>
* @reviewer Other Guy <[email protected]>
*
* @access public
*
* @param array $super_data - super data array
* @param Foo_Baria_Model_Buzz $buzz
* @param string $jfid - id of the jf
* @param array $conf - configuration array ('minf' => , 'minh' => )
* @param string $rfid - rfid of the customer
* @param array $ra_conf - configuration of RA to test
*
* @return void
*/")
(let [whitespace (insta/parser "whitespace = #'[ \t\f\r\n]+'")
parser (insta/parser grammar
:auto-whitespace whitespace
:output-format :hiccup)]
(time
(pprint (insta/parse parser test-phpdoc :optimize :memory))
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment