'*******************************************************************************
' EverEdit Syntax File
' Language:    PECMD
' Maintainer:  mdyblog.blog.163.com 
' History:
'   2013/04/28 Created
'*******************************************************************************
Include( ".\const.mac" )

Set pecmd=CreateParser()
pecmd.WordChars="_"

'comment
Set rLineComment=pecmd.CreateRegion( COLOR_COMMENT1, "+//+", "$", True )
Set rBlockComment=pecmd.CreateRegion( COLOR_COMMENT2, "+/*+", "+*/+", True )
pecmd.AddRegion( rLineComment )
pecmd.AddRegion( rBlockComment )

'add todo to comment
Set iTodo=pecmd.CreateItem( COLOR_HIGHLIGHT2, "\b(TODO|FIX)\b", False )
rLineComment.AddItem( iTodo )
rBlockComment.AddItem( iTodo )

'single quote string
Set rString1=pecmd.CreateStringRegion( COLOR_STRING1, "'", "\", False )
pecmd.AddRegion( rString1 )

Set rString2=pecmd.CreateStringRegion( COLOR_STRING1, """", "\", False )
pecmd.AddRegion( rString2 )

'function
pecmd.AddItem( pecmd.CreateItem(COLOR_FUNCTION, "[\w_][\w\d_]+(?=\()", False) )

'内部命令
pecmd.AddWord( pecmd.CreateWord(COLOR_WORD1, "ADSL ALias BASE BREAK BROW CALC Clipboard CMPS CODE COME CONTINUE Cur  DATE DeskTopFresh DEVI DIR DISK DISP DROPFILE  EATEKEYS EJEC ENVI EXEC EXIT  FBWF FDIR FDRV FEXT FILE FLNK FNAM FONT FORM FORX FPOS FVER  GETF  HASH HELP HelpColor HIDE HIVE HKEY HOME HOTK INIT InstallService  KILL LINK LOAD LOCK LOGO LOGS LPOS LSTR  MAIN MDIR MOUN MouseCapture MSTR  NAME NOTE NUMK NTPC  PAGE PART PATH PCIP PINT poprmenu POS POSTMSG PUTF  RAMD RAND READ RECY REGI RMENU RemoveService RPOS RSTR runrmenu RUNS  SCRN SED SEND SENDMSG SERV SET SITE SIZE SHEL SHOW SHUT SOCK SSTR STRL SUBJ  TaskIcoMenu TEAM TEXT THREAD TIME  UPNP USER  WALL WAIT WRIT", True ) )

'语法
pecmd.AddWord( pecmd.CreateWord(COLOR_WORD2, "_SUB CALL IMPORT EnviMode EXPORTLOCAL FIND FORCELOCAL IFEX LOOP this { } !  |", True ) )


'语法2
pecmd.AddWord( pecmd.CreateWord(COLOR_WORD3, "_END _ENDFILE", True ) )

'控件
pecmd.AddWord( pecmd.CreateWord(COLOR_WORD4, "CHEK DTIM EDIT GROU IMAG IPAD ITEM LABE LIST MEMO MENU MESS MSG PBAR RADI SBAR SLID SPIN SWIN TABL TABS TIPS TREE", True ) )

'operators
pecmd.AddItem( pecmd.CreateItem(COLOR_OPERATOR, "[\{\}\(\)\+\-\*\\=%&\^~<>?\.,:;\/\[\]]",False ) )
Set rError=pecmd.CreateRegion( COLOR_COMMENT1, "#\s*error\b", "$", True )
pecmd.AddRegion( rError )

'include
Set iInclude1=pecmd.CreateItem( COLOR_MACRO, "#\s*include\s*(<.*?>)", False )
iInclude1.Capture 1, COLOR_STRING2
Set iInclude2=pecmd.CreateItem( COLOR_MACRO, "#\s*include\s*(?="")", False )
iInclude2.Capture 1, COLOR_STRING2

pecmd.AddItem( iInclude1 )
pecmd.AddItem( iInclude2 )

'macro
pecmd.AddItem( pecmd.CreateItem(COLOR_MACRO, "#\s*if\s+!?defined",False ) )

pecmd.AddItem( pecmd.CreateItem(COLOR_MACRO, "#\s*(if|pragma|else|elif|error|ifndef|define|endif|undef|ifdef)\b", False ) )
'number
pecmd.AddItem( pecmd.CreateItem(COLOR_NUMBER, "\b([0-9]+\.?[0-9]*|0x[0-9a-fA-F]+)\b", False) )


pecmd.AddSnippet "c.snippet"
pecmd.FoldText "\{", False, "\}", False
pecmd.IndentText "(\[|{|\w+:)$", False, "^\s*}|\]$", False

pecmd.CommentLine("\b//")
pecmd.CommentLine("\b`")

pecmd.SetPairs( "[]{}()""""''" )
