Skip to content

Commit acfccc5

Browse files
committed
Add a JSON error emitter
1 parent e5bab5d commit acfccc5

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

src/libsyntax/errors/json.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
//! A JSON emitter for errors.
12+
13+
use codemap::{Span, CodeMap};
14+
use diagnostics::registry::Registry;
15+
use errors::{Level, DiagnosticBuilder, RenderSpan};
16+
use errors::emitter::Emitter;
17+
18+
use std::rc::Rc;
19+
20+
pub struct JsonEmitter {
21+
todo: i32
22+
}
23+
24+
impl JsonEmitter {
25+
pub fn basic() -> JsonEmitter {
26+
JsonEmitter {
27+
todo: 42,
28+
}
29+
}
30+
31+
pub fn stderr(registry: Option<Registry>,
32+
code_map: Rc<CodeMap>) -> JsonEmitter {
33+
JsonEmitter {
34+
todo: 42,
35+
}
36+
}
37+
}
38+
39+
impl Emitter for JsonEmitter {
40+
fn emit(&mut self, span: Option<Span>, msg: &str, code: Option<&str>, lvl: Level) {
41+
unimplemented!();
42+
43+
}
44+
45+
fn custom_emit(&mut self, sp: RenderSpan, msg: &str, lvl: Level) {
46+
unimplemented!();
47+
48+
}
49+
50+
fn emit_struct(&mut self, db: &DiagnosticBuilder) {
51+
unimplemented!();
52+
}
53+
}

src/libsyntax/errors/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ use std::rc::Rc;
2424
use term;
2525

2626
pub mod emitter;
27+
pub mod json;
2728

2829
#[derive(Clone)]
2930
pub enum RenderSpan {

0 commit comments

Comments
 (0)