flat assembler
Message board for the users of flat assembler.
Index
> Projects and Ideas > fasmg as css preprocsesor |
Author |
|
Tomasz Grysztar 02 Oct 2017, 16:46
Enko wrote: The first issue I see is the minus "-" character. Then again, I am horrible at fasm macros. If using modified variant of fasmg is an option to consider, you could tweak fasmg's source so that it would not strip comments. Then the processing you need could be done with "macro ?!". |
|||
02 Oct 2017, 16:46 |
|
Tomasz Grysztar 02 Oct 2017, 17:38
With such modification in mind I tried to tweak fasmg source so that it would strip comments not upon reading source text from file, but later when preparing such line to be assembled. This change makes it easier to further tweak the sources so that semicolon-started comments would not be stripped at all, and even opens up a possibility of disabling this at the assembly time with some directive. Unfortunately, this also degrades performance a little bit, so I'm not eager to make it mainstream just for a couple of exotic applications.
Here's the diff of the tweak I made: Code: Index: source/assembler.inc ================================================================== --- source/assembler.inc +++ source/assembler.inc @@ -1071,10 +1071,12 @@ je convert_name_symbol cmp al,22h je convert_quoted_string cmp al,27h je convert_quoted_string + cmp al,';' + je skip_comment stosb cmp al,'`' je convert_parameter cmp al,'\' jne preprocess_line_from_file @@ -1082,10 +1084,29 @@ jne preprocess_line_from_file inc esi dec edi inc [ebx+SourceEntry.number_of_attached_lines] jmp preprocess_line_from_file + skip_comment: + lodsb + test al,al + jz file_ended + cmp al,0Ah + je line_ended + cmp al,22h + je skip_quoted_string + cmp al,27h + je skip_quoted_string + cmp al,1Ah + jne skip_comment + lodsd + lea esi,[esi+eax+8] + jmp skip_comment + skip_quoted_string: + lodsd + add esi,eax + jmp skip_comment convert_quoted_string: stosb mov eax,esi stosd lodsd Index: source/reader.inc ================================================================== --- source/reader.inc +++ source/reader.inc @@ -246,23 +246,11 @@ mov [last_token],0Ah cmp al,0Dh je cr cmp al,0Ah je lf - cmp al,3Bh - jne end_of_file - skip_comment: - lodsb - cmp al,0Dh - je cr - cmp al,0Ah - je lf - cmp al,1Ah - je end_of_file - test al,al - jnz skip_comment - end_of_file: xor al,al stosb mov ecx,edi mov eax,[tokenization_buffer] sub ecx,eax Index: source/tables.inc ================================================================== --- source/tables.inc +++ source/tables.inc @@ -15,14 +15,14 @@ PREPOSITION_AT = 0 PREPOSITION_FROM = 1 PREPOSITION_AS = 2 PREPOSITION_DUP = 3 -control_characters db 0,9,0Ah,0Dh,1Ah,20h,3Bh +control_characters db 0,9,0Ah,0Dh,1Ah,20h .count = $-control_characters -syntactical_characters db '+-/*=<>()[]{}:?!,.|&~#`\' +syntactical_characters db '+-/*=<>()[]{}:?!,.|&~#`\;' .count = $-syntactical_characters include_variable db 'INCLUDE',0 separating_operators: |
|||
02 Oct 2017, 17:38 |
|
Enko 02 Oct 2017, 17:44
In the case of semicolon for the source code, I think it might be optional as the newline should finish the line instruction too. I'll refresh my memory on fasm macros and see what I can come up with.
Thank you for the tips! |
|||
02 Oct 2017, 17:44 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.