mw-parser.generate
Generate Clojure source from simplified parse trees.
generate-action
(generate-action tree others)
From this tree
, assumed to be a syntactically correct action, generate and return the appropriate clojure fragment.
generate-condition
(generate-condition tree)
From this tree
, assumed to be a syntactically correct condition clause, generate and return the appropriate clojure fragment.
generate-conditions
(generate-conditions tree)
From this tree
, assumed to be a syntactically correct conditions clause, generate and return the appropriate clojure fragment.
generate-conjunct-condition
(generate-conjunct-condition tree)
From this tree
, assumed to be a syntactically conjunct correct condition clause, generate and return the appropriate clojure fragment.
generate-disjunct-condition
(generate-disjunct-condition tree)
From this tree
, assumed to be a syntactically correct disjunct condition clause, generate and return the appropriate clojure fragment.
generate-disjunct-property-condition
(generate-disjunct-property-condition tree)
(generate-disjunct-property-condition _tree property qualifier expression)
From this tree
, assumed to be a syntactically property condition clause where the expression is a a disjunction, generate and return the appropriate clojure fragment. TODO: this is definitely still wrong!
generate-disjunct-value
(generate-disjunct-value tree)
Generate a disjunct value. Essentially what we need here is to generate a flat list of values, since the member
has already been taken care of.
generate-multiple-actions
(generate-multiple-actions tree)
From this tree
, assumed to be one or more syntactically correct actions, generate and return the appropriate clojure fragment.
generate-neighbours-condition
(generate-neighbours-condition tree)
(generate-neighbours-condition tree quantifier-type)
(generate-neighbours-condition comp1 quantity property-condition distance)
(generate-neighbours-condition comp1 quantity property-condition)
Generate code for a condition which refers to neighbours.
generate-numeric-expression
(generate-numeric-expression tree)
From this tree
, assumed to be a syntactically correct numeric expression, generate and return the appropriate clojure fragment.
generate-probable-action
(generate-probable-action tree)
(generate-probable-action tree others)
From this tree
, assumed to be a syntactically correct probable action, generate and return the appropriate clojure fragment.
generate-property-condition
(generate-property-condition tree)
(generate-property-condition tree expression-type)
From this tree
, assumed to be a syntactically property condition clause, generate and return the appropriate clojure fragment.
generate-qualifier
(generate-qualifier tree)
From this tree
, assumed to be a syntactically correct qualifier, generate and return the appropriate clojure fragment.
generate-ranged-property-condition
(generate-ranged-property-condition tree property expression)
From this tree
, assumed to be a syntactically property condition clause for this property
where the expression
is a numeric range, generate and return the appropriate clojure fragment.
generate-rule
(generate-rule tree)
From this tree
, assumed to be a syntactically correct rule specification, generate and return the appropriate rule as a function of two arguments.
generate-simple-action
(generate-simple-action tree)
(generate-simple-action tree others)
From this tree
, assumed to be a syntactically correct simple action, generate and return the appropriate clojure fragment.
generate-within-condition
(generate-within-condition tree)
(generate-within-condition tree quantifier-type)
Generate code for a condition which refers to neighbours within a specified distance. NOTE THAT there’s clearly masses of commonality between this and generate-neighbours-condition
, and that some refactoring is almost certainly desirable. It may be that it’s better to simplify a NEIGHBOURS-CONDITION
into a WITHIN-CONDITION
in the simplification stage.