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

Parser for includes. #132

Open
threonorm opened this issue Dec 2, 2016 · 6 comments
Open

Parser for includes. #132

threonorm opened this issue Dec 2, 2016 · 6 comments

Comments

@threonorm
Copy link
Contributor

Depending on how we comment an include :

//`include foo
// `include bar

the script for dependency tracking consider that foo is a dependency, but not bar. When I expect the two to not be dependencies (as they are commented).

I guess connectal used the first form of comment as a feature to signal weird dependies invisible to bluespec but visible to connectal?

The code involved is in bsvdependencies.py:

 m = re.match('//`include "([^\"]+)"', line)
 m1 = re.match('//`include(.*)', line)
 if m:
                iname = m.group(1)
                if iname in abspaths:
                    iname = abspaths[iname]
                else:
                    iname = 'obj/%s' % iname
                includes.append(iname)

I am not sure why this special case. I don't have the full picture.
If connectal really need to do this kind of commented include that should not be seen by BSV, perhaps connectal could use a special form of include like `includeConnectal, that would be in the comment section?

@hanw
Copy link
Member

hanw commented Dec 2, 2016

Hi threonorm, Jamey is on vacation with limited email access, so your question may not be answered in time. It sounds like the error is due to some hacky-ness in bsvdependencies.py , would you be able suggest a fix for this? I think you are correct that none of these two cases should generate a dependency.

@threonorm
Copy link
Contributor Author

Hi hanw, thanks for your answer!

I have a "fix" where I just consider every commented dependency to be not a dependency, this work for my use of the bsvdependencies functions, but I suspect that Jamey uses it in a different way somewhere else where he actually wants to keep this feature. (The way the code is written make me believe that this is really a feature)

For this reason, I don't want to pull request yet, waiting for his opinion is definitely a good idea :).

@jameyhicks
Copy link
Member

I guess it would be less Jaclyn if bsvpreprocess returned a list of included files as well as the expanded source code. Do you have time to make that change? Then it could ignore all commented out includes.

@jameyhicks
Copy link
Member

autocorrect strikes again :)

@jameyhicks
Copy link
Member

jameyhicks commented Dec 30, 2016 via email

@threonorm
Copy link
Contributor Author

threonorm commented Dec 30, 2016 via email

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

No branches or pull requests

3 participants