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

[issue1146] Validate SAS file #227

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

tanjaschindler
Copy link

No description provided.

Copy link
Member

@FlorianPommerening FlorianPommerening left a comment

Choose a reason for hiding this comment

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

I had a look at the code. I don't know the list of things this should check so I didn't verify completeness.

src/search/utils/input_file_parser.h Outdated Show resolved Hide resolved
src/search/utils/input_file_parser.h Outdated Show resolved Hide resolved
src/search/utils/input_file_parser.h Outdated Show resolved Hide resolved
/*
Set context for error reporting.
*/
void set_context(const std::string &context);
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this is still relevant, but we have classes for the command line parsing that do something similar (for example SyntaxAnalyzerContext, DecorateContext, and ConstructContext, they are different private classes for different use cases but all parallel code). They have an advantage over setting the context manually because they leave the context once they go out of scope. This way you can produce error messages with a stack trace of contexts.

One suggestion would be to use a similar design here, another (more complicated) option would be to extract the common functionality.

src/search/utils/input_file_parser.h Outdated Show resolved Hide resolved
int num_facts = file_parser.read_line_int("number of facts in mutex group");
if (num_facts < 1) {
file_parser.error("Number of facts in mutex group is less than 1, should be at least 1.");
}
vector<FactPair> invariant_group;
invariant_group.reserve(num_facts);
for (int j = 0; j < num_facts; ++j) {
Copy link
Member

Choose a reason for hiding this comment

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

Don't we already have a function that reads a list of facts? And doesn't it also need the check that there are no duplicate facts?

src/search/tasks/root_task.cc Outdated Show resolved Hide resolved
src/search/tasks/root_task.cc Outdated Show resolved Hide resolved

// TODO: Maybe we could move this into a separate function as well
Copy link
Member

Choose a reason for hiding this comment

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

sounds good

src/search/tasks/root_task.cc Show resolved Hide resolved
src/search/tasks/root_task.cc Outdated Show resolved Hide resolved
src/search/tasks/root_task.cc Outdated Show resolved Hide resolved
src/search/tasks/root_task.cc Outdated Show resolved Hide resolved
src/search/tasks/root_task.cc Outdated Show resolved Hide resolved
src/search/utils/input_file_parser.h Outdated Show resolved Hide resolved
src/search/utils/input_file_parser.h Outdated Show resolved Hide resolved
src/search/utils/input_file_parser.h Outdated Show resolved Hide resolved
src/search/utils/input_file_parser.cc Outdated Show resolved Hide resolved
if(next_line != "") {
error("Expected end of file, found non-empty line " + next_line);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}
void InputFileParser::confirm_end_of_file() {
assert(may_start_line);
if (!stream.eof()) {
line = find_next_line();
error("Expected end of file, found non-empty line " + line);
}

this would also remove the need of a bool flag in find_next_line.

Copy link
Contributor

@SimonDold SimonDold left a comment

Choose a reason for hiding this comment

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

LGTM, just added renaming suggestions but i am happy as is.

void TaskParser::confirm_end_of_input() {
find_next_line(false);
if(line != "") {
error("Expected end of task, found non-empty line " + line);
Copy link
Contributor

Choose a reason for hiding this comment

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

rename:
task -> task encoding


class InputFileParser {
/*
Parse a task file.
Copy link
Contributor

Choose a reason for hiding this comment

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

rename:
task file -> task encoding

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.

4 participants