Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Обсуждение форума > ВНИМАНИЕ! Подсветка синтаксиса на форуме.


Автор: sergejzr 20.12.2004, 22:17
И так все, кому хоть что-то не понравилось в подсветке. Пожалуйста жалобы и предложения сюда!
Так как ошибки исправлены и делать стало нечего ( smile ) хочется наконец-то опубликовать окончательный вариант и закрыть проект.

Вот так будет выглядеть подсветка (изменения по сравнению с сущ. в языках Си++, дельфи, Хтмл).
http://_http://www.iwi-iuk.org:8081/tests/vingrad/test2.php?oldurl=http://forum.vingrad.ru

Так же то, что дейчас не изменится, так и останется smile

Короче говоря конечный спурт!

Спасибо! smile

ПС:
Если найдёте ссылки на интересные коды на форум, плиз тоже сюда smile
Когда будете постить примеры кода, указывайте его язык!

Вот конкретно ссылка на новоподсвеченный код конкретно в этой теме:
http://_http://www.iwi-iuk.org:8081/tests/vingrad/test2.php?oldurl=http://forum.vingrad.ru/index.php?act=ST&f=27&t=37700&st=0#
Нажимайте рефреш, если что smile

Автор: Domestic Cat 20.12.2004, 22:27
А когда планируется запустить в производство?

Автор: sergejzr 20.12.2004, 22:31
Как все довольны будут smile ну во всяком случае до нового года. Правда пока с Админом не разговаривал, но думаю, он против не будет smile

Автор: Domestic Cat 20.12.2004, 22:35
Цитата
Как все довольны будут


прямо коммунизм настанет smile

Автор: Vit 21.12.2004, 05:41
Delphi-хочу привычное выделение Bold для зарезервированных слов языка (Procedure, Var и т.п.)

Автор: Akina 21.12.2004, 09:28
Код

open "file.ext" for input as someVar
open "file.ext" for input as #someVar

Автор: Vach 21.12.2004, 17:34
Для Vb
Код
Type typLinkInfo
   fFileName As String
End Type

Dim a() As Byte
ReDim Preserve a(11)
a(1) = "b"
a(1) = IIf(1 = 1, tyue, False)
Me.Show
If Len(Label1.Caption) Then
If (Not DE.rsZ.BOF) And (Not DE.rsZ.EOF) Then

Type - тогоже цвет как и End
ReDim Preserve - тогоже цвет как и Dim
"()" скобки не подсвечиваются

далее для соотведствия, хоя мне нравится
IIf, Len, Me, Not, And - не подсвечивается

Автор: sergejzr 21.12.2004, 17:45
Vit, я чего то не понял... Разве сейчас не так?
Код

procedure var


Vach
"Type ReDim Preserve" добавлены. Скобки менять не будем, так как были люди за их синий цвет. Так же с "IIf, Len, Me, Not, And" smile

Akina
Поясните, а также указывайте плиз название языка.

Автор: Vit 21.12.2004, 23:51
Цитата(sergej @ 21.12.2004, 08:45)
Vit, я чего то не понял... Разве сейчас не так?


Всё нормально... Это как оказалось Clear Type сглаживание на ноутбуке так работает что почти не видно разницы smile

Автор: -Mikle- 22.12.2004, 00:13
Цитата(Akina @ 21.12.2004, 12:28)
open "file.ext" for input as someVar
open "file.ext" for input as #someVar


Это наверно из-за меня...
Я когда сождавал подсветку, задал покрас синим после символа #
Можно убрать конечно, это лишнее оказалось...

sergei.z, дай снова доступ к коду инициализации, я подправлю до нового года...

А также, предложение: можно ли сделать так, чтоб потом в последствии, можно было бы добавлять и корректировать подсветку?

Автор: sergejzr 22.12.2004, 00:49
Цитата(Mikle @ 21.12.2004, 23:13)

sergei.z, дай снова доступ к коду инициализации, я подправлю до нового года...

А также, предложение: можно ли сделать так, чтоб потом в последствии, можно было бы добавлять и корректировать подсветку?

Доступ у тебя остался smile
А корректировать можно, но внедрять только релизами smile

Автор: ~FoX~ 22.12.2004, 11:04
Delphi
Код

