discret 0.6.2

A backend to create peer to peer (P2P) applications, using a GraphQL inspired syntax
Documentation
// add DEFAULT to be used with the ifnull() sqlite function
// partial index every entity id

WHITESPACE = _{ " " | "\t" | "\r" | "\n" }
COMMENT    = _{ "//" ~ (!NEWLINE ~ ANY)* ~ NEWLINE }

identifier = @{ (LETTER | NUMBER | "_")+ }

namespace_entity = @{ (LETTER | NUMBER | "_" | ".")+ }

deprecated = @{ ^"@deprecated" }
comma      =  { "," }

deprecable_identifier = { deprecated? ~ identifier }

datamodel = { SOI ~ namespace* ~ EOI }
entity    = { deprecable_identifier ~ entity_param? ~ "{" ~ entry ~ (comma ~ entry)* ~ comma? ~ "}" }
namespace = { identifier? ~ "{" ~ entity* ~ "}" }

entity_param    = {
    "(" ~ ")"
  | "(" ~ disable_feature ~ (comma ~ disable_feature)* ~ comma? ~ ")"
}
disable_feature = { no_full_text_index }

no_full_text_index = { "no_full_text_index" }

nullable      = { ^"nullable" }
default       = { ^"default" ~ default_value }
default_value = { float | integer | boolean | string }
scalar_type   = { ^"Integer" | ^"Float" | ^"Boolean" | ^"String" | ^"Base64" | ^"Json" }
scalar_field  = { scalar_type ~ (nullable | default)? }
entity_array  = { "[" ~ namespace_entity ~ "]" ~ (nullable)? }
entity_field  = { namespace_entity ~ (nullable)? }
field         = { deprecable_identifier ~ ":" ~ (entity_array | scalar_field | entity_field) }

index = { ^"index" ~ "(" ~ identifier ~ (comma ~ identifier)* ~ comma? ~ ")" }
entry = { index | field }

string = ${ "\"" ~ inner ~ "\"" }
inner  = @{ char* }
char   =  {
    !("\"" | "\\") ~ ANY
  | "\\" ~ ("\"" | "\\" | "/" | "b" | "f" | "n" | "r" | "t")
  | "\\" ~ ("u" ~ ASCII_HEX_DIGIT{4})
}

float = @{
    "-"? ~ ("0" | ASCII_NONZERO_DIGIT ~ ASCII_DIGIT*) ~ ("." ~ ASCII_DIGIT*) ~ (^"e" ~ ("+" | "-")? ~ ASCII_DIGIT+)?
}

integer = @{
    "-"? ~ ASCII_DIGIT+
}
boolean =  { ^"true" | ^"false" }