flat assembler
Message board for the users of flat assembler.
  
|  Index
      > Compiler Internals > macro definition inside match bug? | 
| Author | 
 | 
| revolution 01 Feb 2006, 07:12 Use the backslash to escape the closing curly brackets.
 Code: match , { macro x{ \} } | |||
|  01 Feb 2006, 07:12 | 
 | 
| Ancient One 01 Feb 2006, 07:26 using backlash is the correct way to do this, but the above error should be detected, example in code like
 Code: macro a { macro b {} } fasm detect the error. | |||
|  01 Feb 2006, 07:26 | 
 | 
| Tomasz Grysztar 01 Feb 2006, 14:35 The "{" character is not disallowed inside the macro block - only "}" is treated specially and always means closing the current block (you can find this information in the manual, though it may appear hidden a bit).
 Let's look at your second sample (the first one actually causes an error< I guess you did copy not the right one sample there): Code: match , { macro a {display 'a'} macro b {} a } I'll indent it a bit differently to explain how it works: Code: match , { macro a { display 'a' } macro b { } a } The "match" begins the definition of "a" macro, but doesn't close it. So the the definition of a macro continues, and contains also "macro b" and "{" character before it is ended with "}". Now the next line invokes the "a" macro - so it begins the definition of "b" macro, but also doesn't close it, and thus the last "}" finally closes the definition of "b" macro - everything is OK. | |||
|  01 Feb 2006, 14:35 | 
 | 
| Ancient One 09 Feb 2006, 05:51 oh... now i understand..thanks a lot privalov. | |||
|  09 Feb 2006, 05:51 | 
 | 
| < Last Thread | Next Thread > | 
| Forum Rules: 
 | 
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.