Skip to content
Browse files

Code is cleaner, commented, and tests were expanded.

Added report of theoretical fastest time.

Debugging is drastically different and resulted in better performance.

The function gen-ps was renamed to wrap-string.

IPosition was renamed to IAmotoen and significantly cleaned up.

Two new 'provided' symbols were added, to signify the end of input or to
accept any character.

The Not Predicate made it back in.

The function with-fns and post-process were added to facilitate wrapping grammars in
post-processing functions.

Grammars were updated to fit the new syntax, with json seeing a small
increase in tests and csv seeing significant increases.

The csv grammar namespace also demonstrates dynamically defined grammars
as well as wrapping a grammar in post-processing functions.
  • Loading branch information...
1 parent 984fe40 commit ee603053248dbb32917e6aeca3c18012e8298100 @richard-lyman committed Jul 20, 2012
View
2 project.clj
@@ -1,4 +1,4 @@
-(defproject com.lithinos/amotoen "0.1.0-SNAPSHOT"
+(defproject com.lithinos/amotoen "0.2.0-SNAPSHOT"
:description "Amotoen is a Clojure library that supports PEG style definitions of grammars that can produce parsers."
:url "http://www.lithinos.com/amotoen"
:license {:name "EPL-v1.0" :distribution :repo :comments "same as Clojure" :url "http://www.eclipse.org/legal/epl-v10.html"}
View
360 src/com/lithinos/amotoen/core.clj
@@ -6,146 +6,113 @@
; the terms of this license.
; You must not remove this notice, or any other, from this software.
-(ns com.lithinos.amotoen.core)
+(ns com.lithinos.amotoen.core
+ (:use [clojure.set]))
; s - input string
; w - input wrapper
; g - given grammar
; r - result to return
-; n - next character in input
+; n - usually a rule or some part of a rule in a grammar
(declare pegasus)
-(def ^:dynamic *currentK* (ref nil))
-
-(defprotocol IPosition
- (psdebug [t] "Some form of helpful debug info")
- (in [t] "Indent - for debugging")
- (de [t] "Dedent - for debugging")
- (clone [t] "")
- (gp [t] "Get pos") ; E.V.I.L. ... maybe
- (sp [t j] "Set pos") ; E.V.I.L. ... maybe
+(defprotocol IAmotoen
+ "Currently oriented around strings and characters, but could easily be adapted for other approaches."
+ (gp [t] "Get pos")
+ (sp [t j] "Set pos")
(end [t] "End of input")
- (m [t] "Returns the 'c' then (inc pos)")
- (c [t] "The character at pos"))
+ (c [t] "The character at pos")
+ (m [t] "Returns the 'c' then (inc pos)"))
-(defn gen-ps ; 'ps' is for a 'p'eggable 's'tring
- ([#^String s] (gen-ps s 0))
+(defn wrap-string
+ "Reifies IAmotoen around a string 's', possibly at a given starting point 'j'.
+ The function 'charAt' is the mechanism to walk through the string."
+ ([#^String s] (wrap-string s 0))
([#^String s j] ; 'j' is where we currently are in the input... 'i' was skipped since it was too close to 'i'nput
- (let [j (ref j)
- indent (ref 0)]
- (reify IPosition
- (psdebug [t]
- (let [indent-string (apply str (take @indent (repeat " ")))
- padding (apply str (take 60 (repeat " ")))
- before_j (str "'" (pr-str (try
- (subs s
- (max 0 (- @j 30))
- (max 0 @j))
- (catch Exception e ""))) "'")
- at_j (str " " (pr-str (c t)) " ")
- after_j (str "'" (pr-str (try
- (subs s
- (inc @j)
- (min (+ @j 30) (count s)))
- (catch Exception e ""))) "'")]
- (str (subs
- (str (if (< @j 0)
- (str "<-" (subs s 0 20))
- (str before_j at_j after_j))
- padding)
- 0
- 60)
- indent-string)))
- (in [t] #_(dosync (alter indent inc)))
- (de [t] #_(dosync (alter indent dec)))
- (gp [t] @j)
- (sp [t k] (dosync (ref-set j k)))
- (clone [t] (gen-ps s @j))
- (end [t] (= @j (count s)))
- (m [t] (let [r (c t)] (dosync (alter j inc)) r))
- (c [t] (try (.charAt s @j) (catch Exception e nil)))))))
-
-(defn lpegs [t s] (reverse (into '() (cons t (seq s))))) ; This doesn't need to be fast, but shouldn't the following work? (list (cons t (seq s)))
-(defn pegs [s] (vec (seq s)))
-
-(def ^:dynamic *debug* (ref false))
-(defn- debug [w & args]
- (when @*debug*
- (print (psdebug w))
- (print @*currentK* " ")
- (apply println args)
- (flush)))
-
-(def #^{:private true} grammar-grammar {
+ (let [j (ref j)]
+ (reify IAmotoen
+ (gp [t] @j)
+ (sp [t k] (dosync (ref-set j k)))
+ (end [t] (= @j (count s)))
+ (c [t] (try (.charAt s @j) (catch Exception e nil)))
+ (m [t] (let [r (c t)]
+ (when (nil? r) (throw (Exception. "Consuming nil")))
+ (dosync (alter j inc))
+ r))))))
+
+(defn lpegs
+ "Produces a rule that allows any character in the string 's' as a valid match."
+ [t s] (reverse (into '() (cons t (seq s)))))
+
+(defn pegs
+ "Produces a rule that consumes each character in the string 's'."
+ [s] (vec (seq s)))
+
+(def #^{:private true :doc "Starts at :Grammar."} grammar-grammar {
:_* '(* :Whitespace)
:_ [:Whitespace '(* :Whitespace)]
:Grammar [\{ :_* :Rule '(* [:_ :Rule]) :_* \}]
:Rule [:Keyword :_ :Body]
- :Keyword [\: :AmotoenSymbol]
- :Body '(| :Keyword :Char :Grouping :AnyNot :AwareFunction :Function)
+ :Keyword [\: '(| :AmotoenSymbol :ProvidedSymbol)]
+ :ProvidedSymbol '(| :EndOfInput :AcceptAnything)
+ :EndOfInput \$ ; If the Keyword ':$' is encountered, the wrapped input should be at the end
+ :AcceptAnything \. ; If the Keyword ':.' is encountered, any character is accepted
+ :Body '(| :Keyword :Char :Grouping :NotPredicate :AnyNot :AwareFunction :Function)
:Grouping '(| :Sequence :Either :ZeroOrMore)
- :Sequence [\[ :_* :Body '(* [:_* :Body]) :_* \]]
- :Either [\( \| :_ :Body '(* [:_* :Body]) :_* \)]
- :ZeroOrMore [\( \* :_ :Body :_* \)]
- :AnyNot [\( \% :_ :Body :_* \)]
- :AwareFunction [\( \a :_ :Symbol :_ :Body :_* \)]
- :Function [\( \f :_ :Symbol :_ :Body :_* \)]
- :Whitespace '(| \space \newline \tab \,)
- :Char [\\ (list '| (pegs "tab") (pegs "space") (pegs "newline") '(% \space))]
- :Symbol '(| \/ :AmotoenSymbol)
+ :Sequence [\[ :_* :Body '(* [:_* :Body]) :_* \]]
+ :Either [\( \| :_ :Body '(* [:_* :Body]) :_* \)]
+ :NotPredicate [\( \! :_ :Body :_* \)]
+ :ZeroOrMore [\( \* :_ :Body :_* \)]
+ :AnyNot [\( \% :_ :Body :_* \)]
+ :AwareFunction [\( \a :_ :CljReaderFn :_* \)]
+ :Function [\( \f :_ :CljReaderFn :_ :Body :_* \)]
+ :CljReaderFn [\# \< '(% \>) '(* (% \>)) \>]
+ :Whitespace '(| \space \newline \return \tab \,)
+ :Char [\\ (list '| (pegs "tab") (pegs "space") (pegs "newline") (pegs "return") '(% \space))]
:AmotoenSymbol [:NonNumericCharacter '(* :AlphanumericCharactersPlus)] ; _Not_ the same as a Clojure Symbol
:NonNumericCharacter (list '% (lpegs '| "0123456789"))
:AlphanumericCharactersPlus (lpegs '| "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789:/*+!-_?.")
})
-(defn- either [n g w]
- #_(let [original (gp w)]
- (loop [remaining (rest n)]
- (if (nil? (seq remaining))
- nil
- (do
- (sp w original)
- (let [result (pegasus (first remaining) g w)]
- (if (nil? result)
- (recur (rest remaining))
- result))))))
- (let [original (gp w)] ; Why is this still the fastest?
+(defn- either
+ "Returns the result of the first element in 'n' to successfully process something from 'w'."
+ [n g w]
+ (let [original (gp w)]
(first
(keep
#(do
(sp w original)
(pegasus % g w))
- (rest n))))
- #_(let [original (gp w)]
- #_(println "Processing either:" (first n) (rest n))
- (first
- (filter #(do #_(println "checking for nil:" %) (not (nil? %)))
- (doall
- (pmap
- #(do #_(println "Running with:" %) (pegasus % g (clone w)))
- (rest n))))))
-)
-
-(defn- any-not [b g w]
- (let [c (c w) p (gp w)]
- (if (pegasus b g w)
- (do (sp w p) nil) ; If we succeed, then we fail - that's the point of AnyNot... and rollback
- (do
- #_(debug w "AnyNot MATCH:" (pr-str b) c)
- (m w)
- c)))); If we fail, then we accept the current char
+ (rest n)))))
+
+(defn- any-not
+ "See comments in code. Success if failure, failure if success."
+ [b g w]
+ (let [p (gp w)]
+ (if (or (pegasus b g w) (end w))
+ (do (sp w p) nil) ; If we succeed (or are at the end), then we fail - that's the point of AnyNot... and rollback
+ (m w)))) ; If we fail and aren't at the end, then we accept the current char
+
+(defn debug
+ "Very very inefficient and useful in some cases.
+ Prints out 'i' number of characters from 'w' followed by 'n',
+ and then resets the position in 'w' as if nothing had been consumed."
+ [n w i]
+ (let [p (gp w)]
+ (println ">> " (pr-str (apply str (doall (take i (repeatedly #(try (m w) (catch Exception e ""))))))) ":" n)
+ (sp w p)))
(defn- try-char [n w]
+ ;(debug n w 25)
(if (= n (c w))
- ;(do
- #_(debug w (str "MATCH: '" (pr-str n) "' with '" (pr-str (c w)) "'"))
- (m w);)
- ;(do
- #_(debug w (str "FAIL: '" (pr-str n) "' with '" (pr-str (c w)) "'"))
- nil));)
-
-(defn- peg-vec [n g w]
+ (m w)
+ nil))
+
+(defn- peg-vec
+ "Returns the result of calling pegasus on each element in 'n'.
+ If any call fails then nil is returned as the single result of all calls."
+ [n g w]
(let [p (gp w)]
(loop [remaining n
result []]
@@ -159,71 +126,124 @@
(sp w p)
nil)))))))
-(defn- typed-list [n g w]
+(defn- zero-or-more
+ "Continues to collect the result of calling (pegasus b g w) until that call returns nil.
+ Returns the collected results. If nothing was consumed from 'w', then nil is returned."
+ [b g w]
+ (let [lastp (ref (gp w))]
+ (doall
+ (take-while
+ #(if (= (gp w) @lastp)
+ nil
+ (if (keyword? b) (b %) %))
+ (repeatedly #(do (dosync (ref-set lastp (gp w)))
+ (pegasus b g w)))))))
+
+(defn- not-predicate
+ "Returns true if (pegasus b g w) doesn't succeed, nil otherwise."
+ [b g w]
+ (let [p (gp w)
+ r (nil? (pegasus b g w))]
+ (if (or r (end w))
+ (do (sp w p) true)
+ nil)))
+
+(defn- list-of-one-element
+ "Check to find lists containing only a single element.
+ Significantly faster than 'count'."
+ [r]
+ (and
+ (seq? r)
+ (nil? (seq (rest r)))
+ (not (nil? (first r)))))
+
+(defn- typed-list
+ "Similar in purpose and result as pegasus, with the expectation that n is a 'Typed-List' in the grammar."
+ [n g w]
(let [t (first n)
b (second n)
- result (cond (= t '|) (let [temp (either n g w)]
- #_(debug w "Either returning:" (pr-str temp))
- temp)
+ result (cond (= t '|) (either n g w)
(= t '%) (any-not b g w)
- (= t '*) (doall (take-while #(if (keyword? b)
- (b %)
- %)
- (repeatedly #(pegasus b g w))))
- (= t 'a) (b g w (pegasus (first (rest (rest n))) g w))
- (= t 'f) (b (pegasus (first (rest (rest n))) g w)))]
- (if (and
- (seq? result)
- (nil? (seq (rest result)))
- (not (nil? (first result)))
- )
+ (= t '*) (zero-or-more b g w)
+ (= t '!) (not-predicate b g w)
+ (= t 'a) (b g w)
+ (= t 'f) (b (pegasus (first (rest (rest n))) g w)))]
+ (if (list-of-one-element result)
(first result)
result)))
-(defn- p [w s n] #_(debug w s (pr-str n)))
-(defn- fp [w s n]
- (dosync (ref-set *debug* true))
- (p w "c:" n)
- (dosync (ref-set *debug* false)))
-
-; If the rule and current position pair have already been seen...
-(defn pegasus [n g w]
- (in w)
- #_(when (keyword? n) (dosync (ref-set *currentK* n)))
- (let [result (cond
- (keyword? n)(do (p w "k:" n)
- (when (nil? (n g)) (throw (Error. (str "Keyword '" n "' does not exist in grammar"))))
- (let [temp (pegasus (n g) g w)]
- (if temp
- {n temp}
- nil)))
- (vector? n) (do #_(p w "v:" n) (peg-vec n g w))
- (list? n) (do #_(p w "l:" n) (typed-list n g w))
- (char? n) (do #_(p w "c:" n) (try-char n w))
- true (throw (Error. (str "Unknown type: " n))))]
- #_(when (keyword? n) (dosync (ref-set *currentK* n)))
- (de w)
- result))
+(defn- peg-keyword
+ "Similar in purpose and result as pegasus, with the expectation that n is a Keyword in the grammar."
+ [n g w]
+ (cond
+ (= n :$) (if (end w) :$ (throw (Error. "Declaration of end without end")))
+ (= n :.) (if (not (end w)) (m w) (throw (Error. "Attempt to consume any character at end")))
+ true (do
+ (when (nil? (n g)) (throw (Error. (str "Keyword '" n "' does not exist in grammar"))))
+ (let [temp (pegasus (n g) g w)]
+ (if temp
+ {n temp}
+ nil)))))
+
+(defn pegasus
+ "Returns the AST resulting from parsing the wrapped input 'w'
+ given a grammar definition 'g' and starting at rule 'n' in 'g'."
+ [n g w]
+ ;(when (keyword? n) (debug n w 25))
+ (cond
+ (keyword? n)(peg-keyword n g w)
+ (vector? n) (peg-vec n g w)
+ (list? n) (typed-list n g w)
+ (char? n) (try-char n w)
+ true (throw (Error. (str "Unknown type: " n)))))
+
+(defn with-fns
+ "Simplifies attaching 'post-processing' functions to Non-Terminals in the grammar.
+ Keys in 'fn-map' should match keys in the grammar 'g'.
+ Values in 'fn-map' should be functions accepting the result of having
+ parsed some input according to the related value in 'g'."
+ ([g fn-map] (with-fns g fn-map 'f))
+ ([g fn-map fn-type]
+ (merge-with (fn [from-g from-fn-map]
+ (list fn-type from-fn-map from-g))
+ g
+ fn-map)))
+
+(defn post-process
+ "Similar to with-fns. Other parameters match pegasus.
+ The final result is assumed to be the value of the root map that pegasus would have returned."
+ [n g w fn-map]
+ (n (pegasus n (with-fns g fn-map) w)))
(defn validate
- ([g] (validate g false))
- ([g d]
- (dosync (ref-set *debug* d))
- (let [w (gen-ps (pr-str g))
- temp (pegasus :Grammar grammar-grammar w)
- r (or (nil? temp)
- (not (end w)))]
- (dosync (ref-set *debug* false))
- [r, temp])))
-
-(defn self-check [] (validate grammar-grammar))
-(defn self-ast []
- (dosync (ref-set *debug* false))
- (let [r (pr-str (pegasus
- :Grammar
- grammar-grammar
- (gen-ps (pr-str grammar-grammar))))]
- (dosync (ref-set *debug* false))
- r)
- )
+ "Validate can help identify problems in grammars.
+ Using grammar-grammar as the grammar for valid grammars,
+ it will return nil if the given grammar 'g' is not valid."
+ [g]
+ (let [w (wrap-string (pr-str g))
+ ast (pegasus :Grammar grammar-grammar w)
+ r (and (not (nil? ast))
+ (end w))]
+ [r, ast]))
+
+(defn fastest-theoretical
+ "Finding a lower-bound on any optimizations for speed starts
+ by simply reading each character in the string to be parsed 'b'.
+ The function 'end' is the conditional with 'm' consuming."
+ [s]
+ (let [w (wrap-string s)]
+ (loop [continue (not (end w))]
+ (when continue
+ (m w)
+ (recur (not (end w)))))))
+
+(defn self-check-fastest
+ "This returns the fastest time to read each character of grammar-grammar"
+ [] (fastest-theoretical (pr-str grammar-grammar)))
+
+(defn self-check
+ "This ensures that grammar-grammar is a valid grammar.
+ It attempts to parse itself. While not every part of valid
+ grammars is used in grammar-grammar, it's a nice sanity check."
+ [] (validate grammar-grammar))
View
85 src/com/lithinos/amotoen/grammars/csv.clj
@@ -6,35 +6,70 @@
; the terms of this license.
; You must not remove this notice, or any other, from this software.
-(ns com.lithinos.amotoen.grammars.csv)
+(ns com.lithinos.amotoen.grammars.csv
+ (:use [clojure.pprint])
+ (:use [com.lithinos.amotoen.core]))
(def grammar {
- :Start :Document
- :_* #"^[ \t]*"
- :Document ['(+ :Line) :$]
- :Line [:_* :Value '(* :_* "," :_* :Value) :_*]
- :Value '(| ["\"" :DoubleQuotedValue "\""]
- ["'" :SingleQuotedValue "'"]
- :VanillaValue)
- :DoubleQuotedValue '(* [(! "\"") (| :DEscapedChar :AnyChar)])
- :SingleQuotedValue '(* [(! "'") (| :SEscapedChar :AnyChar)])
- :VanillaValue '(* [(! ",") (| :VEscapedChar :AnyChar)])
- :DEscapedChar ["\\" '(| "\\" "\"")]
- :SEscapedChar ["\\" '(| "\\" "\'")]
- :VEscapedChar ["\\" '(| "\\" "\,")]
- :AnyChar #"^."
+ :Document [:Line '(* :Line) :$]
+ :Line [:_* :Value '(* [:_* \, :_* :Value]) :_* '(* :EndOfLine)]
+ :Value '(| [\" (* :DoubleQuotedValue) \"]
+ [\' (* :SingleQuotedValue) \']
+ (* :VanillaValue))
+ :DoubleQuotedValue '(| [\\ \"] [\\ \\] (% \"))
+ :SingleQuotedValue '(| [\\ \'] [\\ \\] (% \'))
+ :VanillaValue ['(! :EndOfLine) '(% \,)]
+ :_* '(* :Whitespace)
+ :Whitespace '(| \space \tab)
+ :EndOfLine '(| \newline \return)
})
(defn specified
- ([] (specified "," "\"" "\""))
- ([separator] (specified separator "\"" "\""))
+ ([] (specified \,\ \" \"))
+ ([separator] (specified separator \" \"))
([separator, wrapper] (specified separator wrapper wrapper))
([separator, left-wrapper, right-wrapper] {
- :Start :Document
- :_* #"^[ \t]*"
- :Document ['(+ :Line) :$]
- :Line [:_* :Value '(* :_* separator :_* :Value) :_*]
- :Value [left-wrapper :WrappedValue right-wrapper]
- :WrappedValue '(* [(! right-wrapper) (| :EscapedChar :AnyChar)])
- :EscapedChar ["\\" '(| "\\" right-wrapper)]
- :AnyChar #"^."}))
+ :Document [:Line '(* :Line) :$]
+ :Line [:_* :Value (list '* [:_* separator :_* :Value]) :_* '(* :EndOfLine)]
+ :Value (list '| [left-wrapper '(* :WrappedValue) right-wrapper]
+ '(* :VanillaValue))
+ :WrappedValue (list '| [\\ right-wrapper] [\\ \\] (list '% right-wrapper))
+ :VanillaValue ['(! :EndOfLine) (list '% separator)]
+ :_* '(* :Whitespace)
+ :Whitespace '(| \space \tab)
+ :EndOfLine '(| \newline \return)
+}))
+
+(defn ignore [_] "")
+(defn value-as-string [l]
+ (let [l (if (vector? l) (second l) l)]
+ (cond
+ (map? l) (str (first (vals l)))
+ true (apply str
+ (map #(first (vals %))
+ l)))))
+(defn without-guard [v]
+ (second v))
+(defn line-as-vec [v]
+ (let [others (map last (first (rest (rest v))))]
+ (reduce (fn [r i] (conj r (first (vals i))))
+ []
+ (conj others (second v)))))
+(defn lines-as-vec [v]
+ (let [v (vec (flatten v))]
+ (reduce (fn [r i] (if (empty? i) r (conj r (first (vals i)))))
+ []
+ (butlast v))))
+
+(def #^{:private true} to-clj-fns { :Document lines-as-vec
+ :Line line-as-vec
+ :Value value-as-string
+ :VanillaValue without-guard
+ :_* ignore
+ ;:EndOfLine (fn [_] nil)
+ :Whitespace ignore })
+
+(defn to-clj
+ ([s] (to-clj s grammar))
+ ([s g] (post-process :Document g (wrap-string s) to-clj-fns)))
+
View
62 src/com/lithinos/amotoen/grammars/json.clj
@@ -6,42 +6,50 @@
; the terms of this license.
; You must not remove this notice, or any other, from this software.
-(ns com.lithinos.amotoen.grammars.json)
+(ns com.lithinos.amotoen.grammars.json
+ (:use [com.lithinos.amotoen.core]))
+
+(defn json-control-character [g w]
+ (let [s #{ \u0000 \u0001 \u0002 \u0003 \u0004 \u0005 \u0006 \u0007 \u0008 \u0009 \u000A \u000B \u000C \u000D \u000E \u000F
+ \u0010 \u0011 \u0012 \u0013 \u0014 \u0015 \u0016 \u0017 \u0018 \u0019 \u001A \u001B \u001C \u001D \u001E \u001F}]
+ (if (contains? s (c w))
+ (m w)
+ nil)))
(def grammar {
- :Start :JSONRoot
- :_* #"^[\n\r\t ]*"
- :JSONRoot [ :_* '(* :Value) :_* :$]
- :Value '(| :JSONString :JSONNumber :JSONObject :Array "true" "false" "null")
+ :_* '(* (| \newline \return \tab \space))
+ :JSONText [:_* '(| :JSONObject :Array) :_* :$]
+ :Value (list '| :JSONString :JSONObject :Array (pegs "true") (pegs "false") (pegs "null") :JSONNumber)
; Objects
:JSONObject '(| :EmptyObject :ContainingObject)
- :EmptyObject ["{" :_* "}"]
- :ContainingObject ["{" :_* :Members :_* "}"]
- :Members '(| [:Pair :_* "," :_* :Members] :Pair)
- :Pair [:JSONString :_* ":" :_* :Value]
+ :EmptyObject [\{ :_* \}]
+ :ContainingObject [\{ :_* :Members :_* \}]
+ :Members '(| [:Pair :_* \, :_* :Members] :Pair) ; Nests the structure significantly
+ :Pair [:JSONString :_* \: :_* :Value]
; Arrays
:Array '(| :EmptyArray :ContainingArray)
- :EmptyArray ["[" :_* "]"]
- :ContainingArray ["[" :_* :Elements :_* "]"]
- :Elements '(| [:Value :_* "," :_* :Elements] :Value)
+ :EmptyArray [\[ :_* \]]
+ :ContainingArray [\[ :_* :Elements :_* \]]
+ :Elements '(| [:Value :_* \, :_* :Elements] :Value) ; Nests the structure significantly
; Strings
:JSONString '(| :EmptyString :ContainingString)
- :EmptyString ["\"" "\""]
- :ContainingString ["\"" :Chars "\""]
- :Chars '(+ [(! :ControlCharacter) :Char])
- :ControlCharacter #"^[\u0000-\u001F]"
- :Char '(| :EscapedChar [(! "\"") :NonEscapedChar])
- :EscapedChar ["\\" '(| "\"" "\\" "/" "b" "f" "n" "r" "t" :Unicode)]
- :Unicode ["u" :HexDigit :HexDigit :HexDigit :HexDigit]
- :HexDigit #"^[0-9A-Fa-f]"
- :NonEscapedChar #"^." ; This is OK since the only way it's used is with appropriate guards.
+ :EmptyString [\" \"]
+ :ContainingString [\" :Chars \"]
+ :Chars [:GuardedChar '(* :GuardedChar)]
+ :GuardedChar ['(! :ControlCharacter) :Char]
+ :ControlCharacter (list 'a json-control-character)
+ :Char '(| :EscapedChar [(! \") :NonEscapedChar])
+ :EscapedChar [\\ '(| \" \\ \/ \b \f \n \r \t :Unicode)]
+ :Unicode [\u :HexDigit :HexDigit :HexDigit :HexDigit]
+ :HexDigit (lpegs '| "0123456789ABCDEFabcdef")
+ :NonEscapedChar :. ; This is OK since the only way it's used is with appropriate guards.
; Numbers
:JSONNumber '(| [:Int :Frac :Exp] [:Int :Exp] [:Int :Frac] :Int)
- :Int '(| ["-" :Digit1-9 :Digits] ["-" :Digit] [:Digit1-9 :Digits] :Digit)
- :Frac ["." :Digits]
+ :Int '(| [\- :Digit1-9 :Digits] [\- :Digit] [:Digit1-9 :Digits] :Digit)
+ :Frac [\. :Digits]
:Exp [:ExpLeader :Digits]
- :Digit #"^[0-9]"
- :Digit1-9 #"^[1-9]"
- :Digits #"^[0-9]+"
- :ExpLeader [#"^[eE]" #"^[+-]*"]
+ :Digit (lpegs '| "0123456789")
+ :Digit1-9 (lpegs '| "123456789")
+ :Digits [:Digit '(* :Digits)]
+ :ExpLeader ['(| \e \E) '(* (| \+ \-))]
})
View
2 src/com/lithinos/amotoen/grammars/markdown.clj
@@ -6,7 +6,7 @@
; the terms of this license.
; You must not remove this notice, or any other, from this software.
-(ns com.lithinos.amotoen.markdown)
+(ns com.lithinos.amotoen.grammars.markdown)
(def grammar {
:Start {:Document #(let [ast (first (:Document %))]
View
83 src/com/lithinos/amotoen/grammars/minimark.clj
@@ -6,53 +6,60 @@
; the terms of this license.
; You must not remove this notice, or any other, from this software.
-(ns com.lithinos.amotoen.minimark)
+(ns com.lithinos.amotoen.grammars.minimark
+ (:use [com.lithinos.amotoen.core]))
+
+(defn delimited
+ ([m] (delimited m m))
+ ([s e] [s [(list '% e) (list '* (list '% e))] e]))
(def grammar {
-; Start
- :Start :Content
+;Bulk
+ :Content [:Element '(* :Element) :$]
+ :Element '(| :_+ :Alphanumeric :Markup :.)
+ :Markup '(| :HRule :MDash :List :SS :U :H4 :H3 :H2 :H1 :B :I :Href :Pre)
+ :Markup-Guard (list '! (list '| :HRule :MDash :Unordered-List-Marker :Ordered-List-Marker
+ \^ (pegs "__") (pegs "====") (pegs "===") (pegs "==") \= (pegs "'''") (pegs "''") \[ (pegs "{{{")))
+ :Non-Markup [:Markup-Guard :Any-Char]
+ :NM+ [:Non-Markup '(* :Non-Markup)]
; Whitespace
- :N "\n"
- :_ " "
- :_* #"^\s*"
+ :N \newline
+ :_ \space
+ :_* '(* :_)
+ :_+ [:_ '(* :_)]
; Odds-n-Ends
- :Any-Char '(| :Empty-Line :Escaped-Char #"(?s)^.")
+ :Any-Char '(| :Empty-Line :Escaped-Char :.)
:Empty-Line [:N :N]
- :Escaped-Char ["!" #"^[A-Z!\[=]"]
- :Alphanumeric #"^[A-Za-z0-9]" ; No markup ever starts with an alphanumeric character
-;Bulk
- :Content ['(+ (| #"^\s+" :Alphanumeric :Markup #"^.")) :$]
- :Markup '(| :HRule :MDash :List :SS :U :H4 :H3 :H2 :H1 :B :I :Href :Pre)
- :Markup-Guard '(! (| :HRule :MDash :List-Marker "^" "__" "====" "===" "==" "=" "'''" "''" "[" "{{{"))
- :Non-Markup [:Markup-Guard '(| :Any-Char)]
- :NM+ '(+ :Non-Markup)
+ :Escaped-Char [\! (pegs "ABCDEFGHIJKLMNOPQRSTUVWXYZ!\\[=]")]
+ :Alphanumeric (pegs "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") ; No markup ever starts with an alphanumeric character
;Links
:Href '(| :Href-Straight :Href-Explained)
- :Href-Straight ["[" :Href-Body "]"]
- :Href-Explained ["[" :Href-Text :_ :Href-Body "]"]
- :Href-Body #"^[^] ]+"
- :Href-Text #"^[^ ]+"
+ :Href-Straight [\[ :Href-Body \]]
+ :Href-Explained [\[ :Href-Text :_ :Href-Body \]]
+ :Href-Body [:Href-Body-Part '(* :Href-Body-Part)]
+ :Href-Body-Part '(% (| \] \space))
+ :Href-Text ['(% \space) '(* (% \space))]
;Lists
- :List-Marker '(| "-- " "-. ")
+ :Unordered-List-Marker (pegs "-- ")
+ :Ordered-List-Marker (pegs "-. ")
:List '(| :Ordered-List :Unordered-List)
- :Ordered-List '(+ [:_* "-. " :List-Body])
- :Unordered-List '(+ [:_* "-- " :List-Body])
- :List-Body '(+ :List-Chunk)
- :List-Chunk '(| :SS :U :B :I :Href :Pre #"^.")
+ :Ordered-List [:_* :Ordered-List-Marker :List-Body '(* [:_* :Ordered-List-Marker :List-Body])]
+ :Unordered-List [:_* :Unordered-List-Marker :List-Body '(* [:_* :Unordered-List-Marker :List-Body])]
+ :List-Body [:List-Chunk '(* :List-Chunk)]
+ :List-Chunk '(| :SS :U :B :I :Href :Pre :.)
;Superscript
- :SS ["^" :SS-Body "^"]
- :SS-Body '(+ [(! "^") :SS-Chunk])
- :SS-Chunk '(| :U :B :I :Href #"^.")
+ :SS [\^ :SS-Body \^]
+ :SS-Body ['(! \^) :SS-Chunk '(* [(! \^) :SS-Chunk])]
+ :SS-Chunk '(| :U :B :I :Href :.)
;Pre
- :Pre ["{{{" :Pre-Markup-Body "}}}"]
- :Pre-Markup-Body '(+ [(! "}}}") :Any-Char])
+ :Pre (delimited (pegs "{{{") (pegs "}}}"))
;Remaining
- :H1 ["=" #"^[^=]+" "="]
- :H2 ["==" '(+ [(! "==") #"^."]) "=="]
- :H3 ["===" '(+ [(! "===") #"^."]) "==="]
- :H4 ["====" '(+ [(! "====") #"^."]) "===="]
- :B ["'''" '(+ [(! "'''") #"^."]) "'''"]
- :I ["''" '(+ [(! "''") #"^."]) "''"]
- :U ["__" '(+ [(! "__") #"^."]) "__"]
- :HRule "----"
- :MDash "---"})
+ :H1 (delimited \=)
+ :H2 (delimited (pegs "=="))
+ :H3 (delimited (pegs "==="))
+ :H4 (delimited (pegs "===="))
+ :B (delimited (pegs "'''"))
+ :I (delimited (pegs "''"))
+ :U (delimited (pegs "__"))
+ :HRule (pegs "----")
+ :MDash (pegs "---")})
View
22 test/JSONTests/1.in
@@ -0,0 +1,22 @@
+{
+ "glossary": {
+ "title": "example glossary",
+ "GlossDiv": {
+ "title": "S",
+ "GlossList": {
+ "GlossEntry": {
+ "ID": "SGML",
+ "SortAs": "SGML",
+ "GlossTerm": "Standard Generalized Markup Language",
+ "Acronym": "SGML",
+ "Abbrev": "ISO 8879:1986",
+ "GlossDef": {
+ "para": "A meta-markup language, used to create markup languages such as DocBook.",
+ "GlossSeeAlso": ["GML", "XML"]
+ },
+ "GlossSee": "markup"
+ }
+ }
+ }
+ }
+}
View
1 test/JSONTests/1.out
@@ -0,0 +1 @@
+{:JSONText [{:_* ()} {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \x}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \tab \tab)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \D}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \v}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} ()]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \tab \tab \tab)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \L}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \E}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \I}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \D}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \M}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \L}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \tab \tab \tab \tab \tab)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \M}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \L}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \tab \tab \tab \tab \tab)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \T}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \z}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \M}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \k}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \L}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \tab \tab \tab \tab \tab)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \M}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \L}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \tab \tab \tab \tab \tab)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \v}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \I}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \8}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \8}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \7}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \9}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \:}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \1}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \9}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \8}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \6}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \tab \tab \tab \tab \tab)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \D}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \-}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \k}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \,}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \k}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \h}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \D}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \B}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \k}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \.}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \tab \tab \tab \tab \tab \tab)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:Array {:ContainingArray [\[ {:_* ()} {:Elements [{:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \M}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \L}]}]})]} \"]}}} {:_* ()} \, {:_* \space} {:Elements {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \X}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \M}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \L}]}]})]} \"]}}}}]} {:_* ()} \]]}}}]}}]} {:_* (\return \newline \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space)} \}]}}}]} {:_* ()} \, {:_* (\return \newline \tab \tab \tab \tab \tab)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \k}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]})]} \"]}}}]}}]}]}]}]}]}]} {:_* (\return \newline \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space \space)} \}]}}}]}} {:_* (\return \newline \space \space \space \space \space \space \space \space \space \space \space \space)} \}]}}}]}}]} {:_* (\return \newline \space \space \space \space \space \space \space \space)} \}]}}}]}}]} {:_* (\return \newline \space \space \space \space)} \}]}}}]}} {:_* (\return \newline)} \}]}} {:_* (\return \newline)} :$]}
View
11 test/JSONTests/2.in
@@ -0,0 +1,11 @@
+{"menu": {
+ "id": "file",
+ "value": "File",
+ "popup": {
+ "menuitem": [
+ {"value": "New", "onclick": "CreateNewDoc()"},
+ {"value": "Open", "onclick": "OpenDoc()"},
+ {"value": "Close", "onclick": "CloseDoc()"}
+ ]
+ }
+}}
View
1 test/JSONTests/2.out
@@ -0,0 +1 @@
+{:JSONText [{:_* ()} {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \v}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \F}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:Array {:ContainingArray [\[ {:_* (\return \newline \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \v}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \N}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \k}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \C}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \N}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \D}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \(}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \)}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \v}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \k}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \D}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \(}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \)}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space)} {:Elements {:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \v}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \C}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \k}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \C}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \D}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \(}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \)}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}}}]}]} {:_* (\return \newline \space \space \space \space)} \]]}}}]}} {:_* (\return \newline \space \space)} \}]}}}]}}]}]} {:_* (\return \newline)} \}]}}}]}} {:_* ()} \}]}} {:_* (\return \newline)} :$]}
View
25 test/JSONTests/3.in
@@ -0,0 +1,25 @@
+{"widget": {
+ "debug": "on",
+ "window": {
+ "title": "Sample Konfabulator Widget",
+ "name": "main_window",
+ "width": 500,
+ "height": 500
+ },
+ "image": {
+ "src": "Images/Sun.png",
+ "name": "sun1",
+ "hOffset": 250,
+ "vOffset": 250,
+ "alignment": "center"
+ },
+ "text": {
+ "data": "Click Here",
+ "size": 36,
+ "style": "bold",
+ "name": "text1",
+ "hOffset": 250,
+ "vOffset": 100,
+ "alignment": "center",
+ "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
+}}}
View
1 test/JSONTests/3.out
@@ -0,0 +1 @@
+{:JSONText [{:_* ()} {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]}]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \K}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \W}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \_}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \h}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONNumber {:Int [{:Digit1-9 \5} {:Digits [{:Digit \0} {:Digits [{:Digit \0} ()]}]}]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \h}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \h}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONNumber {:Int [{:Digit1-9 \5} {:Digits [{:Digit \0} {:Digits [{:Digit \0} ()]}]}]}}}]}}]}]}]} {:_* (\return \newline \space \space \space \space)} \}]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\space \return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \I}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \/}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \.}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \1}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \h}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONNumber {:Int [{:Digit1-9 \2} {:Digits [{:Digit \5} {:Digits [{:Digit \0} ()]}]}]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \v}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONNumber {:Int [{:Digit1-9 \2} {:Digits [{:Digit \5} {:Digits [{:Digit \0} ()]}]}]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]})]} \"]}}}]}}]}]}]}]} {:_* (\return \newline \space \space \space \space)} \}]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \x}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \C}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \k}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \H}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \z}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONNumber {:Int [{:Digit1-9 \3} {:Digits [{:Digit \6} ()]}]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \x}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \1}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \h}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONNumber {:Int [{:Digit1-9 \2} {:Digits [{:Digit \5} {:Digits [{:Digit \0} ()]}]}]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \v}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \f}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONNumber {:Int [{:Digit1-9 \1} {:Digits [{:Digit \0} {:Digits [{:Digit \0} ()]}]}]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \M}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \U}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \1}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \.}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \=}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \(}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \1}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \.}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \/}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \1}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \0}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \0}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \)}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \*}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \9}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \0}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \;}]}]})]} \"]}}}]}}]}]}]}]}]}]}]} {:_* (\return \newline)} \}]}}}]}}]}]}]} {:_* ()} \}]}}}]}} {:_* ()} \}]}} {:_* (\return \newline)} :$]}
View
88 test/JSONTests/4.in
@@ -0,0 +1,88 @@
+{"web-app": {
+ "servlet": [
+ {
+ "servlet-name": "cofaxCDS",
+ "servlet-class": "org.cofax.cds.CDSServlet",
+ "init-param": {
+ "configGlossary:installationAt": "Philadelphia, PA",
+ "configGlossary:adminEmail": "ksm@pobox.com",
+ "configGlossary:poweredBy": "Cofax",
+ "configGlossary:poweredByIcon": "/images/cofax.gif",
+ "configGlossary:staticPath": "/content/static",
+ "templateProcessorClass": "org.cofax.WysiwygTemplate",
+ "templateLoaderClass": "org.cofax.FilesTemplateLoader",
+ "templatePath": "templates",
+ "templateOverridePath": "",
+ "defaultListTemplate": "listTemplate.htm",
+ "defaultFileTemplate": "articleTemplate.htm",
+ "useJSP": false,
+ "jspListTemplate": "listTemplate.jsp",
+ "jspFileTemplate": "articleTemplate.jsp",
+ "cachePackageTagsTrack": 200,
+ "cachePackageTagsStore": 200,
+ "cachePackageTagsRefresh": 60,
+ "cacheTemplatesTrack": 100,
+ "cacheTemplatesStore": 50,
+ "cacheTemplatesRefresh": 15,
+ "cachePagesTrack": 200,
+ "cachePagesStore": 100,
+ "cachePagesRefresh": 10,
+ "cachePagesDirtyRead": 10,
+ "searchEngineListTemplate": "forSearchEnginesList.htm",
+ "searchEngineFileTemplate": "forSearchEngines.htm",
+ "searchEngineRobotsDb": "WEB-INF/robots.db",
+ "useDataStore": true,
+ "dataStoreClass": "org.cofax.SqlDataStore",
+ "redirectionClass": "org.cofax.SqlRedirection",
+ "dataStoreName": "cofax",
+ "dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver",
+ "dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon",
+ "dataStoreUser": "sa",
+ "dataStorePassword": "dataStoreTestQuery",
+ "dataStoreTestQuery": "SET NOCOUNT ON;select test='test';",
+ "dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log",
+ "dataStoreInitConns": 10,
+ "dataStoreMaxConns": 100,
+ "dataStoreConnUsageLimit": 100,
+ "dataStoreLogLevel": "debug",
+ "maxUrlLength": 500}},
+ {
+ "servlet-name": "cofaxEmail",
+ "servlet-class": "org.cofax.cds.EmailServlet",
+ "init-param": {
+ "mailHost": "mail1",
+ "mailHostOverride": "mail2"}},
+ {
+ "servlet-name": "cofaxAdmin",
+ "servlet-class": "org.cofax.cds.AdminServlet"},
+
+ {
+ "servlet-name": "fileServlet",
+ "servlet-class": "org.cofax.cds.FileServlet"},
+ {
+ "servlet-name": "cofaxTools",
+ "servlet-class": "org.cofax.cms.CofaxToolsServlet",
+ "init-param": {
+ "templatePath": "toolstemplates/",
+ "log": 1,
+ "logLocation": "/usr/local/tomcat/logs/CofaxTools.log",
+ "logMaxSize": "",
+ "dataLog": 1,
+ "dataLogLocation": "/usr/local/tomcat/logs/dataLog.log",
+ "dataLogMaxSize": "",
+ "removePageCache": "/content/admin/remove?cache=pages&id=",
+ "removeTemplateCache": "/content/admin/remove?cache=templates&id=",
+ "fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder",
+ "lookInContext": 1,
+ "adminGroupID": 4,
+ "betaServer": true}}],
+ "servlet-mapping": {
+ "cofaxCDS": "/",
+ "cofaxEmail": "/cofaxutil/aemail/*",
+ "cofaxAdmin": "/admin/*",
+ "fileServlet": "/static/*",
+ "cofaxTools": "/tools/*"},
+
+ "taglib": {
+ "taglib-uri": "cofax.tld",
+ "taglib-location": "/WEB-INF/tlds/cofax.tld"}}}
View
1 test/JSONTests/4.out
1 addition, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
27 test/JSONTests/5.in
@@ -0,0 +1,27 @@
+{"menu": {
+ "header": "SVG Viewer",
+ "items": [
+ {"id": "Open"},
+ {"id": "OpenNew", "label": "Open New"},
+ null,
+ {"id": "ZoomIn", "label": "Zoom In"},
+ {"id": "ZoomOut", "label": "Zoom Out"},
+ {"id": "OriginalView", "label": "Original View"},
+ null,
+ {"id": "Quality"},
+ {"id": "Pause"},
+ {"id": "Mute"},
+ null,
+ {"id": "Find", "label": "Find..."},
+ {"id": "FindAgain", "label": "Find Again"},
+ {"id": "Copy"},
+ {"id": "CopyAgain", "label": "Copy Again"},
+ {"id": "CopySVG", "label": "Copy SVG"},
+ {"id": "ViewSVG", "label": "View SVG"},
+ {"id": "ViewSource", "label": "View Source"},
+ {"id": "SaveAs", "label": "Save As"},
+ null,
+ {"id": "Help"},
+ {"id": "About", "label": "About Adobe CVG Viewer..."}
+ ]
+}}
View
1 test/JSONTests/5.out
@@ -0,0 +1 @@
+{:JSONText [{:_* ()} {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONObject {:ContainingObject [\{ {:_* (\return \newline \space \space \space \space)} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \h}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]})]} \"]}}}]} {:_* ()} \, {:_* (\return \newline \space \space \space \space)} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:Array {:ContainingArray [\[ {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]})]} \"]}}}]}} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \N}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \N}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value [\n \u \l \l]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \Z}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \I}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \Z}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \I}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \Z}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \Z}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \m}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \O}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value [\n \u \l \l]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \Q}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]})]} \"]}}}]}} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \P}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}}}]}} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \M}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}}}]}} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value [\n \u \l \l]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \F}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \F}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \.}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \.}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \.}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \F}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \F}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \C}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]})]} \"]}}}]}} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \C}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \C}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \g}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \n}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \C}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \C}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \y}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \c}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \v}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \S}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \v}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \s}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value [\n \u \l \l]} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements [{:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \H}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \p}]}]})]} \"]}}}]}} {:_* ()} \}]}}} {:_* ()} \, {:_* (\return \newline \space \space \space \space \space \space \space \space)} {:Elements {:Value {:JSONObject {:ContainingObject [\{ {:_* ()} {:Members [{:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]}]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]})]} \"]}}}]} {:_* ()} \, {:_* \space} {:Members {:Pair [{:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \a}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \l}]}]})]} \"]}} {:_* ()} \: {:_* \space} {:Value {:JSONString {:ContainingString [\" {:Chars [{:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} ({:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \u}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \t}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \A}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \d}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \o}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \b}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \C}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \G}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \space}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \V}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \i}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \w}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \e}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \r}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \.}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \.}]}]} {:GuardedChar [true {:Char [true {:NonEscapedChar \.}]}]})]} \"]}}}]}}]} {:_* ()} \}]}}}}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]}]} {:_* (\return \newline \space \space \space \space)} \]]}}}]}}]} {:_* (\return \newline)} \}]}}}]}} {:_* ()} \}]}} {:_* (\return \newline)} :$]}
View
136 test/com/lithinos/amotoen/test/core.clj
@@ -1,109 +1,85 @@
+; Copyright (c) Richard Lyman. All rights reserved.
+; The use and distribution terms for this software are covered by the
+; Eclipse Public License 1.0 (http://www.eclipse.org/legal/epl-v10.html)
+; which can be found in the file epl-v10.html at the root of this distribution.
+; By using this software in any fashion, you are agreeing to be bound by
+; the terms of this license.
+; You must not remove this notice, or any other, from this software.
+
(ns com.lithinos.amotoen.test.core
(:import (java.io File))
(:use [com.lithinos.amotoen.core] :reload-all)
(:use [clojure.test])
(:use [clojure.pprint])
- #_(:use [com.lithinos.amotoen.string-wrapper]
- [com.lithinos.amotoen [markdown :rename {grammar markdown-grammar}]])
- )
-
-#_(deftest standard-test-files
- (let [mdp (create-parser markdown-grammar)]
- (doseq [f (list (first (filter #(re-find #"\.text$" (.getName %)) (file-seq (File. "./test/MarkdownTests")))))]
- (println f)
- (let [correct (File. (.replaceAll (.getCanonicalPath f) ".text$" ".html"))
- result (markdown-to-html (mdp (wrap-string (slurp f))))]
- ;(is (= result (slurp correct)))
- ))
- ))
-
-#_(deftest single-regularchar
- (let [mdp (create-parser markdown-grammar)
- result (mdp (wrap-string "a"))]))
-
-#_(deftest newlines-and-blanklines
- (let [mdp (create-parser markdown-grammar)]
- (pprint (mdp (wrap-string "
-
-")))
- (pprint (mdp (wrap-string "a
-")))
- (pprint (mdp (wrap-string "a
-
-")))
- (pprint (mdp (wrap-string "a
-
-a")))
- (pprint (mdp (wrap-string "a
-
-a")))))
+ (:use [com.lithinos.amotoen.grammars
+ [csv :rename {grammar csv-grammar specified csv-specified}]
+ [json :rename {grammar json-grammar}]
+ [minimark :rename {grammar minimark-grammar}]
+ ]))
(defn test-grammars []
- (doseq [g [ {:S \a}
- {:S (pegs "}}}")}
- {:S (list '% (pegs "}}}"))}
- {:S (list '* (list '% (pegs "}}}")))}]]
- (when (not (first (validate g))) (throw (Error. (str "Invalid grammar: " (pr-str g)))))))
+ (let [cf #(apply str %)]
+ (doseq [g [ {:S \a}
+ {:S (pegs "}}}")}
+ {:S (list '% (pegs "}}}"))}
+ {:S (list '* (list '% (pegs "}}}")))}
+ {:S [(list '* (list '% (pegs "}}}"))) (pegs "}}}")]}
+ {:S [(list 'f cf (pegs "abcabc"))]}
+ {:S [(list 'f cf (list '* (lpegs '| "abc")))]}
+ {:S [(list 'f cf '(* (| :A :B :C)))] :A \a :B \b :C \c }
+ csv-grammar
+ json-grammar
+ minimark-grammar]]
+ (is (first (validate g))))))
(defn vectors-reset-pos []
(let [g {:S [(list '* (list '% (pegs "}}}"))) (pegs "}}}")]}
i "a}}b}}}"
- r (pegasus :S g (gen-ps i))]
- (when (not= '{:S [(\a \} \} \b) [\} \} \}]]} r) (throw (Error. "Failed Vectors are not resetting the pos.")))
- true))
+ r (pegasus :S g (wrap-string i))]
+ (is (= '{:S [(\a \} \} \b) [\} \} \}]]} r))))
(defn collapse-pegs []
(let [custom-collapse #(apply str %)
g {:S [(list 'f custom-collapse (pegs "abcabc"))]}
i "abcabc"
- r (pegasus :S g (gen-ps i))]
- (when (not= '{:S ["abcabc"]} r) (throw (Error. (str "pegs didn't collapse: " r))))
- true))
+ r (pegasus :S g (wrap-string i))]
+ (is (= '{:S ["abcabc"]} r))))
(defn collapse-lpegs []
(let [custom-collapse #(apply str %)
g {:S [(list 'f custom-collapse (list '* (lpegs '| "abc")))]}
i "aabbcc"
- r (pegasus :S g (gen-ps i))]
- (when (not= '{:S ["aabbcc"]} r) (throw (Error. (str "lpegs didn't collapse: " r))))
- true))
+ r (pegasus :S g (wrap-string i))]
+ (is (= '{:S ["aabbcc"]} r))))
(defn collapse-keywords []
(let [custom-collapse (fn [r] (apply str (map #(first (vals %)) r)))
g {:S [(list 'f custom-collapse '(* (| :A :B :C)))] :A \a :B \b :C \c }
i "aabbcc"
- r (pegasus :S g (gen-ps i))]
- (when (not= '{:S ["aabbcc"]} r) (throw (Error. (str "keywords didn't collapse: " r))))
- true))
-
-;(dosync (ref-set *debug* true))
-(println "Single run") (time (self-check))
-;(println "Single run" (self-check))
-;(println "Dump" (time (self-ast)))
-;(println "10 runs") (time (doall (take 10 (repeatedly #(self-check)))))
-(println "100 runs") (time (doall (take 100 (repeatedly #(self-check)))))
-(println "100 runs") (time (doall (take 100 (repeatedly #(self-check)))))
-(println "100 runs") (time (doall (take 100 (repeatedly #(self-check)))))
-(println "100 runs") (time (doall (take 100 (repeatedly #(self-check)))))
-
-;(println "start")
-;(let [i (ref 0) j (ref 0)]
-; (println (first (keep #(do (dosync (alter i inc)) (if (even? %) :a nil)) [1 1 1 1 2 1 1 1 2])))
-; (println (loop []
-; (dosync (alter j inc))
-; (when (< (rand-int 100) 90)
-; (recur))))
-; (println "end: " @i @j))
-
-
-;(test-grammars)
-;(vectors-reset-pos)
-;(collapse-lpegs)
-;(collapse-keywords)
-;(collapse-pegs)
-
-#_(try
- (pegasus :S {:A :B} (gen-ps "fail"))
+ r (pegasus :S g (wrap-string i))]
+ (is (= '{:S ["aabbcc"]} r))))
+
+(do
+ (println "Speed tests")
+ (let [fastest (with-out-str (time (self-check-fastest)))
+ single (with-out-str (time (self-check)))
+ avg50 (with-out-str (time (doall (take 50 (repeatedly #(self-check))))))
+ extract #(Double/parseDouble (nth (.split % " ") 2)) ]
+ (printf "%8.2f - Single Run\n" (extract single))
+ (printf "%8.2f - Average over 50 runs\n" (/ (extract avg50) 50))
+ (printf "%8.2f - Fastest theoretically possible\n" (extract fastest))
+ (println "\n (in milliseconds)\n")))
+
+(do
+ (println "Corner cases")
+ (test-grammars)
+ (vectors-reset-pos)
+ (collapse-lpegs)
+ (collapse-keywords)
+ (collapse-pegs))
+
+(try
+ (pegasus :S {:A :B} (wrap-string "fail"))
(throw (Error. "A useful error should be thrown when a keyword doesn't exist in a grammar"))
(catch Error e))
View
320 test/com/lithinos/amotoen/test/csv.clj
@@ -0,0 +1,320 @@
+; Copyright (c) Richard Lyman. All rights reserved.
+; The use and distribution terms for this software are covered by the
+; Eclipse Public License 1.0 (http://www.eclipse.org/legal/epl-v10.html)
+; which can be found in the file epl-v10.html at the root of this distribution.
+; By using this software in any fashion, you are agreeing to be bound by
+; the terms of this license.
+; You must not remove this notice, or any other, from this software.
+
+(ns com.lithinos.amotoen.test.csv
+ (:import (java.io File))
+ (:use [com.lithinos.amotoen.core] :reload-all)
+ (:use [clojure.test])
+ (:use [clojure.pprint])
+ (:use [com.lithinos.amotoen.grammars.csv]))
+
+(deftest one-drawback-of-vanilla-chars (is (= (to-clj " a , b , c ") [["a " "b " "c "]])))
+
+(deftest plain (is (not (nil? (pegasus :Document grammar (wrap-string "a,b,c"))))))
+(deftest plain-multi-char (is (not (nil? (pegasus :Document grammar (wrap-string "aaa,bbb,ccc"))))))
+(deftest plain-multi-line (is (not (nil? (pegasus :Document grammar (wrap-string "a,b,c
+ x,y,z"))))))
+(deftest plain-multi-char-and-line (is (not (nil? (pegasus :Document grammar (wrap-string "aaa,bbb,ccc
+ xxx,yyy,zzz"))))))
+(deftest plain-multi-char-and-line+ (is (not (nil? (pegasus :Document grammar (wrap-string "aaa,bbb,ccc
+ iii,jjj,kkk
+ xxx,yyy,zzz"))))))
+(deftest single (is (not (nil? (pegasus :Document grammar (wrap-string "'a','b','c'"))))))
+(deftest double-quote (is (not (nil? (pegasus :Document grammar (wrap-string "\"a\",\"b\",\"c\""))))))
+(deftest specified-comma-square (is (not (nil? (pegasus :Document (specified \, \[ \]) (wrap-string "[a],[b],[c]"))))))
+(deftest specified-pipe-square (is (not (nil? (pegasus :Document (specified \| \[ \]) (wrap-string "[a]|[b]|[c]"))))))
+(deftest specified-pipe-plus (is (not (nil? (pegasus :Document (specified \| \+ \+) (wrap-string "+a+|+b+|+c+"))))))
+
+(deftest to-clj-plain (is (= (to-clj "a,b,c") [["a" "b" "c"]])))
+
+(deftest to-clj-plain-multi-char (is (= (to-clj "aaa,bbb,ccc") [["aaa" "bbb" "ccc"]])))
+
+(deftest to-clj-plain-multi-line (is (= (to-clj " a,b,c
+ x,y,z") [["a" "b" "c"] ["x" "y" "z"]])))
+
+(deftest to-clj-plain-multi-char-and-line (is (= (to-clj "aaa,bbb,ccc
+ xxx,yyy,zzz") [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+
+(deftest to-clj-plain-multi-char-and-line+ (is (= (to-clj "aaa,bbb,ccc
+ iii,jjj,kkk
+ xxx,yyy,zzz") [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+
+(deftest to-clj-single (is (= (to-clj "'a','b','c'") [["a" "b" "c"]])))
+(deftest to-clj-double (is (= (to-clj "\"a\",\"b\",\"c\"") [["a" "b" "c"]])))
+(deftest to-clj-specified-comma-square (is (= (to-clj "[a],[b],[c]" (specified \, \[ \])) [["a" "b" "c"]])))
+(deftest to-clj-specified-pipe-square (is (= (to-clj "[a]|[b]|[c]" (specified \| \[ \])) [["a" "b" "c"]])))
+(deftest to-clj-specified-pipe-plus (is (= (to-clj "+a+|+b+|+c+" (specified \| \+ \+)) [["a" "b" "c"]])))
+
+(deftest to-clj-multiple-single (is (= (to-clj "'aaa','bbb','ccc'") [["aaa" "bbb" "ccc"]])))
+(deftest to-clj-multiple-double (is (= (to-clj "\"aaa\",\"bbb\",\"ccc\"") [["aaa" "bbb" "ccc"]])))
+(deftest to-clj-multiple-specified-comma-square (is (= (to-clj "[aaa],[bbb],[ccc]" (specified \, \[ \])) [["aaa" "bbb" "ccc"]])))
+(deftest to-clj-multiple-specified-pipe-square (is (= (to-clj "[aaa]|[bbb]|[ccc]" (specified \| \[ \])) [["aaa" "bbb" "ccc"]])))
+(deftest to-clj-multiple-specified-pipe-plus (is (= (to-clj "+aaa+|+bbb+|+ccc+" (specified \| \+ \+)) [["aaa" "bbb" "ccc"]])))
+
+(deftest to-clj-multi-char-and-line-single (is (= (to-clj "'aaa','bbb','ccc'
+ 'xxx','yyy','zzz'") [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+(deftest to-clj-multi-char-and-line-double (is (= (to-clj "\"aaa\",\"bbb\",\"ccc\"
+ \"xxx\",\"yyy\",\"zzz\"") [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+(deftest to-clj-multi-char-and-line-specified-comma-square (is (= (to-clj "[aaa],[bbb],[ccc]
+ [xxx],[yyy],[zzz]" (specified \, \[ \])) [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+(deftest to-clj-multi-char-and-line-specified-pipe-square (is (= (to-clj "[aaa]|[bbb]|[ccc]
+ [xxx]|[yyy]|[zzz]" (specified \| \[ \])) [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+(deftest to-clj-multi-char-and-line-specified-pipe-plus (is (= (to-clj "+aaa+|+bbb+|+ccc+
+ +xxx+|+yyy+|+zzz+" (specified \| \+ \+)) [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+
+(deftest to-clj-multi-char-and-line-single+ (is (= (to-clj "'aaa','bbb','ccc'
+ 'iii','jjj','kkk'
+ 'xxx','yyy','zzz'") [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+(deftest to-clj-multi-char-and-line-double+ (is (= (to-clj "\"aaa\",\"bbb\",\"ccc\"
+ \"iii\",\"jjj\",\"kkk\"
+ \"xxx\",\"yyy\",\"zzz\"") [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+(deftest to-clj-multi-char-and-line-specified-comma-square+ (is (= (to-clj "[aaa],[bbb],[ccc]
+ [iii],[jjj],[kkk]
+ [xxx],[yyy],[zzz]" (specified \, \[ \])) [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+(deftest to-clj-multi-char-and-line-specified-pipe-square+ (is (= (to-clj "[aaa]|[bbb]|[ccc]
+ [iii]|[jjj]|[kkk]
+ [xxx]|[yyy]|[zzz]" (specified \| \[ \])) [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+(deftest to-clj-multi-char-and-line-specified-pipe-plus+ (is (= (to-clj "+aaa+|+bbb+|+ccc+
+ +iii+|+jjj+|+kkk+
+ +xxx+|+yyy+|+zzz+" (specified \| \+ \+)) [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+
+
+(deftest with-vanilla-single (is (not (nil? (pegasus :Document grammar (wrap-string "'a',b,'c'"))))))
+(deftest with-vanilla-double-quote (is (not (nil? (pegasus :Document grammar (wrap-string "\"a\",b,\"c\""))))))
+(deftest with-vanilla-specified-comma-square (is (not (nil? (pegasus :Document (specified \, \[ \]) (wrap-string "[a],b,[c]"))))))
+(deftest with-vanilla-specified-pipe-square (is (not (nil? (pegasus :Document (specified \| \[ \]) (wrap-string "[a]|b|[c]"))))))
+(deftest with-vanilla-specified-pipe-plus (is (not (nil? (pegasus :Document (specified \| \+ \+) (wrap-string "+a+|b|+c+"))))))
+
+(deftest with-vanilla-to-clj-single (is (= (to-clj "'a',b,'c'") [["a" "b" "c"]])))
+(deftest with-vanilla-to-clj-double (is (= (to-clj "\"a\",b,\"c\"") [["a" "b" "c"]])))
+(deftest with-vanilla-to-clj-specified-comma-square (is (= (to-clj "[a],b,[c]" (specified \, \[ \])) [["a" "b" "c"]])))
+(deftest with-vanilla-to-clj-specified-pipe-square (is (= (to-clj "[a]|b|[c]" (specified \| \[ \])) [["a" "b" "c"]])))
+(deftest with-vanilla-to-clj-specified-pipe-plus (is (= (to-clj "+a+|b|+c+" (specified \| \+ \+)) [["a" "b" "c"]])))
+
+(deftest with-vanilla-to-clj-multiple-single (is (= (to-clj "'aaa',bbb,'ccc'") [["aaa" "bbb" "ccc"]])))
+(deftest with-vanilla-to-clj-multiple-double (is (= (to-clj "\"aaa\",bbb,\"ccc\"") [["aaa" "bbb" "ccc"]])))
+(deftest with-vanilla-to-clj-multiple-specified-comma-square (is (= (to-clj "[aaa],bbb,[ccc]" (specified \, \[ \]))[["aaa" "bbb" "ccc"]])))
+(deftest with-vanilla-to-clj-multiple-specified-pipe-square (is (= (to-clj "[aaa]|bbb|[ccc]" (specified \| \[ \]))[["aaa" "bbb" "ccc"]])))
+(deftest with-vanilla-to-clj-multiple-specified-pipe-plus (is (= (to-clj "+aaa+|bbb|+ccc+" (specified \| \+ \+))[["aaa" "bbb" "ccc"]])))
+
+(deftest with-vanilla-to-clj-multi-char-and-line-single (is (= (to-clj "'aaa',bbb,'ccc'
+ 'xxx',yyy,'zzz'") [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+(deftest with-vanilla-to-clj-multi-char-and-line-double (is (= (to-clj "\"aaa\",bbb,\"ccc\"
+ \"xxx\",yyy,\"zzz\"") [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+(deftest with-vanilla-to-clj-multi-char-and-line-specified-comma-square (is (= (to-clj "[aaa],bbb,[ccc]
+ [xxx],yyy,[zzz]" (specified \, \[ \])) [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+(deftest with-vanilla-to-clj-multi-char-and-line-specified-pipe-square (is (= (to-clj "[aaa]|bbb|[ccc]
+ [xxx]|yyy|[zzz]" (specified \| \[ \])) [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+(deftest with-vanilla-to-clj-multi-char-and-line-specified-pipe-plus (is (= (to-clj "+aaa+|bbb|+ccc+
+ +xxx+|yyy|+zzz+" (specified \| \+ \+)) [["aaa" "bbb" "ccc"] ["xxx" "yyy" "zzz"]])))
+
+(deftest with-vanilla-to-clj-multi-char-and-line-single+ (is (= (to-clj "'aaa',bbb,'ccc'
+ 'iii',jjj,'kkk'
+ 'xxx',yyy,'zzz'") [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+(deftest with-vanilla-to-clj-multi-char-and-line-double+ (is (= (to-clj "\"aaa\",bbb,\"ccc\"
+ \"iii\",jjj,\"kkk\"
+ \"xxx\",yyy,\"zzz\"") [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+(deftest with-vanilla-to-clj-multi-char-and-line-specified-comma-square+ (is (= (to-clj "[aaa],bbb,[ccc]
+ [iii],jjj,[kkk]
+ [xxx],yyy,[zzz]" (specified \, \[ \])) [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+(deftest with-vanilla-to-clj-multi-char-and-line-specified-pipe-square+ (is (= (to-clj "[aaa]|bbb|[ccc]
+ [iii]|jjj|[kkk]
+ [xxx]|yyy|[zzz]" (specified \| \[ \])) [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+(deftest with-vanilla-to-clj-multi-char-and-line-specified-pipe-plus+ (is (= (to-clj "+aaa+|bbb|+ccc+
+ +iii+|jjj|+kkk+
+ +xxx+|yyy|+zzz+" (specified \| \+ \+)) [["aaa" "bbb" "ccc"] ["iii" "jjj" "kkk"] ["xxx" "yyy" "zzz"]])))
+
+(def nightmare-string "a,b,c
+aaa,bbb,ccc
+a,b,c
+x,y,z
+ aaa,bbb,ccc
+ xxx,yyy,zzz
+'a','b','c'
+\"a\",\"b\",\"c\"
+[a],[b],[c]
+[a]|[b]|[c]
++a+|+b+|+c+
+a,b,c
+aaa,bbb,ccc
+ a,b,c
+ x,y,z
+ aaa,bbb,ccc
+ xxx,yyy,zzz
+'a','b','c'
+\"a\",\"b\",\"c\"
+[a],[b],[c]
+[a]|[b]|[c]
++a+|+b+|+c+
+'aaa','bbb','ccc'
+\"aaa\",\"bbb\",\"ccc\"
+[aaa],[bbb],[ccc]
+[aaa]|[bbb]|[ccc]
++aaa+|+bbb+|+ccc+
+'aaa','bbb','ccc'
+'xxx','yyy','zzz'
+\"aaa\",\"bbb\",\"ccc\"
+\"xxx\",\"yyy\",\"zzz\"
+[aaa],[bbb],[ccc]
+[xxx],[yyy],[zzz]
+[aaa]|[bbb]|[ccc]
+[xxx]|[yyy]|[zzz]
++aaa+|+bbb+|+ccc+
++xxx+|+yyy+|+zzz+
+'a',b,'c'
+\"a\",b,\"c\"
+[a],b,[c]
+[a]|b|[c]
++a+|b|+c+
+'a',b,'c'
+\"a\",b,\"c\"
+[a],b,[c]
+[a]|b|[c]
++a+|b|+c+
+'aaa',bbb,'ccc'
+\"aaa\",bbb,\"ccc\"
+[aaa],bbb,[ccc]
+[aaa]|bbb|[ccc]
++aaa+|bbb|+ccc+
+'aaa',bbb,'ccc'
+'xxx',yyy,'zzz'
+\"aaa\",bbb,\"ccc\"
+\"xxx\",yyy,\"zzz\"
+[aaa],bbb,[ccc]
+[xxx],yyy,[zzz]
+[aaa]|bbb|[ccc]
+[xxx]|yyy|[zzz]
++aaa+|bbb|+ccc+
++xxx+|yyy|+zzz+")
+(def nightmare-string-with-whitespace "a,b,c
+aaa,bbb,ccc
+a,b,c
+x,y,z
+ aaa,bbb,ccc
+ xxx,yyy,zzz
+'a', 'b','c'
+\"a\",\"b\",\"c\"
+[a],[b],[c]
+[a]|[b]|[c]
++a+|+b+|+c+
+a,b,c
+aaa,bbb,ccc
+ a,b,c
+ x,y,z
+ aaa,bbb,ccc
+ xxx,yyy,zzz
+'a','b','c'
+\"a\",\"b\",\"c\"
+[a],[b],[c]
+[a]|[b]|[c]
++a+|+b+|+c+
+'aaa','bbb', 'ccc'
+\"aaa\",\"bbb\",\"ccc\"
+[aaa],[bbb],[ccc]
+[aaa]|[bbb]|[ccc]
++aaa+|+bbb+|+ccc+
+'aaa','bbb','ccc'
+'xxx','yyy','zzz'
+\"aaa\" ,\"bbb\",\"ccc\"
+\"xxx\",\"yyy\",\"zzz\"
+ [aaa],[bbb],[ccc]
+[xxx],[yyy],[zzz]
+[aaa]|[bbb]|[ccc]
+[xxx]|[yyy]|[zzz]
++aaa+ |+bbb+ |+ccc+
++xxx+|+yyy+|+zzz+
+'a',b,'c'
+\"a\",b,\"c\"
+[a],b,[c]
+[a]|b|[c]
+ +a+|b|+c+
+'a',b,'c'
+\"a\",b,\"c\"
+[a],b,[c]
+[a]|b|[c]
++a+|b|+c+
+'aaa',bbb, 'ccc'
+\"aaa\",bbb, \"ccc\"
+[aaa],bbb,[ccc]
+[aaa]|bbb|[ccc]
++aaa+|bbb|+ccc+
+'aaa',bbb,'ccc'
+'xxx',yyy,'zzz'
+ \"aaa\",bbb,\"ccc\"
+\"xxx\",yyy,\"zzz\"
+[aaa],bbb,[ccc]
+[xxx],yyy,[zzz]
+[aaa]|bbb|[ccc]
+[xxx]|yyy|[zzz]
++aaa+|bbb|+ccc+
++xxx+|yyy|+zzz+")
+(def nightmare-parsed [ ["a" "b" "c"]
+ ["aaa" "bbb" "ccc"]
+ ["a" "b" "c"]
+ ["x" "y" "z"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["aaa" "bbb" "ccc"]
+ ["a" "b" "c"]
+ ["x" "y" "z"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["aaa" "bbb" "ccc"]
+ ["aaa" "bbb" "ccc"]
+ ["aaa" "bbb" "ccc"]
+ ["aaa" "bbb" "ccc"]
+ ["aaa" "bbb" "ccc"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["a" "b" "c"]
+ ["aaa" "bbb" "ccc"]
+ ["aaa" "bbb" "ccc"]
+ ["aaa" "bbb" "ccc"]
+ ["aaa" "bbb" "ccc"]
+ ["aaa" "bbb" "ccc"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]
+ ["aaa" "bbb" "ccc"]
+ ["xxx" "yyy" "zzz"]])
+(def nightmare-grammar (specified (lpegs '| ",|") (lpegs '| "'\"[+") (lpegs '| "'\"]+")))
+(deftest nightmare-string-to-clj (is (= (to-clj nightmare-string nightmare-grammar) nightmare-parsed)))
+(deftest nightmare-string-with-whitespace-to-clj (is (= (to-clj nightmare-string-with-whitespace nightmare-grammar) nightmare-parsed)))
View
38 test/com/lithinos/amotoen/test/json.clj
@@ -0,0 +1,38 @@
+; Copyright (c) Richard Lyman. All rights reserved.
+; The use and distribution terms for this software are covered by the
+; Eclipse Public License 1.0 (http://www.eclipse.org/legal/epl-v10.html)
+; which can be found in the file epl-v10.html at the root of this distribution.
+; By using this software in any fashion, you are agreeing to be bound by
+; the terms of this license.
+; You must not remove this notice, or any other, from this software.
+
+(ns com.lithinos.amotoen.test.json
+ (:import (java.io File))
+ (:use [com.lithinos.amotoen.core] :reload-all)
+ (:use [clojure.test])
+ (:use [clojure.pprint])
+ (:use [com.lithinos.amotoen.grammars
+ [json :rename {grammar json-grammar}]]))
+
+(deftest json-empty-object
+ (let [r (pegasus :JSONText json-grammar (wrap-string "{}"))]
+ (is (not (nil? r)))))
+
+(deftest json-containing-object
+ (let [r (pegasus :JSONText json-grammar (wrap-string "{\"a\":true,\"b\":false}"))]
+ (is (not (nil? r)))))
+
+(deftest json-empty-array
+ (let [r (pegasus :JSONText json-grammar (wrap-string "[]"))]
+ (is (not (nil? r)))))
+
+(deftest json-containing-array
+ (let [r (pegasus :JSONText json-grammar (wrap-string "[1,2,3]"))]
+ (is (not (nil? r)))))
+
+(deftest json-samples-in-out
+ (doseq [f (filter #(re-find #"\.in$" (.getName %)) (file-seq (File. "./test/JSONTests")))]
+ (let [c (.trim (slurp (File. (.replaceAll (.getCanonicalPath f) ".in$" ".out"))))
+ r (pegasus :JSONText json-grammar (wrap-string (slurp f)))]
+ (is (= c (pr-str r))))))
+
View
46 test/com/lithinos/amotoen/test/markdown.clj
@@ -0,0 +1,46 @@
+; Copyright (c) Richard Lyman. All rights reserved.
+; The use and distribution terms for this software are covered by the
+; Eclipse Public License 1.0 (http://www.eclipse.org/legal/epl-v10.html)
+; which can be found in the file epl-v10.html at the root of this distribution.
+; By using this software in any fashion, you are agreeing to be bound by
+; the terms of this license.
+; You must not remove this notice, or any other, from this software.
+
+(ns com.lithinos.amotoen.test.markdown
+ (:import (java.io File))
+ (:use [com.lithinos.amotoen.core] :reload-all)
+ (:use [clojure.test])
+ (:use [clojure.pprint])
+ (:use [com.lithinos.amotoen.grammars.markdown]))
+
+#_(deftest standard-test-files
+ (doseq [f (list (first (filter #(re-find #"\.text$" (.getName %)) (file-seq (File. "./test/MarkdownTests")))))]
+ (println f)
+ (let [correct (File. (.replaceAll (.getCanonicalPath f) ".text$" ".html"))
+ result (pegasus :Start grammar (wrap-string (slurp f))) ]
+ (pprint result)
+ ;(is (= result (slurp correct)))
+ ))
+ )
+
+#_(deftest single-regularchar
+ (let [mdp (create-parser grammar)
+ result (mdp (wrap-string "a"))]))
+
+#_(deftest newlines-and-blanklines
+ (let [mdp (create-parser grammar)]
+ (pprint (mdp (wrap-string "
+
+")))
+ (pprint (mdp (wrap-string "a
+")))
+ (pprint (mdp (wrap-string "a
+
+")))
+ (pprint (mdp (wrap-string "a
+
+a")))
+ (pprint (mdp (wrap-string "a
+
+a")))))
+
View
15 test/com/lithinos/amotoen/test/minimark.clj
@@ -0,0 +1,15 @@
+; Copyright (c) Richard Lyman. All rights reserved.
+; The use and distribution terms for this software are covered by the
+; Eclipse Public License 1.0 (http://www.eclipse.org/legal/epl-v10.html)
+; which can be found in the file epl-v10.html at the root of this distribution.
+; By using this software in any fashion, you are agreeing to be bound by
+; the terms of this license.
+; You must not remove this notice, or any other, from this software.
+
+(ns com.lithinos.amotoen.test.minimark
+ (:import (java.io File))
+ (:use [com.lithinos.amotoen.core] :reload-all)
+ (:use [clojure.test])
+ (:use [clojure.pprint])
+ (:use [com.lithinos.amotoen.grammars.minimark]))
+

0 comments on commit ee60305

Please sign in to comment.
Something went wrong with that request. Please try again.