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

Improve links between individual constructs in internal representation (issue #73) #96

Merged
merged 5 commits into from
Apr 28, 2020

Conversation

TadeasKucera
Copy link
Contributor

In this PR we allow yaramod::Literal to reference another of it's kind so we can create links between tokens in a tokenstream. This brings a possibility to rename strings and rules easily. We had to move yaramod::Token::Type to a new file and make it a class yaramod::TokenType and similar with yaramod::Expression::Type.

@TadeasKucera TadeasKucera marked this pull request as ready for review April 21, 2020 06:52
Copy link
Member

@metthal metthal left a comment

Choose a reason for hiding this comment

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

Looks okay to me. There are just 2 things I have commented on but they are not that important so that this PR is blocked by them so I'll merge this and please take a look at those comment and just answer/incorporate them later. Thanks.

namespace yaramod {

///< Type of the expression.
enum class ExpressionType
Copy link
Member

Choose a reason for hiding this comment

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

What was the motivation for taking out this type out of Expression itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Literal class now needs to access Symbol::getName method. That means it needs to include the symbol.h file. In the symbol.h file there has been include of expression.h so we would end up with cyclic dependency (see picture). Luckily, the Symbol class only needs access to ExpressionType which has been extracted from Expression::Type to avoid this cyclic dependency.
yaramod_class_dependecy

else if (literal.isSymbol())
os << literal.getSymbol()->getName();
else if (literal.isLiteralReference())
{
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: there are no curly braces in other parts of this condition so I wouldn't expect them here either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will fix it in my next PR, thank you for merging this.

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.

None yet

2 participants