flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > Optional match? |
Author |
|
Borsuc 31 Dec 2009, 15:46
First of all, in your example above all of them are one single symbol, so you can't match them as separate symbols at all! You would have to separate them by spaces (literal symbols are separated by spaces, unless they are special characters like ':', '/' and other FASM-related symbols)
Code: a 1 e c e 1 b d a 1 b now... to make optional matching you'd have to use a bunch of them, unfortunately -- and possibly use a temporary symbolic constant as a 'signal' so it doesn't get matched twice. (don't forget to restore the symbolic constant upon end, so as to not conflict). Code: define t match ... { ... restore t define t + } ; use 't' as signal for matches with '+' restore t ; end However, if '1' is a literal symbol then all you have to do is: Code: match a =1 b, 12 2324 1 55 { ; a = symbols to the left of '1' symbol, i.e '12 2324' ; b = symbols to the right of '1' symbol, i.e '55' } You can also loop through symbols with irps and then use it as a "tape machine" (turing machine) so you can pretty much do anything you want... |
|||
31 Dec 2009, 15:46 |
|
Azu 31 Dec 2009, 15:52
Thanks!
I don't want there to have to be a '1' though, rather I want to get what is in between the a and b. And I think irps only works if there are spaces. In all the examples I see there has to be spaces in between everything. So doesn't it have the same problem? |
|||
31 Dec 2009, 15:52 |
|
Borsuc 31 Dec 2009, 16:14
you can't separate characters, you can only separate symbols in FASM. This isn't match or irps specific, it is FASM specific and how it handles symbols. A literal label is a single symbol.
A symbol is not a "character", only in special cases (like ':' and '/' and '+' and other such characters). |
|||
31 Dec 2009, 16:14 |
|
Azu 31 Dec 2009, 16:24
Thanks
What about load? Could it work to db `symbol in a virtual block and load back 1 character at a time? I'm guessing not since this is FASM specific not just match or irps specific, but I don't see why it shouldn't work. I'd try it myself but I'm pretty sure it is in the assembler stage.. and it would help a lot more if I could do it in preprocessor.. please is there some way? Besides trying to link FASM to PCRE somehow? |
|||
31 Dec 2009, 16:24 |
|
Borsuc 31 Dec 2009, 17:50
well you could do it but it's too complicated and not worth it, can't you just re-structure whatever you need it for in a more accessible (to FASM's preprocessor) way?
|
|||
31 Dec 2009, 17:50 |
|
Azu 31 Dec 2009, 17:56
Great idea, thanks:(
|
|||
31 Dec 2009, 17:56 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.