Skip to content

Instantly share code, notes, and snippets.

@ndrew
Created October 19, 2014 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ndrew/1fb8f1d452b991dba9c9 to your computer and use it in GitHub Desktop.
Save ndrew/1fb8f1d452b991dba9c9 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 <some.guy@gmail.com>
* @reviewer Other Guy <other.guy@gmail.com>
*
* @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