From 3dfc8f0258ab0884eef50cc8f33b8666cdb4c3cf Mon Sep 17 00:00:00 2001 From: johannst Date: Mon, 20 Nov 2023 23:28:40 +0000 Subject: deploy: 4e3898b34a5dbcfabbcf861998d915c261831b60 --- src/llvm_kaleidoscope_rs/codegen.rs.html | 649 +++++----- src/llvm_kaleidoscope_rs/lexer.rs.html | 435 ++++--- src/llvm_kaleidoscope_rs/lib.rs.html | 239 ++-- src/llvm_kaleidoscope_rs/llvm/basic_block.rs.html | 87 +- src/llvm_kaleidoscope_rs/llvm/builder.rs.html | 565 ++++---- src/llvm_kaleidoscope_rs/llvm/lljit.rs.html | 313 +++-- src/llvm_kaleidoscope_rs/llvm/mod.rs.html | 153 ++- src/llvm_kaleidoscope_rs/llvm/module.rs.html | 431 ++++--- src/llvm_kaleidoscope_rs/llvm/pass_manager.rs.html | 155 ++- src/llvm_kaleidoscope_rs/llvm/type_.rs.html | 125 +- src/llvm_kaleidoscope_rs/llvm/value.rs.html | 499 ++++---- src/llvm_kaleidoscope_rs/parser.rs.html | 1345 ++++++++++---------- 12 files changed, 2493 insertions(+), 2503 deletions(-) (limited to 'src') diff --git a/src/llvm_kaleidoscope_rs/codegen.rs.html b/src/llvm_kaleidoscope_rs/codegen.rs.html index f802910..96150db 100644 --- a/src/llvm_kaleidoscope_rs/codegen.rs.html +++ b/src/llvm_kaleidoscope_rs/codegen.rs.html @@ -1,326 +1,326 @@ -codegen.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160
-161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-211
-212
-213
-214
-215
-216
-217
-218
-219
-220
-221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232
-233
-234
-235
-236
-237
-238
-239
-240
-241
-242
-243
-244
-245
-246
-247
-248
-249
-250
-251
-252
-253
-254
-255
-256
-257
-258
-259
-260
-261
-262
-263
-264
-265
-266
-267
-268
-269
-270
-271
-272
-273
-274
-275
-276
-277
-278
-279
-280
-281
-282
-283
-284
-285
-286
-287
-288
-289
-290
-291
-292
-293
-294
-295
-296
-297
-298
-299
-300
-301
-302
-303
-304
-305
-306
-307
-308
-309
-310
-311
-312
-313
-314
-315
-316
-317
-318
-319
-320
-321
-322
-
use std::collections::HashMap;
+codegen.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+
use std::collections::HashMap;
 
 use crate::llvm::{FnValue, FunctionPassManager, IRBuilder, Module, Value};
 use crate::parser::{ExprAST, FunctionAST, PrototypeAST};
@@ -642,5 +642,4 @@
         Some(callee)
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/lexer.rs.html b/src/llvm_kaleidoscope_rs/lexer.rs.html index 240080c..61bbe5f 100644 --- a/src/llvm_kaleidoscope_rs/lexer.rs.html +++ b/src/llvm_kaleidoscope_rs/lexer.rs.html @@ -1,210 +1,210 @@ -lexer.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160
-161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-
#[derive(Debug, PartialEq)]
+lexer.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+
#[derive(Debug, PartialEq)]
 pub enum Token {
     Eof,
     Def,
@@ -318,11 +318,11 @@
     }
 }
 
