'*******************************************************************************
' EverEdit Syntax File
' Language:    VB Script
' Maintainer:  www.everedit.net  
' History:
'   2012/02/15 First Version
'   2012/07/17 Added line comment with 'rem'
'   2014/05/21 Added vbs.snippet
'	2014/07/14 Added more key words and outline support
'*******************************************************************************
Include( ".\const.mac" )

Set vbs=CreateParser()

Set rLineComment=vbs.CreateRegion(COLOR_COMMENT1, "'", "$", True )
vbs.AddRegion( vbs.CreateRegion(COLOR_COMMENT1, "\brem\b", "$", False ) )
Set rString2=vbs.CreateStringRegion( COLOR_STRING2, """", "", False )

'Reserved words;
Set wKeyWord=vbs.CreateWord( COLOR_WORD1, "Anchor And As ByRef ByVal Call Case Class Clear Const Debug Description Dictionary Dim Do Document Each Element Else ElseIf Empty End Eqv Erase Err Error Execute ExecuteGlobal Exit Explicit False FileSystemObject  FirstIndex For Form Function Get Global Goto HelpContext HelpFile History If IgnoreCase Imp In InstrRev Is Length Let Link Location Loop Match Matches Mod Navigator New Next Not Nothing Null Number On Option Or Pattern Preserve Private Property Public Raise Randomize ReDim RegExp Resume Select Set Source Step Stop Sub SubMatches Test TextStream Then To True Until Value vbCrLf WeekDayName Wend While Window With Write WriteLine Xor", False )
wKeyWord.AutoCase=True

'Const
Set wWordConst=vbs.CreateWord( COLOR_WORD2, "vbAbort vbAbortRetryIgnore vbApplicationModal vbArray vbBinaryCompare vbBlack vbBlue vbBoolean vbByte vbCancel vbCr vbCritical vbCrLf vbCurrency vbCyan vbDataObject vbDate vbDecimal vbDefaultButton1 vbDefaultButton2 vbDefaultButton3 vbDefaultButton4 vbDouble vbEmpty vbError vbExclamation vbFalse vbFirstFourDays vbFirstFullWeek vbFirstJan1 vbFormFeed vbFriday vbGeneralDate vbGreen vbIgnore vbInformation vbInteger vbLf vbLong vbLongDate vbLongTime vbMagenta vbMonday vbNewLine vbNo vbNull vbNullChar vbNullString vbObject vbObjectError vbOK vbOKCancel vbOKOnly vbQuestion vbRed vbRetry vbRetryCancel vbSaturday vbShortDate vbShortTime vbSingle vbString vbSunday vbSystemModal vbTab vbTextCompare vbThursday vbTrue vbTuesday vbUseDefault vbUseSystemDayOfWeek vbVariant vbVerticalTab vbWednesday vbWhite vbYellow vbYes vbYesNo vbYesNoCancel", False )
wWordConst.AutoCase=True

'Functions;
Set wFunction=vbs.CreateWord( COLOR_WORD3, "Abs Array Asc Atn CBool CByte CCur CDate CDbl Chr CInt CLng Conversions Cos CreateObject CSng CStr Date DateAdd DateDiff DatePart DateSerial DateValue Day Derived Escape Eval Exp Filter Fix FormatCurrency FormatDateTime FormatNumber FormatPercent GetLocale GetObject GetRef Hex Hour InputBox InStr InStrRev Int IsArray IsDate IsEmpty IsNull IsNumeric IsObject Join LBound LCase Left Len LoadPicture Log LTrim Math Maths Mid Minute Month MonthName MsgBox Now Oct Replace RGB Right Rnd Round RTrim ScriptEngine ScriptEngineBuildVersion ScriptEngineMajorVersion ScriptEngineMinorVersion Second SetLocale Sgn Sin Space Split Sqr StrComp String StrReverse Tan Time Timer TimeSerial TimeValue Trim TypeName UBound UCase Unescape VarType Weekday WeekdayName Year", False )
wFunction.AutoCase=True

vbs.AddRegion( rLineComment )
vbs.AddRegion( rString2 )
vbs.AddWord( wKeyWord )
vbs.AddWord( wWordConst )
vbs.AddWord( wFunction )

vbs.FoldText "\bThen\s*$|\b(Do|For)\s+(?=\w+)|(?<!\b(End|Exit)\s+)(Function|Sub|Select)\b", False, "\b(Wend|End If|Elseif|End Select|End Sub|End Function|Loop)\b|^\s*Next\s*$", False
vbs.IndentText "\b(Then|Do|For|Function|Sub|Select|Case|Else|ElseIf)\b", False, "\b(Next|Wend)\s*$|\bEnd\b", False

vbs.SetPairs( "[]{}()""""" )
vbs.CommentLine("'")
vbs.AddCallTip "vbs.ecp", False
vbs.AddSnippet "vbs.snippet", False

