mirror of
https://github.com/github/semantic.git
synced 2024-11-28 18:23:44 +03:00
24 lines
499 B
JavaScript
24 lines
499 B
JavaScript
function termFromJSON(json) {
|
|
return new Term({
|
|
extract: json.extract,
|
|
unwrap: new Syntax(json.unwrap, function(x) {
|
|
return termFromJSON(x);
|
|
})
|
|
});
|
|
}
|
|
|
|
function Term(object) {
|
|
this.range = object.extract;
|
|
this.unwrap = object.unwrap;
|
|
return this;
|
|
}
|
|
|
|
/// Term -> String -> DOM
|
|
function termToDOM(term, which, source) {
|
|
return rangeAndSyntaxToDOM(term.range, term.unwrap, source, function(term) {
|
|
return term.range;
|
|
}, function(term) {
|
|
return termToDOM(term, which, source);
|
|
});
|
|
}
|