-#[cfg(test)]
+#[cfg(test)]
 mod test {
     use super::{Lexer, Token};
 
-    #[test]
+    #[test]
     fn test_identifier() {
         let mut lex = Lexer::new("a b c".chars());
         assert_eq!(Token::Identifier("a".into()), lex.gettok());
@@ -331,7 +331,7 @@
         assert_eq!(Token::Eof, lex.gettok());
     }
 
-    #[test]
+    #[test]
     fn test_keyword() {
         let mut lex = Lexer::new("def extern".chars());
         assert_eq!(Token::Def, lex.gettok());
@@ -339,7 +339,7 @@
         assert_eq!(Token::Eof, lex.gettok());
     }
 
-    #[test]
+    #[test]
     fn test_number() {
         let mut lex = Lexer::new("12.34".chars());
         assert_eq!(Token::Number(12.34f64), lex.gettok());
@@ -356,7 +356,7 @@
         assert_eq!(Token::Eof, lex.gettok());
     }
 
-    #[test]
+    #[test]
     fn test_comment() {
         let mut lex = Lexer::new("# some comment".chars());
         assert_eq!(Token::Eof, lex.gettok());
@@ -367,7 +367,7 @@
         assert_eq!(Token::Eof, lex.gettok());
     }
 
-    #[test]
+    #[test]
     fn test_chars() {
         let mut lex = Lexer::new("a+b-c".chars());
         assert_eq!(Token::Identifier("a".into()), lex.gettok());
@@ -378,7 +378,7 @@
         assert_eq!(Token::Eof, lex.gettok());
     }
 
-    #[test]
+    #[test]
     fn test_whitespaces() {
         let mut lex = Lexer::new("    +a  b      c!    ".chars());
         assert_eq!(Token::Char('+'), lex.gettok());
@@ -395,7 +395,7 @@
         assert_eq!(Token::Eof, lex.gettok());
     }
 
-    #[test]
+    #[test]
     fn test_ite() {
         let mut lex = Lexer::new("if then else".chars());
         assert_eq!(Token::If, lex.gettok());
@@ -403,12 +403,11 @@
         assert_eq!(Token::Else, lex.gettok());
     }
 
-    #[test]
+    #[test]
     fn test_for() {
         let mut lex = Lexer::new("for in".chars());
         assert_eq!(Token::For, lex.gettok());
         assert_eq!(Token::In, lex.gettok());
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/lib.rs.html b/src/llvm_kaleidoscope_rs/lib.rs.html index acd8915..938b2ac 100644 --- a/src/llvm_kaleidoscope_rs/lib.rs.html +++ b/src/llvm_kaleidoscope_rs/lib.rs.html @@ -1,115 +1,115 @@ -lib.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-
use std::convert::TryFrom;
+lib.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+
use std::convert::TryFrom;
 
 pub mod codegen;
 pub mod lexer;
@@ -122,7 +122,7 @@
 /// Small C string on the stack with fixed size [`SMALL_STR_SIZE`].
 ///
 /// This is specially crafted to interact with the LLVM C API and get rid of some heap allocations.
-#[derive(Debug, PartialEq)]
+#[derive(Debug, PartialEq)]
 pub struct SmallCStr([u8; SMALL_STR_SIZE]);
 
 impl SmallCStr {
@@ -164,12 +164,12 @@
     B(B),
 }
 
-#[cfg(test)]
+#[cfg(test)]
 mod test {
     use super::{SmallCStr, SMALL_STR_SIZE};
     use std::convert::TryInto;
 
-    #[test]
+    #[test]
     fn test_create() {
         let src = "\x30\x31\x32\x33";
         let scs = SmallCStr::new(&src).unwrap();
@@ -183,7 +183,7 @@
         );
     }
 
-    #[test]
+    #[test]
     fn test_contain_null() {
         let src = "\x30\x00\x32\x33";
         let scs = SmallCStr::new(&src);
@@ -194,7 +194,7 @@
         assert_eq!(scs, None);
     }
 
-    #[test]
+    #[test]
     fn test_too_large() {
         let src = (0..SMALL_STR_SIZE).map(|_| 'a').collect::<String>();
         let scs = SmallCStr::new(&src);
@@ -205,7 +205,7 @@
         assert_eq!(scs, None);
     }
 
-    #[test]
+    #[test]
     fn test_try_into() {
         let src = "\x30\x31\x32\x33";
         let scs: Result<SmallCStr, ()> = src.try_into();
@@ -220,5 +220,4 @@
         assert!(scs.is_err());
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/llvm/basic_block.rs.html b/src/llvm_kaleidoscope_rs/llvm/basic_block.rs.html index 2370022..8da6d3e 100644 --- a/src/llvm_kaleidoscope_rs/llvm/basic_block.rs.html +++ b/src/llvm_kaleidoscope_rs/llvm/basic_block.rs.html @@ -1,50 +1,50 @@ -basic_block.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-
use llvm_sys::{core::LLVMGetBasicBlockParent, prelude::LLVMBasicBlockRef};
+basic_block.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+
use llvm_sys::{core::LLVMGetBasicBlockParent, prelude::LLVMBasicBlockRef};
 
 use std::marker::PhantomData;
 
 use super::FnValue;
 
 /// Wrapper for a LLVM Basic Block.
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone)]
 pub struct BasicBlock<'llvm>(LLVMBasicBlockRef, PhantomData<&'llvm ()>);
 
 impl<'llvm> BasicBlock<'llvm> {
@@ -59,7 +59,7 @@
     }
 
     /// Get the raw LLVM value reference.
