type
TSakuraScriptFountainParser = class(TFountainParser)
- private
protected
function GetTalkToken: char;
procedure InitMethodTable; override;
procedure MetaProc;
procedure SakuraSymbolProc;
function SsParser: TSsParser;
+ function IsScope0ChangeTag(const Tag: String): boolean; virtual;
+ function IsScope1ChangeTag(const Tag: String): boolean; virtual;
public
function NextToken: Char; override;
function TokenToFountainColor: TFountainColor; override;
FTagErrorColor: TFountainColor;
FSynchronizedColor: TFountainColor;
FSakuraScriptParser: TSsParser;
+ FProcessSync: boolean;
+ FChangeScopeByHU: boolean;
+ FChangeScopeBy01: boolean;
procedure SetMetaWordColor(const Value: TFountainColor);
procedure SetScope0Color(const Value: TFountainColor);
procedure SetScope1Color(const Value: TFountainColor);
procedure SetTagErrorColor(const Value: TFountainColor);
procedure SetSynchronizedColor(const Value: TFountainColor);
procedure SetSakuraScriptParser(const Value: TSsParser);
+ procedure SetChangeScopeBy01(const Value: boolean);
+ procedure SetChangeScopeByHU(const Value: boolean);
+ procedure SetProcessSync(const Value: boolean);
{ Private \90é\8c¾ }
protected
{ Protected \90é\8c¾ }
procedure CreateFountainColors; override;
function GetParserClass: TFountainParserClass; override;
public
+ constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Scope0Color: TFountainColor read FScope0Color write SetScope0Color;
property MetaWordColor: TFountainColor read FMetaWordColor write SetMetaWordColor;
property SynchronizedColor: TFountainColor read FSynchronizedColor write SetSynchronizedColor;
property SakuraScriptParser: TSsParser read FSakuraScriptParser write SetSakuraScriptParser;
+ property ChangeScopeBy01: boolean read FChangeScopeBy01 write SetChangeScopeBy01 default true;
+ property ChangeScopeByHU: boolean read FChangeScopeByHU write SetChangeScopeByHU default true;
+ property ProcessSync: boolean read FProcessSync write SetProcessSync default true;
published
{ Published \90é\8c¾ }
end;
{ TSakuraScriptFountain }
+constructor TSakuraScriptFountain.Create(AOwner: TComponent);
+begin
+ inherited;
+ FChangeScopeByHU := true;
+ FChangeScopeBy01 := true;
+ FProcessSync := true;
+end;
+
procedure TSakuraScriptFountain.CreateFountainColors;
begin
inherited;
Result := TSakuraScriptFountainParser;
end;
+procedure TSakuraScriptFountain.SetChangeScopeBy01(const Value: boolean);
+begin
+ FChangeScopeBy01 := Value;
+end;
+
+procedure TSakuraScriptFountain.SetChangeScopeByHU(const Value: boolean);
+begin
+ FChangeScopeByHU := Value;
+end;
+
procedure TSakuraScriptFountain.SetMetaWordColor(
const Value: TFountainColor);
begin
FMetaWordColor.Assign(Value);
end;
+procedure TSakuraScriptFountain.SetProcessSync(const Value: boolean);
+begin
+ FProcessSync := Value;
+end;
+
procedure TSakuraScriptFountain.SetSakuraScriptParser(
const Value: TSsParser);
begin
end;
+function TSakuraScriptFountainParser.IsScope0ChangeTag(
+ const Tag: String): boolean;
+begin
+ Result := false;
+ if (Self.FFountain as TSakuraScriptFountain).ChangeScopeBy01 then
+ if Tag = '\0' then
+ Result := true;
+ if (Self.FFountain as TSakuraScriptFountain).ChangeScopeByHU then
+ if Tag = '\h' then
+ Result := true;
+end;
+
+function TSakuraScriptFountainParser.IsScope1ChangeTag(
+ const Tag: String): boolean;
+begin
+ Result := false;
+ if (Self.FFountain as TSakuraScriptFountain).ChangeScopeBy01 then
+ if Tag = '\1' then
+ Result := true;
+ if (Self.FFountain as TSakuraScriptFountain).ChangeScopeByHU then
+ if Tag = '\u' then
+ Result := true;
+end;
+
procedure TSakuraScriptFountainParser.MetaProc;
var i, Le: integer;
begin
inherited NextToken;
if FToken = toTag then
begin
- if TokenString = '\u' then
- FElementIndex := FElementIndex or InScope1;
- if TokenString = '\h' then
- FElementIndex := FElementIndex and not InScope1;
- if TokenString = '\_s' then
+ if IsScope1ChangeTag(TokenString) then
+ FElementIndex := FElementIndex or InScope1
+ else if IsScope0ChangeTag(TokenString) then
+ FElementIndex := FElementIndex and not InScope1
+ else if (FFountain as TSakuraScriptFountain).ProcessSync and
+ (TokenString = '\_s') then
FElementIndex := FElementIndex xor InSynchronized;
end else
begin