MSON AST Source Map
January 15, 2015 · View on GitHub
This document defines serialization formats for MSON AST Source Map.
Version
Refer to the MSON AST Definition – the version of the Source Map conforms to the version of MSON AST.
Quick Links
Source Map Definition
Following is the description of MSON Source map media types using the MSON syntax.
Source Map (array)
Set of indices to source code blocks. The blocks may be non-continuous.
Each block is defined by a zero-based index of its first character and the number of following characters.
Items
- (array, fixed) - A tuple defining position of a block in the source code
- 1219 (number) - Zero-based index of the first character
- 30 (number) - Number of the characters in the block
Named Type Source Map (object)
Source map of the Named Type
Properties
name(Source Map) - Source map of name of the typetypeDefinition(Source Map) - Source map of ancestor type definitionsections(array[Type Section Source Map]) - Ordered array of type section source maps
Type Section Source Map (enum)
Source map of the Type Section
Members
- (Source Map) - Source map of content for
blockDescriptionor a literal value ofsampleanddefaultclasses - (array[Element Source Map]) - Ordered array of elements (
memberType,sampleordefaultclasses only)
Element Source Map (enum)
Source map of the Element
Members
- (Property Member Source Map) - Source map for
propertyclass - (Value Member Source Map) - Source map for
valueclass - (Mixin Source Map) - Source map for
mixinclass - (One Of Source Map) - Source map for
oneOfclass - (Elements Source Map) - Source map for
groupclass
Elements Source Map (array[Element Source Map])
Source map of the Elements
Property Member Source Map (Value Member Source Map)
Source map of the Property Member
Properties
name(Source Map) - Source map of the property name
Value Member Source Map (object)
Source map of the Value Member
Properties
description(Source Map) - Source map of inline descriptionvalueDefinition(Source Map) - Source map of member's value definitionsections(array[Type Section Source Map]) - List of member's type section source maps
Mixin Source Map (Source Map)
Source map of the Mixin
One Of Source Map (Elements Source Map)
Source map of the One Of
Media Types
The Base type media type is application/vnd.mson.sourcemap.
Serialization formats
Two supported, feature-equal, serialization formats are JSON and YAML:
application/vnd.mson.sourcemap+jsonapplication/vnd.mson.sourcemap+yaml
Example: JSON Serialization
application/vnd.mson.sourcemap+json; version=2.0
{
"name": [
[0, 16]
],
"typeDefinition": [
[0, 16]
],
"sections": [
[
{
"name": [
[18, 17]
],
"description": [],
"valueDefinition": [
[18, 17]
],
"sections": []
},
{
"name": [
[37, 19]
],
"description": [],
"valueDefinition": [
[37, 19]
],
"sections": []
},
{
"name": [
[58, 22]
],
"description": [],
"valueDefinition": [
[58, 22]
],
"sections": []
},
{
"name": [
[82, 18]
],
"description": [],
"valueDefinition": [
[82, 18]
],
"sections": []
},
{
"name": [
[102, 15]
],
"description": [],
"valueDefinition": [
[102, 15]
],
"sections": [
[
{
"description": [],
"valueDefinition": [
[123, 2]
],
"sections": []
},
{
"description": [],
"valueDefinition": [
[131, 2]
],
"sections": []
},
{
"description": [],
"valueDefinition": [
[137, 4]
],
"sections": []
}
]
]
}
]
]
}
NOTE: This example uses the same MSON AST as used in the MSON AST Definition example.