-    #[inline]
+    #[inline]
     pub(super) fn bb_ref(&self) -> LLVMBasicBlockRef {
         self.0
     }
@@ -76,5 +76,4 @@
         FnValue::new(value_ref)
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/llvm/builder.rs.html b/src/llvm_kaleidoscope_rs/llvm/builder.rs.html index fad1867..8515cba 100644 --- a/src/llvm_kaleidoscope_rs/llvm/builder.rs.html +++ b/src/llvm_kaleidoscope_rs/llvm/builder.rs.html @@ -1,283 +1,283 @@ -builder.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160
-161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-211
-212
-213
-214
-215
-216
-217
-218
-219
-220
-221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232
-233
-234
-235
-236
-237
-238
-239
-240
-241
-242
-243
-244
-245
-246
-247
-248
-249
-250
-251
-252
-253
-254
-255
-256
-257
-258
-259
-260
-261
-262
-263
-264
-265
-266
-267
-268
-269
-270
-271
-272
-273
-274
-275
-276
-277
-278
-279
-
use llvm_sys::{
+builder.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+
use llvm_sys::{
     core::{
         LLVMAddIncoming, LLVMBuildBr, LLVMBuildCondBr, LLVMBuildFAdd, LLVMBuildFCmp, LLVMBuildFMul,
         LLVMBuildFSub, LLVMBuildPhi, LLVMBuildRet, LLVMBuildUIToFP, LLVMCreateBuilderInContext,
@@ -474,7 +474,7 @@
         let value_ref = unsafe {
             LLVMBuildCall2(
                 self.builder,
-                fn_value.ret_type(),
+                fn_value.fn_type(),
                 fn_value,
                 args.as_mut_ptr(),
                 args.len() as libc::c_uint,
@@ -556,5 +556,4 @@
         unsafe { LLVMDisposeBuilder(self.builder) }
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/llvm/lljit.rs.html b/src/llvm_kaleidoscope_rs/llvm/lljit.rs.html index 80be225..9d7c949 100644 --- a/src/llvm_kaleidoscope_rs/llvm/lljit.rs.html +++ b/src/llvm_kaleidoscope_rs/llvm/lljit.rs.html @@ -1,158 +1,158 @@ -lljit.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-
use llvm_sys::orc2::{
+lljit.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+
use llvm_sys::orc2::{
     lljit::{
         LLVMOrcCreateLLJIT, LLVMOrcLLJITAddLLVMIRModuleWithRT, LLVMOrcLLJITGetGlobalPrefix,
         LLVMOrcLLJITGetMainJITDylib, LLVMOrcLLJITLookup, LLVMOrcLLJITRef,
@@ -306,5 +306,4 @@
         };
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/llvm/mod.rs.html b/src/llvm_kaleidoscope_rs/llvm/mod.rs.html index 87756d4..800e533 100644 --- a/src/llvm_kaleidoscope_rs/llvm/mod.rs.html +++ b/src/llvm_kaleidoscope_rs/llvm/mod.rs.html @@ -1,78 +1,78 @@ -mod.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-
//! Safe wrapper around the LLVM C API.
+mod.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+
//! Safe wrapper around the LLVM C API.
 //!
 //! References returned from the LLVM API are tied to the `'llvm` lifetime which is bound to the
 //! context where the objects are created in.
@@ -146,5 +146,4 @@
         LLVMShutdown();
     };
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/llvm/module.rs.html b/src/llvm_kaleidoscope_rs/llvm/module.rs.html index 127ba39..8b441d5 100644 --- a/src/llvm_kaleidoscope_rs/llvm/module.rs.html +++ b/src/llvm_kaleidoscope_rs/llvm/module.rs.html @@ -1,214 +1,214 @@ -module.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160
-161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-
use llvm_sys::{
+module.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+
use llvm_sys::{
     core::{
         LLVMAddFunction, LLVMAppendBasicBlockInContext, LLVMCreateBasicBlockInContext,
         LLVMDisposeModule, LLVMDoubleTypeInContext, LLVMDumpModule, LLVMGetNamedFunction,
@@ -272,13 +272,13 @@
     }
 
     /// Get the raw LLVM context reference.
-    #[inline]
+    #[inline]
     pub(super) fn ctx(&self) -> LLVMContextRef {
         self.ctx
     }
 
     /// Get the raw LLVM module reference.
-    #[inline]
+    #[inline]
     pub(super) fn module(&self) -> LLVMModuleRef {
         self.module
     }
@@ -287,7 +287,7 @@
     ///
     /// If ownership of the raw reference is not transferred (eg to the JIT), memory will be leaked
     /// in case the reference is disposed explicitly with LLVMOrcDisposeThreadSafeModule.
-    #[inline]
+    #[inline]
     pub(super) fn into_raw_thread_safe_module(mut self) -> LLVMOrcThreadSafeModuleRef {
         let m = std::mem::replace(&mut self.module, std::ptr::null_mut());
 
@@ -418,5 +418,4 @@
         }
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/llvm/pass_manager.rs.html b/src/llvm_kaleidoscope_rs/llvm/pass_manager.rs.html index 968856f..f142650 100644 --- a/src/llvm_kaleidoscope_rs/llvm/pass_manager.rs.html +++ b/src/llvm_kaleidoscope_rs/llvm/pass_manager.rs.html @@ -1,79 +1,79 @@ -pass_manager.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-
use llvm_sys::{
+pass_manager.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+
use llvm_sys::{
     core::{
         LLVMCreateFunctionPassManagerForModule, LLVMDisposePassManager,
         LLVMInitializeFunctionPassManager, LLVMRunFunctionPassManager,
@@ -148,5 +148,4 @@
         }
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/llvm/type_.rs.html b/src/llvm_kaleidoscope_rs/llvm/type_.rs.html index 7df4f4d..6f713c1 100644 --- a/src/llvm_kaleidoscope_rs/llvm/type_.rs.html +++ b/src/llvm_kaleidoscope_rs/llvm/type_.rs.html @@ -1,62 +1,62 @@ -type_.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-
use llvm_sys::{
+type_.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+
use llvm_sys::{
     core::{LLVMConstReal, LLVMDumpType, LLVMGetTypeKind},
     prelude::LLVMTypeRef,
     LLVMTypeKind,
@@ -67,7 +67,7 @@
 use super::Value;
 
 /// Wrapper for a LLVM Type Reference.
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone)]
 #[repr(transparent)]
 pub struct Type<'llvm>(LLVMTypeRef, PhantomData<&'llvm ()>);
 
@@ -83,7 +83,7 @@
     }
 
     /// Get the raw LLVM type reference.
-    #[inline]
+    #[inline]
     pub(super) fn type_ref(&self) -> LLVMTypeRef {
         self.0
     }
@@ -114,5 +114,4 @@
         Value::new(value_ref)
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/llvm/value.rs.html b/src/llvm_kaleidoscope_rs/llvm/value.rs.html index 102c957..c3015d8 100644 --- a/src/llvm_kaleidoscope_rs/llvm/value.rs.html +++ b/src/llvm_kaleidoscope_rs/llvm/value.rs.html @@ -1,253 +1,253 @@ -value.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160
-161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-211
-212
-213
-214
-215
-216
-217
-218
-219
-220
-221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232
-233
-234
-235
-236
-237
-
#![allow(unused)]
+value.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+
#![allow(unused)]
 
 use llvm_sys::{
     analysis::{LLVMVerifierFailureAction, LLVMVerifyFunction},
     core::{
         LLVMAddIncoming, LLVMAppendExistingBasicBlock, LLVMCountBasicBlocks, LLVMCountParams,
-        LLVMDumpValue, LLVMGetParam, LLVMGetReturnType, LLVMGetValueKind, LLVMGetValueName2,
+        LLVMDumpValue, LLVMGetParam, LLVMGetValueKind, LLVMGetValueName2, LLVMGlobalGetValueType,
         LLVMIsAFunction, LLVMIsAPHINode, LLVMSetValueName2, LLVMTypeOf,
     },
     prelude::LLVMValueRef,
     LLVMTypeKind, LLVMValueKind,
 };
-
 use std::ffi::CStr;
 use std::marker::PhantomData;
 use std::ops::Deref;
@@ -256,7 +256,7 @@
 use super::Type;
 
 /// Wrapper for a LLVM Value Reference.
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone)]
 #[repr(transparent)]
 pub struct Value<'llvm>(LLVMValueRef, PhantomData<&'llvm ()>);
 
@@ -272,7 +272,7 @@
     }
 
     /// Get the raw LLVM value reference.
-    #[inline]
+    #[inline]
     pub(super) fn value_ref(&self) -> LLVMValueRef {
         self.0
     }
@@ -349,7 +349,7 @@
 }
 
 /// Wrapper for a LLVM Value Reference specialized for contexts where function values are needed.
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone)]
 #[repr(transparent)]
 pub struct FnValue<'llvm>(Value<'llvm>);
 
