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

__FILE__ is not quoted on substitution. #22

Open
ayourtch opened this issue Aug 17, 2016 · 1 comment
Open

__FILE__ is not quoted on substitution. #22

ayourtch opened this issue Aug 17, 2016 · 1 comment

Comments

@ayourtch
Copy link

Testcase:

print(__FILE__)

The file name gets substituted without the double quotes.

@ayourtch
Copy link
Author

The following diff takes care of it:

@@ -1404,7 +1413,7 @@ function lcpp.compileFile(filename, predefines, macro_sources, next, _local)
        if not file then error("file not found: "..filename) end
        local code = file:read('*a')
        predefines = predefines or {}
-       predefines[__FILE__] = filename
+       predefines[__FILE__] = '"' .. filename .. '"'
        return lcpp.compile(code, predefines, macro_sources)
 end

ayourtch added a commit to ayourtch/lcpp that referenced this issue Aug 18, 2016
ayourtch added a commit to ayourtch/lcpp that referenced this issue Aug 22, 2016
ayourtch added a commit to ayourtch/lcpp that referenced this issue Aug 22, 2016
m-schmoock#22 - the testcase
covers only less important half of this fix.
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

1 participant