Skip to content

working version#5

Open
visper wants to merge 1 commit intoalexkutsan:masterfrom
visper:feature/TSPolCalc
Open

working version#5
visper wants to merge 1 commit intoalexkutsan:masterfrom
visper:feature/TSPolCalc

Conversation

@visper
Copy link
Copy Markdown

@visper visper commented Dec 19, 2019

No description provided.


std::vector<long double> numbers;
double rec = 0;
for(;;) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

this for definitely should be splitted

} else { //operation

long double result = numbers[0];
for(int i = 1; i < numbers.size(); ++i) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Start splitting from internal scopes.

rec = result;
}

if(!rc) break;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

rename rc :-)


void Parser::parse()
{
for(size_t i = 0; i < rawLines.size(); ++i) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

cac be used range based?

currentPosition = i+1;
//check for operator
///TODO: check Factory applicance
if(rawLines[i] == std::string("+")) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks like good place for factory

///TODO: split to different constructors
Token(const bool is_number, const TOper::Operand opr, const long double num);
Token(const long double num);
Token(const TOper::Operand opr);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

3 constructs with partial initialization confuses.

Token(const bool is_number, const TOper::Operand opr, const long double num);
Token(const long double num);
Token(const TOper::Operand opr);
bool is_number();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

sounds like const


try {
if (argc < 2 /*|| argc >= 12*/) {
show_usage();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can you throw here?

}

std::vector <std::string> sources;
for (int i = 1; i < argc; ++i) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I would put htis for in separate function

ASSERT_EQ(4, stk.getSize());

t = stk.pop(rc);
ASSERT_EQ(1, rc);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Long test. Probably can be splitted

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