📄 skyparser.pas
字号:
end;
end;
procedure TCustomSkyParser.SetBlockCommentOffs(Value: TStrings);
begin
if Assigned(FBlockCommentOffs) then
begin
FBlockCommentOffs.Assign(Value);
end;
end;
procedure TCustomSkyParser.SetWords_1(Value: TStrings);
begin
if Assigned(FWords_1) then
begin
FWords_1.Assign(Value);
end;
end;
procedure TCustomSkyParser.SetWords_2(Value: TStrings);
begin
if Assigned(FWords_2) then
begin
FWords_2.Assign(Value);
end;
end;
procedure TCustomSkyParser.SetWords_3(Value: TStrings);
begin
if Assigned(FWords_3) then
begin
FWords_3.Assign(Value);
end;
end;
procedure TCustomSkyParser.SetWords_4(Value: TStrings);
begin
if Assigned(FWords_4) then
begin
FWords_4.Assign(Value);
end;
end;
procedure TCustomSkyParser.SetWords_5(Value: TStrings);
begin
if Assigned(FWords_5) then
begin
FWords_5.Assign(Value);
end;
end;
procedure TCustomSkyParser.SetWords_6(Value: TStrings);
begin
if Assigned(FWords_6) then
begin
FWords_6.Assign(Value);
end;
end;
procedure TCustomSkyParser.SetWords_7(Value: TStrings);
begin
if Assigned(FWords_7) then
begin
FWords_7.Assign(Value);
end;
end;
procedure TCustomSkyParser.SetWords_8(Value: TStrings);
begin
if Assigned(FWords_8) then
begin
FWords_8.Assign(Value);
end;
end;
procedure TCustomSkyParser.SetFileExtentions(Value: TStrings);
begin
if Assigned(FFileExtentions) then
begin
FFileExtentions.Assign(Value);
end;
end;
function TCustomSkyParser.GetSyntaxTypeByWord(const sWord: String;
var idx: Integer): TSkySyntaxType;
begin
idx := -1;
if sWord <> '' then
begin
Result := sstNone;
if Length(sWord) = 1 then
begin
if (FEscapeChar > #0) and (sWord[1] = FEscapeChar) then
begin //字符串忽略符(换行用)
Result := sstEscapeChar;
FCurrSyntaxAttr := @FNormalTextAttr;//FStringsAttr;
end
else if (FMacroWrapChar > #0) and (sWord[1] = FMacroWrapChar) then
begin //宏换行符
Result := sstMacroWrapChar;
FCurrSyntaxAttr := @FNormalTextAttr;//FMacrosAttr;
end
else if (FCharacters > #0) and (sWord[1] = FCharacters) then
begin //单个字符指示符
Result := sstCharacters;
FCurrSyntaxAttr := @FCharAttr;
end
else if sWord[1] in FMacroNoteSymbols then
begin //宏指示符
Result := sstMacroSymbols;
FCurrSyntaxAttr := @FMacrosAttr;
end
else if sWord[1] in FStringSymbols then
begin //字符串指示符
Result := sstStringChars;
FCurrSyntaxAttr := @FStringsAttr;
end
;
end;
if Result = sstNone then
begin
if TStringList(FLineComments).Find(sWord, idx) then
begin
Result := sstLineComments;
FCurrSyntaxAttr := @FCommentsAttr;
end
else if TStringList(FBlockCommentOns).IndexOf(sWord) >= 0 then
begin //注意:多行注释符不能用Find(即不可排序)! 2004.10.21
idx := TStringList(FBlockCommentOns).IndexOf(sWord);
Result := sstCommentOns;
FCurrSyntaxAttr := @FCommentsAttr;
end
else if TStringList(FWords_1).Find(sWord, idx) then
begin
Result := sstWords_1;
FCurrSyntaxAttr := @FWords_1_Attr;
end
else if TStringList(FWords_2).Find(sWord, idx) then
begin
Result := sstWords_2;
FCurrSyntaxAttr := @FWords_2_Attr;
end
else if TStringList(FWords_3).Find(sWord, idx) then
begin
Result := sstWords_3;
FCurrSyntaxAttr := @FWords_3_Attr;
end
else if TStringList(FWords_4).Find(sWord, idx) then
begin
Result := sstWords_4;
FCurrSyntaxAttr := @FWords_4_Attr;
end
else if TStringList(FWords_5).Find(sWord, idx) then
begin
Result := sstWords_5;
FCurrSyntaxAttr := @FWords_5_Attr;
end
else if TStringList(FWords_6).Find(sWord, idx) then
begin
Result := sstWords_6;
FCurrSyntaxAttr := @FWords_6_Attr;
end
else if TStringList(FWords_7).Find(sWord, idx) then
begin
Result := sstWords_7;
FCurrSyntaxAttr := @FWords_7_Attr;
end
else if TStringList(FWords_8).Find(sWord, idx) then
begin
Result := sstWords_8;
FCurrSyntaxAttr := @FWords_8_Attr;
end
;
end;
if (Length(sWord) = 1) and (Result = sstNone) and
(sWord[1] in FDelimiterSymbols) then
begin //分隔符
Result := sstDelimiters;
FCurrSyntaxAttr := @FDelimitersAttr;
end
end
else
Result := sstNone;
if Result = sstNone then
FCurrSyntaxAttr := @FNormalTextAttr;
end;
function TCustomSkyParser.GetCurrSyntaxAttr: TSkySyntaxAttr;
begin
Result := FCurrSyntaxAttr^;
end;
function TCustomSkyParser.IsStringSymbols(ch: Char): Boolean;
begin //是字符串指示符?
Result := ch in Self.FStringSymbols;
end;
function TCustomSkyParser.IsMacroSymbols(ch: Char): Boolean;
begin //是宏串指示符?
Result := ch in Self.FMacroNoteSymbols;
end;
procedure TCustomSkyParser.SetInt_1_Chars(const Value: String);
var
i: Integer;
begin
FInt_1_Chars := Value;
FInt_1_Charset := [];
for i := 1 to Length(Value) do
Include(FInt_1_Charset, Value[i]); //整数一字符集合
end;
procedure TCustomSkyParser.SetInt_2_Chars(const Value: String);
var
i: Integer;
begin
FInt_2_Chars := Value;
FInt_2_Charset := [];
for i := 1 to Length(Value) do
Include(FInt_2_Charset, Value[i]); //整数二字符集合
end;
procedure TCustomSkyParser.SetInt_3_Chars(const Value: String);
var
i: Integer;
begin
FInt_3_Chars := Value;
FInt_3_Charset := [];
for i := 1 to Length(Value) do
Include(FInt_3_Charset, Value[i]); //整数三字符集合
end;
procedure TCustomSkyParser.SetInt_4_Chars(const Value: String);
var
i: Integer;
begin
FInt_4_Chars := Value;
FInt_4_Charset := [];
for i := 1 to Length(Value) do
Include(FInt_4_Charset, Value[i]); //整数四字符集合
end;
procedure TCustomSkyParser.SetFloat_Chars(const Value: String);
var
i: Integer;
begin
FFloat_Chars := Value;
FFloat_Charset := [];
for i := 1 to Length(Value) do
Include(FFloat_Charset, Value[i]); //浮点数字符集合
end;
procedure TCustomSkyParser.SetAlphabetChars(const Value: String);
var
i: Integer;
begin
FAlphabetChars := Value;
FAlphabet := [];
for i := 1 to Length(Value) do
Include(FAlphabet, Value[i]); //组成单词的字母表字符集合
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -