File tree 13 files changed +71
-14
lines changed
13 files changed +71
-14
lines changed Original file line number Diff line number Diff line change 35
35
- uses : actions/checkout@master
36
36
- run : cargo check --all-targets --all-features
37
37
38
+ compile-no-std :
39
+ runs-on : ubuntu-latest
40
+ steps :
41
+ - name : Set up Rust
42
+ uses : hecrj/setup-rust-action@v1
43
+ with :
44
+ targets : ' thumbv6m-none-eabi'
45
+ - uses : actions/checkout@master
46
+ - run : cargo check --no-default-features --target thumbv6m-none-eabi
47
+
38
48
test :
39
49
strategy :
40
50
matrix :
Original file line number Diff line number Diff line change @@ -13,12 +13,15 @@ include = [
13
13
" Cargo.toml" ,
14
14
]
15
15
edition = " 2018"
16
+ resolver = " 2"
16
17
17
18
[lib ]
18
19
name = " sqlparser"
19
20
path = " src/lib.rs"
20
21
21
22
[features ]
23
+ default = [" std" ]
24
+ std = []
22
25
# Enable JSON output in the `cli` example:
23
26
json_example = [" serde_json" , " serde" ]
24
27
Original file line number Diff line number Diff line change 10
10
// See the License for the specific language governing permissions and
11
11
// limitations under the License.
12
12
13
- use std:: fmt;
13
+ #[ cfg( not( feature = "std" ) ) ]
14
+ use alloc:: boxed:: Box ;
15
+ use core:: fmt;
14
16
15
17
#[ cfg( feature = "serde" ) ]
16
18
use serde:: { Deserialize , Serialize } ;
Original file line number Diff line number Diff line change 13
13
//! AST types specific to CREATE/ALTER variants of [Statement]
14
14
//! (commonly referred to as Data Definition Language, or DDL)
15
15
16
- use std:: fmt;
16
+ #[ cfg( not( feature = "std" ) ) ]
17
+ use alloc:: { boxed:: Box , string:: ToString , vec:: Vec } ;
18
+ use core:: fmt;
17
19
18
20
#[ cfg( feature = "serde" ) ]
19
21
use serde:: { Deserialize , Serialize } ;
Original file line number Diff line number Diff line change @@ -18,7 +18,13 @@ mod operator;
18
18
mod query;
19
19
mod value;
20
20
21
- use std:: fmt;
21
+ #[ cfg( not( feature = "std" ) ) ]
22
+ use alloc:: {
23
+ boxed:: Box ,
24
+ string:: { String , ToString } ,
25
+ vec:: Vec ,
26
+ } ;
27
+ use core:: fmt;
22
28
23
29
#[ cfg( feature = "serde" ) ]
24
30
use serde:: { Deserialize , Serialize } ;
Original file line number Diff line number Diff line change 10
10
// See the License for the specific language governing permissions and
11
11
// limitations under the License.
12
12
13
- use std :: fmt;
13
+ use core :: fmt;
14
14
15
15
#[ cfg( feature = "serde" ) ]
16
16
use serde:: { Deserialize , Serialize } ;
Original file line number Diff line number Diff line change 10
10
// See the License for the specific language governing permissions and
11
11
// limitations under the License.
12
12
13
+ #[ cfg( not( feature = "std" ) ) ]
14
+ use alloc:: { boxed:: Box , vec:: Vec } ;
15
+
13
16
#[ cfg( feature = "serde" ) ]
14
17
use serde:: { Deserialize , Serialize } ;
15
18
Original file line number Diff line number Diff line change 10
10
// See the License for the specific language governing permissions and
11
11
// limitations under the License.
12
12
13
- use std:: fmt;
13
+ #[ cfg( not( feature = "std" ) ) ]
14
+ use alloc:: string:: String ;
15
+ use core:: fmt;
14
16
15
17
#[ cfg( feature = "bigdecimal" ) ]
16
18
use bigdecimal:: BigDecimal ;
Original file line number Diff line number Diff line change @@ -20,8 +20,8 @@ mod postgresql;
20
20
mod snowflake;
21
21
mod sqlite;
22
22
23
- use std :: any:: { Any , TypeId } ;
24
- use std :: fmt:: Debug ;
23
+ use core :: any:: { Any , TypeId } ;
24
+ use core :: fmt:: Debug ;
25
25
26
26
pub use self :: ansi:: AnsiDialect ;
27
27
pub use self :: generic:: GenericDialect ;
Original file line number Diff line number Diff line change 32
32
//!
33
33
//! println!("AST: {:?}", ast);
34
34
//! ```
35
+
36
+ #![ cfg_attr( not( feature = "std" ) , no_std) ]
35
37
#![ allow( clippy:: upper_case_acronyms) ]
36
38
39
+ #[ cfg( not( feature = "std" ) ) ]
40
+ extern crate alloc;
41
+
37
42
pub mod ast;
38
43
#[ macro_use]
39
44
pub mod dialect;
Original file line number Diff line number Diff line change 12
12
13
13
//! SQL Parser
14
14
15
- use std:: error:: Error ;
16
- use std:: fmt;
15
+ #[ cfg( not( feature = "std" ) ) ]
16
+ use alloc:: {
17
+ boxed:: Box ,
18
+ format,
19
+ string:: { String , ToString } ,
20
+ vec,
21
+ vec:: Vec ,
22
+ } ;
23
+ use core:: fmt;
17
24
18
25
use log:: debug;
19
26
@@ -81,7 +88,8 @@ impl fmt::Display for ParserError {
81
88
}
82
89
}
83
90
84
- impl Error for ParserError { }
91
+ #[ cfg( feature = "std" ) ]
92
+ impl std:: error:: Error for ParserError { }
85
93
86
94
pub struct Parser < ' a > {
87
95
tokens : Vec < Token > ,
Original file line number Diff line number Diff line change 16
16
//
17
17
// Integration tests (i.e. everything under `tests/`) import this
18
18
// via `tests/test_utils/mod.rs`.
19
- use std:: fmt:: Debug ;
19
+
20
+ #[ cfg( not( feature = "std" ) ) ]
21
+ use alloc:: {
22
+ boxed:: Box ,
23
+ string:: { String , ToString } ,
24
+ vec,
25
+ vec:: Vec ,
26
+ } ;
27
+ use core:: fmt:: Debug ;
20
28
21
29
use crate :: ast:: * ;
22
30
use crate :: dialect:: * ;
Original file line number Diff line number Diff line change 16
16
//!
17
17
//! The tokens then form the input for the parser, which outputs an Abstract Syntax Tree (AST).
18
18
19
- use std:: fmt;
20
- use std:: iter:: Peekable ;
21
- use std:: str:: Chars ;
19
+ #[ cfg( not( feature = "std" ) ) ]
20
+ use alloc:: {
21
+ borrow:: ToOwned ,
22
+ format,
23
+ string:: { String , ToString } ,
24
+ vec,
25
+ vec:: Vec ,
26
+ } ;
27
+ use core:: fmt;
28
+ use core:: iter:: Peekable ;
29
+ use core:: str:: Chars ;
22
30
23
31
#[ cfg( feature = "serde" ) ]
24
32
use serde:: { Deserialize , Serialize } ;
You can’t perform that action at this time.
0 commit comments