@@ -376,13 +376,15 @@
         FnValue(value)
     }
 
-    /// Get a type reference representing the return value of the given function value.
+    /// Get a type reference representing the function type (return + args) of the given function
+    /// value.
     ///
     /// # Panics
     ///
     /// Panics if LLVM API returns a `null` pointer.
-    pub fn ret_type(&self) -> Type<'llvm> {
-        let type_ref = unsafe { LLVMGetReturnType(LLVMTypeOf(self.value_ref())) };
+    pub fn fn_type(&self) -> Type<'llvm> {
+        // https://github.com/llvm/llvm-project/issues/72798
+        let type_ref = unsafe { LLVMGlobalGetValueType(self.value_ref()) };
         Type::new(type_ref)
     }
 
@@ -427,7 +429,7 @@
 }
 
 /// Wrapper for a LLVM Value Reference specialized for contexts where phi values are needed.
-#[derive(Copy, Clone)]
+#[derive(Copy, Clone)]
 #[repr(transparent)]
 pub struct PhiValue<'llvm>(Value<'llvm>);
 
@@ -472,5 +474,4 @@
         }
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file diff --git a/src/llvm_kaleidoscope_rs/parser.rs.html b/src/llvm_kaleidoscope_rs/parser.rs.html index 1751341..d73be84 100644 --- a/src/llvm_kaleidoscope_rs/parser.rs.html +++ b/src/llvm_kaleidoscope_rs/parser.rs.html @@ -1,660 +1,660 @@ -parser.rs - source
1
-2
-3
-4
-5
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15
-16
-17
-18
-19
-20
-21
-22
-23
-24
-25
-26
-27
-28
-29
-30
-31
-32
-33
-34
-35
-36
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79
-80
-81
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140
-141
-142
-143
-144
-145
-146
-147
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160
-161
-162
-163
-164
-165
-166
-167
-168
-169
-170
-171
-172
-173
-174
-175
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185
-186
-187
-188
-189
-190
-191
-192
-193
-194
-195
-196
-197
-198
-199
-200
-201
-202
-203
-204
-205
-206
-207
-208
-209
-210
-211
-212
-213
-214
-215
-216
-217
-218
-219
-220
-221
-222
-223
-224
-225
-226
-227
-228
-229
-230
-231
-232
-233
-234
-235
-236
-237
-238
-239
-240
-241
-242
-243
-244
-245
-246
-247
-248
-249
-250
-251
-252
-253
-254
-255
-256
-257
-258
-259
-260
-261
-262
-263
-264
-265
-266
-267
-268
-269
-270
-271
-272
-273
-274
-275
-276
-277
-278
-279
-280
-281
-282
-283
-284
-285
-286
-287
-288
-289
-290
-291
-292
-293
-294
-295
-296
-297
-298
-299
-300
-301
-302
-303
-304
-305
-306
-307
-308
-309
-310
-311
-312
-313
-314
-315
-316
-317
-318
-319
-320
-321
-322
-323
-324
-325
-326
-327
-328
-329
-330
-331
-332
-333
-334
-335
-336
-337
-338
-339
-340
-341
-342
-343
-344
-345
-346
-347
-348
-349
-350
-351
-352
-353
-354
-355
-356
-357
-358
-359
-360
-361
-362
-363
-364
-365
-366
-367
-368
-369
-370
-371
-372
-373
-374
-375
-376
-377
-378
-379
-380
-381
-382
-383
-384
-385
-386
-387
-388
-389
-390
-391
-392
-393
-394
-395
-396
-397
-398
-399
-400
-401
-402
-403
-404
-405
-406
-407
-408
-409
-410
-411
-412
-413
-414
-415
-416
-417
-418
-419
-420
-421
-422
-423
-424
-425
-426
-427
-428
-429
-430
-431
-432
-433
-434
-435
-436
-437
-438
-439
-440
-441
-442
-443
-444
-445
-446
-447
-448
-449
-450
-451
-452
-453
-454
-455
-456
-457
-458
-459
-460
-461
-462
-463
-464
-465
-466
-467
-468
-469
-470
-471
-472
-473
-474
-475
-476
-477
-478
-479
-480
-481
-482
-483
-484
-485
-486
-487
-488
-489
-490
-491
-492
-493
-494
-495
-496
-497
-498
-499
-500
-501
-502
-503
-504
-505
-506
-507
-508
-509
-510
-511
-512
-513
-514
-515
-516
-517
-518
-519
-520
-521
-522
-523
-524
-525
-526
-527
-528
-529
-530
-531
-532
-533
-534
-535
-536
-537
-538
-539
-540
-541
-542
-543
-544
-545
-546
-547
-548
-549
-550
-551
-552
-553
-554
-555
-556
-557
-558
-559
-560
-561
-562
-563
-564
-565
-566
-567
-568
-569
-570
-571
-572
-573
-574
-575
-576
-577
-578
-579
-580
-581
-582
-583
-584
-585
-586
-587
-588
-589
-590
-591
-592
-593
-594
-595
-596
-597
-598
-599
-600
-601
-602
-603
-604
-605
-606
-607
-608
-609
-610
-611
-612
-613
-614
-615
-616
-617
-618
-619
-620
-621
-622
-623
-624
-625
-626
-627
-628
-629
-630
-631
-632
-633
-634
-635
-636
-637
-638
-639
-640
-641
-642
-643
-644
-645
-646
-647
-648
-649
-650
-651
-652
-653
-654
-
use crate::lexer::{Lexer, Token};
-
-#[derive(Debug, PartialEq)]
+parser.rs - source
1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+145
+146
+147
+148
+149
+150
+151
+152
+153
+154
+155
+156
+157
+158
+159
+160
+161
+162
+163
+164
+165
+166
+167
+168
+169
+170
+171
+172
+173
+174
+175
+176
+177
+178
+179
+180
+181
+182
+183
+184
+185
+186
+187
+188
+189
+190
+191
+192
+193
+194
+195
+196
+197
+198
+199
+200
+201
+202
+203
+204
+205
+206
+207
+208
+209
+210
+211
+212
+213
+214
+215
+216
+217
+218
+219
+220
+221
+222
+223
+224
+225
+226
+227
+228
+229
+230
+231
+232
+233
+234
+235
+236
+237
+238
+239
+240
+241
+242
+243
+244
+245
+246
+247
+248
+249
+250
+251
+252
+253
+254
+255
+256
+257
+258
+259
+260
+261
+262
+263
+264
+265
+266
+267
+268
+269
+270
+271
+272
+273
+274
+275
+276
+277
+278
+279
+280
+281
+282
+283
+284
+285
+286
+287
+288
+289
+290
+291
+292
+293
+294
+295
+296
+297
+298
+299
+300
+301
+302
+303
+304
+305
+306
+307
+308
+309
+310
+311
+312
+313
+314
+315
+316
+317
+318
+319
+320
+321
+322
+323
+324
+325
+326
+327
+328
+329
+330
+331
+332
+333
+334
+335
+336
+337
+338
+339
+340
+341
+342
+343
+344
+345
+346
+347
+348
+349
+350
+351
+352
+353
+354
+355
+356
+357
+358
+359
+360
+361
+362
+363
+364
+365
+366
+367
+368
+369
+370
+371
+372
+373
+374
+375
+376
+377
+378
+379
+380
+381
+382
+383
+384
+385
+386
+387
+388
+389
+390
+391
+392
+393
+394
+395
+396
+397
+398
+399
+400
+401
+402
+403
+404
+405
+406
+407
+408
+409
+410
+411
+412
+413
+414
+415
+416
+417
+418
+419
+420
+421
+422
+423
+424
+425
+426
+427
+428
+429
+430
+431
+432
+433
+434
+435
+436
+437
+438
+439
+440
+441
+442
+443
+444
+445
+446
+447
+448
+449
+450
+451
+452
+453
+454
+455
+456
+457
+458
+459
+460
+461
+462
+463
+464
+465
+466
+467
+468
+469
+470
+471
+472
+473
+474
+475
+476
+477
+478
+479
+480
+481
+482
+483
+484
+485
+486
+487
+488
+489
+490
+491
+492
+493
+494
+495
+496
+497
+498
+499
+500
+501
+502
+503
+504
+505
+506
+507
+508
+509
+510
+511
+512
+513
+514
+515
+516
+517
+518
+519
+520
+521
+522
+523
+524
+525
+526
+527
+528
+529
+530
+531
+532
+533
+534
+535
+536
+537
+538
+539
+540
+541
+542
+543
+544
+545
+546
+547
+548
+549
+550
+551
+552
+553
+554
+555
+556
+557
+558
+559
+560
+561
+562
+563
+564
+565
+566
+567
+568
+569
+570
+571
+572
+573
+574
+575
+576
+577
+578
+579
+580
+581
+582
+583
+584
+585
+586
+587
+588
+589
+590
+591
+592
+593
+594
+595
+596
+597
+598
+599
+600
+601
+602
+603
+604
+605
+606
+607
+608
+609
+610
+611
+612
+613
+614
+615
+616
+617
+618
+619
+620
+621
+622
+623
+624
+625
+626
+627
+628
+629
+630
+631
+632
+633
+634
+635
+636
+637
+638
+639
+640
+641
+642
+643
+644
+645
+646
+647
+648
+649
+650
+651
+652
+653
+654
+
use crate::lexer::{Lexer, Token};
+
+#[derive(Debug, PartialEq)]
 pub enum ExprAST {
     /// Number - Expression class for numeric literals like "1.0".
     Number(f64),
@@ -688,11 +688,11 @@
 /// PrototypeAST - This class represents the "prototype" for a function,
 /// which captures its name, and its argument names (thus implicitly the number
 /// of arguments the function takes).
-#[derive(Debug, PartialEq, Clone)]
+#[derive(Debug, PartialEq, Clone)]
 pub struct PrototypeAST(pub String, pub Vec<String>);
 
 /// FunctionAST - This class represents a function definition itself.
-#[derive(Debug, PartialEq)]
+#[derive(Debug, PartialEq)]
 pub struct FunctionAST(pub PrototypeAST, pub ExprAST);
 
 /// Parse result with String as Error type (to be compliant with tutorial).
@@ -1090,7 +1090,7 @@
     }
 }
 
