Skip to content

WIP: Target#437

Closed
anakrish wants to merge 6 commits into
microsoft:mainfrom
anakrish:target
Closed

WIP: Target#437
anakrish wants to merge 6 commits into
microsoft:mainfrom
anakrish:target

Conversation

@anakrish

Copy link
Copy Markdown
Collaborator

In progress implementation of "targets".
Typechecking is in the process of being rewritten to using JSON schema.

anakrish added 5 commits July 16, 2025 10:05
Indexes allow associating extra data with nodes in the AST
using an array and then quickly looking up the array to fetch
the extra data.

- Index eidx for expressions
- Index sidx for statements
- Index qidx for queries.

AST nodes are not cloneable. Therefore once a module is created,
it is not possible to accidentally create two nodes with the same
index inadvertently via clone.

Also added IndexChecker in debug builds. When a module is parsed,
it will assert that indexes have been constructed correctly.

AST Cleanup
- Make literal expressions (null, val, number, string etc) also structs
  to match all other expressions
- Merge True and False nodes into a single Bool node.

Also update dependencies.

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Comment thread src/typing.rs Fixed
Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
Comment thread src/interpreter.rs
}

pub fn validate(&mut self) -> Result<()> {
let mut target = None;

Check warning

Code scanning / clippy

variable target is assigned to, but never used Warning

variable target is assigned to, but never used
Comment thread src/interpreter.rs
let mut target = None;
for m in self.modules.iter() {
if m.target.is_some() {
target = m.target.clone();

Check warning

Code scanning / clippy

value assigned to target is never read Warning

value assigned to target is never read
Comment thread src/schema.rs
}
}

impl Schema {

Check warning

Code scanning / clippy

method get_property is never used Warning

method get_property is never used
Comment thread src/schema.rs
}

impl Schema {
pub fn get_property(&self, name: &str) -> Result<Schema> {

Check warning

Code scanning / clippy

method get_property is never used Warning

method get_property is never used
Comment thread src/typing.rs
use crate::*;
use crate::{schema::*, target::Target};

use alloc::collections::BTreeMap;

Check warning

Code scanning / clippy

unused import: alloc::collections::BTreeMap Warning

unused import: alloc::collections::BTreeMap
Comment thread src/typing.rs
Ok(())
}

fn check_query(&mut self, query: &Query) -> Result<()> {

Check warning

Code scanning / clippy

multiple associated items are never used Warning

multiple associated items are never used
Comment thread src/typing.rs
Ok(())
}

fn check_rule_body(&mut self, name: &String, body: &RuleBody) -> Result<()> {

Check warning

Code scanning / clippy

multiple associated items are never used Warning

multiple associated items are never used
Comment thread src/typing.rs
Ok(())
}

fn check_rule(&mut self, name: &String, rule: &Ref<Rule>) -> Result<Schema> {

Check warning

Code scanning / clippy

multiple associated items are never used Warning

multiple associated items are never used
Comment thread src/typing.rs
Ok(Schema::default())
}

fn check_rules(&mut self, name: &String, rules: &[Ref<Rule>]) -> Result<()> {

Check warning

Code scanning / clippy

multiple associated items are never used Warning

multiple associated items are never used
Comment thread src/typing.rs
Ok(())
}

pub fn check(&mut self) -> Result<()> {

Check warning

Code scanning / clippy

multiple associated items are never used Warning

multiple associated items are never used
@anakrish anakrish closed this Aug 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants