oson.annotation is a small language which is used in the language oson.
oson is a micro-language to describe the schema of JSON. It allows you to write down the JSON and the schema of JSON inside only one file(with annotation). oson is a subset of JSON-Schema, so it can be compiled to JSON-schema, it is inspired by "orderly" and annotation.
oson.annotation can be compiled to a JSON, which is also a part of JSON Schema with path: JSON Pointer (#/properties/somekey).
For more details, see oson/doc.md
A compiler can be found here:
oson.annotation.js
annotationObject
'@' annotation
annotation
annotationType
annotationType
unionType
basicType
unionType
'(' basicType ')' '|' unionType
'(' basicType ')'
basicType
basicTypePrefix basicTypeSuffix
basicTypePrefix
INTEGER_TYPE optionalRange
NUMBER_TYPE optionalRange
BOOLEAN_TYPE
NULL_TYPE
ANY_TYPE
STRING_TYPE optionalRange optionalPerlRegex
JSON_TYPE
'\*' optionalTypeTuple
optionalTypeTuple
unionType
#nothing
basicTypeSuffix
optionalEnumValues optionalDefaultValue
optionalEnumValues
'{' elements '}'
'{' '}'
#nothing
optionalDefaultValue
'=' json_value
#nothing
optionalRange
'[' json_number ',' json_number ']'
'[' json_number ',' ']'
'[' ',' json_number ']'
'[' ',' ']'
#nothing
optionalPerlRegex
REGEX
#nothing
elements
json_value
json_value ',' elements
json_value
json_string
json_number
TRUE
FALSE
NULL
json_number
NUMBER_LIT
json_array
'[' ']'
'[' elements ']'
json_object
'{' '}'
'{' members '}'
members
pair
pair ',' members
pair
STRING_LIT ':' json_value
json_string
STRING_LIT