fixes and correct tests

This commit is contained in:
gluax 2022-04-04 15:31:08 -07:00
parent f6aa32da35
commit 80d97416cb
13 changed files with 748 additions and 198 deletions

View File

@ -17,6 +17,7 @@
use super::*; use super::*;
use leo_errors::{ParserError, Result}; use leo_errors::{ParserError, Result};
use leo_span::sym;
impl ParserContext<'_> { impl ParserContext<'_> {
/// Returns a [`ParsedInputFile`] struct filled with the data acquired in the file. /// Returns a [`ParsedInputFile`] struct filled with the data acquired in the file.
@ -49,10 +50,10 @@ impl ParserContext<'_> {
let mut definitions = Vec::new(); let mut definitions = Vec::new();
while let Some(SpannedToken { while let Some(SpannedToken {
token: Token::Ident(_), .. token: Token::Const | Token::Private | Token::Public | Token::Ident(_), ..
}) = self.peek_option() }) = self.peek_option()
{ {
definitions.push(self.parse_input_definition()?); definitions.push(self.parse_input_definition(section.name == sym::main)?);
} }
Ok(Section { Ok(Section {
@ -65,15 +66,16 @@ impl ParserContext<'_> {
/// Parses a single parameter definition: /// Parses a single parameter definition:
/// `<identifier> : <type> = <expression>;` /// `<identifier> : <type> = <expression>;`
/// Returns [`Definition`]. /// Returns [`Definition`].
pub fn parse_input_definition(&mut self) -> Result<Definition> { pub fn parse_input_definition(&mut self, is_main: bool) -> Result<Definition> {
let const_ = self.eat(Token::Const).is_some(); let const_ = self.eat(Token::Const).is_some();
let private = self.eat(Token::Private).is_some(); let private = self.eat(Token::Private).is_some();
let public = self.eat(Token::Public).is_some(); let public = self.eat(Token::Public).is_some();
match (const_, private, public) { match (const_, private, public) {
(true, false, false) | (false, true, false) | (false, false, true) => {} (true, false, false) | (false, true, false) | (false, false, true) if is_main => {}
(false, false, false) => return Err(ParserError::inputs_no_variable_type_specified().into()), (false, false, false) if is_main => return Err(ParserError::inputs_no_variable_type_specified().into()),
_ => return Err(ParserError::inputs_multpe_variable_types_specified().into()), _ if is_main => return Err(ParserError::inputs_multpe_variable_types_specified().into()),
_ => {}
} }
let name = self.expect_ident()?; let name = self.expect_ident()?;

View File

@ -11,6 +11,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const y: u32) {\\\"}\"}"
const_: true const_: true
private: false
public: false
mutable: false mutable: false
type_: type_:
IntegerType: U32 IntegerType: U32
@ -130,6 +132,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":9,\\\"line_stop\\\":9,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}"
const_: false const_: false
private: false
public: false
mutable: true mutable: true
type_: Boolean type_: Boolean
span: span:

View File

@ -11,6 +11,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}"
const_: false const_: false
private: false
public: false
mutable: true mutable: true
type_: type_:
IntegerType: U32 IntegerType: U32
@ -24,6 +26,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, const y: i32) {\\\"}\"}"
const_: true const_: true
private: false
public: false
mutable: false mutable: false
type_: type_:
IntegerType: I32 IntegerType: I32
@ -78,6 +82,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":18,\\\"col_stop\\\":19,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}"
const_: true const_: true
private: false
public: false
mutable: false mutable: false
type_: type_:
IntegerType: U32 IntegerType: U32
@ -91,6 +97,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":26,\\\"col_stop\\\":27,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(const x: u32, y: i32) {\\\"}\"}"
const_: false const_: false
private: false
public: false
mutable: true mutable: true
type_: type_:
IntegerType: I32 IntegerType: I32

View File

@ -53,6 +53,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":15,\\\"col_stop\\\":16,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function main(y: bool) -> bool {\\\"}\"}"
const_: false const_: false
private: false
public: false
mutable: true mutable: true
type_: Boolean type_: Boolean
span: span:

View File

@ -11,6 +11,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}"
const_: false const_: false
private: false
public: false
mutable: true mutable: true
type_: type_:
IntegerType: U32 IntegerType: U32
@ -24,6 +26,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) {\\\"}\"}"
const_: false const_: false
private: false
public: false
mutable: true mutable: true
type_: type_:
IntegerType: I32 IntegerType: I32

View File

@ -11,6 +11,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" identifier: "{\"name\":\"x\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":12,\\\"col_stop\\\":13,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}"
const_: false const_: false
private: false
public: false
mutable: true mutable: true
type_: type_:
IntegerType: U32 IntegerType: U32
@ -24,6 +26,8 @@ outputs:
- Variable: - Variable:
identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}" identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":20,\\\"col_stop\\\":21,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: u32, y: i32) -> u32 {\\\"}\"}"
const_: false const_: false
private: false
public: false
mutable: true mutable: true
type_: type_:
IntegerType: I32 IntegerType: I32

View File

@ -0,0 +1,5 @@
---
namespace: Input
expectation: Fail
outputs:
- "Error [EPAR0370000]: c0\n --> test:4:1\n |\n 4 | c0: bool = true; \n | ^^"

View File

@ -0,0 +1,295 @@
---
namespace: Input
expectation: Pass
outputs:
- sections:
- name: main
definitions:
- const_: true
private: false
public: false
type_: Boolean
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const a: bool = true; \\\"}\"}"
value:
Value:
Boolean:
- "true"
- span:
line_start: 4
line_stop: 4
col_start: 18
col_stop: 22
path: ""
content: "const a: bool = true; "
span:
line_start: 4
line_stop: 4
col_start: 10
col_stop: 14
path: ""
content: "const a: bool = true; "
- const_: true
private: false
public: false
type_:
IntegerType: U8
name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const b: u8 = 2; \\\"}\"}"
value:
Value:
Implicit:
- "2"
- span:
line_start: 5
line_stop: 5
col_start: 18
col_stop: 19
path: ""
content: "const b: u8 = 2; "
span:
line_start: 5
line_stop: 5
col_start: 10
col_stop: 12
path: ""
content: "const b: u8 = 2; "
- const_: true
private: false
public: false
type_: Field
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const c: field = 0; \\\"}\"}"
value:
Value:
Implicit:
- "0"
- span:
line_start: 6
line_stop: 6
col_start: 18
col_stop: 19
path: ""
content: "const c: field = 0; "
span:
line_start: 6
line_stop: 6
col_start: 10
col_stop: 15
path: ""
content: "const c: field = 0; "
- const_: true
private: false
public: false
type_: Group
name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const d: group = (0, 1)group; \\\"}\"}"
value:
Value:
Group:
Tuple:
x:
Number:
- "0"
- span:
line_start: 7
line_stop: 7
col_start: 19
col_stop: 20
path: ""
content: "const d: group = (0, 1)group; "
y:
Number:
- "1"
- span:
line_start: 7
line_stop: 7
col_start: 22
col_stop: 23
path: ""
content: "const d: group = (0, 1)group; "
span:
line_start: 7
line_stop: 7
col_start: 19
col_stop: 29
path: ""
content: "const d: group = (0, 1)group; "
span:
line_start: 7
line_stop: 7
col_start: 10
col_stop: 15
path: ""
content: "const d: group = (0, 1)group; "
- const_: true
private: false
public: false
type_: Address
name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":7,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
value:
Value:
Address:
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8
- span:
line_start: 8
line_stop: 8
col_start: 20
col_stop: 83
path: ""
content: "const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 8
line_stop: 8
col_start: 10
col_stop: 17
path: ""
content: "const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 3
line_stop: 3
col_start: 2
col_stop: 6
path: ""
content: "[main]"
- name: registers
definitions:
- const_: false
private: false
public: false
type_: Boolean
name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}"
value:
Value:
Boolean:
- "true"
- span:
line_start: 11
line_stop: 11
col_start: 13
col_stop: 17
path: ""
content: "r0: bool = true; "
span:
line_start: 11
line_stop: 11
col_start: 5
col_stop: 9
path: ""
content: "r0: bool = true; "
- const_: false
private: false
public: false
type_:
IntegerType: U8
name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}"
value:
Value:
Implicit:
- "2"
- span:
line_start: 12
line_stop: 12
col_start: 13
col_stop: 14
path: ""
content: "r1: u8 = 2; "
span:
line_start: 12
line_stop: 12
col_start: 5
col_stop: 7
path: ""
content: "r1: u8 = 2; "
- const_: false
private: false
public: false
type_: Field
name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}"
value:
Value:
Implicit:
- "0"
- span:
line_start: 13
line_stop: 13
col_start: 13
col_stop: 14
path: ""
content: "r2: field = 0; "
span:
line_start: 13
line_stop: 13
col_start: 5
col_stop: 10
path: ""
content: "r2: field = 0; "
- const_: false
private: false
public: false
type_: Group
name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}"
value:
Value:
Group:
Tuple:
x:
Number:
- "0"
- span:
line_start: 14
line_stop: 14
col_start: 14
col_stop: 15
path: ""
content: "r3: group = (0, 1)group; "
y:
Number:
- "1"
- span:
line_start: 14
line_stop: 14
col_start: 17
col_stop: 18
path: ""
content: "r3: group = (0, 1)group; "
span:
line_start: 14
line_stop: 14
col_start: 14
col_stop: 24
path: ""
content: "r3: group = (0, 1)group; "
span:
line_start: 14
line_stop: 14
col_start: 5
col_stop: 10
path: ""
content: "r3: group = (0, 1)group; "
- const_: false
private: false
public: false
type_: Address
name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
value:
Value:
Address:
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8
- span:
line_start: 15
line_stop: 15
col_start: 15
col_stop: 78
path: ""
content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 15
line_stop: 15
col_start: 5
col_stop: 12
path: ""
content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 10
line_stop: 10
col_start: 2
col_stop: 11
path: ""
content: "[registers]"

View File

@ -0,0 +1,295 @@
---
namespace: Input
expectation: Pass
outputs:
- sections:
- name: main
definitions:
- const_: false
private: false
public: true
type_: Boolean
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public a: bool = true; \\\"}\"}"
value:
Value:
Boolean:
- "true"
- span:
line_start: 4
line_stop: 4
col_start: 19
col_stop: 23
path: ""
content: "public a: bool = true; "
span:
line_start: 4
line_stop: 4
col_start: 11
col_stop: 15
path: ""
content: "public a: bool = true; "
- const_: false
private: false
public: true
type_:
IntegerType: U8
name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public b: u8 = 2; \\\"}\"}"
value:
Value:
Implicit:
- "2"
- span:
line_start: 5
line_stop: 5
col_start: 19
col_stop: 20
path: ""
content: "public b: u8 = 2; "
span:
line_start: 5
line_stop: 5
col_start: 11
col_stop: 13
path: ""
content: "public b: u8 = 2; "
- const_: false
private: false
public: true
type_: Field
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public c: field = 0; \\\"}\"}"
value:
Value:
Implicit:
- "0"
- span:
line_start: 6
line_stop: 6
col_start: 19
col_stop: 20
path: ""
content: "public c: field = 0; "
span:
line_start: 6
line_stop: 6
col_start: 11
col_stop: 16
path: ""
content: "public c: field = 0; "
- const_: false
private: false
public: true
type_: Group
name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public d: group = (0, 1)group; \\\"}\"}"
value:
Value:
Group:
Tuple:
x:
Number:
- "0"
- span:
line_start: 7
line_stop: 7
col_start: 20
col_stop: 21
path: ""
content: "public d: group = (0, 1)group; "
y:
Number:
- "1"
- span:
line_start: 7
line_stop: 7
col_start: 23
col_stop: 24
path: ""
content: "public d: group = (0, 1)group; "
span:
line_start: 7
line_stop: 7
col_start: 20
col_stop: 30
path: ""
content: "public d: group = (0, 1)group; "
span:
line_start: 7
line_stop: 7
col_start: 11
col_stop: 16
path: ""
content: "public d: group = (0, 1)group; "
- const_: false
private: false
public: true
type_: Address
name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":8,\\\"col_stop\\\":9,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"public e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
value:
Value:
Address:
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8
- span:
line_start: 8
line_stop: 8
col_start: 21
col_stop: 84
path: ""
content: "public e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 8
line_stop: 8
col_start: 11
col_stop: 18
path: ""
content: "public e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 3
line_stop: 3
col_start: 2
col_stop: 6
path: ""
content: "[main]"
- name: registers
definitions:
- const_: false
private: false
public: false
type_: Boolean
name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}"
value:
Value:
Boolean:
- "true"
- span:
line_start: 11
line_stop: 11
col_start: 13
col_stop: 17
path: ""
content: "r0: bool = true; "
span:
line_start: 11
line_stop: 11
col_start: 5
col_stop: 9
path: ""
content: "r0: bool = true; "
- const_: false
private: false
public: false
type_:
IntegerType: U8
name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}"
value:
Value:
Implicit:
- "2"
- span:
line_start: 12
line_stop: 12
col_start: 13
col_stop: 14
path: ""
content: "r1: u8 = 2; "
span:
line_start: 12
line_stop: 12
col_start: 5
col_stop: 7
path: ""
content: "r1: u8 = 2; "
- const_: false
private: false
public: false
type_: Field
name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}"
value:
Value:
Implicit:
- "0"
- span:
line_start: 13
line_stop: 13
col_start: 13
col_stop: 14
path: ""
content: "r2: field = 0; "
span:
line_start: 13
line_stop: 13
col_start: 5
col_stop: 10
path: ""
content: "r2: field = 0; "
- const_: false
private: false
public: false
type_: Group
name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}"
value:
Value:
Group:
Tuple:
x:
Number:
- "0"
- span:
line_start: 14
line_stop: 14
col_start: 14
col_stop: 15
path: ""
content: "r3: group = (0, 1)group; "
y:
Number:
- "1"
- span:
line_start: 14
line_stop: 14
col_start: 17
col_stop: 18
path: ""
content: "r3: group = (0, 1)group; "
span:
line_start: 14
line_stop: 14
col_start: 14
col_stop: 24
path: ""
content: "r3: group = (0, 1)group; "
span:
line_start: 14
line_stop: 14
col_start: 5
col_stop: 10
path: ""
content: "r3: group = (0, 1)group; "
- const_: false
private: false
public: false
type_: Address
name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
value:
Value:
Address:
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8
- span:
line_start: 15
line_stop: 15
col_start: 15
col_stop: 78
path: ""
content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 15
line_stop: 15
col_start: 5
col_stop: 12
path: ""
content: "r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 10
line_stop: 10
col_start: 2
col_stop: 11
path: ""
content: "[registers]"