type
 TAboutBox = class(TForm)
   OKButton: TButton;
   ProgramIcon: TImage;
   Label1: TLabel;
   Version: TLabel;
   Copyright: TLabel;
   procedure OKButtonClick(Sender: TObject);
   procedure FormShow(Sender: TObject);
 private
   { Private declarations }
 public
   { Public declarations }
 end;

 If (CheckBox4.Checked = true) and (CheckBox5.Checked = false) then
   begin
      Reg:=TRegIniFile.Create('SOFTWARE\Microsoft\Windows\CurrentVersion\Run');
      Reg.RootKey := (HKEY_LOCAL_MACHINE);
      s:=Application.ExeName + ' /a';
      Reg.WriteString('SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'Wall', s);
      IniFile.WriteBool('Options', 'Reb', true);
   end


Код

       CPL_INQUIRE     : DoInquire(PCplInfo(lParam2)^);
       CPL_NEWINQUIRE  : DoNewInquire(PNewCPLInfo(lParam2)^);
       CPL_DBLCLK      : DoActivate(LongInt(lParam2));
       CPL_STOP        : DoStop(LongInt(LParam2));
       CPL_EXIT        : DoExit;
       CPL_SETUP       : DoSetup;


uses Types;

{$HPPEMIT '#ifdef __linux__'}

{$HPPEMIT '#ifdef CLX_USE_LIBQT'}
{$HPPEMIT '#pragma link "libqtintf-6.9-qt2.3.so"'}
{$HPPEMIT '#else'}
{$HPPEMIT '#pragma link "libborqt-6.9-qt2.3.so"'}
{$HPPEMIT '#endif'}


asm
       PUSH    ESI
       PUSH    EDI
       MOV     EDI,EAX
       MOV     ESI,EDX
       MOV     EDX,EAX
       CLD
@@1:    LODSB
@@2:    OR      AL,AL
       JE      @@4
       CMP     AL,0AH
       JE      @@3
       STOSB
       CMP     AL,0DH
       JNE     @@1
       MOV     AL,0AH
       STOSB
       LODSB
       CMP     AL,0AH
       JE      @@1
       JMP     @@2
@@3:    MOV     EAX,0A0DH
       STOSW
       JMP     @@1
@@4:    STOSB
       LEA     EAX,[EDI-1]
       SUB     EAX,EDX
       POP     EDI
       POP     ESI
end;

Хех.......

Автор: sergejzr 22.12.2004, 13:26
А что это за конструкция? @@4
Может тоже подсветить?
Добавлено @ 13:30
Хотя в принципе p0s0l наверное бы подсветил, если бы надо было бы
(Во! 3 раза "бы" smile)

Автор: Pakshin A. S. 24.12.2004, 23:20
Удалите пост...

Автор: p0s0l 24.12.2004, 23:48
Код
asm
 @label1: jmp @@label2
 @@label2: jmp @label1
 @1: jmp @@2
 @@2: jmp @1
 @@@1label: ...
end;


Добавлено @ 23:54
Ух, это плохо...
В принципе, тогда добавил подсветку меток (начинаются на @), но видимо, если после @ идёт цифра, а не буква, то облом получается... А также, если несколько споподряд символов @, то тоже не очень красиво (метка подсвечивается начиная только с последнего символа @)... Я не знаю, как это обойти...
sergej.z наверное знает smile

Автор: sergejzr 25.12.2004, 19:41
Если @ не используется в других контекстах, то исправил smile

Автор: Cheba 25.12.2004, 23:20
sergej.z, а оно используется. smile

Автор: sergejzr 25.12.2004, 23:24
В каких?

Автор: Cheba 26.12.2004, 18:53
Цитата(Delphi)
Labels

Labels are used in built-in assembly statements as they are in the Delphi language--by writing the label and a colon before a statement. There is no limit to a label's length. As in Delphi, labels must be declared in a label declaration part in the block containing the asm statement. The one exception to this rule is local labels.

Local labels are labels that start with an at-sign (@). They consist of an at-sign followed by one or more letters, digits, underscores, or at-signs. Use of local labels is restricted to asm statements, and the scope of a local label extends from the asm reserved word to the end of the asm statement that contains it. A local label doesn't have to be declared.


Цитата(Delphi)
The @ operator

The @ operator returns the address of a variable, or of a function, procedure, or method; that is, @ constructs a pointer to its operand. For more information about pointers, see Pointers and pointer types. The following rules apply to @.

If X is a variable, @X returns the address of X. (Special rules apply when X is a procedural variable; see Procedural types in statements and expressions.) The type of @X is Pointer if the default {$T-} compiler directive is in effect. In the {$T+} state, @X is of type ^T, where T is the type of X (This distinction is important for assignment compatibility, see "Assignment-compatibility" on page 5-36).

If F is a routine (a function or procedure), @F returns F's entry point. The type of @F is always Pointer.
When @ is applied to a method defined in a class, the method identifier must be qualified with the class name. For example,

Код
@TMyClass.DoSomething

points to the DoSomething method of TMyClass. For more information about classes and methods, see Classes and objects.

Note 
When using the @ operator, it is not possible to take the address of an interface method as the address is not known at compile time and cannot be extracted at runtime.


Цитата(Delphi)
Procedural types in statements and expressions

When a procedural variable is on the left side of an assignment statement, the compiler expects a procedural value on the right. The assignment makes the variable on the left a pointer to the function or procedure indicated on the right. In other contexts, however, using a procedural variable results in a call to the referenced procedure or function. You can even use a procedural variable to pass parameters:

Код
var
 F: function(X: Integer): Integer;
 I: Integer;
function SomeFunction(X: Integer): Integer;
...
F := SomeFunction;  // assign SomeFunction to F
I := F(4);          // call function; assign result to I

In assignment statements, the type of the variable on the left determines the interpretation of procedure or method pointers on the right. For example,

Код
var
 F, G: function: Integer;
 I: Integer;
function SomeFunction: Integer;
...
F := SomeFunction;  // assign SomeFunction to F
G := F;             // copy F to G
I := G;             // call function; assign result to I

The first statement assigns a procedural value to F. The second statement copies that value to another variable. The third statement makes a call to the referenced function and assigns the result to I. Because I is an integer variable, not a procedural one, the last assignment actually calls the function (which returns an integer).

In some situations it is less clear how a procedural variable should be interpreted. Consider the statement

Код
if F = MyFunction then ...;

In this case, the occurrence of F results in a function call; the compiler calls the function pointed to by F, then calls the function MyFunction, then compares the results. The rule is that whenever a procedural variable occurs within an expression, it represents a call to the referenced procedure or function. In a case where F references a procedure (which doesn't return a value), or where F references a function that requires parameters, the previous statement causes a compilation error. To compare the procedural value of F with MyFunction, use

Код
if @F = @MyFunction then ...;

@F converts F into an untyped pointer variable that contains an address, and @MyFunction returns the address of MyFunction.

To get the memory address of a procedural variable (rather than the address stored in it), use @@. For example, @@F returns the address of F.

The @ operator can also be used to assign an untyped pointer value to a procedural variable. For example,

Код
var StrComp: function(Str1, Str2: PChar): Integer;
...
@StrComp := GetProcAddress(KernelHandle, 'lstrcmpi');

calls the GetProcAddress function and points StrComp to the result.

Any procedural variable can hold the value nil, which means that it points to nothing. But attempting to call a nil-valued procedural variable is an error. To test whether a procedural variable is assigned, use the standard function Assigned:

Код
if Assigned(OnClick) then OnClick(X);


Цитата(Symbols)
Код
Symbol    Value                    Class              Type
@Result   Result variable offset   Memory reference   Size of type

Автор: p0s0l 26.12.2004, 19:31
Подсветка асма и дельфи - это разные вещи, друг на друга не влияют...
@ используется для получения указателя на процедуру, переменную и т.д. в Pascal-коде...
Но тут проблема была в asm-части, где @ используется для меток.
Вместо оператора @ в asm-коде используется оператор offset.
Единственное исключение - @Result...
Но ради этого что-то мудрить - не стоит, т.к. @Result редко используется, да и не больно вид испортится... Зато подсветка меток - это удобно...
...
Хотя если подумать, это может даже и удобнее smile. Ведь по-смыслу @Result - это тоже метка smile, которая автоматически присутствует в функциях. Т.е. можно сделать jmp @Result, call [@Result], mov eax, [@Result] и т.д... Всё пучком короче smile

Цитата(sergej @ 25.12.2004, 19:41)
Если @ не используется в других контекстах, то исправил
Сейчас всё круто! Молодец! smile



Автор: sergejzr 29.12.2004, 14:47
Дорогие друзья подсветки!

Благодаря работам dm9, подсветка ХТМЛ и CSS теперь полностью поддерживается. Огромная ему благодарность!
А также:
В связи с проведёнными оптимизациями кода, он не только сократился по обьёму на 7,5 кБ (теперь 30 кБ) , но и величилась скорость самой подсветки. (Напомним, что подсвечиваются 15 различных языков)
Вот пример:
http://forum.vingrad.ru/index.php?showtopic=37557
http://_http://www.iwi-iuk.org:8081/tests/vingrad/test2.php?oldurl=http://forum.vingrad.ru/index.php?showtopic=37557

На данный момент Cashey и -Mikle- ведут работы над SQL и VB. После их заключения подсветку можно будет обновлять.

Поможем же им в этом деле smile

Cheba, спасибо smile

Автор: The MASTER 28.2.2005, 22:21
Код

ShellExecute(handle, 'open', pchar('regedit'), nil, nil, sw_shownormal);

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)