OpenOffice.org Basic in NetBeans/files/language.nbs
From Apache OpenOffice Wiki
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # # Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. # # The contents of this file are subject to the terms of either the GNU # General Public License Version 2 only ("GPL") or the Common # Development and Distribution License("CDDL") (collectively, the # "License"). You may not use this file except in compliance with the # License. You can obtain a copy of the License at # http://www.netbeans.org/cddl-gplv2.html # or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the # specific language governing permissions and limitations under the # License. When distributing the software, include this License Header # Notice in each file and include the License file at # nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this # particular file as subject to the "Classpath" exception as provided # by Sun in the GPL Version 2 section of the License file that # accompanied this code. If applicable, add the following below the # License Header, with the fields enclosed by brackets [] replaced by # your own identifying information: # "Portions Copyrighted [year] [name of copyright owner]" # # Contributor(s): # # The Original Software is NetBeans. The Initial Developer of the Original # Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun # Microsystems, Inc. All Rights Reserved. # # If you wish your version of this file to be governed by only the CDDL # or only the GPL Version 2, indicate your decision by adding # "[Contributor] elects to include this software in this distribution # under the [CDDL or GPL Version 2] license." If you do not indicate a # single choice of license, a recipient has the option to distribute # your version of this file under either the CDDL, the GPL Version 2 or # to extend the choice of license to its licensees as provided above. # However, if you add GPL Version 2 code and therefore, elected the GPL # Version 2 license, then the option applies only if the new code is # made subject to such option by the copyright holder. # Maintainer: thorsten.bosbach@sun.com 01.03.2008 # OpenOffice.org VCL TestTool Support for .bas and .inc files # Extraction of keywords from the files: # script/basic/source/runtime/stdobj.cxx # script/basic/source/runtime/rtlproto.hxx # util/automation/source/testtool/objtest.hxx # util/automation/source/testtool/objtest.cxx ########### tokens ############################################################# TOKEN:sb_type: ( "Boolean"i | "Date"i | "Double"i | "Integer"i | "Long"i | "Object"i | "Single"i | "String"i | "Variant"i | "Empty"i | "Null"i ) TOKEN:sb_deprecated: ( "AboutStarBasic"i | "SendKeys"i | "DumpAllObjects"i | "Load"i | "Unload"i | "LoadPicture"i | "SavePicture"i | "CreatePropertySet"i | "CCur"i | "StrConv"i | "DateAdd"i | "DateDiff"i | "DatePart"i ) TOKEN:sb_function: ( "Abs"i | "Array"i | "Asc"i | "Atn"i | "Blue"i | "CBool"i | "CByte"i | "CDateFromIso"i | "CDateToIso"i | "CDate"i | "CDec"i | "CDbl"i | "CInt"i | "CLng"i | "CSng"i | "CStr"i | "CVar"i | "CVErr"i | "Choose"i | "Chr"i | "ConvertToUrl"i | "ConvertFromUrl"i | "Cos"i | "CreateUnoDialog"i | "CreateUnoListener"i | "CreateUnoService"i | "CreateUnoStruct"i | "CreateUnoValue"i | "CreateObject"i | "CurDir"i | "DateSerial"i | "DateValue"i | "Day"i | "DimArray"i | "Dir"i | "Environ"i | "EOF"i | "EqualUnoObjects"i | "Erl"i | "Err"i | "Error"i | "On"i | "{Error"i |"GoTo"i| "Labelname"i | "GoTo"i | "0"i | "Resume"i | "Next}"i | "Exp"i | "FileAttr"i | "FileDateTime"i | "FileExists"i | "FileLen"i | "FindObject"i | "FindPropertyObject"i | "Fix"i | "Format"i | "FreeFile"i | "FreeLibrary"i | "GetAttr"i | "GetDefaultContext"i | "GetProcessServiceManager"i | "GetSolarVersion"i | "GetSystemTicks"i | "GetGUIType"i | "Green"i | "HasUnoInterfaces"i | "Hex"i | "Hour"i | "InStr"i | "InputBox"i | "Int"i | "IsArray"i | "IsDate"i | "IsEmpty"i | "IsError"i | "IsMissing"i | "IsNull"i | "IsNumeric"i | "IsObject"i | "IsUnoStruct"i | "Join"i | "LBound"i | "LCase"i | "LTrim"i | "Left"i | "Len"i | "Loc"i | "Lof"i | "Log"i | "Mid"i | "Minute"i | "Month"i | "MsgBox"i | "Now"i | "Oct"i | "QBColor"i | "Red"i | "RGB"i | "Right"i | "RmDir"i | "Rnd"i | "RTrim"i | "Second"i | "Seek"i | "Sgn"i | "Shell"i | "Sin"i | "Space"i | "Split"i | "Sqr"i | "Str"i | "StrComp"i | "String"i | "Switch"i | "Tan"i | "Timer"i | "TimeSerial"i | "TimeValue"i | "Trim"i | "TwipsPerPixelX"i | "TwipsPerPixelY"i | "TypeName"i | "UBound"i | "UCase"i | "Val"i | "VarType"i | "Weekday"i | "Year"i | "Pi"i ) TOKEN:sb_operator: ( "=" | "<" | ">" | "<=" | ">=" | "<>" | "TRUE"i | "FALSE"i | "AND"i |"Eqv"i| "Imp"i| "MOD"i| "NOT"i| "OR"i| "XOR"i | "-" | "*" | "+" | "/" | "^" | "(" | ")" | "&" | "," | "_" | "." | ";" ) TOKEN:sb_statement: ( "Beep"i | "Call"i | "ChDir"i | "ChDrive"i | "Close"i | "Const"i | "Date"i | "Declare"i | "DefBool"i | "DefDate"i | "DefDbl"i | "DefInt"i | "DefLng"i | "DefObj"i | "DevVar"i | "Dim"i | "as"i | "Do Loop"i | "End,"i| "End Function,"i| "End If,"i| "End Select,"i| "End Sub"i | "Exit"i | "FileCopy"i | "For Next"i | "Function"i | "Get"i | "GoSub"i | "....."i| "Return"i | "GoTo"i | "Iif"i | "If"i| "..."i| "Then"i| "..."i| "Else"i| "ElseIf"i| "EndIf"i| "End If"i | "Input"i | "Kill"i | "LSet"i | "Let"i | "Line Input"i | "MkDir"i | "Name"i | "Open"i | "Option Base"i | "Option Explicit"i | "Optional"i | "Print"i | "Public"i | "Put"i | "Randomize"i | "ReDim"i | "Rem"i | "Reset"i | "RSet"i | "Select"i| "Case"i| "Case"i| "Else"i| "End"i| "Select"i | "Set"i | "SetAttr"i | "Static"i | "Stop"i | "Sub"i | "Time"i | "Wait"i | "While"i| "...Wend"i | "With"i | "Write"i | "GlobalScope"i | "CompatibilityMode"i ) TOKEN:sb_undefined: ( "Spc"i | "TypeLen"i | "DDEInitiate"i | "DDETerminate"i | "DDETerminateAll"i | "DDERequest"i | "DDEExecute"i | "DDEPoke"i | "WaitUntil"i | "EnableReschedule"i | "GetDialogZoomFactorX"i | "GetDialogZoomFactorY"i | "ResolvePath"i | "GetSystemType"i | "GetGUIVersion"i | "GetPathSeparator"i ) TOKEN:sb_compatibility: ( "AscW"i | "ChrW"i | "FormatDateTime"i | "Input"i | "InStrRev"i | "Me"i | "MonthName"i | "Round"i | "RTL"i | "StrReverse"i | "WeekdayName"i ) TOKEN:tt_function:( "Kontext"i | "GetError"i | "ErrorDummy"i | "RecordError"i | "Start"i | "Kill"i | "Reset"i | "AppAbort"i | "Dispatch"i | "UNODispatch"i | "Control"i | "StartUse"i | "Use"i | "FinishUse"i | "CaseLog"i | "ExceptLog"i | "PrintLog"i | "WarnLog"i | "ErrorLog"i | "EnableQaErrors"i | "QAErrorLog"i | "MaybeAddErr"i | "ClearError"i | "GetNextCloseWindow"i | "RemoteCommand"i | "SaveIDs"i | "AutoExecute"i | "Execute"i | "DialogHandler"i | "GetUnoApp"i | "GetIServer"i | "RemoteCommandDelay"i | "GetApplicationPath"i | "GetCommonApplicationPath"i | "MakeIniFileName"i | "StringControl"i | "Wait"i | "GetErrorCount"i | "GetWarningCount"i | "GetQAErrorCount"i | "GetUseFileWarningCount"i | "GetErrorList"i | "GetWarningList"i | "GetQAErrorList"i | "GetUseFileWarningList"i | "GetTestCaseName"i | "GetTestCaseFileName"i | "GetTestCaseLineNr"i | "StopOnSyntaxError"i | "SetChildEnv"i | "GetChildEnv"i | "GetLinkDestination"i | "GetRegistryValue"i | "KillApp"i | "HTTPSend"i | "HTTPSetProxy"i ) TOKEN:tt_constant: ( "CTBrowseBox"i | "CTValueSet"i | "CTORoadmap"i | "CTUnknown"i | "ALIGN_LEFT"i | "ALIGN_TOP"i | "ALIGN_RIGHT"i | "ALIGN_BOTTOM"i | "FilePicker"i | "FolderPicker"i | "NodeTypeCharacter"i | "NodeTypeElement"i | "NodeTypeComment"i | "ItemTypeText"i | "ItemTypeBMP"i | "ItemTypeCheckbox"i | "ItemTypeContextBMP"i | "ItemTypeUnknown"i | "WSTimeout"i | "WSAborted"i | "WSFinished"i ) TOKEN:tt_method: ( "Select"i | "SetNoSelection"i | "SetText"i | "More"i | "Less"i | "ToMin"i | "ToMax"i | "Check"i | "UnCheck"i | "TriState"i | "SetPage"i | "Click"i | "Close"i | "Cancel"i | "OK"i | "Help"i | "Default"i | "Yes"i | "No"i | "Repeat"i | "Open"i | "Pick"i | "Move"i | "Size"i | "Minimize"i | "Maximize"i | "Dock"i | "Undock"i | "TypeKeys"i | "MouseDown"i | "MouseUp"i | "MouseMove"i | "MouseDoubleClick"i | "SnapShot"i | "SetNextToolBox"i | "OpenContextMenu"i | "MultiSelect"i | "SetPath"i | "SetCurFilter"i | "SetPrinter"i | "CheckRange"i | "SetRangeText"i | "SetFirstPage"i | "SetLastPage"i | "CheckCollate"i | "SetPageId"i | "SetPageNr"i | "AnimateMouse"i | "TearOff"i | "FadeIn"i | "FadeOut"i | "Pin"i | "UseMenu"i | "OpenMenu"i | "Restore"i | "DisplayPercent"i | "Exists"i | "NotExists"i | "IsEnabled"i | "IsVisible"i | "IsWritable"i | "GetPage"i | "IsChecked"i | "IsTristate"i | "GetState"i | "GetText"i | "GetSelCount"i | "GetSelIndex"i | "GetSelText"i | "GetItemCount"i | "GetItemText"i | "IsOpen"i | "Caption"i | "IsMax"i | "IsDocked"i | "GetRT"i | "GetPageId"i | "GetPageCount"i | "GetPosX"i | "GetPosY"i | "GetSizeX"i | "GetSizeY"i | "GetNextToolBox"i | "GetButtonCount"i | "GetButtonId"i | "IsFadeIn"i | "IsPin"i | "StatusGetText"i | "StatusIsProgress"i | "StatusGetItemCount"i | "StatusGetItemId"i | "GetMouseStyle"i | "GetCheckBoxText"i | "HasScrollBar"i | "IsScrollBarEnabled"i | "_IsEnabled"i | "GetFixedTextCount"i | "GetFixedText"i | "IsMin"i | "IsRestore"i | "GetItemType"i | "GetColumnCount"i | "GetRowCount"i | "IsEditing"i | "IsItemEnabled"i ) TOKEN:tt_remotecommand:( "AppAbort"i | "SetClipboard"i | "NoDebug"i | "Debug"i | "GPF"i | "DisplayHid"i | "AppDelay"i | "UseBindings"i | "Profile"i | "MenuSelect"i | "SetControlType"i | "Kill"i | "RmDir"i | "MkDir"i | "FileCopy"i | "Name"i | "CaptureAssertions"i | "Assert"i | "MenuOpen"i | "TypeKeysDelay"i | "ShowBar"i | "LoadURL"i | "CloseSysDialog"i | "SAXRelease"i | "RecordMacro"i | "ActivateDocument"i | "CatchGPF"i | "GetClipboard"i | "WinTree"i | "ResetApplication"i | "GetNextCloseWindow"i | "ApplicationBusy"i | "MenuGetItemCount"i | "MenuGetItemId"i | "MenuGetItemPos"i | "MenuIsSeperator"i | "MenuIsItemChecked"i | "MenuIsItemEnabled"i | "MenuGetItemText"i | "Dir"i | "FileLen"i | "FileDateTime"i | "Translate"i | "GetMouseStyle"i | "UnpackStorage"i | "IsBarVisible"i | "MenuGetItemCommand"i | "ExistsSysDialog"i | "SAXCheckWellformed"i | "SAXReadFile"i | "SAXGetNodeType"i | "SAXGetElementName"i | "SAXGetChars"i | "SAXGetChildCount"i | "SAXGetAttributeCount"i | "SAXGetAttributeName"i | "SAXGetAttributeValue"i | "SAXSeekElement"i | "SAXHasElement"i | "SAXGetElementPath"i | "GetDocumentCount"i | "GetSystemLanguage"i | "IsProduct"i | "MenuHasSubMenu"i | "UsePostEvents"i | "WaitSlot"i ) TOKEN:tt_statement: ( "trya" | "caatch" | "endcaatch" | "testcase" | "endcase" ) TOKEN:identifier:( ["a"-"z""A"-"Z"]["a"-"z""A"-"Z""0"-"9"]* ) TOKEN:whitespace:( [" " "\t" "\n" "\r"]+ ) TOKEN:comment: ('\'' [^"\t""\n"]*) TOKEN:string: ("\"" [^ "\"" "\r" "\n"]* "\"") TOKEN:number: (["0"-"9"]*) # parser should ignore whitespaces SKIP:whitespace SKIP:comment # definition of grammar S = (Statement)*; Statement = WhileStatement | IfStatement | ExpressionStatement | KeywordStatement | <string> | <operator> | <number> | <sb_type> | <sb_deprecated> | <sb_function> | <sb_operator> | <sb_statement> | <sb_undefined> | <sb_compatibility> | <tt_function> | <tt_constant> | <tt_method> | <tt_remotecommand> | <tt_statement>; SubStatementBeginn = "sub" <identifier>; SubStatementEnd = "end sub"; WhileStatement = "while" ConditionalExpression ; IfStatement = "if" ConditionalExpression ["then"]; Block = SubStatementBeginn (Statement)* SubStatementEnd ; ConditionalExpression = <identifier>; ExpressionStatement = <identifier>; KeywordStatement = <keyword>; # code folding FOLD:Block FOLD:comment # navigator support NAVIGATOR:WhileStatement: { display_name: "$ConditionalExpression$"; } # brace completion COMPLETE "{:}" COMPLETE "(:)" # brace matching BRACE "{:}" BRACE "(:)" BRACE "if:endif" BRACE "testcase:endcase" BRACE "begin:end" BRACE "sub:sub" BRACE "query:end" # indentation support INDENT "{:}" INDENT "(:)" #INDENT "\\s*(((if|while)\\s*\\(|else\\s*|else\\s+if\\s*\\(|for\\s*\\(.*\\))[^{;]*)" # error highlighting #MARK:ERROR: { # type:"Error"; # message:"Syntax error."; #} #MARK:error: { # type:"Error"; # message:"Unexpected character."; #} # code completion COMPLETION:keyword, operator, identifier, whitespace: { text1:"while"; text2:"if"; text3:"else"; } NAVIGATOR:identifier: { display_name: "$identifier$"; } COLOR:sb_type: { foreground_color: "blue"; default_coloring: "keyword"; } COLOR:sb_deprecated: { foreground_color: "red"; default_coloring: "keyword"; } COLOR:sb_function: { foreground_color: "green"; default_coloring: "keyword"; } COLOR:sb_operator: { foreground_color: "magenta"; default_coloring: "operator"; } COLOR:sb_statement: { foreground_color: "green"; default_coloring: "keyword"; } COLOR:sb_undefined: { foreground_color: "red"; default_coloring: "keyword"; } COLOR:sb_compatibility: { foreground_color: "red"; default_coloring: "keyword"; } COLOR:tt_function: { foreground_color: "orange"; default_coloring: "keyword"; } COLOR:tt_constant: { foreground_color: "orange"; default_coloring: "keyword"; } COLOR:tt_method: { foreground_color: "orange"; default_coloring: "keyword"; } COLOR:tt_remotecommand: { foreground_color: "orange"; default_coloring: "keyword"; } COLOR:tt_statement: { foreground_color: "orange"; default_coloring: "keyword"; } COLOR:number: { foreground_color: "darkGray"; default_coloring: "number"; }