Skip to content
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

Feat: Variable parsing rework (Array input) #1200

Merged
merged 70 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
fad11cb
"basic" parsing done
quinchs Jan 29, 2024
77d26fa
quoted string parser & error/hints
quinchs Jan 31, 2024
ee85154
Make quoted str input context based
quinchs Jan 31, 2024
d4ca3b9
remove blunt "fail" message
quinchs Jan 31, 2024
d4ad542
reorder use statements
quinchs Jan 31, 2024
26fadfe
simplify uuid
quinchs Jan 31, 2024
596a6bd
recognize on float
quinchs Jan 31, 2024
2bf6edb
remove unused imports and add suggestions
quinchs Feb 2, 2024
06453fa
unicodes
quinchs Feb 5, 2024
c4b1b2a
Better JSON parsing
quinchs Feb 5, 2024
dd49508
even better json parsing
quinchs Feb 5, 2024
69b4a9e
start on tuple impl
quinchs Feb 7, 2024
c1f1556
fix str parser not respecting flags & tuple input
quinchs Feb 7, 2024
75da459
consume single json value instead of looping it
quinchs Feb 7, 2024
4e98310
change str impl to use unquote_string
quinchs Feb 7, 2024
67d6e88
remove redundant logic for str
quinchs Feb 7, 2024
4bd301c
remove json remainder flag
quinchs Feb 7, 2024
b77c580
inline str.char_indeces()
quinchs Feb 7, 2024
0552f50
grammar and more direct context error
quinchs Feb 7, 2024
7f44260
remove commented code
quinchs Feb 7, 2024
aef5cd6
remove redundant slice call
quinchs Feb 8, 2024
7e5f361
Fix empty str parsing & add some tests
quinchs Feb 9, 2024
c30ee49
add rest of the tests
quinchs Feb 9, 2024
cf64cfd
remove unused imports
quinchs Feb 9, 2024
d5052e2
fix formatting and remove more unused imports
quinchs Feb 9, 2024
5779a31
simplify string parser & add err if missing quote
quinchs Feb 12, 2024
4f1b162
"basic" parsing done
quinchs Jan 29, 2024
30cc04b
quoted string parser & error/hints
quinchs Jan 31, 2024
9a7de63
Make quoted str input context based
quinchs Jan 31, 2024
87d1d7f
remove blunt "fail" message
quinchs Jan 31, 2024
42734fa
reorder use statements
quinchs Jan 31, 2024
8bb5f6a
simplify uuid
quinchs Jan 31, 2024
d44ff3d
recognize on float
quinchs Jan 31, 2024
fc04845
remove unused imports and add suggestions
quinchs Feb 2, 2024
57cf198
unicodes
quinchs Feb 5, 2024
455c003
Better JSON parsing
quinchs Feb 5, 2024
37932b7
even better json parsing
quinchs Feb 5, 2024
b25d846
start on tuple impl
quinchs Feb 7, 2024
1705a0d
fix str parser not respecting flags & tuple input
quinchs Feb 7, 2024
16a8b08
consume single json value instead of looping it
quinchs Feb 7, 2024
9aecaa3
change str impl to use unquote_string
quinchs Feb 7, 2024
70948ad
remove redundant logic for str
quinchs Feb 7, 2024
933d59e
remove json remainder flag
quinchs Feb 7, 2024
b2b3c6f
inline str.char_indeces()
quinchs Feb 7, 2024
6eb2deb
grammar and more direct context error
quinchs Feb 7, 2024
1c1bc7c
remove commented code
quinchs Feb 7, 2024
b995335
remove redundant slice call
quinchs Feb 8, 2024
780185c
Fix empty str parsing & add some tests
quinchs Feb 9, 2024
5e159af
add rest of the tests
quinchs Feb 9, 2024
5e668a7
remove unused imports
quinchs Feb 9, 2024
9856b22
fix formatting and remove more unused imports
quinchs Feb 9, 2024
d37a3d0
simplify string parser & add err if missing quote
quinchs Feb 12, 2024
552ce50
Merge branch 'feat/variable-parsing-rework' of github.com:edgedb/edge…
quinchs Feb 12, 2024
397c91e
simplify escape condition
quinchs Feb 12, 2024
f425fc3
Merge branch 'master' into feat/variable-parsing-rework
quinchs Feb 13, 2024
ed703e1
named tuples too
quinchs Feb 13, 2024
c7e86dd
remove unused imports
quinchs Feb 13, 2024
8856945
combinator approach to named tuple
quinchs Feb 13, 2024
3e9fe36
allow spaces in array and tuple
quinchs Feb 14, 2024
b498eda
monads and strife (trailing commas)
msullivan Feb 21, 2024
1498361
a version with more comby tuples that support trailing commas
msullivan Feb 13, 2024
751690a
rust-fmt these changed files to help merge
msullivan May 6, 2024
4b63684
Merge branch 'master' into feat/variable-parsing-rework
msullivan May 6, 2024
3426df2
clippy
msullivan May 6, 2024
fb528fb
Merge branch 'master' into feat/variable-parsing-rework
msullivan May 22, 2024
d5107d6
some more tests with spacing
msullivan May 22, 2024
75df813
drop a function that duplicated multispace0
msullivan May 22, 2024
151dd04
Check duplicates in named tuples
msullivan May 22, 2024
efc348e
Make the type name that gets outputted be correct
msullivan May 22, 2024
7180e61
cargo fmt
msullivan May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ dissimilar = "1.0.6"
notify = "5.0.0"
gethostname = "0.4.1"
bitvec = "1.0.1"
nom = "7.1.3"
bitflags = "1.3.2"

[dev-dependencies]
assert_cmd = "2.0.8"
Expand Down
16 changes: 13 additions & 3 deletions src/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::completion;
use crate::print::Highlight;
use crate::print::style::Styler;
use crate::highlight;
use crate::prompt::variable::VariableInput;
use crate::prompt::variable::{InputFlags, VariableInput};
use crate::repl::{TX_MARKER, FAILURE_MARKER};
use crate::platform::editor_path;

Expand Down Expand Up @@ -330,8 +330,18 @@ pub fn main(mut control: Receiver<Control>)
}
Err(e) => Err(e)?,
};
match var_type.parse(&text) {
Ok(value) => break (text, value),
match var_type.parse(&text, InputFlags::NONE) {
Ok(parse_result) => {
if parse_result.0.len() > 0 {
// remaining input
println!("Bad value: remaining text '{}' is unparsed", parse_result.0);
initial = text;
}
else {
break (text.to_owned(), parse_result.1)
}

},
Err(e) => {
println!("Bad value: {}", e);
initial = text;
Expand Down