Naughty NOT in edited VB syntax highlighting.

Syntax highlighting, code folding, brace matching, code indenting, and function list

Naughty NOT in edited VB syntax highlighting.

Postby THEMike » Mon Nov 01, 2004 6:16 am

I'm guessing it's me being a moron, but, you never know it could be a bug, I have messed around (a lot) with a base VB wordfile.txt entry to mung it to match my needs for some heavy duty WSH work I'm doing. The only problem I really have is that NOT is not highighting.

Code: Select all
If a OR b NOT c XOR d Then
  wScript.Echo "Silly test of highlighting"
End If


In the above clip of VBS, the OR and XOR are printed in blue as I have configured my syntax highlighting to do so. All three (XOR/OR/NOT) are auto-corrected to upper case when typed in lower case, however, NOT remains resolutley black. (Ultraedit 10.20c, XP Pro SP1)

wordfile entry (NOT is in /C6"Operators"):
Code: Select all
/L2"Visual Basic" Line Comment = ' Block Comment On = <!-- Block Comment Off = --> File Extensions = BAS FRM CLS VBS CTL WSF
/Function String = "%[ ,^t]++^{Public^}^{Private^} ^(^{Function^}^{Sub^}*^)(*[)]++*"
/Function String 1 = "%[ ,^t]++^(^{Function^}^{Sub^}*^)(*)"
/Function String 2 = "%[ ,^t]++^{Public^}^{Private^} ^(Property ^{Let^}^{Get^}*^)(*)*"
/Function String 3 = "%[ ,^t]++^(Property ^{Let^}^{Get^}*^)(*)*"
/Function String 4 = "%[ ,^t]++^{Function^}^{Sub^} ^(*)"
/Indent Strings = "Then" "Else"
/Unindent Strings = "End" "Next" "Wend" "Else"
/Delimiters = "() ,   .=/><
/C1"Functions"
Abs Array Asc AscB AscW Atn Avg
CBool CByte CCur CDate CDbl Cdec Choose Chr ChrB ChrW CInt CLng Command Cos Count CreateObject CSng CStr CurDir CVar CVDate CVErr
Date DateAdd DateDiff DatePart DateSerial DateValue Day DDB Dir DoEvents
Environ EOF Error Exp
FileAttr FileDateTime FileLen Fix Format FreeFile FV
GetAllStrings GetAttr GetAutoServerSettings GetObject GetSetting
Hex Hour
IIf IMEStatus Input InputB InputBox InStr InstB Int IPmt IsArray IsDate IsEmpty IsError IsMissing IsNull IsNumeric IsObject
LBound LCase Left LeftB Len LenB LoadPicture Loc LOF Log LTrim
Max Mid MidB Min Minute MIRR Month MsgBox
Now NPer NPV
Oct
Partition Pmt PPmt PV
QBColor
Rate RGB Right RightB Rnd RTrim
Second Seek Sgn Shell Sin SLN Space Spc Sqr StDev StDevP Str StrComp StrConv String Switch Sum SYD
Tab Tan Time Timer TimeSerial TimeValue Trim TypeName
UBound UCase
Val Var VarP VarType
Weekday
Year
/C2"Methods"
Accept Activate Add AddCustom AddFile AddFromFile AddFromTemplate AddItem AddNew AddToAddInToolbar AddToolboxProgID Append AppendChunk Arrange Assert AsyncRead
BatchUpdate BeginTrans Bind BuildPath
Cancel CancelAsyncRead CancelBatch CancelUpdate CanPropertyChange CaptureImage CellText CellValue Circle Clear ClearFields ClearSel ClearSelCols Clone Close Cls ColContaining ColumnSize CommitTrans CompactDatabase Compose Connect Copy CopyQueryDef CreateDatabase CreateDragImage CreateEmbed CreateField CreateGroup CreateIndex CreateLink CreatePreparedStatement CreatePropery CreateQuery CreateQueryDef CreateRelation CreateTableDef CreateUser CreateWorkspace Customize
Delete DeleteColumnLabels DeleteColumns DeleteRowLabels DeleteRows DoVerb Drag Draw
Edit EditCopy EditPaste EndDoc EnsureVisible EstablishConnection Execute ExtractIcon
Fetch FetchVerbs Files FileExists FillCache Find FindFirst FindItem FindLast FindNext FindPrevious Forward
GetBookmark GetChunk GetClipString GetData GetFirstVisible GetFormat GetHeader GetLineFromChar GetNumTicks GetRows GetSelectedPart GetText GetVisibleCount GoBack GoForward
Hide HitTest HoldFields
Idle InitializeLabels InsertColumnLabels InsertColumns InsertObjDlg InsertRowLabels InsertRows Item
KillDoc
Layout Line LinkExecute LinkPoke LinkRequest LinkSend Listen LoadFile LoadResData LoadResPicture LoadResString LogEvent
MakeCompileFile MakeReplica MoreResults Move MoveData MoveFirst MoveLast MoveNext MovePrevious
NavigateTo NewPage NewPassword NextRecordset
OLEDrag OnAddinsUpdate OnConnection OnDisconnection OnStartupComplete Open OpenConnection OpenDatabase OpenQueryDef OpenRecordset OpenResultset OpenURL Overlay
PaintPicture Paste PastSpecialDlg PeekData Play Point PopulatePartial PopupMenu Print PrintForm PropertyChanged PSet
Quit
Raise RandomDataFill RandomFillColumns RandomFillRows rdoCreateEnvironment rdoRegisterDataSource ReadFromFile ReadProperty Rebind ReFill Refresh RefreshLink RegisterDatabase Reload Remove RemoveAddInFromToolbar RemoveItem Render RepairDatabase Reply ReplyAll Requery ResetCustom ResetCustomLabel ResolveName RestoreToolbar Resync Rollback RollbackTrans RowBookmark RowContaining RowTop
Save SaveAs SaveFile SaveToFile SaveToolbar SaveToOle1File Scale ScaleX ScaleY Scroll SelectAll SelectPart SelPrint Send SendData SetAutoServerSettings SetData SetFocus SetOption SetSize SetText SetViewport Show ShowColor ShowFont ShowHelp ShowOpen ShowPrinter ShowSave ShowWhatsThis SignOff SignOn Size Span SplitContaining StartLabelEdit StartLogging Stop Synchronize
TextHeight TextWidth ToDefaults TwipsToChartPart TypeByChartType
Update UpdateControls UpdateRecord UpdateRow Upto
WhatsThisMode WriteProperty
ZOrder
/C3"Events"
AccessKeyPress AfterAddFile AfterChangeFileName AfterCloseFile AfterColEdit AfterColUpdate AfterDelete AfterInsert AfterLabelEdit AfterRemoveFile AfterUpdate AfterWriteFile AmbienChanged ApplyChanges Associate AsyncReadComplete AxisActivated AxisLabelActivated AxisLabelSelected AxisLabelUpdated AxisSelected AxisTitleActivated AxisTitleSelected AxisTitleUpdated AxisUpdated
BeforeClick BeforeColEdit BeforeColUpdate BeforeConnect BeforeDelete BeforeInsert BeforeLabelEdit BeforeLoadFile BeforeUpdate ButtonClick ButtonCompleted ButtonGotFocus ButtonLostFocus
Change ChartActivated ChartSelected ChartUpdated Click ColEdit Collapse ColResize ColumnClick Compare ConfigChageCancelled ConfigChanged ConnectionRequest
DataArrival DataChanged DataUpdated DblClick Deactivate DeviceArrival DeviceOtherEvent DeviceQueryRemove DeviceQueryRemoveFailed DeviceRemoveComplete DeviceRemovePending DevModeChange Disconnect DisplayChanged Dissociate DoGetNewFileName Done DonePainting DownClick DragDrop DragOver DropDown
EditProperty EnterCell EnterFocus Event ExitFocus Expand
FootnoteActivated FootnoteSelected FootnoteUpdated
GotFocus
HeadClick
InfoMessage Initialize IniProperties ItemActivated ItemAdded ItemCheck ItemClick ItemReloaded ItemRemoved ItemRenamed ItemSeletected
KeyDown KeyPress KeyUp
LeaveCell LegendActivated LegendSelected LegendUpdated LinkClose LinkError LinkNotify LinkOpen Load LostFocus
MouseDown MouseMove MouseUp
NodeClick
ObjectMove OLECompleteDrag OLEDragDrop OLEDragOver OLEGiveFeedback OLESetData OLEStartDrag OnAddNew OnComm
Paint PanelClick PanelDblClick PathChange PatternChange PlotActivated PlotSelected PlotUpdated PointActivated PointLabelActivated PointLabelSelected PointLabelUpdated PointSelected PointUpdated PowerQuerySuspend PowerResume PowerStatusChanged PowerSuspend
QueryChangeConfig QueryComplete QueryCompleted QueryTimeout QueryUnload
ReadProperties Reposition RequestChangeFileName RequestWriteFile Resize ResultsChanged RowColChange RowCurrencyChange RowResize RowStatusChanged
SelChange SelectionChanged SendComplete SendProgress SeriesActivated SeriesSelected SeriesUpdated SettingChanged SplitChange StateChanged StatusUpdate SysColorsChanged
Terminate TimeChanged TitleActivated TitleSelected TitleActivated
UnboundAddData UnboundDeleteRow UnboundGetRelativeBookmark UnboundReadData UnboundWriteData Unload UpClick Updated
Validate ValidationError
WillAssociate WillChangeData WillDissociate WillExecute WillUpdateRows WithEvents WriteProperties
/C4"Statements"
AppActivate
Base Beep
Call Case ChDir ChDrive Class Const
Declare DefBool DefByte DefCur DefDate DefDbl DefDec DefInt DefLng DefObj DefSng DefStr Deftype DefVar DeleteSetting Dim Do
Each Else ElseIf End Enum Erase Event Exit Explicit
FileCopy For ForEach Friend Function
Get GoSub GoTo
If Implements In
Kill
Let LineInput Lock LSet
MkDir
Name Next
OnError On Option
Private Property Public Put
RaiseEvent Randomize ReDim Rem Reset Resume Return RmDir RSet
SavePicture SaveSetting SendKeys Select Set SetAttr Static Sub
Then To Type
Unlock
Wend While Width With Write
/C5"XML markup"
<script </script>
job
language
src
/C6"Operators"
&
+
-
.
/
<
<=
=
<>
>
(
)
^
AND
Eqv
Imp Is
Mod
new NOT
OR
XOR
/C7"Common Objects"
** obj
Comm Conn
FSO
RS
wScript
User avatar
THEMike
Basic User
Basic User
 
