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

stringify test cases and some comments #122

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jaycarlton
Copy link

@jaycarlton jaycarlton commented Nov 5, 2024

Added a few test cases to help learn bits of the system. Added some comments while exploring the code.

@jaycarlton jaycarlton changed the title some basic test cases stringify test cases and some comments Nov 10, 2024
@jaycarlton jaycarlton marked this pull request as ready for review November 12, 2024 00:13
Copy link
Member

@nhatcher nhatcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jaycarlton , thanks for all the work put in here and very sorry for my late reply :'(.

I think our best course of action is to decline this PR and create some minor ones. I am happy to have a call with you to align our priorities.

@@ -149,16 +149,17 @@ impl Lexer {

/// Checks the next token without advancing position
/// See also [advance_token](Self::advance_token)
/// TODO: is there not a way to do this without mutating `self`?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kind of questions shouldn't be in code. The reason is that peek_token advances te token position. Otherwise we would hace to parse it all over again if we "accept" it

pub fn peek_token(&mut self) -> TokenType {
let position = self.position;
let orig_position = self.position;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try not to rename variables unless there is a need for it or a previous discussion.

tk
}

/// Advances position. This is used in conjunction with [`peek_token`](Self::peek_token)
/// It is a noop if the has not been a previous peek_token
/// It is a noop if there has not been a previous peek_token
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
annoying but, could you do this is a separate PR?

@@ -446,6 +447,7 @@ impl Lexer {

// Private methods

// Move position to the end of input and return a `LexerError` value.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss how to best comment code first. This is an awesome contribution but a bit more difficult than it looks like.
Let's do that is separate PRs please.

@@ -10,6 +10,7 @@ use crate::expressions::{
types::ParsedReference,
};

// TODO: why not jsut pass in a `LexerMode`? It's more expressive than a bool arg.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by that? Maybe we can discuss?

@@ -464,6 +474,7 @@ impl Parser {
Some(name) => self.get_sheet_index_by_name(name),
None => self.get_sheet_index_by_name(&context.sheet),
};
// todo: bust out helper function for this calculation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what you mean by this. Maybe let's talk?

@@ -30,6 +30,7 @@ pub struct CellReference {
#[derive(Clone)]
pub struct CellReferenceRC {
pub sheet: String,
// 1-based index
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, rows and columns are always 1-based and sheets 0-based. I think we should only document it once.

@@ -369,9 +369,11 @@ pub struct Font {
#[serde(default = "default_as_false")]
#[serde(skip_serializing_if = "is_false")]
pub u: bool, // seems that Excel supports a bit more - double underline / account underline etc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, you could open a ticket for this. And actually this might be a nice first issue.

@@ -18,8 +18,8 @@ export function updateNameSelectedWorkbook(model: Model, newName: string) {
console.warn("Failed saving new name");
}
}
const modeBytes = model.toBytes();
localStorage.setItem(uuid, bytesToBase64(modeBytes));
const modelBytes = model.toBytes();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooops, thanks! Care to make a PR just for this?

@@ -0,0 +1,146 @@
use super::Parser;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jaycarlton , these tests are amazing? But why did you add them? Did you add them because you want to learn how to use the API or because you are covering some case that wasn't covered before. If it is the second case we definitely need them in!

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.

3 participants