-
Notifications
You must be signed in to change notification settings - Fork 1
Feat/reading graph #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
giospada
wants to merge
8
commits into
main
Choose a base branch
from
feat/reading_graph
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a577144
added nfa reading from string
giospada 3081790
from string to nfa
giospada 8eca4bb
temp
giospada 44d8903
prova con srede, finata la ui
giospada ec321a6
added comments, split files,and add self visualizator
giospada 74a5b1f
sync computer
giospada cca478f
finished right side bar
giospada 3173320
added the visualizer graph, and parameter
giospada File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,13 @@ | ||
| use log::info; | ||
| use serde::{Deserialize, Serialize}; | ||
| use std::collections::{BTreeMap, BTreeSet}; | ||
|
|
||
| use crate::automata::regular_expression as RE; | ||
| use crate::display::DisplayGraph; | ||
| use crate::utils::Graph; | ||
|
|
||
| #[derive(Debug)] | ||
| use crate::utils::{Graph, IntoGraph}; | ||
|
|
||
| mod string_transform; | ||
|
|
||
| #[derive(Debug, Serialize, Deserialize)] | ||
| pub struct NFA { | ||
| start_state: usize, | ||
| num_states: usize, | ||
|
|
@@ -18,7 +20,7 @@ pub struct NFA { | |
| } | ||
|
|
||
| impl NFA { | ||
| fn new() -> Self { | ||
| pub fn new() -> Self { | ||
| Self { | ||
| num_states: 0, | ||
| start_state: 0, | ||
|
|
@@ -213,8 +215,8 @@ impl From<&RE::ReOperator> for NFA { | |
| } | ||
| } | ||
|
|
||
| impl Into<Graph> for NFA { | ||
| fn into(self) -> Graph { | ||
| impl IntoGraph for NFA { | ||
| fn into_graph(&self) -> Graph { | ||
| let mut graph = Graph::new(); | ||
|
|
||
| let finals_nodes = self | ||
|
|
@@ -264,6 +266,7 @@ mod test { | |
| Box::new(RE::ReOperator::Char('b')), | ||
| ); | ||
| let nfa = NFA::from(®ex); | ||
| println!("{:?}", nfa); | ||
| let out = serde_json::to_string(&nfa); | ||
| panic!("{:?}\n", out.unwrap()); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. questo test utile per debuggare, però dovresti fixarlo.
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep |
||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In rust ci sono dei trait
FromeIntoche sono builtin, non sarebbe meglio utilizzare quelli?https://doc.rust-lang.org/std/convert/trait.From.html
Poi se implementi from hai già into. Però alla fine è solo questione di stile quindi come vuoi 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Into non puoi passare l'oggetto come reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puoi, ti basta implementare
Into<&Graph>.