Posts: 15
Joined: Mon Nov 01, 2004 12:00 am
Location: UK

Re: Naughty NOT in edited VB syntax highlighting.

Postby Mofi » Mon Nov 01, 2004 7:34 am

Copied from the UltraEdit help about Syntax Highlighting.

If the language is case sensitive, the letter 'A' is different from 'a' and so words starting with 'A' MUST be on a different line from words starting with 'a'. If the language is case insensitive words starting with the letter 'A' must be on the same line as words starting with the letter 'a'.

This paragraph is also bold in the help. So look at your "Operators" definitions. "new" and "NOT" in the same line cannot be correct, because the language is case-sensitive. Also <= and <> are incorrect, because the are all delimiters. So <= for example is "word" < and "word" =.

Here is the correct definition for the operators.

/C6"Operators"
&
(
)
+
-
.
/
<
=
>
AND
Eqv
Imp Is
Mod
NOT
OR
XOR
^
new

Check also the rest of your word definitions, because there are also case-sensitive mistakes, for example "Rate RGB Right RightB Rnd RTrim" which should be "RGB RTrimRate Right RightB Rnd".
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Naughty NOT in edited VB syntax highlighting.

Postby THEMike » Mon Nov 01, 2004 8:07 am

Ah I suspected it was me being a moron.

I've been using UE for a long time (since 99 sometime I think) and haven't tinkered with the Wordfile for a couple of years I guess, so I just sort of skimmed through again to check things and missed the big bold paragraph like a moron.

Thanks for the help.

So the case-sensitivity on a LINE matters too?

i.e. you have to do

WOrd word2

not
word2 WOrd
?
User avatar
THEMike
Basic User
Basic User
 
Posts: 15
Joined: Mon Nov 01, 2004 12:00 am
Location: UK

Re: Naughty NOT in edited VB syntax highlighting.

Postby Mofi » Tue Nov 02, 2004 11:24 am

WOrd word2
in the same line is also totally wrong, if the language is case-sensitive, because the two words start with different characters.

It must be

WOrd
:
: some other words starting with X - v
:
word2

Only words starting with the same character can be in the same line and these words should be also sorted case-sensitive.

For example:

WOrd Word2
:
:
wOrdy wordx

While developing a language file, it is best to write only 1 word per line. Then you can always use the case-sensitive sort function of UltraEdit on each color section. When you think, you have alle words found, compact the words to get better overview.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Syntax Highlighting