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

Split src/colis.ml into a library and an executable #30

Merged
merged 9 commits into from
Oct 17, 2018
Merged

Conversation

Niols
Copy link
Member

@Niols Niols commented Oct 16, 2018

  • It makes the separation of code cleaner
  • It allows for an easy use of internal functions (eg for testing purpose)
  • It allows for a better documentation of internal functions
  • It will allow an other tool to use the internal library directly instead of using the executable

@Niols Niols requested review from benozol and claudemarche October 16, 2018 13:08
src/colis_cmd.ml Outdated
eprintf "Parsing error@.";
exit 2
| Morsmall.SyntaxError _pos ->
eprintf "Syntax error@.";
Copy link
Contributor

Choose a reason for hiding this comment

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

What about showing the same error message for syntax errors in Shell (Morsmall.SyntaxError) and Colis (Colis.ColisParser)? (BTW it would be nice if we could have a pos for the Colis parser as well and display it. I’ll have a look later…)

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree. If fact, in the lib Colis, we could have only one exception for all lexing/parsing errors, what do you think? And indeed, it would be nice to carry a position in the parser (which reminds me of #19: do we want positions in the AST?)

Copy link
Contributor

Choose a reason for hiding this comment

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

only one exception for all lexing/parsing errors

Yes good idea.

#19

It will certainly be interesting to be able to point to the position in the shell script from within the symbolic execution. But IMO we can postpone adding positions to the AST until we are there – it will require refactoring but won’t be technically complicated. What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

only one exception for all lexing/parsing errors

Yes good idea.

OK, commit inc

#19

It will certainly be interesting to be able to point to the position in the shell script from within the symbolic execution. But IMO we can postpone adding positions to the AST until we are there – it will require refactoring but won’t be technically complicated. What do you think?

So at some point we will refactor both the AST, the conversion and the parser to add positions everywhere? Fine with me

@benozol
Copy link
Contributor

benozol commented Oct 17, 2018

Very useful PR – I was already alienated by how much logic should be put into the colis.ml.

@benozol
Copy link
Contributor

benozol commented Oct 17, 2018

OK looks good to me!

@Niols
Copy link
Member Author

Niols commented Oct 17, 2018

Do you think we should merge it?

@benozol
Copy link
Contributor

benozol commented Oct 17, 2018

Definitely

@benozol benozol closed this Oct 17, 2018
@benozol benozol reopened this Oct 17, 2018
@benozol benozol merged commit 6506be7 into master Oct 17, 2018
@Niols Niols deleted the colis-lib branch October 17, 2018 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants