Rev 8855 | Rev 8957 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8855 | Rev 8856 | ||
---|---|---|---|
Line 65... | Line 65... | ||
65 | def __init__(self, line, name): |
65 | def __init__(self, line, name): |
66 | self.line = line |
66 | self.line = line |
67 | self.name = name |
67 | self.name = name |
Line 68... | Line 68... | ||
68 | 68 | ||
69 | class AsmMacro: |
69 | class AsmMacro: |
- | 70 | def __init__(self, asm_file_name, line, name, comment, args): |
|
70 | def __init__(self, line, name, comment, args): |
71 | self.file = asm_file_name |
71 | self.line = line |
72 | self.line = line |
72 | self.name = name |
73 | self.name = name |
73 | self.comment = comment |
74 | self.comment = comment |
Line 242... | Line 243... | ||
242 | else: |
243 | else: |
243 | raise Exception(f"Unexpected symbol '{curr()}' at index #{i} " + |
244 | raise Exception(f"Unexpected symbol '{curr()}' at index #{i} " + |
244 | f"in the macro declaration:\n'{line}'") |
245 | f"in the macro declaration:\n'{line}'") |
245 | if arg != '': |
246 | if arg != '': |
246 | args.append(arg) |
247 | args.append(arg) |
247 | if len(args) > 0: |
- | |
248 | print(line, args) |
- | |
249 | # Find a comment if any |
248 | # Find a comment if any |
250 | comment = "" |
249 | comment = "" |
251 | while curr() and curr() != ';': step() |
250 | while curr() and curr() != ';': step() |
252 | if curr() == ';': |
251 | if curr() == ';': |
253 | step() |
252 | step() |
Line 270... | Line 269... | ||
270 | warnings += f"{asm_file_name}:{line_idx + 1}: Empty comment in\n" |
269 | warnings += f"{asm_file_name}:{line_idx + 1}: Empty comment in\n" |
271 | if comment[0].islower(): |
270 | if comment[0].islower(): |
272 | warnings += f"{asm_file_name}:{line_idx + 1}: Сomment sarting with lowercase\n" |
271 | warnings += f"{asm_file_name}:{line_idx + 1}: Сomment sarting with lowercase\n" |
273 | # Build the output |
272 | # Build the output |
274 | line_span = line_idx - line_idx_orig + 1 |
273 | line_span = line_idx - line_idx_orig + 1 |
275 | result = AsmMacro(line_idx_orig, name, comment, args) |
274 | result = AsmMacro(asm_file_name, line_idx_orig, name, comment, args) |
276 | return (line_span, result) |
275 | return (line_span, result) |
Line 277... | Line 276... | ||
277 | 276 | ||
278 | def get_declarations(asm_file_contents, asm_file_name): |
277 | def get_declarations(asm_file_contents, asm_file_name): |
279 | asm_file_name = asm_file_name.replace("./", "") |
278 | asm_file_name = asm_file_name.replace("./", "") |