-#[cfg(test)]
+#[cfg(test)]
 mod test {
     use super::{ExprAST, FunctionAST, Parser, PrototypeAST};
     use crate::lexer::Lexer;
@@ -1105,14 +1105,14 @@
         p
     }
 
-    #[test]
+    #[test]
     fn parse_number() {
         let mut p = parser("13.37");
 
         assert_eq!(p.parse_num_expr(), Ok(ExprAST::Number(13.37f64)));
     }
 
-    #[test]
+    #[test]
     fn parse_variable() {
         let mut p = parser("foop");
 
@@ -1122,7 +1122,7 @@
         );
     }
 
-    #[test]
+    #[test]
     fn parse_if() {
         let mut p = parser("if 1 then 2 else 3");
 
@@ -1141,7 +1141,7 @@
         assert_eq!(p.parse_if_expr(), Ok(ExprAST::If { cond, then, else_ }));
     }
 
-    #[test]
+    #[test]
     fn parse_for() {
         let mut p = parser("for i = 1, 2, 3 in 4");
 
@@ -1163,7 +1163,7 @@
         );
     }
 
-    #[test]
+    #[test]
     fn parse_for_no_step() {
         let mut p = parser("for i = 1, 2 in 4");
 
@@ -1185,7 +1185,7 @@
         );
     }
 
