Permalink
Browse files

Final move to Clojure subfolder (v3)

  • Loading branch information...
1 parent e78edfd commit 29e571369c8f18c9ea0a685bbd582c1be133a474 @richard-lyman committed Aug 20, 2013
View
6 src/amotoen/core.clj
@@ -1,6 +0,0 @@
-(ns amotoen.core)
-
-(defn -main
- "I don't do a whole lot."
- [& args]
- (println "Hello, World!"))
View
347 src/com/lithinos/amotoen/core.clj
@@ -1,347 +0,0 @@
-; 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.core
- (:import (java.util.regex Pattern)))
-
-(declare to-ast)
-
-(defprotocol Pegable
- "Fulfilling this protocol is required of any input given to to-ast through its 'w' parameter.
- If you'd like to process some String 's', you could use the provided 'wrap-string' function, which
- would reify this protocol around 's' so that you could pass it to to-ast. If you'd like to process
- binary (or any other type of) inputs, you'll need to provide your own reification/implementation."
- (position [w] [w j] "Gets and sets the position. This allows for backtracking and debugging.")
- (end? [w] "Should return true if there is no more input to consume, false otherwise.")
- (terminal? [w] [w terminal]"The single paramter version is used to verify that a given grammar is valid
- and can be processed. The two parameter version should return true if the
- terminal 'terminal' is a terminal that can be processed by the two paramter
- form of 'move'.")
- (move [w] [w terminal]"Returns the result of consuming the default size terminal or the terminal 'terminal'. Alters the position accordingly."))
-
-(def #^{:private true
- :dynamic true
- :doc "Bind this to true to 'enable' debug output"}
- *amotoen-debug* false)
-
-(def #^{:private true
- :dynamic true
- :doc "The value this is bound to will be the amount of characters that appear in the debug dump of the input"}
- *amotoen-debug-window* 50)
-
-(defn- debug
- "Sample use can be seen in the four parameter version of to-ast.
- Each debug statement is prefixed with a marker to identify what the line represents.
- There are currently only 4 types of debug prefix markers used.
- '##' is used when a regex is being tested. This will come in a triplet.
- The first is the string being matched, the second is the regex, and the
- third is the result of the call to re-find based on that string and regex.
- '++' is used when a terminal matches and the position is about to be moved. The rest of the line is the terminal that matched.
- '->' is used when an element of the grammar is being examined. There are two parts on the
- rest of the line. These two parts are separated by a colon and are, first, a segment
- of the input and, second, the element of the grammar being examined.
- '<-' is used when an element of the grammar is done being examined. The rest of the line is the element of the grammar."
- ([prefix s] (when *amotoen-debug* (println prefix (pr-str s))))
- ([prefix grammar-part w]
- (when *amotoen-debug*
- (let [p (position w)]
- (println prefix
- (pr-str (apply
- str
- (doall
- (take *amotoen-debug-window*
- (repeatedly
- #(try
- (move w)
- (catch Exception e "")))))))
- ":"
- (pr-str grammar-part))
- (position w p)))))
-
-(defn wrap-string
- "Reifies Pegable around a string 's', possibly at a given starting point 'j'.
- Characters, Strings, and Regular Expressions are supported as Terminals."
- ([#^String s] (wrap-string s 0))
- ([#^String s j]
- (let [a (int-array 1 j)
- size (count s)
- c #(try (.charAt s (aget a 0)) (catch Exception e nil))
- move-x (fn [condition size terminal]
- (if condition
- (do (aset-int a 0 (+ size (aget a 0)))
- (debug "++" terminal)
- terminal)))
- move-character #(move-x (= %1 (c)) 1 %1)
- move-string #(move-x (.startsWith s %1 (aget a 0)) (count %1) %1)
- move-regex #(let [match (re-find %1 (.substring s (aget a 0)))]
- (debug "##" (.substring s (aget a 0)))
- (debug "##" %1)
- (debug "##" match)
- (move-x (not (nil? match))
- (count (if (vector? match) (first match) match))
- match))]
- (reify Pegable
- (position [w] (aget a 0))
- (position [w k] (aset-int a 0 k))
- (end? [w] (== (aget a 0) size))
- (terminal? [w] (or (move w #"^\\(?:(?:tab)|(?:space)|(?:newline)|(?:return)|(?:.))") ; Make sure we don't swallow \"
- (move w #"^\"(?:\\|[^\"])++\"")
- (move w #"^#\"^(?:\\|\"|[^\"])++\"")))
- (terminal? [w terminal] (or (char? terminal)
- (instance? String terminal)
- (instance? Pattern terminal)))
- (move [w] (let [r (c)]
- (when (nil? r) (throw (Exception. "Consuming nil")))
- (aset-int a 0 (+ 1 (aget a 0)))
- r))
- (move [w terminal] (cond (char? terminal) (move-character terminal)
- (instance? String terminal) (move-string terminal)
- (instance? Pattern terminal)(move-regex terminal)
- true (throw (Exception. (str "Unsupported terminal: " terminal)))))))))
-
-(defn ls
- "Produces a rule that allows any character in the string 's' as a valid match.
- Since this produces a list, and a succession of 'body' elements, it currently
- only makes sense when called as (ls '| \"abc\") which produces '(| \\a \\b \\c).
- The same effect could be achieved through the regex #\"^[abc]\" but the resulting
- ast would be different."
- [t s] (reverse (into '() (cons t (seq s)))))
-
-(def #^{:private true
- :doc "This grammar is the grammar for Amotoen grammars. It starts at :Grammar."}
- grammar-grammar {
- :_* '(* :Whitespace)
- :_ [:Whitespace '(* :Whitespace)]
- :Grammar [\{ :_* :Rule '(* [:_ :Rule]) :_* \}]
- :Rule [:Keyword :_ :Body]
- :Keyword [\: '(| :AmotoenSymbol :ProvidedSymbol)]
- :ProvidedSymbol '(| :EndOfInput :AcceptAnything)
- :EndOfInput \$ ; If the Keyword ':$' is encountered, the wrapped input should be at the end, i.e.: (= true (end? w))
- :AcceptAnything \. ; If the Keyword ':.' is encountered, any character is accepted
- :Body '(| :Keyword :Terminal :Grouping :NotPredicate :AnyNot :AwareFunction :Function) ; :Terminal should be moved to the end and accept :.
- :Grouping '(| :Sequence :Either :ZeroOrMore)
- :Sequence [\[ :_* :Body '(* [:_* :Body]) :_* \]]
-; All elements that start with \( should be under the same Keyword... it'd speed things up a bit - removing the backtracking
-;
-; ADD THE OPTIONAL OPERATOR '?' (ONE-OR-NONE)
-;
- :Either [\( \| :_ :Body '(* [:_* :Body]) :_* \)]
- :OneOrNone [\( \? :_ :Body :_* \)]
- :ZeroOrMore [\( \* :_ :Body :_* \)]
- :NotPredicate [\( \! :_ :Body :_* \)]
- :AnyNot [\( \% :_ :Body :_* \)]
- :AwareFunction [\( \a :_ :CljReaderFn :_* \)]
- :Function [\( \f :_ :CljReaderFn :_ :Body :_* \)]
- :CljReaderFn [\# \< '(% \>) '(* (% \>)) \>]
- :Whitespace '(| \space \newline \return \tab \,)
- :Terminal (list 'a (fn [g w] (terminal? w)))
-; :Terminal '(| :Char :String :Regex) ; In reality, this is based on what the Pegable input provides as a terminal...
-; :Char [\\ (list '| "tab" "space" "newline" "return" '(% \space))]
-; :String [\" :Chars \"]
-; :Chars [:StringChar '(* :StringChar)]
-; :StringChar '(| :EscapedChar [(! \") :.])
-; :EscapedChar [\\ '(| \" \\ \/ \b \f \n \r \t)]
- :AmotoenSymbol [:NonNumericCharacter '(* :AlphanumericCharactersPlus)] ; _Not_ the same as a Clojure Symbol, though it should be a proper subset
- :NonNumericCharacter (list '% #"^[0123456789]")
- :AlphanumericCharactersPlus #"^[etaoinsrhbcdfgjklmpquvwxyzETAOINSRHBCDFGJKLMPQUVWXYZ0123456789:/*+!_?.-]"}) ; Semi-ordered by frequency - does it matter now?
-
-(defn- either
- "Returns the result of the first element in 'grammar-part' to successfully process something from 'w'."
- [grammar-part g w]
- (let [original (position w)]
- (first
- (keep
- #(do
- (position w original)
- (to-ast % g w))
- (rest grammar-part)))))
-
-(defn- any-not
- "This will accept anything that is not 'body'. For instance, '(% :B) would accept
- any single character that is not whatever matches :B. Success if failure, failure if success.
- It will successfully match any single character if :B fails, and it will fail to match any
- single character if :B succeeds."
- [body g w]
- (let [p (position w)]
- (if (or (to-ast body g w) (end? w))
- (do (position w p) nil) ; If we succeed (or are at the end), then we fail - that's the point of AnyNot... and rollback
- (move w)))) ; If we fail and aren't at the end, then we accept the current char
-
-(defn- peg-vec
- "Returns the result of calling to-ast on each element in 'grammar-part'.
- If any call fails then nil is returned as the single result of all calls."
- [grammar-part g w]
- (let [p (position w)]
- (loop [remaining grammar-part
- result []]
- (if (empty? remaining)
- result
- (let [temp (to-ast (first remaining) g w)]
- (if temp
- (recur (rest remaining)
- (conj result temp))
- (do
- (position w p)
- nil)))))))
-
-(defn- one-or-none
- "Attempts to call to-ast once. If that result is nil, then the position
- is reset and an empty list is returned, otherwise the result is returned."
- [body g w]
- (let [p (position w)
- r (to-ast body g w)]
- (if (nil? r)
- (do (position w p) '())
- r)))
-
-(defn- zero-or-more
- "Continues to collect the result of calling (to-ast body g w) until that call returns nil.
- Returns the collected results. If nothing was consumed from 'w', then nil is returned."
- [body g w]
- (let [lastp (ref (position w))] ; This ref has to have a cost...
- (doall
- (take-while
- #(if (== (position w) @lastp)
- nil
- (if (keyword? body) (body %) %))
- (repeatedly #(do (dosync (ref-set lastp (position w)))
- (to-ast body g w)))))))
-
-(defn- not-predicate
- "Returns true if (to-ast body g w) doesn't succeed, nil otherwise."
- [body g w]
- (let [p (position w)
- r (nil? (to-ast body g w))]
- (if (or r (end? w))
- (do (position w p) true)
- nil)))
-
-(defn- list-of-one-element
- "Check to find lists containing only a single element.
- Significantly faster than 'count' in the worst-case."
- [r]
- (and
- (seq? r)
- (not (nil? (first r)))
- (nil? (seq (rest r)))))
-
-(defn- typed-list
- "Similar in purpose and result as to-ast, with the expectation that 'grammar-part' is a 'Typed-List' in the grammar."
- [grammar-part g w]
- (let [t (first grammar-part)
- rest-of-grammar-part (second grammar-part)
- result (cond (= t '|) (either grammar-part g w)
- (= t '%) (any-not rest-of-grammar-part g w)
- (= t '?) (one-or-none rest-of-grammar-part g w)
- (= t '*) (zero-or-more rest-of-grammar-part g w)
- (= t '!) (not-predicate rest-of-grammar-part g w)
- (= t 'a) (rest-of-grammar-part g w)
- (= t 'f) (rest-of-grammar-part (to-ast (first (rest (rest grammar-part))) g w)))]
- (if (list-of-one-element result)
- (first result)
- result)))
-
-(defn- peg-keyword
- "Similar in purpose and result as to-ast, with the expectation that 'grammar-part' is a Keyword in the grammar."
- [grammar-part g w]
- (cond
- (= grammar-part :$) (if (end? w) :$ (throw (Error. "Declaration of end without end")))
- (= grammar-part :.) (if (not (end? w)) (move w) (throw (Error. "Attempt to consume any character at end")))
- true (do (when (nil? (grammar-part g)) (throw (Error. (str "Keyword '" grammar-part "' does not exist in grammar"))))
- (let [temp (to-ast (grammar-part g) g w)]
- (if temp
- {grammar-part temp}
- nil)))))
-
-(defn- debug-wrap
- ([fn-to-wrap grammar-part] (debug "-> " grammar-part) (let [r (fn-to-wrap)] (debug "<- " grammar-part) r))
- ([fn-to-wrap grammar-part w] (debug "-> " grammar-part w) (let [r (fn-to-wrap)] (debug "<- " grammar-part) r))
- ([fn-to-wrap grammar-part w after] (debug "-> " grammar-part w) (fn-to-wrap)))
-
-(defn to-ast
- "Returns the AST resulting from parsing the wrapped input 'w'
- given a grammar definition 'g' and starting at rule 'grammar-part' in 'g'.
- If passed a fourth parameter, it will dump debug statements to the file 'd'."
- ([grammar-part g w d]
- (with-open [dw (clojure.java.io/writer d :append true)] ; Is append the right approach?
- (binding [*amotoen-debug* true
- *out* dw]
- (to-ast grammar-part g w))))
- ([grammar-part g w]
- (cond
- (keyword? grammar-part) (debug-wrap #(peg-keyword grammar-part g w) grammar-part)
- (vector? grammar-part) (debug-wrap #(peg-vec grammar-part g w) grammar-part w)
- (list? grammar-part) (debug-wrap #(typed-list grammar-part g w) grammar-part w)
- (terminal? w grammar-part) (debug-wrap #(move w grammar-part) grammar-part w false)
- true (throw (Error. (str "Unknown type: " grammar-part))))))
-
-(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 to-ast.
- The final result is assumed to be the value of the root map that to-ast would have returned."
- [grammar-keyword g w fn-map]
- (grammar-keyword (to-ast grammar-keyword (with-fns g fn-map) w)))
-
-; It'd be nice if this provided warnings as well...
-; Zero-consumption rules
-; Cyclical rules
-; Full-consumption rules
-(defn validate
- "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.
- The two parameter form allows passing a debug filename like the
- four parameter form of 'to-ast'."
- ([g] (validate g nil))
- ([g d]
- (let [w (wrap-string (pr-str g))
- ast (if (nil? d)
- (to-ast :Grammar grammar-grammar w)
- (to-ast :Grammar grammar-grammar w d))
- r (and (not (nil? ast))
- (end? w))]
- [r, ast])))
-
-(defn fastest-theoretical-by-single
- "Finding a lower-bound on any optimizations for speed starts
- by simply reading each character in the string to be parsed 's'.
- The function 'end' is the conditional with 'm' consuming. The
- result of this function is _not_ the fastest you can see in real-world
- use, since the runtime might optimize performance further. This
- should just give an indication of how slow a specific grammar and input
- pairing might be. This also assumes that your grammar will move a single
- position at a time. Some grammars and/or wrappers move faster."
- [s]
- (let [w (wrap-string s)]
- (loop [continue (not (end? w))]
- (when continue
- (position w (inc (position w)))
- (recur (not (end? w)))))))
-
-(defn self-check-fastest
- "This returns the fastest time to read each character of grammar-grammar"
- [] (fastest-theoretical-by-single (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
74 src/com/lithinos/amotoen/grammars/csv.clj
@@ -1,74 +0,0 @@
-; 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.grammars.csv
- (:use [com.lithinos.amotoen.core :only [post-process wrap-string]]))
-
-(def grammar {
- :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 \" \"))
- ([separator, wrapper] (specified separator wrapper wrapper))
- ([separator, left-wrapper, right-wrapper] {
- :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
56 src/com/lithinos/amotoen/grammars/json.clj
@@ -1,56 +0,0 @@
-; 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.grammars.json
- (:use [com.lithinos.amotoen.core :only [move ls]]))
-
-(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}
- remaining (drop-while #(nil? (move w %)) s)]
- (if (seq remaining)
- (first remaining)
- nil)))
-
-(def grammar {
- :_* '(* (| \newline \return \tab \space))
- :JSONText [:_* '(| :JSONObject :Array) :_* :$]
- :Value (list '| :JSONString :JSONObject :Array "true" "false" "null" :JSONNumber)
-; Objects
- :JSONObject '(| :EmptyObject :ContainingObject)
- :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) ; Nests the structure significantly
-; Strings
- :JSONString '(| :EmptyString :ContainingString)
- :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 (ls '| "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]
- :Exp [:ExpLeader :Digits]
- :Digit (ls '| "0123456789")
- :Digit1-9 (ls '| "123456789")
- :Digits [:Digit '(* :Digits)]
- :ExpLeader ['(| \e \E) '(* (| \+ \-))]
-})
View
144 src/com/lithinos/amotoen/grammars/minimark.clj
@@ -1,144 +0,0 @@
-; 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.grammars.minimark
- (:use [com.lithinos.amotoen.core :only [ls post-process wrap-string]]))
-
-(defn containing [s b e] [s b (list '* b) e])
-
-(defn delimited
- ([m] (delimited m m))
- ([b e] (delimited b e e))
- ([s b e] (containing s (list '% b) e)))
-
-(defn delimited-body [d b] (delimited d b d))
-
-(defn a-frequency-ordered-char [] ; Semi-frequency-ordered
- (ls '| "etaoinsrh,.?bcdfgjklmpquvwxyz023456789~`@#$%&*()+}]|:;<>/\""))
-
-(defn one-or-more [b] [b (list '* b)])
-
-(defn one-or-more-not [b] [(list '% b) (list '* (list '% b))])
-
-(def grammar {
- :Content '(* (| :SafeChar :Markup :UnsafeChar))
- :Markup '(| :HRule :MDash :List :SS :U :B :I :Href :Pre :H4 :H3 :H2 :H1)
- :HRule "----"
- :MDash "---"
- :List '(| :OrderedList :UnorderedList)
- :OrderedList (one-or-more ["1. " :ListBody])
- :UnorderedList (one-or-more ["-- " :ListBody])
- :ListBody [:ListContent \newline '(* (| \newline \space \tab))]
- :ListContent '(* (| :ListSafeChar :SS :U :B :I :Href :Pre (% \newline)))
- :SS (delimited \^)
- :H4 (delimited-body "====" \=)
- :H3 (delimited-body "===" \=)
- :H2 (delimited-body "==" \=)
- :H1 (delimited-body "=" \=);
- :B (delimited "'''");
- :I (delimited "''");
- :U (delimited "__");
- :Pre (containing "{{{" :PreContent "}}}");
- :PreContent '(| [\! \}] (% [\} \} \}]));
- :Href [\[ (list '| (delimited \[ \]) :HrefExplained) \]];
- :HrefExplained [(one-or-more-not \space) \space (one-or-more-not \])];
- :ListSafeChar (list '| \space :EscapedChar (a-frequency-ordered-char) \tab);
- :SafeChar (list '| :EmptyLine :ListSafeChar \newline);
- :EmptyLine [\newline \newline]
- :EscapedChar [\! :UnsafeChar];
- :UnsafeChar (ls '| "ETAOINSRH1BCDFGJKLMPQUVWXYZ!\\[={_^'-");
-})
-
-(defn list-safe-to-html [l] (if (map? l) (first (vals l)) l))
-
-(defn safe-to-html [l] (if (map? l) (first (vals l)) l))
-
-(defn content-to-html [l]
- (cond
- (map? l) (first (vals l))
- (seq? l) (apply str (map content-to-html l))
- true l))
-
-(defn one-or-more-to-str [l]
- (if (char? (second l))
- (apply str l)
- (reduce (fn [a b] (str a b))
- (first l)
- (second l))))
-
-(defn delimited-to-html
- ([l c] (delimited-to-html l c "span"))
- ([l c t] (if (not (nil? l))
- (str "<" t " class='" c "'>" (one-or-more-to-str (butlast (rest l))) "</" t ">"))))
-
-(defn href-to-html [v]
- (if (not (nil? v))
- (if (vector? (second v))
- (let [l (one-or-more-to-str (butlast (rest (second v))))]
- (str "<a href='" l "'>" l "</a>"))
- (let [inside (first (vals (second v)))
- link (one-or-more-to-str (first inside))
- explanation (one-or-more-to-str (last inside))]
- (str "<a href='" link "'>" explanation "</a>")))))
-
-(defn pre-to-html[v]
- (if (not (nil? v))
- (let [v (butlast (rest v))]
- (if (= \newline (first (vals (first v))))
- (str "<div class='pre-block'>"
- (apply str (map #(first (vals %))
- (butlast (second v))))
- "</div>")
- (str "<div class='pre-inline'>"
- (reduce (fn [a b] (str a (first (vals b))))
- (first (vals (first v)))
- (second v))
- "</div>")))))
-
-(defn list-to-html
- ([v] (list-to-html v "ol"))
- ([v t]
- (if (not (nil? v))
- (str "<" t ">"
- (reduce (fn [a b] (if (empty? b) a (str a (str "<li>" (first (vals (last b))) "</li>"))))
- (str "<li>" (first (vals (last (first v)))) "</li>")
- (rest v))
- "</" t ">"))))
-
-(defn list-content-to-html [l]
- (reduce (fn [a b] (str a (if (map? b) (first (vals b)) b)))
- (first l)
- (rest l)))
-
-(def #^{:private true} to-html-fns {:Content content-to-html
- :EscapedChar #(first (vals (second %)))
- :ListSafeChar list-safe-to-html
- :SafeChar safe-to-html
- :MDash #(if (not (nil? %)) "&mdash;")
- :HRule #(if (not (nil? %)) "<hr />")
- :SS #(delimited-to-html % "superscript")
- :U #(delimited-to-html % "underline")
- :B #(delimited-to-html % "bold")
- :I #(delimited-to-html % "italic")
- :H4 #(delimited-to-html % "H4" "div")
- :H3 #(delimited-to-html % "H3" "div")
- :H2 #(delimited-to-html % "H2" "div")
- :H1 #(delimited-to-html % "H1" "div")
- :Pre pre-to-html
- :Href href-to-html
- :List #(first (vals %))
- :Markup #(first (vals %))
- :ListBody #(first (vals (first %)))
- :OrderedList list-to-html
- :UnorderedList #(list-to-html % "ul")
- :ListContent #(list-content-to-html %)
- :EmptyLine #(if (not (nil? %)) "<div class='empty-line' />") })
-
-(defn to-html
- ([s] (to-html s grammar))
- ([s g] (post-process :Content g (wrap-string s) to-html-fns)))
View
22 test/JSONTests/1.in
@@ -1,22 +0,0 @@
-{
- "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
@@ -1 +0,0 @@
-{: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
@@ -1,11 +0,0 @@
-{"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
@@ -1 +0,0 @@
-{: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
@@ -1,25 +0,0 @@
-{"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
@@ -1 +0,0 @@
-{: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
@@ -1,88 +0,0 @@
-{"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
0 additions, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
View
27 test/JSONTests/5.in
@@ -1,27 +0,0 @@
-{"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
@@ -1 +0,0 @@
-{: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 "null"} {:_* ()} \, {:_* (\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 "null"} {:_* ()} \, {:_* (\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 "null"} {:_* ()} \, {:_* (\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 "null"} {:_* ()} \, {:_* (\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
120 test/com/lithinos/amotoen/test/core.clj
@@ -1,120 +0,0 @@
-; 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.grammars
- [csv :rename {grammar csv-grammar specified csv-specified}]
- [json :rename {grammar json-grammar}]
- [minimark :rename {grammar minimark-grammar}]
- ]))
-
-(defn test-grammars []
- (clojure.java.io/delete-file "debug.txt" true)
- (let [cf #(apply str %)]
- (doseq [g [ {:S \a}
- {:S "}}}"}
- {:S (list '% "}}}")}
- {:S (list '* (list '% "}}}"))}
- {:S [(list '* (list '% "}}}")) "}}}"]}
- {:S [(list 'f cf "abcabc")]}
- {:S [(list 'f cf (list '* (ls '| "abc")))]}
- {:S [(list 'f cf '(* (| :A :B :C)))] :A \a :B \b :C \c }
- csv-grammar
- json-grammar
- minimark-grammar
- ]]
- (if (= g csv-grammar)
- (is (first (validate g "debug.txt")))
- (is (first (validate g))))
-)))
-
-(defn vectors-reset-pos []
- (let [g {:S [(list '* (list '% "}}}")) "}}}"]}
- i "a}}b}}}"
- r (to-ast :S g (wrap-string i) "something.txt")]
- (is (= '{:S [(\a \} \} \b) "}}}"]} r))))
-
-(defn collapse-ls []
- (let [custom-collapse #(apply str %)
- g {:S [(list 'f custom-collapse (list '* (ls '| "abc")))]}
- i "aabbcc"
- r (to-ast :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 (to-ast :S g (wrap-string i))]
- (is (= '{:S ["aabbcc"]} r))))
-
-(defn extract [time-result]
- (Double/parseDouble
- (nth
- (.split
- (last
- (.split time-result "\n"))
- " ")
- 2)))
-
-(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))))))]
- (printf "%8.2fms - Single Run (moving faster than a character at a time)\n" (extract single))
- (printf "%8.2fms - Average over 50 runs (moving faster than a character at a time)\n" (/ (extract avg50) 50))
- (printf "%8.2fms - Fastest theoretically possible, when moving a single terminal at a time (in this case, a character at a time)\n" (extract fastest))
- (println "\n (in milliseconds)\n")))
-
-(do
- (println "Corner cases")
- (test-grammars)
- (vectors-reset-pos)
- (collapse-ls)
- (collapse-keywords)
-)
-
-(try
- (to-ast :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))
-
-(deftest regex []
- (let [i "aabb"
- g {:S #"^a+b+"}
- r (to-ast :S g (wrap-string i))]
- (is (= {:S "aabb"} r))))
-
-(deftest compare-char-string-regex-speed
- (let [i (str (apply str (repeat 100000 "a")) (apply str (repeat 100000 "b")))
- cg {:S ['(* \a) '(* \b)]}
- sg {:S ['(* "a") '(* "b")]}
- rg {:S #"^a*b*"}
- cr (to-ast :S cg (wrap-string i))
- sr (to-ast :S sg (wrap-string i))
- rr (to-ast :S rg (wrap-string i))
- ct ["char" (extract (with-out-str (time (to-ast :S cg (wrap-string i)))))]
- st ["string" (extract (with-out-str (time (to-ast :S sg (wrap-string i)))))]
- rt ["regex" (extract (with-out-str (time (to-ast :S rg (wrap-string i)))))]]
- (println "===")
- (println "In a very contrived example (100k a's followed by 100k b's)...")
- (println (apply str (interpose " is faster than " (map first (sort-by second [ct st rt])))))
- (println "Using the following grammars:")
- (println "\tchar" (pr-str cg))
- (println "\tstring" (pr-str sg))
- (println "\tregex" (pr-str rg))
- (println "\tchar time" (second ct) "in milliseconds")
- (println "\tstring time" (second st) "in milliseconds")
- (println "\tregex time" (second rt) "in milliseconds")
- (println "===")))
-
View
320 test/com/lithinos/amotoen/test/csv.clj
@@ -1,320 +0,0 @@
-; 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? (to-ast :Document grammar (wrap-string "a,b,c"))))))
-(deftest plain-multi-char (is (not (nil? (to-ast :Document grammar (wrap-string "aaa,bbb,ccc"))))))
-(deftest plain-multi-line (is (not (nil? (to-ast :Document grammar (wrap-string "a,b,c
- x,y,z"))))))
-(deftest plain-multi-char-and-line (is (not (nil? (to-ast :Document grammar (wrap-string "aaa,bbb,ccc
- xxx,yyy,zzz"))))))
-(deftest plain-multi-char-and-line+ (is (not (nil? (to-ast :Document grammar (wrap-string "aaa,bbb,ccc
- iii,jjj,kkk
- xxx,yyy,zzz"))))))
-(deftest single (is (not (nil? (to-ast :Document grammar (wrap-string "'a','b','c'"))))))
-(deftest double-quote (is (not (nil? (to-ast :Document grammar (wrap-string "\"a\",\"b\",\"c\""))))))
-(deftest specified-comma-square (is (not (nil? (to-ast :Document (specified \, \[ \]) (wrap-string "[a],[b],[c]"))))))
-(deftest specified-pipe-square (is (not (nil? (to-ast :Document (specified \| \[ \]) (wrap-string "[a]|[b]|[c]"))))))
-(deftest specified-pipe-plus (is (not (nil? (to-ast :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? (to-ast :Document grammar (wrap-string "'a',b,'c'"))))))
-(deftest with-vanilla-double-quote (is (not (nil? (to-ast :Document grammar (wrap-string "\"a\",b,\"c\""))))))
-(deftest with-vanilla-specified-comma-square (is (not (nil? (to-ast :Document (specified \, \[ \]) (wrap-string "[a],b,[c]"))))))
-(deftest with-vanilla-specified-pipe-square (is (not (nil? (to-ast :Document (specified \| \[ \]) (wrap-string "[a]|b|[c]"))))))
-(deftest with-vanilla-specified-pipe-plus (is (not (nil? (to-ast :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 (ls '| ",|") (ls '| "'\"[+") (ls '| "'\"]+")))
-(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
41 test/com/lithinos/amotoen/test/json.clj
@@ -1,41 +0,0 @@
-; 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 (to-ast :JSONText json-grammar (wrap-string "{}"))]
- (is (not (nil? r)))))
-
-(deftest json-containing-object
- (let [r (to-ast :JSONText json-grammar (wrap-string "{\"a\":true,\"b\":false}"))]
- (is (not (nil? r)))))
-
-(deftest json-empty-array
- (let [r (to-ast :JSONText json-grammar (wrap-string "[]"))]
- (is (not (nil? r)))))
-
-(deftest json-containing-array
- (let [r (to-ast :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")))]
- ;(spit "json.txt" (str f "\n\n") :append true)
- (let [c (.trim (slurp (File. (.replaceAll (.getCanonicalPath f) ".in$" ".out"))))
- r (to-ast :JSONText json-grammar (wrap-string (slurp f)))]
- ;(spit "json.txt" (pr-str r) :append true)
- ;(is (= c (pr-str r)))
- )))
-
View
64 test/com/lithinos/amotoen/test/minimark.clj
@@ -1,64 +0,0 @@
-; 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]))
-
-(deftest single-safe-char (is (= \a (to-html "a"))))
-(deftest single-escaped-char (is (= \A (to-html "!A"))))
-(deftest multiple-safe-char (is (= "aaa" (to-html "aaa"))))
-(deftest multiple-escaped-char (is (= "AAA" (to-html "!A!A!A"))))
-(deftest mixed-char (is (= "aA" (to-html "a!A"))))
-(deftest multiple-mixed-char (is (= "aAaAaA" (to-html "a!Aa!Aa!A"))))
-
-(deftest single-safe-newline (is (= \newline (to-html "\n"))))
-(deftest single-safe-empty-line (is (= "<div class='empty-line' />" (to-html "\n\n"))))
-(deftest single-safe-space (is (= \space (to-html " "))))
-(deftest single-safe-tab (is (= \tab (to-html "\t"))))
-
-(deftest mix-safe-chars-and-whitepsace1 (is (= " a\tAa aaa<div class='empty-line' />\t\taA\n" (to-html " a\t!Aa aaa\n\n\t\ta!A\n"))))
-
-(deftest hrule (is (= "<hr />" (to-html "----"))))
-(deftest mdash (is (= "&mdash;" (to-html "---"))))
-(deftest superscript (is (= "<span class='superscript'>SuperScript</span>" (to-html "^SuperScript^"))))
-(deftest h4 (is (= "<div class='H4'> H4 </div>" (to-html "==== H4 ===="))))
-(deftest h3 (is (= "<div class='H3'> H3 </div>" (to-html "=== H3 ==="))))
-(deftest h2 (is (= "<div class='H2'> H2 </div>" (to-html "== H2 =="))))
-(deftest h1 (is (= "<div class='H1'> H1 </div>" (to-html "= H1 ="))))
-(deftest bold (is (= "<span class='bold'>Bold</span>" (to-html "'''Bold'''"))))
-(deftest italics (is (= "<span class='italic'>Italics</span>" (to-html "''Italics''"))))
-(deftest underlined (is (= "<span class='underline'>underlined</span>" (to-html "__underlined__"))))
-(deftest inline-pre (is (= "<div class='pre-inline'>Inline Pre</div>" (to-html "{{{Inline Pre}}}"))))
-(deftest block-pre (is (= "<div class='pre-block'>Block\nPre</div>" (to-html "{{{\nBlock\nPre\n}}}"))))
-(deftest href (is (= "<a href='href'>href</a>" (to-html "[[href]]"))))
-(deftest href-explained (is (= "<a href='href'>explained</a>" (to-html "[href explained]"))))
-
-(deftest list-numbered (is (= "<ol><li>Item</li></ol>" (to-html "1. Item\n"))))
-(deftest list-unordered (is (= "<ul><li>Item</li></ul>" (to-html "-- Item\n"))))
-
-(deftest multi-list-numbered (is (= "<ol><li>Item 1</li><li>Item 2</li></ol>" (to-html "1. Item 1\n1. Item 2\n"))))
-(deftest multi-list-unordered (is (= "<ul><li>Item 1</li><li>Item 2</li></ul>" (to-html "-- Item 1\n-- Item 2\n"))))
-
-(deftest list-numbered-with-markup
- (is (= "<ol><li>Item <span class='superscript'>ss</span> <span class='underline'>u</span> <span class='bold'>b</span> <span class='italic'>i</span> <a href='href'>href</a> <div class='pre-inline'>pre</div> 1</li></ol>"
- (to-html "1. Item ^ss^ __u__ '''b''' ''i'' [[href]] {{{pre}}} 1\n"))))
-(deftest list-unordered-with-markup
- (is (= "<ul><li>Item <span class='superscript'>ss</span> <span class='underline'>u</span> <span class='bold'>b</span> <span class='italic'>i</span> <a href='href'>href</a> <div class='pre-inline'>pre</div> 1</li></ul>"
- (to-html "-- Item ^ss^ __u__ '''b''' ''i'' [[href]] {{{pre}}} 1\n"))))
-
-(deftest multi-list-numbered-with-markup
- (is (= "<ol><li>Item <span class='superscript'>ss</span> <span class='underline'>u</span> <span class='bold'>b</span> <span class='italic'>i</span> <a href='href'>href</a> <div class='pre-inline'>pre</div> 1</li><li>Item <span class='superscript'>ss</span> <span class='underline'>u</span> <span class='bold'>b</span> <span class='italic'>i</span> <a href='href'>href</a> <div class='pre-inline'>pre</div> 1</li></ol>"
- (to-html "1. Item ^ss^ __u__ '''b''' ''i'' [[href]] {{{pre}}} 1\n1. Item ^ss^ __u__ '''b''' ''i'' [[href]] {{{pre}}} 1\n"))))
-(deftest multi-list-unordered-with-markup
- (is (= "<ul><li>Item <span class='superscript'>ss</span> <span class='underline'>u</span> <span class='bold'>b</span> <span class='italic'>i</span> <a href='href'>href</a> <div class='pre-inline'>pre</div> 1</li><li>Item <span class='superscript'>ss</span> <span class='underline'>u</span> <span class='bold'>b</span> <span class='italic'>i</span> <a href='href'>href</a> <div class='pre-inline'>pre</div> 1</li></ul>"
- (to-html "-- Item ^ss^ __u__ '''b''' ''i'' [[href]] {{{pre}}} 1\n-- Item ^ss^ __u__ '''b''' ''i'' [[href]] {{{pre}}} 1\n"))))
-
View
61 test/com/lithinos/amotoen/test/parsely.clj
@@ -1,61 +0,0 @@
-; 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.parsely
- (:use [com.lithinos.amotoen.core] :reload-all)
- (:use [clojure.test])
- (:use [clojure.pprint]))
-
-; :expr #{"x" ["(" :expr* ")"]}
-(def g1 {:expr '(| \x [\( (* :expr) \)])})
-
-(deftest g11 (is (= (to-ast :expr g1 (wrap-string "x")) '{:expr \x})))
-(deftest g12 (is (= (to-ast :expr g1 (wrap-string "()")) '{:expr [\( () \)]})))
-(deftest g13 (is (= (to-ast :expr g1 (wrap-string "(xx)")) '{:expr [\( ({:expr \x} {:expr \x}) \)]})))
-(deftest g14 (is (= (to-ast :expr g1 (wrap-string "((x)())")) '{:expr [\( ({:expr [\( {:expr \x} \)]} {:expr [\( () \)]}) \)]})))
-
-; Different parse trees
-; :expr #{"x" :expr-rep}
-; :expr-rep ["(" :expr* ")"]
-(def g2 {:expr '(| \x [\( (* :expr) \)])})
-(def g3 {:expr '(| \x :expr-rep)
- :expr-rep [\( '(* :expr) \)]})
-(deftest g2_vs_g3 (let [r2 (to-ast :expr g2 (wrap-string "()"))
- r3 (to-ast :expr g3 (wrap-string "()"))]
- (is (= r2 {:expr [\( () \)]}))
- (is (= r3 {:expr {:expr-rep [\( () \)]}}))
- (is (not (= r2 r3)))))
-
-; Force g2 and g3 to result in the same AST
- ; Admittedly, this is uglier than I wish it were
-(def g3prime {:expr (list '| \x (list 'f #(first (vals %)) :expr-rep))
- :expr-rep [\( '(* :expr) \)]})
-(deftest g2_vs_g3prime (let [r2 (to-ast :expr g2 (wrap-string "()"))
- r3 (to-ast :expr g3prime (wrap-string "()"))]
- (is (= r2 {:expr [\( () \)]}))
- (is (= r3 {:expr [\( () \)]}))
- (is (= r2 r3))))
-
-(def p #(to-ast :expr g1 (wrap-string %)))
-
-(deftest conform (is (not (nil? (p "(x(x))")))))
-(deftest malformed (is (nil? (p "a(zldxn(dez)"))))
-
-#_(doseq [g [ {:expr '(| \x \newline [\( (* :expr) \)])}
- {:expr '(| [\( (* :expr) \)] \x \newline)}
- {:expr (list '| #"^((x))" [\( '(* :expr) \)] \newline)}]]
- (println)
- (pprint g)
- (def p #(to-ast :expr g (wrap-string %)))
- (let [line (apply str "\n" (repeat 10 "((x))"))
- input (str "(" (apply str (repeat 1000 line)) ")")]
- (println "Size of input:" (count input))
- ;(time (fastest-theoretical-by-single input))
- (time (p input))
- (time (p (str "(" input ")")))))
-

0 comments on commit 29e5713

Please sign in to comment.