module Hydra.Impl.Haskell.Sources.Util.Codetree.Ast where

import Hydra.All
import Hydra.Impl.Haskell.Dsl.Types as Types
import Hydra.Impl.Haskell.Dsl.Standard
import Hydra.Impl.Haskell.Sources.Core


codetreeAstModule :: Module Meta
codetreeAstModule :: Module Meta
codetreeAstModule = forall m.
Namespace -> [Element m] -> [Module m] -> Maybe String -> Module m
Module Namespace
ns [Element Meta]
elements [] forall a b. (a -> b) -> a -> b
$
    forall a. a -> Maybe a
Just String
"A model which provides a common syntax tree for Hydra serializers"
  where
    ns :: Namespace
ns = String -> Namespace
Namespace String
"hydra/util/codetree/ast"
    def :: String -> Type m -> Element m
def = forall m. Namespace -> String -> Type m -> Element m
datatype Namespace
ns
    ast :: String -> Type m
ast = forall m. Namespace -> String -> Type m
nsref Namespace
ns

    elements :: [Element Meta]
elements = [

      forall {m}. String -> Type m -> Element m
def String
"Associativity" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"Operator associativity" forall a b. (a -> b) -> a -> b
$
        forall m. [String] -> Type m
enum [String
"none", String
"left", String
"right", String
"both"],

      forall {m}. String -> Type m -> Element m
def String
"BlockStyle" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"Formatting option for code blocks" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"indent"forall m. String -> Type m -> FieldType m
>: forall m. Type m
boolean,
          String
"newlineBeforeContent"forall m. String -> Type m -> FieldType m
>: forall m. Type m
boolean,
          String
"newlineAfterContent"forall m. String -> Type m -> FieldType m
>: forall m. Type m
boolean],

      forall {m}. String -> Type m -> Element m
def String
"BracketExpr" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"An expression enclosed by brackets" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"brackets"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Brackets",
          String
"enclosed"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Expr",
          String
"style"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"BlockStyle"],

      forall {m}. String -> Type m -> Element m
def String
"Brackets" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"Matching open and close bracket symbols" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"open"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Symbol",
          String
"close"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Symbol"],

      forall {m}. String -> Type m -> Element m
def String
"Expr" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"An abstract expression" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
union [
          String
"const"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Symbol",
          String
"op"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"OpExpr",
          String
"brackets"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"BracketExpr"],

      forall {m}. String -> Type m -> Element m
def String
"Op" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"An operator symbol" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"symbol"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Symbol",
          String
"padding"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Padding",
          String
"precedence"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Precedence",
          String
"associativity"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Associativity"],

      forall {m}. String -> Type m -> Element m
def String
"OpExpr" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"An operator expression" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"op"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Op",
          String
"lhs"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Expr",
          String
"rhs"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Expr"],

      forall {m}. String -> Type m -> Element m
def String
"Padding" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"Left and right padding for an operator" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"left"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Ws",
          String
"right"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
ast String
"Ws"],

      forall {m}. String -> Type m -> Element m
def String
"Precedence" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"Operator precedence" forall a b. (a -> b) -> a -> b
$
        forall m. Type m
int32,

      forall {m}. String -> Type m -> Element m
def String
"Symbol" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"Any symbol"
        forall m. Type m
string,

      forall {m}. String -> Type m -> Element m
def String
"Ws" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"One of several classes of whitespace" forall a b. (a -> b) -> a -> b
$
        forall m. [String] -> Type m
enum [String
"none", String
"space", String
"break", String
"breakAndIndent", String
"doubleBreak"]]