-
Notifications
You must be signed in to change notification settings - Fork 144
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
base: main
Are you sure you want to change the base?
Conversation
… InputFileLine in root_task
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.
I had a look at the code. I don't know the list of things this should check so I didn't verify completeness.
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) { |
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.
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?
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.
LGTM, just added renaming suggestions but i am happy as is.
src/search/utils/task_parser.cc
Outdated
void TaskParser::confirm_end_of_input() { | ||
find_next_line(false); | ||
if(line != "") { | ||
error("Expected end of task, found non-empty line " + line); |
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.
rename:
task -> task encoding
src/search/utils/task_parser.h
Outdated
|
||
class InputFileParser { | ||
/* | ||
Parse a task file. |
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.
rename:
task file -> task encoding
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.
Looking at the interface of this class, it doesn't really parse a task (neither a file nor an encoding). It mostly does the scanning/lexing, i.e., breaking the input stream into tokens. The actual parsing then happens in root_task.cc
in methods like read_goal
, read_actions
and so on. Maybe we should either move the parsing functionality here, or rename this class and file.
Almost no code was shared. The patch also makes read_pre_post closer to read_facts by letting it take a bool read_from_single_line. This removes an unintuitive dependency on op.is_an_axiom but also means that the string for parsing the variable no longer mentions the source (axiom or operator). The string is not used currently and will be unnecessary once we have errors with a stack trace.
and only allows calling certain methods based on the mode. Violating this contract is not a user error, so it leads to an abort rather than an input error. In line reading mode, the line number is off by one because the stream already is in the next line. The public interface corrects for this.
…ted by operator are not derived.
No description provided.