flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > [fasmg] stringify string

Author
Thread Post new topic Reply to topic
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 14 Jun 2021, 13:15
Hello. I use a ?! macro to stringify all catched line for string processing and other stuff. In fact, I have designed a small domain specific lang. " and ' have not the same meaning (in my lang). But when I stringify line containing " it's converted into '. I can't dissociate what the user wanted. For instance:
Code:
calminstruction _? _params?            
    _init const __params, _params                                              
    stringify _params                                                          
    _asmcmd =display "[", __params, "]"          
end calminstruction                                                            
                                                                               
_ "abc" ; display ['abc']
    

There is no way I can display ["abc"]??
Thanks.
Post 14 Jun 2021, 13:15
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 14 Jun 2021, 19:20
This is a bit of information that is lost during fasm's tokenization, there is no way to get it back. The string token would probably need to be extended with additional byte to fit such information into.
Post 14 Jun 2021, 19:20
View user's profile Send private message Visit poster's website Reply with quote
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 14 Jun 2021, 19:50
Ok. I've re-read the man (lexical part) and I didn't known that double and single quote were apart from the +-/*=<>()[]{} group. So technically you can define variable with quote inside it, like:
Code:
a"b? = 3
    

Pretty funny.
Post 14 Jun 2021, 19:50
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4039
Location: vpcmpistri
bitRAKE 15 Jun 2021, 07:37
It can be really helpful with numbers too:
Code:
bitfields:
.mask   = 00'111'000b
.one    = 00'001'000b
.two    = 00'010'000b
.three  = 00'011'000b    

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 15 Jun 2021, 07:37
View user's profile Send private message Visit poster's website Reply with quote
MaoKo



Joined: 07 May 2019
Posts: 100
Location: Paris/French
MaoKo 15 Jun 2021, 15:18
Yes. I forget that too. Underscore also work but single quote is far better. You can mix both also.
Post 15 Jun 2021, 15:18
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.