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
process macro chaining caused by concat correctly #11
process macro chaining caused by concat correctly #11
Conversation
avoid ambiguousness between functional and replacement macro (eg. #define DEF (REPL))
support C string concatenation
… macro (caused by unmatched parentheses parsing) fix problem when , is included in string literal macro argument
|
Hey, Thanks for the feedback. i was on vacation and just read this. thank you, On Wed, January 1, 2014 1:06 am, iyatomi takehiro wrote:
|
|
hi, after tried to handle many complex case, I realized that not only concatenate but also macro replacement triggers new macro replacement. so I change state:apply so that it repeatedly try to apply macro set until no macro can apply. also I fix following issue
with these fix, now my version of lcpp seems to be able to parse pthread.h, lualib.h, lauxlib.h, stdlib.h, string.h in macosx correctly. if necessary, I will squash these commits together. |
|
Hey, many thanks. I will review and add it to the main repository. Thanks, On Fri, January 10, 2014 5:28 pm, iyatomi takehiro wrote:
|
…rrent implementation of state.apply does not handle functional macro which contains concatenatoion correctly.
…uplicate macro definition which has exactly same value.
support C-style integer type specifier L, U, LL, UL support C-style integer literal 0x, 0b, 0%d+(octet)
add support for #include_next
small fix for parsing rare case in C system headers
|
Hey, sorry im a bit busy and also lazy. im reviewing your branches right now: the latter one seems to produce an test error: |
|
oh, sorry, I only test my code with luajit (because I only uses lcpp for luajit FFI purpose) |
|
with e0aaa66, now it should work with lua 5.1.5 |
add more test for bitwise operation
…ning process macro chaining caused by concat correctly
|
I merged stuff and added you to contributos so you can chaing main repo now :D code looks good. thanks for you work! |
|
nice. thanks. your now contributor in main repo. On Tue, March 18, 2014 1:39 am, iyatomi takehiro wrote:
|
|
thank you for adding me as contributer :D I think it is good time to announce new release.
|
|
the scm has not tp be update because scm means something like "git package so what we can do is build a lcpp 1.1 packaged luarocks. and then announce I also have none experience in contributing luarocks :D Ah, one thing to the lcpp interface functions (conpile and compileFile) _local and next dont seem to be used. the are all not luadoc inline cheers, On Tue, March 18, 2014 3:07 pm, iyatomi takehiro wrote:
|
|
hi, _local and next is for resolving header file path. that is hint for user of lcpp. if lcpp.compileFile called with my usage estimation is inherit lcpp.compileFile like my example and change the way of resolving actual header file path according to the value of next and _local. at lcpp level, current default behavior is treated file path provided from directive as real file path. but when user try to parse practical header files, it probably includes some header file path like which full path needs to be resolved. in such case, _local and next is very useful. ofcourse I can add resolving path feature to lcpp itself, but some rule of resolving header file path is implementation defined (for example, see here), so I think this feature beyond the problem domain of lcpp and decided to just keep it customizable for user of lcpp. but at least I should document about _local and next in function signature. and please tell me your opinion. for example, should we prepare for some interface, instead of telling user to replace compileFile? regards Takehiro Iyatomi |
|
@aktau hi, I will keep on maintaining and developing ffiex. this pull request just feedback what I have done in the development of ffiex. now I become collaborator of lcpp, so I will take care of maintaining lcpp also, but maybe my main development for lcpp will be still done in ffiex first, then feeding it back to here (if it is suitable for the problem domain of lcpp). for new functionality of ffiex, please check thanks! |
|
@umegaya great, thanks! @willsteel sorry for the hijack, I'll shut up now ;) |
hi, I love lcpp feature and use it in my project for parsing some practical library's header file (pthread.h in osx).
but lcpp did not handle macro chaining as I expected.
below quick example about my expectation.
and it seems that this problem caused by 2 reasons.
a) if functional macro argument name contains _, entire macro is not recognized as valid one, because regex for argument list definition only match all alphanumeric, space, and comma:
b) lcpp missing re-processing token when ## is processed. for above example, after CONCAT_TEST4 processed and it compiled to CONCAT_TEST1, lcpp reprocess and compiled it to foobar.
c) FUNCMACRO allows space between macro name and arguments list. also processLine's macro processing potentially allows 1 macro definitions processed as multiple macro type (I'm not sure its needed).
I add some test case and fixing lcpp itself to pass these new test.
but this is not entirely tested for various macro usage.
so can you review this fix?
if it seems good, I would appreciate if you could merge this to master.
thanks and happy new year!!