将网页显示的 Delphi 代码上色并格式化

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 wlnh_2004 的 blog

        感谢李马行云流水网站提供的 c 语言版 《pascal 词法分析器》源代码,本程序以他的程序流程为思路,针对代码上色和格式化进行了功能扩展,用 delphi7.0 编译通过,处理速度比较理想,欢迎大家发表意见。另外,近期将完成 c# 的处理程序。    
        本程序由于功能还待完善,暂不公布源代码,有需要源代码的朋友可以参考《pascal 词法分析器》,需要程序的朋友可以留下 email 地址 。

处理样例如下:

unit mainform;

interface

uses
  windows, messages, sysutils, variants, classes, graphics, controls, forms,
  dialogs, stdctrls,strutils, db, adodb;

type
  tform1 = class(tform)
    button1: tbutton;
    memo: tmemo;
    procedure formcreate(sender: tobject);
    procedure button1click(sender: tobject);
  private
    { private declarations }

    reservewords:tstrings;
    stroutput:string;
    intposition:integer;
    procedure analyzer();
    function isnumberic(ch: char):boolean;
    function isalpha(ch: char): boolean;
    function getnextchar():char;
    procedure processor(strinput:string);

  public
    { public declarations }

  end;

var
  form1: tform1;

implementation

{$r *.dfm}


procedure tform1.formcreate(sender: tobject);
begin
  reservewords:=tstringlist.create();
  reservewords.loadfromfile('关键字.txt');
end;

本文关键:将网页显示的 Delphi 代码上色并格式化
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top