implement more traits for Syntax

This commit is contained in:
강동윤 2018-12-30 13:06:13 +09:00
parent b437488082
commit f89a227d5e
2 changed files with 11 additions and 1 deletions

View File

@ -16,6 +16,7 @@ enum_kind = { version = "0.1", path ="../../macros/enum_kind" }
unicode-xid = "0.1"
log = { version = "0.4", features = ["release_max_level_debug"] }
either = { version = "1.4" }
serde = { version = "1", features = ["derive"] }
smallvec = "0.6.7"
lazy_static = "1"
regex = "1"

View File

@ -81,6 +81,7 @@ extern crate log;
extern crate swc_atoms;
extern crate enum_kind;
extern crate regex;
extern crate serde;
extern crate swc_common;
#[macro_use]
extern crate lazy_static;
@ -97,6 +98,7 @@ pub use self::{
lexer::input::{Input, SourceFileInput},
parser::*,
};
use serde::{Deserialize, Serialize};
use swc_common::errors::Handler;
#[macro_use]
@ -106,13 +108,20 @@ mod lexer;
mod parser;
mod token;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize)]
pub enum Syntax {
Es2019,
Jsx,
Typescript,
Tsx,
}
impl Default for Syntax{
fn default()->Self{
Syntax::Es2019
}
}
impl Syntax {
/// Should we pare jsx?
pub fn jsx(self) -> bool {