Browse Source

[PATCH 061/188] initial support for assembler symbols

From b44f2ceda7be1d4708374dcd07b3a17a1917e8f0 Mon Sep 17 00:00:00 2001
From: Dmitry Boyarintsev <[email protected]>
Date: Tue, 3 Mar 2020 10:34:57 -0500

git-svn-id: branches/wasm@46057 -
nickysn 5 years ago
parent
commit
cfc9f2952f
1 changed files with 19 additions and 0 deletions
  1. 19 0
      utils/wasmbin/watscanner.pas

+ 19 - 0
utils/wasmbin/watscanner.pas

@@ -38,6 +38,7 @@ type
     ofs       : integer;
     ofs       : integer;
     token     : TWatToken;
     token     : TWatToken;
     resText   : string;
     resText   : string;
+    asmCmd    : string;
     procedure SetSource(const abuf: string);
     procedure SetSource(const abuf: string);
     function Next: Boolean;
     function Next: Boolean;
 
 
@@ -148,8 +149,26 @@ begin
 end;
 end;
 
 
 function TWatScanner.CommentIsSymbol(const cmt: string): Boolean;
 function TWatScanner.CommentIsSymbol(const cmt: string): Boolean;
+var
+  i: integer;
+  t: string;
+  v: string;
 begin
 begin
+  writeln('comment: "',cmt,'"');
   Result := false;
   Result := false;
+  if (Pos(';;',cmt)<>1) then Exit;
+  i:=3;
+  ScanWhile(cmt, i, SpaceChars);
+  if (i>length(cmt)) or (cmt[i]<>'.') then Exit;
+
+  inc(i);
+  t := AnsiLowerCase(ScanTo(cmt, i, SpaceChars));
+  ScanWhile(cmt, i, SpaceChars);
+  v := ScanTo(cmt, i, SpaceChars);
+
+  asmCmd := t;
+  resText := v;
+  Result := true;
 end;
 end;
 
 
 procedure TWatScanner.SetSource(const abuf: string);
 procedure TWatScanner.SetSource(const abuf: string);