• R/O
  • HTTP
  • SSH
  • HTTPS

winbottle: Commit

SSTP Bottle Client 本体


Commit MetaInfo

Revision05475bdf6445661de4728ebdf559d3a65a0f7381 (tree)
Time2006-04-11 10:02:04
Authornaru <bottle@mika...>
Commiternaru

Log Message

1つのSsParserインスタンスで複数の処理が出来るように変更。
スレッドセーフにするためには、
EscapeInvalidMeta/LeaveEscapeの保存処理を少しいじればいけるかも

Change Summary

Incremental Difference

--- a/sakurasuite/SsParser.pas
+++ b/sakurasuite/SsParser.pas
@@ -59,14 +59,14 @@ type
5959 function GetStr(Index: Integer): string;
6060 procedure SetExtra(Index: Integer; const Value: string);
6161 function GetItem(Index: Integer): TSsMarkUp;
62+ procedure Clear;
63+ procedure Add(Pos: Integer; MarkUpType: TSsMarkUpType; Str: string;
64+ Extra: string = '');
6265 protected
6366 property Item[Index: Integer]: TSsMarkUp read GetItem;
6467 public
6568 constructor Create(const InputString: string);
6669 destructor Destroy; override;
67- procedure Clear;
68- procedure Add(Pos: Integer; MarkUpType: TSsMarkUpType; Str: string;
69- Extra: string = '');
7070 function MarkUpAt(const Pos: Integer): Integer;
7171 property Count: Integer read GetCount;
7272 property MarkUpType[Index: Integer]: TSsMarkUpType read GetMarkUpType;
@@ -76,7 +76,12 @@ type
7676 property InputString: string read FInputString; // Cannot Write
7777 end;
7878
79- TSsParser = class(TComponent)
79+ // Notes to user:
80+ // This class has been modified so that it can handle multiple parsing
81+ // results, but this class is NOT thread-safe.
82+ // If you want to parse scripts within more than one thread,
83+ // separate parser instance should be prepared for each thread.
84+ TSsParser = class(TComponent)
8085 private
8186 FTagPattern: TStrings; //SakuraScript tag pattern string
8287 FMetaPattern: TStrings; //SakuraScript meta expression pattern string
@@ -114,6 +119,8 @@ type
114119 function EscapeParam(const Param: string): string;
115120 function MarkUpAt(const Pos: integer): integer;
116121
122+ function Parse(const Script: string): TSsParseResult;
123+
117124 { These properties are deprecated. }
118125 property Count: integer read GetCount;
119126 property MarkUpType[Index: integer]: TSsMarkUpType read GetMarkUpType;
@@ -682,6 +689,12 @@ begin
682689 if not Matched then Result := 0;
683690 end;
684691
692+function TSsParser.Parse(const Script: string): TSsParseResult;
693+begin
694+ Result := TSsParseResult.Create(Script);
695+ BeginParse(Result);
696+end;
697+
685698 procedure TSsParser.SetExtra(Index: integer; const Value: string);
686699 begin
687700 FBuffList.Extra[Index] := Value;
Show on old repository browser