Browse Source

* gettoken add support for " quotes

git-svn-id: trunk@5244 -
peter 19 years ago
parent
commit
b7cb804c50
1 changed files with 5 additions and 3 deletions
  1. 5 3
      compiler/cutils.pas

+ 5 - 3
compiler/cutils.pas

@@ -578,21 +578,23 @@ implementation
     function GetToken(var s:string;endchar:char):string;
     function GetToken(var s:string;endchar:char):string;
       var
       var
         i : longint;
         i : longint;
+        quote : char;
       begin
       begin
         GetToken:='';
         GetToken:='';
         s:=TrimSpace(s);
         s:=TrimSpace(s);
         if (length(s)>0) and
         if (length(s)>0) and
-           (s[1]='''') then
+           (s[1] in ['''','"']) then
          begin
          begin
+           quote:=s[1];
            i:=1;
            i:=1;
            while (i<length(s)) do
            while (i<length(s)) do
             begin
             begin
               inc(i);
               inc(i);
-              if s[i]='''' then
+              if s[i]=quote then
                begin
                begin
                  { Remove double quote }
                  { Remove double quote }
                  if (i<length(s)) and
                  if (i<length(s)) and
-                    (s[i+1]='''') then
+                    (s[i+1]=quote) then
                   begin
                   begin
                     Delete(s,i,1);
                     Delete(s,i,1);
                     inc(i);
                     inc(i);