-    #[test]
+    #[test]
     fn parse_primary() {
         let mut p = parser("1337 foop \n bla(123) \n if a then b else c \n for x=1,2 in 3");
 
@@ -1219,7 +1219,7 @@
         );
     }
 
-    #[test]
+    #[test]
     fn parse_binary_op() {
         // Operator before RHS has higher precedence, expected AST
         //
@@ -1245,7 +1245,7 @@
         assert_eq!(p.parse_expression(), Ok(binexpr_abc));
     }
 
-    #[test]
+    #[test]
     fn parse_binary_op2() {
         // Operator after RHS has higher precedence, expected AST
         //
@@ -1271,7 +1271,7 @@
         assert_eq!(p.parse_expression(), Ok(binexpr_abc));
     }
 
-    #[test]
+    #[test]
     fn parse_prototype() {
         let mut p = parser("foo(a,b)");
 
@@ -1280,7 +1280,7 @@
         assert_eq!(p.parse_prototype(), Ok(proto));
     }
 
-    #[test]
+    #[test]
     fn parse_definition() {
         let mut p = parser("def bar( arg0 , arg1 ) arg0 + arg1");
 
@@ -1297,7 +1297,7 @@
         assert_eq!(p.parse_definition(), Ok(func));
     }
 
-    #[test]
+    #[test]
     fn parse_extern() {
         let mut p = parser("extern baz()");
 
@@ -1306,5 +1306,4 @@
         assert_eq!(p.parse_extern(), Ok(proto));
     }
 }
-
-
\ No newline at end of file + \ No newline at end of file -- cgit v1.2.3