View File

@ -5,8 +5,11 @@ outputs:
- sections: - sections:
- name: main - name: main
definitions: definitions:
- type_: Boolean - const_: false
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"a: bool = true; \\\"}\"}" private: true
public: false
type_: Boolean
name: "{\"name\":\"a\",\"span\":\"{\\\"line_start\\\":4,\\\"line_stop\\\":4,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"private a: bool = true; \\\"}\"}"
value: value:
Value: Value:
Boolean: Boolean:
@ -14,20 +17,23 @@ outputs:
- span: - span:
line_start: 4 line_start: 4
line_stop: 4 line_stop: 4
col_start: 12 col_start: 20
col_stop: 16 col_stop: 24
path: "" path: ""
content: "a: bool = true; " content: "private a: bool = true; "
span: span:
line_start: 4 line_start: 4
line_stop: 4 line_stop: 4
col_start: 4 col_start: 12
col_stop: 8 col_stop: 16
path: "" path: ""
content: "a: bool = true; " content: "private a: bool = true; "
- type_: - const_: false
private: true
public: false
type_:
IntegerType: U8 IntegerType: U8
name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"b: u8 = 2; \\\"}\"}" name: "{\"name\":\"b\",\"span\":\"{\\\"line_start\\\":5,\\\"line_stop\\\":5,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"private b: u8 = 2; \\\"}\"}"
value: value:
Value: Value:
Implicit: Implicit:
@ -35,19 +41,22 @@ outputs:
- span: - span:
line_start: 5 line_start: 5
line_stop: 5 line_stop: 5
col_start: 12 col_start: 20
col_stop: 13 col_stop: 21
path: "" path: ""
content: "b: u8 = 2; " content: "private b: u8 = 2; "
span: span:
line_start: 5 line_start: 5
line_stop: 5 line_stop: 5
col_start: 4 col_start: 12
col_stop: 6 col_stop: 14
path: "" path: ""
content: "b: u8 = 2; " content: "private b: u8 = 2; "
- type_: Field - const_: false
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c: field = 0; \\\"}\"}" private: true
public: false
type_: Field
name: "{\"name\":\"c\",\"span\":\"{\\\"line_start\\\":6,\\\"line_stop\\\":6,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"private c: field = 0; \\\"}\"}"
value: value:
Value: Value:
Implicit: Implicit:
@ -55,19 +64,22 @@ outputs:
- span: - span:
line_start: 6 line_start: 6
line_stop: 6 line_stop: 6
col_start: 12 col_start: 20
col_stop: 13 col_stop: 21
path: "" path: ""
content: "c: field = 0; " content: "private c: field = 0; "
span: span:
line_start: 6 line_start: 6
line_stop: 6 line_stop: 6
col_start: 4 col_start: 12
col_stop: 9 col_stop: 17
path: "" path: ""
content: "c: field = 0; " content: "private c: field = 0; "
- type_: Group - const_: false
name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"d: group = (0, 1)group; \\\"}\"}" private: true
public: false
type_: Group
name: "{\"name\":\"d\",\"span\":\"{\\\"line_start\\\":7,\\\"line_stop\\\":7,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"private d: group = (0, 1)group; \\\"}\"}"
value: value:
Value: Value:
Group: Group:
@ -78,36 +90,39 @@ outputs:
- span: - span:
line_start: 7 line_start: 7
line_stop: 7 line_stop: 7
col_start: 13 col_start: 21
col_stop: 14 col_stop: 22
path: "" path: ""
content: "d: group = (0, 1)group; " content: "private d: group = (0, 1)group; "
y: y:
Number: Number:
- "1" - "1"
- span: - span:
line_start: 7 line_start: 7
line_stop: 7 line_stop: 7
col_start: 16 col_start: 24
col_stop: 17 col_stop: 25
path: "" path: ""
content: "d: group = (0, 1)group; " content: "private d: group = (0, 1)group; "
span: span:
line_start: 7 line_start: 7
line_stop: 7 line_stop: 7
col_start: 13 col_start: 21
col_stop: 23 col_stop: 31
path: "" path: ""
content: "d: group = (0, 1)group; " content: "private d: group = (0, 1)group; "
span: span:
line_start: 7 line_start: 7
line_stop: 7 line_stop: 7
col_start: 4 col_start: 12
col_stop: 9 col_stop: 17
path: "" path: ""
content: "d: group = (0, 1)group; " content: "private d: group = (0, 1)group; "
- type_: Address - const_: false
name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" private: true
public: false
type_: Address
name: "{\"name\":\"e\",\"span\":\"{\\\"line_start\\\":8,\\\"line_stop\\\":8,\\\"col_start\\\":9,\\\"col_stop\\\":10,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"private e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
value: value:
Value: Value:
Address: Address:
@ -115,17 +130,17 @@ outputs:
- span: - span:
line_start: 8 line_start: 8
line_stop: 8 line_stop: 8
col_start: 14 col_start: 22
col_stop: 77 col_stop: 85
path: "" path: ""
content: "e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" content: "private e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span: span:
line_start: 8 line_start: 8
line_stop: 8 line_stop: 8
col_start: 4 col_start: 12
col_stop: 11 col_stop: 19
path: "" path: ""
content: "e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;" content: "private e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span: span:
line_start: 3 line_start: 3
line_stop: 3 line_stop: 3
@ -135,7 +150,10 @@ outputs:
content: "[main]" content: "[main]"
- name: registers - name: registers
definitions: definitions:
- type_: Boolean - const_: false
private: false
public: false
type_: Boolean
name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}" name: "{\"name\":\"r0\",\"span\":\"{\\\"line_start\\\":11,\\\"line_stop\\\":11,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r0: bool = true; \\\"}\"}"
value: value:
Value: Value:
@ -155,7 +173,10 @@ outputs:
col_stop: 9 col_stop: 9
path: "" path: ""
content: "r0: bool = true; " content: "r0: bool = true; "
- type_: - const_: false
private: false
public: false
type_:
IntegerType: U8 IntegerType: U8
name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}" name: "{\"name\":\"r1\",\"span\":\"{\\\"line_start\\\":12,\\\"line_stop\\\":12,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r1: u8 = 2; \\\"}\"}"
value: value:
@ -176,7 +197,10 @@ outputs:
col_stop: 7 col_stop: 7
path: "" path: ""
content: "r1: u8 = 2; " content: "r1: u8 = 2; "
- type_: Field - const_: false
private: false
public: false
type_: Field
name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}" name: "{\"name\":\"r2\",\"span\":\"{\\\"line_start\\\":13,\\\"line_stop\\\":13,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r2: field = 0; \\\"}\"}"
value: value:
Value: Value:
@ -196,7 +220,10 @@ outputs:
col_stop: 10 col_stop: 10
path: "" path: ""
content: "r2: field = 0; " content: "r2: field = 0; "
- type_: Group - const_: false
private: false
public: false
type_: Group
name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}" name: "{\"name\":\"r3\",\"span\":\"{\\\"line_start\\\":14,\\\"line_stop\\\":14,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r3: group = (0, 1)group; \\\"}\"}"
value: value:
Value: Value:
@ -236,7 +263,10 @@ outputs:
col_stop: 10 col_stop: 10
path: "" path: ""
content: "r3: group = (0, 1)group; " content: "r3: group = (0, 1)group; "
- type_: Address - const_: false
private: false
public: false
type_: Address
name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}" name: "{\"name\":\"r4\",\"span\":\"{\\\"line_start\\\":15,\\\"line_stop\\\":15,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
value: value:
Value: Value:
@ -263,133 +293,3 @@ outputs:
col_stop: 11 col_stop: 11
path: "" path: ""
content: "[registers]" content: "[registers]"
- name: constants
definitions:
- type_: Boolean
name: "{\"name\":\"c0\",\"span\":\"{\\\"line_start\\\":18,\\\"line_stop\\\":18,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c0: bool = true; \\\"}\"}"
value:
Value:
Boolean:
- "true"
- span:
line_start: 18
line_stop: 18
col_start: 13
col_stop: 17
path: ""
content: "c0: bool = true; "
span:
line_start: 18
line_stop: 18
col_start: 5
col_stop: 9
path: ""
content: "c0: bool = true; "
- type_:
IntegerType: U8
name: "{\"name\":\"c1\",\"span\":\"{\\\"line_start\\\":19,\\\"line_stop\\\":19,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c1: u8 = 2; \\\"}\"}"
value:
Value:
Implicit:
- "2"
- span:
line_start: 19
line_stop: 19
col_start: 13
col_stop: 14
path: ""
content: "c1: u8 = 2; "
span:
line_start: 19
line_stop: 19
col_start: 5
col_stop: 7
path: ""
content: "c1: u8 = 2; "
- type_: Field
name: "{\"name\":\"c2\",\"span\":\"{\\\"line_start\\\":20,\\\"line_stop\\\":20,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c2: field = 0; \\\"}\"}"
value:
Value:
Implicit:
- "0"
- span:
line_start: 20
line_stop: 20
col_start: 13
col_stop: 14
path: ""
content: "c2: field = 0; "
span:
line_start: 20
line_stop: 20
col_start: 5
col_stop: 10
path: ""
content: "c2: field = 0; "
- type_: Group
name: "{\"name\":\"c3\",\"span\":\"{\\\"line_start\\\":21,\\\"line_stop\\\":21,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c3: group = (0, 1)group; \\\"}\"}"
value:
Value:
Group:
Tuple:
x:
Number:
- "0"
- span:
line_start: 21
line_stop: 21
col_start: 14
col_stop: 15
path: ""
content: "c3: group = (0, 1)group; "
y:
Number:
- "1"
- span:
line_start: 21
line_stop: 21
col_start: 17
col_stop: 18
path: ""
content: "c3: group = (0, 1)group; "
span:
line_start: 21
line_stop: 21
col_start: 14
col_stop: 24
path: ""
content: "c3: group = (0, 1)group; "
span:
line_start: 21
line_stop: 21
col_start: 5
col_stop: 10
path: ""
content: "c3: group = (0, 1)group; "
- type_: Address
name: "{\"name\":\"c4\",\"span\":\"{\\\"line_start\\\":22,\\\"line_stop\\\":22,\\\"col_start\\\":1,\\\"col_stop\\\":3,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;\\\"}\"}"
value:
Value:
Address:
- aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8
- span:
line_start: 22
line_stop: 22
col_start: 15
col_stop: 78
path: ""
content: "c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 22
line_stop: 22
col_start: 5
col_stop: 12
path: ""
content: "c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;"
span:
line_start: 17
line_stop: 17
col_start: 2
col_stop: 11
path: ""
content: "[constants]"

View File

@ -0,0 +1,18 @@
/*
namespace: Input
expectation: Pass
*/
[main]
const a: bool = true;
const b: u8 = 2;
const c: field = 0;
const d: group = (0, 1)group;
const e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
[registers]
r0: bool = true;
r1: u8 = 2;
r2: field = 0;
r3: group = (0, 1)group;
r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;

View File

@ -0,0 +1,19 @@
/*
namespace: Input
expectation: Pass
*/
[main]
public a: bool = true;
public b: u8 = 2;
public c: field = 0;
public d: group = (0, 1)group;
public e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
[registers]
r0: bool = true;
r1: u8 = 2;
r2: field = 0;
r3: group = (0, 1)group;
r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;

View File

@ -4,11 +4,11 @@ expectation: Pass
*/ */
[main] [main]
a: bool = true; private a: bool = true;
b: u8 = 2; private b: u8 = 2;
c: field = 0; private c: field = 0;
d: group = (0, 1)group; private d: group = (0, 1)group;
e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; private e: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
[registers] [registers]
r0: bool = true; r0: bool = true;
@ -17,9 +17,3 @@ r2: field = 0;
r3: group = (0, 1)group; r3: group = (0, 1)group;
r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8; r4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;
[constants]
c0: bool = true;
c1: u8 = 2;
c2: field = 0;
c3: group = (0, 1)group;
c4: address = aleo1qnr4dkkvkgfqph0vzc3y6z2eu975wnpz2925ntjccd5cfqxtyu8sta57j8;