From f5f6a7d5f4cfe5011d624df7f1877f32a9701647 Mon Sep 17 00:00:00 2001 From: jneen Date: Wed, 25 Feb 2026 18:27:33 -0500 Subject: [PATCH] use a lazy builtins file generated from docs for igor pro --- Gemfile | 2 + lib/rouge/lexers/igorpro.rb | 1545 +------------------------- lib/rouge/lexers/igorpro/builtins.rb | 15 + tasks/builtins/igorpro.rake | 73 ++ tasks/task_helper.rb | 1 + 5 files changed, 101 insertions(+), 1535 deletions(-) create mode 100644 lib/rouge/lexers/igorpro/builtins.rb create mode 100644 tasks/builtins/igorpro.rake diff --git a/Gemfile b/Gemfile index 7227e7605e..0da2b12cde 100644 --- a/Gemfile +++ b/Gemfile @@ -19,6 +19,8 @@ gem 'memory_profiler', require: false group :development do gem 'pry' + gem 'nokogiri', '~> 1.19' + # Needed for a Rake task gem 'git' gem 'yard' diff --git a/lib/rouge/lexers/igorpro.rb b/lib/rouge/lexers/igorpro.rb index dada41cd16..805acda59e 100644 --- a/lib/rouge/lexers/igorpro.rb +++ b/lib/rouge/lexers/igorpro.rb @@ -11,6 +11,8 @@ class IgorPro < RegexLexer title "IgorPro" desc "WaveMetrics Igor Pro" + lazy { require_relative "igorpro/builtins" } + def self.keywords @keywords ||= Set.new %w( structure endstructure @@ -33,1543 +35,16 @@ def self.preprocessor ) end - def self.igorDeclarations - @igorDeclarations ||= Set.new %w( + def self.igor_declarations + @igor_declarations ||= Set.new %w( variable string wave strconstant constant nvar svar dfref funcref struct char uchar int16 uint16 int32 uint32 int64 uint64 float double ) end - def self.igorConstants - @igorConstants ||= Set.new %w( - nan inf - ) - end - - def self.igorFunction - @igorFunction ||= Set.new %w( - abs - acos - acosh - AddListItem - AiryA - AiryAD - AiryB - AiryBD - alog - AnnotationInfo - AnnotationList - area - areaXY - asin - asinh - atan - atanh - atan2 - AxisInfo - AxisLabel - AxisList - AxisValFromPixel - AxonTelegraphAGetDataNum - AxonTelegraphAGetDataString - AxonTelegraphAGetDataStruct - AxonTelegraphGetDataNum - AxonTelegraphGetDataString - AxonTelegraphGetDataStruct - AxonTelegraphGetTimeoutMs - AxonTelegraphSetTimeoutMs - Base64Decode - Base64Encode - Besseli - Besselj - Besselk - Bessely - beta - betai - BinarySearch - BinarySearchInterp - binomial - binomialln - binomialNoise - cabs - CaptureHistory - CaptureHistoryStart - ceil - centerOfMass - centerOfMassXY - cequal - char2num - chebyshev - chebyshevU - CheckName - ChildWindowList - CleanupName - cmplx - cmpstr - conj - ContourInfo - ContourNameList - ContourNameToWaveRef - ContourZ - ControlNameList - ConvertTextEncoding - cos - cosh - cosIntegral - cot - coth - CountObjects - CountObjectsDFR - cpowi - CreateDataObjectName - CreationDate - csc - csch - CsrInfo - CsrWave - CsrWaveRef - CsrXWave - CsrXWaveRef - CTabList - DataFolderDir - DataFolderExists - DataFolderList - DataFolderRefChanges - DataFolderRefsEqual - DataFolderRefStatus - date - datetime - DateToJulian - date2secs - Dawson - defined - deltax - digamma - dilogarithm - DimDelta - DimOffset - DimSize - ei - ellipticE - ellipticK - enoise - equalWaves - erf - erfc - erfcw - erfcx - exists - exp - expInt - expIntegralE1 - expNoise - factorial - Faddeeva - fakedata - faverage - faverageXY - fDAQmx_AI_ChannelConfigs - fDAQmx_AI_GetReader - fDAQmx_AO_UpdateOutputs - fDAQmx_ConnectTerminals - fDAQmx_CTR_Finished - fDAQmx_CTR_IsFinished - fDAQmx_CTR_IsPulseFinished - fDAQmx_CTR_ReadCounter - fDAQmx_CTR_ReadWithOptions - fDAQmx_CTR_SetPulseFrequency - fDAQmx_CTR_Start - fDAQmx_DeviceNames - fDAQmx_DIO_Finished - fDAQmx_DIO_PortWidth - fDAQmx_DIO_Read - fDAQmx_DIO_Write - fDAQmx_DisconnectTerminals - fDAQmx_ErrorString - fDAQmx_ExternalCalDate - fDAQmx_NumAnalogInputs - fDAQmx_NumAnalogOutputs - fDAQmx_NumCounters - fDAQmx_NumDIOPorts - fDAQmx_ReadChan - fDAQmx_ReadNamedChan - fDAQmx_ResetDevice - fDAQmx_ScanGetAvailable - fDAQmx_ScanGetNextIndex - fDAQmx_ScanStart - fDAQmx_ScanStop - fDAQmx_ScanWait - fDAQmx_ScanWaitWithTimeout - fDAQmx_SelfCalDate - fDAQmx_SelfCalibration - fDAQmx_WaveformStart - fDAQmx_WaveformStop - fDAQmx_WF_IsFinished - fDAQmx_WF_WaitUntilFinished - fDAQmx_WriteChan - FetchURL - FindDimLabel - FindListItem - floor - FontList - FontSizeHeight - FontSizeStringWidth - FresnelCos - FresnelSin - FuncRefInfo - FunctionInfo - FunctionList - FunctionPath - gamma - gammaEuler - gammaInc - gammaNoise - gammln - gammp - gammq - Gauss - Gauss1D - Gauss2D - gcd - GeometricMean - GetBrowserLine - GetBrowserSelection - GetDataFolder - GetDataFolderDFR - GetDefaultFont - GetDefaultFontSize - GetDefaultFontStyle - GetDimLabel - GetEnvironmentVariable - GetErrMessage - GetFormula - GetIndependentModuleName - GetIndexedObjName - GetIndexedObjNameDFR - GetKeyState - GetRTErrMessage - GetRTError - GetRTLocation - GetRTLocInfo - GetRTStackInfo - GetScrapText - GetUserData - GetWavesDataFolder - GetWavesDataFolderDFR - GetWindowBrowserSelection - GISGetAllFileFormats - GISSRefsAreEqual - GizmoInfo - GizmoScale - gnoise - GrepList - GrepString - GuideInfo - GuideNameList - Hash - hcsr - HDF5AttributeInfo - HDF5DatasetInfo - HDF5LibraryInfo - HDF5LinkInfo - HDF5TypeInfo - hermite - hermiteGauss - HyperGNoise - HyperGPFQ - HyperG0F1 - HyperG1F1 - HyperG2F1 - i - IgorInfo - IgorVersion - imag - ImageInfo - ImageNameList - ImageNameToWaveRef - IndependentModuleList - IndexedDir - IndexedFile - IndexToScale - Inf - Integrate1D - interp - Interp2D - Interp3D - inverseERF - inverseERFC - ItemsInList - JacobiCn - JacobiSn - JulianToDate - Laguerre - LaguerreA - LaguerreGauss - LambertW - LayoutInfo - leftx - LegendreA - limit - ListMatch - ListToTextWave - ListToWaveRefWave - ln - log - logNormalNoise - lorentzianNoise - LowerStr - MacroInfo - MacroList - MacroPath - magsqr - MandelbrotPoint - MarcumQ - MatrixCondition - MatrixDet - MatrixDot - MatrixRank - MatrixTrace - max - MCC_AutoBridgeBal - MCC_AutoFastComp - MCC_AutoPipetteOffset - MCC_AutoSlowComp - MCC_AutoWholeCellComp - MCC_GetBridgeBalEnable - MCC_GetBridgeBalResist - MCC_GetFastCompCap - MCC_GetFastCompTau - MCC_GetHolding - MCC_GetHoldingEnable - MCC_GetMode - MCC_GetNeutralizationCap - MCC_GetNeutralizationEnable - MCC_GetOscKillerEnable - MCC_GetPipetteOffset - MCC_GetPrimarySignalGain - MCC_GetPrimarySignalHPF - MCC_GetPrimarySignalLPF - MCC_GetRsCompBandwidth - MCC_GetRsCompCorrection - MCC_GetRsCompEnable - MCC_GetRsCompPrediction - MCC_GetSecondarySignalGain - MCC_GetSecondarySignalLPF - MCC_GetSlowCompCap - MCC_GetSlowCompTau - MCC_GetSlowCompTauX20Enable - MCC_GetSlowCurrentInjEnable - MCC_GetSlowCurrentInjLevel - MCC_GetSlowCurrentInjSetlTime - MCC_GetWholeCellCompCap - MCC_GetWholeCellCompEnable - MCC_GetWholeCellCompResist - MCC_SelectMultiClamp700B - MCC_SetBridgeBalEnable - MCC_SetBridgeBalResist - MCC_SetFastCompCap - MCC_SetFastCompTau - MCC_SetHolding - MCC_SetHoldingEnable - MCC_SetMode - MCC_SetNeutralizationCap - MCC_SetNeutralizationEnable - MCC_SetOscKillerEnable - MCC_SetPipetteOffset - MCC_SetPrimarySignalGain - MCC_SetPrimarySignalHPF - MCC_SetPrimarySignalLPF - MCC_SetRsCompBandwidth - MCC_SetRsCompCorrection - MCC_SetRsCompEnable - MCC_SetRsCompPrediction - MCC_SetSecondarySignalGain - MCC_SetSecondarySignalLPF - MCC_SetSlowCompCap - MCC_SetSlowCompTau - MCC_SetSlowCompTauX20Enable - MCC_SetSlowCurrentInjEnable - MCC_SetSlowCurrentInjLevel - MCC_SetSlowCurrentInjSetlTime - MCC_SetTimeoutMs - MCC_SetWholeCellCompCap - MCC_SetWholeCellCompEnable - MCC_SetWholeCellCompResist - mean - median - min - mod - ModDate - MPFXEMGPeak - MPFXExpConvExpPeak - MPFXGaussPeak - MPFXLorentzianPeak - MPFXVoigtPeak - NameOfWave - NaN - NewFreeDataFolder - NewFreeWave - norm - NormalizeUnicode - note - NumberByKey - numpnts - numtype - NumVarOrDefault - num2char - num2istr - num2str - NVAR_Exists - OperationList - PadString - PanelResolution - ParamIsDefault - ParseFilePath - PathList - pcsr - Pi - PICTInfo - PICTList - PixelFromAxisVal - pnt2x - poissonNoise - poly - PolygonArea - poly2D - PossiblyQuoteName - ProcedureText - ProcedureVersion - p2rect - qcsr - real - RemoveByKey - RemoveEnding - RemoveFromList - RemoveListItem - ReplaceNumberByKey - ReplaceString - ReplaceStringByKey - ReplicateString - rightx - round - r2polar - sawtooth - scaleToIndex - ScreenResolution - sec - sech - Secs2Date - Secs2Time - SelectNumber - SelectString - SetEnvironmentVariable - sign - sin - sinc - sinh - sinIntegral - SortList - SpecialCharacterInfo - SpecialCharacterList - SpecialDirPath - SphericalBessJ - SphericalBessJD - SphericalBessY - SphericalBessYD - SphericalHarmonics - SQLAllocHandle - SQLAllocStmt - SQLBinaryWavesToTextWave - SQLBindCol - SQLBindParameter - SQLBrowseConnect - SQLBulkOperations - SQLCancel - SQLCloseCursor - SQLColAttributeNum - SQLColAttributeStr - SQLColumnPrivileges - SQLColumns - SQLConnect - SQLDataSources - SQLDescribeCol - SQLDescribeParam - SQLDisconnect - SQLDriverConnect - SQLDrivers - SQLEndTran - SQLError - SQLExecDirect - SQLExecute - SQLFetch - SQLFetchScroll - SQLForeignKeys - SQLFreeConnect - SQLFreeEnv - SQLFreeHandle - SQLFreeStmt - SQLGetConnectAttrNum - SQLGetConnectAttrStr - SQLGetCursorName - SQLGetDataNum - SQLGetDataStr - SQLGetDescFieldNum - SQLGetDescFieldStr - SQLGetDescRec - SQLGetDiagFieldNum - SQLGetDiagFieldStr - SQLGetDiagRec - SQLGetEnvAttrNum - SQLGetEnvAttrStr - SQLGetFunctions - SQLGetInfoNum - SQLGetInfoStr - SQLGetStmtAttrNum - SQLGetStmtAttrStr - SQLGetTypeInfo - SQLMoreResults - SQLNativeSql - SQLNumParams - SQLNumResultCols - SQLNumResultRowsIfKnown - SQLNumRowsFetched - SQLParamData - SQLPrepare - SQLPrimaryKeys - SQLProcedureColumns - SQLProcedures - SQLPutData - SQLReinitialize - SQLRowCount - SQLSetConnectAttrNum - SQLSetConnectAttrStr - SQLSetCursorName - SQLSetDescFieldNum - SQLSetDescFieldStr - SQLSetDescRec - SQLSetEnvAttrNum - SQLSetEnvAttrStr - SQLSetPos - SQLSetStmtAttrNum - SQLSetStmtAttrStr - SQLSpecialColumns - SQLStatistics - SQLTablePrivileges - SQLTables - SQLTextWaveToBinaryWaves - SQLTextWaveTo2DBinaryWave - SQLUpdateBoundValues - SQLXOPCheckState - SQL2DBinaryWaveToTextWave - sqrt - StartMSTimer - StatsBetaCDF - StatsBetaPDF - StatsBinomialCDF - StatsBinomialPDF - StatsCauchyCDF - StatsCauchyPDF - StatsChiCDF - StatsChiPDF - StatsCMSSDCDF - StatsCorrelation - StatsDExpCDF - StatsDExpPDF - StatsErlangCDF - StatsErlangPDF - StatsErrorPDF - StatsEValueCDF - StatsEValuePDF - StatsExpCDF - StatsExpPDF - StatsFCDF - StatsFPDF - StatsFriedmanCDF - StatsGammaCDF - StatsGammaPDF - StatsGeometricCDF - StatsGeometricPDF - StatsGEVCDF - StatsGEVPDF - StatsHyperGCDF - StatsHyperGPDF - StatsInvBetaCDF - StatsInvBinomialCDF - StatsInvCauchyCDF - StatsInvChiCDF - StatsInvCMSSDCDF - StatsInvDExpCDF - StatsInvEValueCDF - StatsInvExpCDF - StatsInvFCDF - StatsInvFriedmanCDF - StatsInvGammaCDF - StatsInvGeometricCDF - StatsInvKuiperCDF - StatsInvLogisticCDF - StatsInvLogNormalCDF - StatsInvMaxwellCDF - StatsInvMooreCDF - StatsInvNBinomialCDF - StatsInvNCChiCDF - StatsInvNCFCDF - StatsInvNormalCDF - StatsInvParetoCDF - StatsInvPoissonCDF - StatsInvPowerCDF - StatsInvQCDF - StatsInvQpCDF - StatsInvRayleighCDF - StatsInvRectangularCDF - StatsInvSpearmanCDF - StatsInvStudentCDF - StatsInvTopDownCDF - StatsInvTriangularCDF - StatsInvUsquaredCDF - StatsInvVonMisesCDF - StatsInvWeibullCDF - StatsKuiperCDF - StatsLogisticCDF - StatsLogisticPDF - StatsLogNormalCDF - StatsLogNormalPDF - StatsMaxwellCDF - StatsMaxwellPDF - StatsMedian - StatsMooreCDF - StatsNBinomialCDF - StatsNBinomialPDF - StatsNCChiCDF - StatsNCChiPDF - StatsNCFCDF - StatsNCFPDF - StatsNCTCDF - StatsNCTPDF - StatsNormalCDF - StatsNormalPDF - StatsParetoCDF - StatsParetoPDF - StatsPermute - StatsPoissonCDF - StatsPoissonPDF - StatsPowerCDF - StatsPowerNoise - StatsPowerPDF - StatsQCDF - StatsQpCDF - StatsRayleighCDF - StatsRayleighPDF - StatsRectangularCDF - StatsRectangularPDF - StatsRunsCDF - StatsSpearmanRhoCDF - StatsStudentCDF - StatsStudentPDF - StatsTopDownCDF - StatsTriangularCDF - StatsTriangularPDF - StatsTrimmedMean - StatsUSquaredCDF - StatsVonMisesCDF - StatsVonMisesNoise - StatsVonMisesPDF - StatsWaldCDF - StatsWaldPDF - StatsWeibullCDF - StatsWeibullPDF - StopMSTimer - StringByKey - stringCRC - StringFromList - StringList - stringmatch - StringToUnsignedByteWave - strlen - strsearch - StrVarOrDefault - str2num - StudentA - StudentT - sum - SVAR_Exists - TableInfo - TagVal - TagWaveRef - tan - tanh - TDMAddChannel - TDMAddGroup - TDMAppendDataValues - TDMAppendDataValuesTime - TDMChannelPropertyExists - TDMCloseChannel - TDMCloseFile - TDMCloseGroup - TDMCreateChannelProperty - TDMCreateFile - TDMCreateFileProperty - TDMCreateGroupProperty - TDMFilePropertyExists - TDMGetChannelPropertyNames - TDMGetChannelPropertyNum - TDMGetChannelPropertyStr - TDMGetChannelPropertyTime - TDMGetChannelPropertyType - TDMGetChannels - TDMGetChannelStringPropertyLen - TDMGetDataType - TDMGetDataValues - TDMGetDataValuesTime - TDMGetFilePropertyNames - TDMGetFilePropertyNum - TDMGetFilePropertyStr - TDMGetFilePropertyTime - TDMGetFilePropertyType - TDMGetFileStringPropertyLen - TDMGetGroupPropertyNames - TDMGetGroupPropertyNum - TDMGetGroupPropertyStr - TDMGetGroupPropertyTime - TDMGetGroupPropertyType - TDMGetGroups - TDMGetGroupStringPropertyLen - TDMGetLibraryErrorDescription - TDMGetNumChannelProperties - TDMGetNumChannels - TDMGetNumDataValues - TDMGetNumFileProperties - TDMGetNumGroupProperties - TDMGetNumGroups - TDMGroupPropertyExists - TDMOpenFile - TDMOpenFileEx - TDMRemoveChannel - TDMRemoveGroup - TDMReplaceDataValues - TDMReplaceDataValuesTime - TDMSaveFile - TDMSetChannelPropertyNum - TDMSetChannelPropertyStr - TDMSetChannelPropertyTime - TDMSetDataValues - TDMSetDataValuesTime - TDMSetFilePropertyNum - TDMSetFilePropertyStr - TDMSetFilePropertyTime - TDMSetGroupPropertyNum - TDMSetGroupPropertyStr - TDMSetGroupPropertyTime - TextEncodingCode - TextEncodingName - TextFile - ThreadGroupCreate - ThreadGroupGetDF - ThreadGroupGetDFR - ThreadGroupRelease - ThreadGroupWait - ThreadProcessorCount - ThreadReturnValue - ticks - time - TraceFromPixel - TraceInfo - TraceNameList - TraceNameToWaveRef - TrimString - trunc - UniqueName - UnPadString - UnsetEnvironmentVariable - UpperStr - URLDecode - URLEncode - VariableList - Variance - vcsr - viAssertIntrSignal - viAssertTrigger - viAssertUtilSignal - viClear - viClose - viDisableEvent - viDiscardEvents - viEnableEvent - viFindNext - viFindRsrc - viGetAttribute - viGetAttributeString - viGpibCommand - viGpibControlATN - viGpibControlREN - viGpibPassControl - viGpibSendIFC - viIn8 - viIn16 - viIn32 - viLock - viMapAddress - viMapTrigger - viMemAlloc - viMemFree - viMoveIn8 - viMoveIn16 - viMoveIn32 - viMoveOut8 - viMoveOut16 - viMoveOut32 - viOpen - viOpenDefaultRM - viOut8 - viOut16 - viOut32 - viPeek8 - viPeek16 - viPeek32 - viPoke8 - viPoke16 - viPoke32 - viRead - viReadSTB - viSetAttribute - viSetAttributeString - viStatusDesc - viTerminate - viUnlock - viUnmapAddress - viUnmapTrigger - viUsbControlIn - viUsbControlOut - viVxiCommandQuery - viWaitOnEvent - viWrite - VoigtFunc - VoigtPeak - WaveCRC - WaveDataToString - WaveDims - WaveExists - WaveHash - WaveInfo - WaveList - WaveMax - WaveMin - WaveMinAndMax - WaveModCount - WaveName - WaveRefIndexed - WaveRefIndexedDFR - WaveRefsEqual - WaveRefWaveToList - WaveTextEncoding - WaveType - WaveUnits - WhichListItem - WinList - WinName - WinRecreation - WinType - wnoise - xcsr - XWaveName - XWaveRefFromTrace - x2pnt - zcsr - ZernikeR - zeromq_client_connect - zeromq_client_recv - zeromq_client_send - zeromq_handler_start - zeromq_handler_stop - zeromq_pub_bind - zeromq_pub_send - zeromq_server_bind - zeromq_server_recv - zeromq_server_send - zeromq_set - zeromq_set_logging_template - zeromq_stop - zeromq_sub_add_filter - zeromq_sub_connect - zeromq_sub_recv - zeromq_sub_remove_filter - zeromq_test_callfunction - zeromq_test_serializeWave - zeta - ) - end - - def self.igorOperation - @igorOperation ||= Set.new %w( - Abort - AddFIFOData - AddFIFOVectData - AddMovieAudio - AddMovieFrame - AddWavesToBoxPlot - AddWavesToViolinPlot - AdoptFiles - APMath - Append - AppendBoxPlot - AppendImage - AppendLayoutObject - AppendMatrixContour - AppendText - AppendToGizmo - AppendToGraph - AppendToLayout - AppendToTable - AppendViolinPlot - AppendXYZContour - AutoPositionWindow - AxonTelegraphFindServers - BackgroundInfo - Beep - BezierToPolygon - BoundingBall - BoxSmooth - BrowseURL - BuildMenu - Button - cd - Chart - CheckBox - CheckDisplayed - ChooseColor - Close - CloseHelp - CloseMovie - CloseProc - ColorScale - ColorTab2Wave - Concatenate - ControlBar - ControlInfo - ControlUpdate - ConvertGlobalStringTextEncoding - ConvexHull - Convolve - CopyDimLabels - CopyFile - CopyFolder - CopyScales - Correlate - CreateAliasShortcut - CreateBrowser - Cross - CtrlBackground - CtrlFIFO - CtrlNamedBackground - Cursor - CurveFit - CustomControl - CWT - DAQmx_AI_SetupReader - DAQmx_AO_SetOutputs - DAQmx_CTR_CountEdges - DAQmx_CTR_OutputPulse - DAQmx_CTR_Period - DAQmx_CTR_PulseWidth - DAQmx_DeviceInfo - DAQmx_DIO_Config - DAQmx_DIO_WriteNewData - DAQmx_Scan - DAQmx_WaveformGen - Debugger - DebuggerOptions - DefaultFont - DefaultGuiControls - DefaultGuiFont - DefaultTextEncoding - DefineGuide - DelayUpdate - DeleteAnnotations - DeleteFile - DeleteFolder - DeletePoints - Differentiate - dir - Display - DisplayHelpTopic - DisplayProcedure - DoAlert - DoIgorMenu - DoUpdate - DoWindow - DoXOPIdle - DPSS - DrawAction - DrawArc - DrawBezier - DrawLine - DrawOval - DrawPICT - DrawPoly - DrawRect - DrawRRect - DrawText - DrawUserShape - DSPDetrend - DSPPeriodogram - Duplicate - DuplicateDataFolder - DWT - EdgeStats - Edit - ErrorBars - EstimatePeakSizes - Execute - ExecuteScriptText - ExperimentInfo - ExperimentModified - ExportGizmo - Extract - FastGaussTransform - FastOp - FBinRead - FBinWrite - FCALL_CallFunction - FCALL_FreeLibrary - FCALL_GetFunctionList - FCALL_GetParamTypeList - FCALL_LoadLibrary - FCALL_Version - FFT - FGetPos - FIFOStatus - FIFO2Wave - FilterFIR - FilterIIR - FindAPeak - FindContour - FindDuplicates - FindLevel - FindLevels - FindPeak - FindPointsInPoly - FindRoots - FindSequence - FindValue - FMaxFlat - FPClustering - fprintf - FReadLine - FSetPos - FStatus - FTPCreateDirectory - FTPDelete - FTPDownload - FTPUpload - FuncFit - FuncFitMD - GBLoadWave - GetAxis - GetCamera - GetFileFolderInfo - GetGizmo - GetLastUserMenuInfo - GetMarquee - GetMouse - GetSelection - GetWindow - GISCreateVectorLayer - GISGetRasterInfo - GISGetRegisteredFileInfo - GISGetVectorLayerInfo - GISLoadRasterData - GISLoadVectorData - GISRasterizeVectorData - GISRegisterFile - GISTransformCoords - GISUnRegisterFile - GISWriteFieldData - GISWriteGeometryData - GISWriteRaster - GPIBReadBinaryWave2 - GPIBReadBinary2 - GPIBReadWave2 - GPIBRead2 - GPIBWriteBinaryWave2 - GPIBWriteBinary2 - GPIBWriteWave2 - GPIBWrite2 - GPIB2 - GraphNormal - GraphWaveDraw - GraphWaveEdit - Grep - GroupBox - Hanning - HCluster - HDFInfo - HDFReadImage - HDFReadSDS - HDFReadVset - HDF5CloseFile - HDF5CloseGroup - HDF5Control - HDF5CreateFile - HDF5CreateGroup - HDF5CreateLink - HDF5DimensionScale - HDF5Dump - HDF5DumpErrors - HDF5FlushFile - HDF5ListAttributes - HDF5ListGroup - HDF5LoadData - HDF5LoadGroup - HDF5LoadImage - HDF5OpenFile - HDF5OpenGroup - HDF5SaveData - HDF5SaveGroup - HDF5SaveImage - HDF5UnlinkObject - HideIgorMenus - HideInfo - HideProcedures - HideTools - HilbertTransform - Histogram - ICA - IFFT - ImageAnalyzeParticles - ImageBlend - ImageBoundaryToMask - ImageComposite - ImageEdgeDetection - ImageFileInfo - ImageFilter - ImageFocus - ImageFromXYZ - ImageGenerateROIMask - ImageGLCM - ImageHistModification - ImageHistogram - ImageInterpolate - ImageLineProfile - ImageLoad - ImageMorphology - ImageRegistration - ImageRemoveBackground - ImageRestore - ImageRotate - ImageSave - ImageSeedFill - ImageSkeleton3d - ImageSnake - ImageStats - ImageThreshold - ImageTransform - ImageUnwrapPhase - ImageWindow - IndexSort - InsertPoints - InstantFrequency - Integrate - IntegrateODE - Integrate2D - Interpolate2 - Interpolate3D - Interp3DPath - ITCCloseAll2 - ITCCloseDevice2 - ITCConfigAllChannels2 - ITCConfigChannelReset2 - ITCConfigChannelUpload2 - ITCConfigChannel2 - ITCFIFOAvailableAll2 - ITCFIFOAvailable2 - ITCGetAllChannelsConfig2 - ITCGetChannelConfig2 - ITCGetCurrentDevice2 - ITCGetDeviceInfo2 - ITCGetDevices2 - ITCGetErrorString2 - ITCGetSerialNumber2 - ITCGetState2 - ITCGetVersions2 - ITCInitialize2 - ITCOpenDevice2 - ITCReadADC2 - ITCReadDigital2 - ITCReadTimer2 - ITCSelectDevice2 - ITCSetDAC2 - ITCSetGlobals2 - ITCSetModes2 - ITCSetState2 - ITCStartAcq2 - ITCStopAcq2 - ITCUpdateFIFOPositionAll2 - ITCUpdateFIFOPosition2 - ITCWriteDigital2 - JCAMPLoadWave - JointHistogram - JSONXOP_AddTree - JSONXOP_AddValue - JSONXOP_Dump - JSONXOP_GetArraySize - JSONXOP_GetKeys - JSONXOP_GetMaxArraySize - JSONXOP_GetType - JSONXOP_GetValue - JSONXOP_New - JSONXOP_Parse - JSONXOP_Release - JSONXOP_Remove - JSONXOP_Version - KillBackground - KillControl - KillDataFolder - KillFIFO - KillFreeAxis - KillPath - KillPICTs - KillStrings - KillVariables - KillWaves - KillWindow - KMeans - Label - Layout - LayoutPageAction - LayoutSlideShow - Legend - LinearFeedbackShiftRegister - ListBox - LoadData - LoadPackagePreferences - LoadPICT - LoadWave - Loess - LombPeriodogram - Make - MakeIndex - MarkPerfTestTime - MatrixBalance - MatrixConvolve - MatrixCorr - MatrixEigenV - MatrixFactor - MatrixFilter - MatrixGaussJ - MatrixGLM - MatrixInverse - MatrixLinearSolve - MatrixLinearSolveTD - MatrixLLS - MatrixLUBkSub - MatrixLUD - MatrixLUDTD - MatrixMultiply - MatrixMultiplyAdd - MatrixOP - MatrixReverseBalance - MatrixSchur - MatrixSolve - MatrixSparse - MatrixSVBkSub - MatrixSVD - MatrixTranspose - MCC_FindServers - MeasureStyledText - MFR_CheckForNewBricklets - MFR_CloseResultFile - MFR_CreateOverviewTable - MFR_GetBrickletCount - MFR_GetBrickletData - MFR_GetBrickletDeployData - MFR_GetBrickletMetaData - MFR_GetBrickletRawData - MFR_GetReportTemplate - MFR_GetResultFileMetaData - MFR_GetResultFileName - MFR_GetVernissageVersion - MFR_GetVersion - MFR_GetXOPErrorMessage - MFR_OpenResultFile - MLLoadWave - Modify - ModifyBoxPlot - ModifyBrowser - ModifyCamera - ModifyContour - ModifyControl - ModifyControlList - ModifyFreeAxis - ModifyGizmo - ModifyGraph - ModifyImage - ModifyLayout - ModifyPanel - ModifyProcedure - ModifyTable - ModifyViolinPlot - ModifyWaterfall - MoveDataFolder - MoveFile - MoveFolder - MoveString - MoveSubwindow - MoveVariable - MoveWave - MoveWindow - MultiTaperPSD - MultiThreadingControl - NC_CloseFile - NC_DumpErrors - NC_Inquire - NC_ListAttributes - NC_ListObjects - NC_LoadData - NC_OpenFile - NeuralNetworkRun - NeuralNetworkTrain - NewCamera - NewDataFolder - NewFIFO - NewFIFOChan - NewFreeAxis - NewGizmo - NewImage - NewLayout - NewMovie - NewNotebook - NewPanel - NewPath - NewWaterfall - NILoadWave - NI4882 - Note - Notebook - NotebookAction - Open - OpenHelp - OpenNotebook - Optimize - ParseOperationTemplate - PathInfo - PauseForUser - PauseUpdate - PCA - PlayMovie - PlayMovieAction - PlaySound - PolygonOp - PopupContextualMenu - PopupMenu - Preferences - PrimeFactors - Print - printf - PrintGraphs - PrintLayout - PrintNotebook - PrintSettings - PrintTable - Project - PulseStats - PutScrapText - pwd - Quit - RatioFromNumber - Redimension - Remez - Remove - RemoveContour - RemoveFromGizmo - RemoveFromGraph - RemoveFromLayout - RemoveFromTable - RemoveImage - RemoveLayoutObjects - RemovePath - Rename - RenameDataFolder - RenamePath - RenamePICT - RenameWindow - ReorderImages - ReorderTraces - ReplaceText - ReplaceWave - Resample - ResumeUpdate - Reverse - Rotate - Save - SaveData - SaveExperiment - SaveGizmoCopy - SaveGraphCopy - SaveNotebook - SavePackagePreferences - SavePICT - SaveTableCopy - SetActiveSubwindow - SetAxis - SetBackground - SetDashPattern - SetDataFolder - SetDimLabel - SetDrawEnv - SetDrawLayer - SetFileFolderInfo - SetFormula - SetIdlePeriod - SetIgorHook - SetIgorMenuMode - SetIgorOption - SetMarquee - SetProcessSleep - SetRandomSeed - SetScale - SetVariable - SetWaveLock - SetWaveTextEncoding - SetWindow - ShowIgorMenus - ShowInfo - ShowTools - Silent - Sleep - Slider - Smooth - SmoothCustom - Sort - SortColumns - SoundInRecord - SoundInSet - SoundInStartChart - SoundInStatus - SoundInStopChart - SoundLoadWave - SoundSaveWave - SphericalInterpolate - SphericalTriangulate - SplitString - SplitWave - sprintf - SQLHighLevelOp - sscanf - Stack - StackWindows - StatsAngularDistanceTest - StatsANOVA1Test - StatsANOVA2NRTest - StatsANOVA2RMTest - StatsANOVA2Test - StatsChiTest - StatsCircularCorrelationTest - StatsCircularMeans - StatsCircularMoments - StatsCircularTwoSampleTest - StatsCochranTest - StatsContingencyTable - StatsDIPTest - StatsDunnettTest - StatsFriedmanTest - StatsFTest - StatsHodgesAjneTest - StatsJBTest - StatsKDE - StatsKendallTauTest - StatsKSTest - StatsKWTest - StatsLinearCorrelationTest - StatsLinearRegression - StatsMultiCorrelationTest - StatsNPMCTest - StatsNPNominalSRTest - StatsQuantiles - StatsRankCorrelationTest - StatsResample - StatsSample - StatsScheffeTest - StatsShapiroWilkTest - StatsSignTest - StatsSRTest - StatsTTest - StatsTukeyTest - StatsVariancesTest - StatsWatsonUSquaredTest - StatsWatsonWilliamsTest - StatsWheelerWatsonTest - StatsWilcoxonRankTest - StatsWRCorrelationTest - STFT - StructFill - StructGet - StructPut - SumDimension - SumSeries - TabControl - Tag - TDMLoadData - TDMSaveData - TextBox - TextHistogram - Text2Bezier - ThreadGroupPutDF - ThreadStart - TickWavesFromAxis - Tile - TileWindows - TitleBox - ToCommandLine - ToolsGrid - Triangulate3d - TUFXOP_AcquireLock - TUFXOP_Clear - TUFXOP_GetStorage - TUFXOP_Init - TUFXOP_ReleaseLock - TUFXOP_RunningInMainThread - TUFXOP_Version - Unwrap - UnzipFile - URLRequest - ValDisplay - VDTClosePort2 - VDTGetPortList2 - VDTGetStatus2 - VDTOpenPort2 - VDTOperationsPort2 - VDTReadBinaryWave2 - VDTReadBinary2 - VDTReadHexWave2 - VDTReadHex2 - VDTReadWave2 - VDTRead2 - VDTTerminalPort2 - VDTWriteBinaryWave2 - VDTWriteBinary2 - VDTWriteHexWave2 - VDTWriteHex2 - VDTWriteWave2 - VDTWrite2 - VDT2 - VISAControl - VISARead - VISAReadBinary - VISAReadBinaryWave - VISAReadWave - VISAWrite - VISAWriteBinary - VISAWriteBinaryWave - VISAWriteWave - WaveMeanStdv - WaveStats - WaveTracking - WaveTransform - wfprintf - WignerTransform - WindowFunction - XLLoadWave - ) + def self.igor_constants + @igor_constants ||= Set.new %w(nan inf) end def self.object_name @@ -1591,16 +66,16 @@ def self.object_name if m[0].downcase =~ /function/ token Keyword::Declaration push :parse_function - elsif self.class.igorDeclarations.include? m[0].downcase + elsif self.class.igor_declarations.include? m[0].downcase token Keyword::Declaration push :parse_variables elsif self.class.keywords.include? m[0].downcase token Keyword - elsif self.class.igorConstants.include? m[0].downcase + elsif self.class.igor_constants.include? m[0].downcase token Keyword::Constant - elsif self.class.igorFunction.include? m[0].downcase + elsif FUNCTIONS.include?(m[0].downcase) token Name::Builtin - elsif self.class.igorOperation.include? m[0].downcase + elsif OPERATIONS.include? m[0].downcase token Keyword::Reserved push :operationFlags elsif m[0].downcase =~ /\b(v|s|w)_[a-z]+[a-z0-9]*/ diff --git a/lib/rouge/lexers/igorpro/builtins.rb b/lib/rouge/lexers/igorpro/builtins.rb new file mode 100644 index 0000000000..93ae91ad28 --- /dev/null +++ b/lib/rouge/lexers/igorpro/builtins.rb @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +# DO NOT EDIT +# This file is automatically generated by `rake builtins:igorpro`. +# See tasks/builtins/igorpro.rake for more info. + +module Rouge + module Lexers + class IgorPro + FUNCTIONS = Set["abs", "acos", "acosh", "addlistitem", "airya", "airyad", "airyb", "airybd", "alog", "annotationinfo", "annotationlist", "area", "areaxy", "asin", "asinh", "atan", "atan2", "atanh", "axisinfo", "axislabel", "axislist", "axisvalfrompixel", "base64decode", "base64encode", "besseli", "besselj", "besselk", "bessely", "bessi", "bessj", "bessk", "bessy", "beta", "betai", "binarysearch", "binarysearchinterp", "binomial", "binomialln", "binomialnoise", "cabs", "capturehistory", "capturehistorystart", "ceil", "centerofmass", "centerofmassxy", "cequal", "char2num", "chebyshev", "chebyshevu", "checkname", "childwindowlist", "cleanupname", "cmplx", "cmpstr", "conj", "contourinfo", "contournamelist", "contournametowaveref", "contourz", "controlnamelist", "converttextencoding", "cos", "cosh", "cosintegral", "cot", "coth", "countobjects", "countobjectsdfr", "cpowi", "createdataobjectname", "creationdate", "csc", "csch", "csrinfo", "csrwave", "csrwaveref", "csrxwave", "csrxwaveref", "ctablist", "datafolderdir", "datafolderexists", "datafolderlist", "datafolderrefchanges", "datafolderrefsequal", "datafolderrefstatus", "date", "date2secs", "datetime", "datetojulian", "dawson", "defined", "deltax", "digamma", "dilogarithm", "dimdelta", "dimoffset", "dimsize", "e", "ei", "elliptice", "elliptick", "enoise", "equalwaves", "erf", "erfc", "erfcw", "erfcx", "exists", "exp", "expint", "expintegrale1", "expnoise", "factorial", "faddeeva", "fakedata", "faverage", "faveragexy", "fetchurl", "finddimlabel", "findlistitem", "floor", "fontlist", "fontsizeheight", "fontsizestringwidth", "fresnelcos", "fresnelcs", "fresnelsin", "funcrefinfo", "functioninfo", "functionlist", "functionpath", "functions_intro", "gamma", "gammaeuler", "gammainc", "gammanoise", "gammln", "gammp", "gammq", "gauss", "gauss1d", "gauss2d", "gcd", "geometricmean", "getbrowserline", "getbrowserselection", "getdatafolder", "getdatafolderdfr", "getdefaultfont", "getdefaultfontsize", "getdefaultfontstyle", "getdimlabel", "getenvironmentvariable", "geterrmessage", "getformula", "getindependentmodulename", "getindexedobjname", "getindexedobjnamedfr", "getkeystate", "getrterrmessage", "getrterror", "getrtlocation", "getrtlocinfo", "getrtstackinfo", "getscraptext", "getuserdata", "getwavesdatafolder", "getwavesdatafolderdfr", "gizmoinfo", "gizmoscale", "gnoise", "graphemelength", "greplist", "grepstring", "guideinfo", "guidenamelist", "hash", "hcsr", "hdf5attributeinfo", "hdf5datasetinfo", "hdf5libraryinfo", "hdf5linkinfo", "hdf5typeinfo", "hermite", "hermitegauss", "hyperg0f1", "hyperg1f1", "hyperg2f1", "hypergnoise", "hypergpfq", "i", "igorinfo", "igorversion", "ilim", "imag", "imageinfo", "imagenamelist", "imagenametowaveref", "independentmodulelist", "indexeddir", "indexedfile", "indextoscale", "inf", "integrate1d", "interp", "interp2d", "interp3d", "interp4d", "inverseerf", "inverseerfc", "itemsinlist", "j", "jacobicn", "jacobisn", "jlim", "juliantodate", "laguerre", "laguerrea", "laguerregauss", "lambertw", "layoutinfo", "leftx", "legendrea", "limit", "listmatch", "listtotextwave", "listtowaverefwave", "ln", "log", "lognormalnoise", "lorentziannoise", "lowerstr", "macroinfo", "macrolist", "macropath", "magsqr", "mandelbrotpoint", "marcumq", "matrixcondition", "matrixdet", "matrixdot", "matrixrank", "matrixtrace", "max", "mean", "median", "min", "mod", "moddate", "mpfxemgpeak", "mpfxexpconvexppeak", "mpfxgausspeak", "mpfxlorentzianpeak", "mpfxvoigtpeak", "nameofwave", "nan", "newfreedatafolder", "newfreewave", "norm", "normalizeunicode", "note", "num2char", "num2istr", "num2str", "numberbykey", "numpnts", "numtype", "numvarordefault", "nvar_exists", "operationlist", "p", "p2rect", "padstring", "panelresolution", "paramisdefault", "parsefilepath", "pathlist", "pcsr", "pi", "pictinfo", "pictlist", "pixelfromaxisval", "pnt2x", "poissonnoise", "poly", "poly2d", "polygonarea", "possiblyquotename", "proceduretext", "procedureversion", "q", "qcsr", "r", "r2polar", "real", "removebykey", "removeending", "removefromlist", "removelistitem", "replacenumberbykey", "replacestring", "replacestringbykey", "replicatestring", "rightx", "round", "s", "sawtooth", "scaletoindex", "screenresolution", "sec", "sech", "secs2date", "secs2time", "selectnumber", "selectstring", "setenvironmentvariable", "sign", "sin", "sinc", "sinh", "sinintegral", "sortlist", "specialcharacterinfo", "specialcharacterlist", "specialdirpath", "sphericalbessj", "sphericalbessjd", "sphericalbessy", "sphericalbessyd", "sphericalharmonics", "sqrt", "startmstimer", "statsbetacdf", "statsbetapdf", "statsbinomialcdf", "statsbinomialpdf", "statscauchycdf", "statscauchypdf", "statschicdf", "statschipdf", "statscmssdcdf", "statscorrelation", "statsdexpcdf", "statsdexppdf", "statserlangcdf", "statserlangpdf", "statserrorpdf", "statsevaluecdf", "statsevaluepdf", "statsexpcdf", "statsexppdf", "statsfcdf", "statsfpdf", "statsfriedmancdf", "statsgammacdf", "statsgammapdf", "statsgeometriccdf", "statsgeometricpdf", "statsgevcdf", "statsgevpdf", "statshypergcdf", "statshypergpdf", "statsinvbetacdf", "statsinvbinomialcdf", "statsinvcauchycdf", "statsinvchicdf", "statsinvcmssdcdf", "statsinvdexpcdf", "statsinvevaluecdf", "statsinvexpcdf", "statsinvfcdf", "statsinvfriedmancdf", "statsinvgammacdf", "statsinvgeometriccdf", "statsinvkuipercdf", "statsinvlogisticcdf", "statsinvlognormalcdf", "statsinvmaxwellcdf", "statsinvmoorecdf", "statsinvnbinomialcdf", "statsinvncchicdf", "statsinvncfcdf", "statsinvnormalcdf", "statsinvparetocdf", "statsinvpoissoncdf", "statsinvpowercdf", "statsinvqcdf", "statsinvqpcdf", "statsinvrayleighcdf", "statsinvrectangularcdf", "statsinvspearmancdf", "statsinvstudentcdf", "statsinvtopdowncdf", "statsinvtriangularcdf", "statsinvusquaredcdf", "statsinvvonmisescdf", "statsinvweibullcdf", "statskuipercdf", "statslogisticcdf", "statslogisticpdf", "statslognormalcdf", "statslognormalpdf", "statsmaxwellcdf", "statsmaxwellpdf", "statsmedian", "statsmoorecdf", "statsnbinomialcdf", "statsnbinomialpdf", "statsncchicdf", "statsncchipdf", "statsncfcdf", "statsncfpdf", "statsnctcdf", "statsnctpdf", "statsnormalcdf", "statsnormalpdf", "statsparetocdf", "statsparetopdf", "statspermute", "statspoissoncdf", "statspoissonpdf", "statspowercdf", "statspowernoise", "statspowerpdf", "statsqcdf", "statsqpcdf", "statsrayleighcdf", "statsrayleighpdf", "statsrectangularcdf", "statsrectangularpdf", "statsrunscdf", "statsspearmanrhocdf", "statsstudentcdf", "statsstudentpdf", "statstopdowncdf", "statstriangularcdf", "statstriangularpdf", "statstrimmedmean", "statsusquaredcdf", "statsvonmisescdf", "statsvonmisesnoise", "statsvonmisespdf", "statswaldcdf", "statswaldpdf", "statsweibullcdf", "statsweibullpdf", "stopmstimer", "str2num", "stringbykey", "stringcrc", "stringfromlist", "stringisnull", "stringlist", "stringmatch", "stringtounsignedbytewave", "strlen", "strsearch", "strvarordefault", "studenta", "studentt", "sum", "svar_exists", "t", "tableinfo", "tagval", "tagwaveref", "tan", "tanh", "textencodingcode", "textencodingname", "textfile", "threadgroupcreate", "threadgroupgetdf", "threadgroupgetdfr", "threadgrouprelease", "threadgroupwait", "threadprocessorcount", "threadreturnvalue", "ticks", "time", "tracefrompixel", "traceinfo", "tracenamelist", "tracenametowaveref", "trimstring", "trunc", "uniquename", "unpadstring", "unsetenvironmentvariable", "upperstr", "urldecode", "urlencode", "utf8charlength", "variablelist", "variance", "vcsr", "voigtfunc", "voigtpeak", "wavecrc", "wavedatatostring", "wavedims", "waveexists", "wavehash", "waveinfo", "wavelist", "wavemax", "wavemin", "waveminandmax", "wavemodcount", "wavename", "waverefindexed", "waverefindexeddfr", "waverefsequal", "waverefwavetolist", "wavetextencoding", "wavetype", "waveunits", "whichlistitem", "winlist", "winname", "winrecreation", "wintype", "wnoise", "x", "x2pnt", "xcsr", "xwavename", "xwavereffromtrace", "y", "z", "zcsr", "zerniker", "zeta"] + OPERATIONS = Set["abort", "addfifodata", "addfifovectdata", "addmovieaudio", "addmovieframe", "addwavestoboxplot", "addwavestoviolinplot", "adoptfiles", "apmath", "append", "appendboxplot", "appendimage", "appendlayoutobject", "appendmatrixcontour", "appendtext", "appendtogizmo", "appendtograph", "appendtolayout", "appendtotable", "appendviolinplot", "appendxyzcontour", "autopositionwindow", "backgroundinfo", "beep", "beziertopolygon", "boundingball", "boxsmooth", "browseurl", "buildmenu", "button", "cd", "chart", "checkbox", "checkdisplayed", "choosecolor", "close", "closehelp", "closemovie", "closeproc", "colorscale", "colortab2wave", "concatenate", "controlbar", "controlinfo", "controlupdate", "convertglobalstringtextencoding", "convexhull", "convolve", "copydimlabels", "copyfile", "copyfolder", "copyscales", "correlate", "createaliasshortcut", "createbrowser", "cross", "ctrlbackground", "ctrlfifo", "ctrlnamedbackground", "cursor", "curvefit", "customcontrol", "cwt", "debugger", "debuggeroptions", "defaultfont", "defaultguicontrols", "defaultguifont", "defaulttextencoding", "defineguide", "delayupdate", "deleteannotations", "deletefile", "deletefolder", "deletepoints", "differentiate", "dir", "display", "displayhelptopic", "displayprocedure", "doalert", "doigormenu", "doupdate", "dowindow", "doxopidle", "dpss", "drawaction", "drawarc", "drawbezier", "drawline", "drawoval", "drawpict", "drawpoly", "drawrect", "drawrrect", "drawtext", "drawusershape", "dspdetrend", "dspperiodogram", "duplicate", "duplicatedatafolder", "dwt", "edgestats", "edit", "errorbars", "estimatepeaksizes", "execute", "executescripttext", "experimentinfo", "experimentmodified", "exportgizmo", "extract", "fastgausstransform", "fastop", "fbinread", "fbinwrite", "fft", "fgetpos", "fifo2wave", "fifostatus", "filterfir", "filteriir", "findapeak", "findcontour", "findduplicates", "findlevel", "findlevels", "findpeak", "findpointsinpoly", "findroots", "findsequence", "findvalue", "fmaxflat", "fpclustering", "fprintf", "freadline", "fsetpos", "fstatus", "ftpcreatedirectory", "ftpdelete", "ftpdownload", "ftpupload", "funcfit", "funcfitmd", "gbloadwave", "getaxis", "getcamera", "getfilefolderinfo", "getgizmo", "getlastusermenuinfo", "getmarquee", "getmouse", "getselection", "getwindow", "getwindowbrowserselection", "graphnormal", "graphwavedraw", "graphwaveedit", "grep", "groupbox", "hanning", "hcluster", "hdf5closefile", "hdf5closegroup", "hdf5control", "hdf5createfile", "hdf5creategroup", "hdf5createlink", "hdf5dimensionscale", "hdf5dump", "hdf5dumperrors", "hdf5flushfile", "hdf5listattributes", "hdf5listgroup", "hdf5loaddata", "hdf5loadgroup", "hdf5loadimage", "hdf5openfile", "hdf5opengroup", "hdf5savedata", "hdf5savegroup", "hdf5saveimage", "hdf5unlinkobject", "hideigormenus", "hideinfo", "hideprocedures", "hidetools", "hilberttransform", "histogram", "ica", "ifft", "imageanalyzeparticles", "imageblend", "imageboundarytomask", "imagecomposite", "imageedgedetection", "imagefileinfo", "imagefilter", "imagefocus", "imagefromxyz", "imagegenerateroimask", "imageglcm", "imagehistmodification", "imagehistogram", "imageinterpolate", "imagelineprofile", "imageload", "imagemorphology", "imageregistration", "imageremovebackground", "imagerestore", "imagerotate", "imagesave", "imageseedfill", "imageskeleton3d", "imagesnake", "imagestats", "imagethreshold", "imagetransform", "imageunwrapphase", "imagewindow", "indexsort", "insertpoints", "instantfrequency", "integrate", "integrate2d", "integrateode", "interp3dpath", "interp4dpath", "interpolate2", "interpolate3d", "jcamploadwave", "jointhistogram", "killbackground", "killcontrol", "killdatafolder", "killfifo", "killfreeaxis", "killpath", "killpicts", "killstrings", "killvariables", "killwaves", "killwindow", "kmeans", "label", "layout", "layoutpageaction", "layoutslideshow", "legend", "linearfeedbackshiftregister", "listbox", "loaddata", "loadpackagepreferences", "loadpict", "loadwave", "loess", "lombperiodogram", "make", "makeindex", "markperftesttime", "matrixbalance", "matrixconvolve", "matrixcorr", "matrixeigenv", "matrixfactor", "matrixfilter", "matrixgaussj", "matrixglm", "matrixinverse", "matrixlinearsolve", "matrixlinearsolvetd", "matrixlls", "matrixlubksub", "matrixlud", "matrixludtd", "matrixmultiply", "matrixmultiplyadd", "matrixop", "matrixreversebalance", "matrixschur", "matrixsolve", "matrixsparse", "matrixsvbksub", "matrixsvd", "matrixtranspose", "measurestyledtext", "mlloadwave", "modify", "modifyboxplot", "modifybrowser", "modifycamera", "modifycontour", "modifycontrol", "modifycontrollist", "modifyfreeaxis", "modifygizmo", "modifygraph", "modifyimage", "modifylayout", "modifypanel", "modifyprocedure", "modifytable", "modifyviolinplot", "modifywaterfall", "movedatafolder", "movefile", "movefolder", "movestring", "movesubwindow", "movevariable", "movewave", "movewindow", "multitaperpsd", "multithreadingcontrol", "neuralnetworkrun", "neuralnetworktrain", "newcamera", "newdatafolder", "newfifo", "newfifochan", "newfreeaxis", "newgizmo", "newimage", "newlayout", "newmovie", "newnotebook", "newpanel", "newpath", "newwaterfall", "notebook", "notebookaction", "open", "openhelp", "opennotebook", "openproc", "optimize", "parseoperationtemplate", "pathinfo", "pauseforuser", "pauseupdate", "pca", "playmovie", "playmovieaction", "playsnd", "playsound", "polygonop", "popupcontextualmenu", "popupmenu", "preferences", "primefactors", "print", "printf", "printgraphs", "printlayout", "printnotebook", "printsettings", "printtable", "project", "pulsestats", "putscraptext", "pwd", "python", "pythonenv", "pythonfile", "quit", "ratiofromnumber", "readvariables", "redimension", "remez", "remove", "removecontour", "removefromgizmo", "removefromgraph", "removefromlayout", "removefromtable", "removeimage", "removelayoutobjects", "removepath", "rename", "renamedatafolder", "renamepath", "renamepict", "renamewindow", "reorderimages", "reordertraces", "replacetext", "replacewave", "resample", "resumeupdate", "reverse", "rotate", "save", "savedata", "saveexperiment", "savegizmocopy", "savegraphcopy", "savenotebook", "savepackagepreferences", "savepict", "savetablecopy", "say", "setactivesubwindow", "setaxis", "setbackground", "setdashpattern", "setdatafolder", "setdimlabel", "setdrawenv", "setdrawlayer", "setfilefolderinfo", "setformula", "setidleperiod", "setigorhook", "setigormenumode", "setigoroption", "setmarquee", "setprocesssleep", "setrandomseed", "setscale", "setvariable", "setwavelock", "setwavetextencoding", "setwindow", "showigormenus", "showinfo", "showtools", "silent", "sleep", "slider", "slow", "smooth", "smoothcustom", "sort", "sortcolumns", "soundinrecord", "soundinset", "soundinstartchart", "soundinstatus", "soundinstopchart", "soundloadwave", "soundsavewave", "sphericalinterpolate", "sphericaltriangulate", "splitstring", "splitwave", "sprintf", "sscanf", "stack", "stackwindows", "statsangulardistancetest", "statsanova1test", "statsanova2nrtest", "statsanova2rmtest", "statsanova2test", "statschitest", "statscircularcorrelationtest", "statscircularmeans", "statscircularmoments", "statscirculartwosampletest", "statscochrantest", "statscontingencytable", "statsdiptest", "statsdunnetttest", "statsfriedmantest", "statsftest", "statshodgesajnetest", "statsjbtest", "statskde", "statskendalltautest", "statskstest", "statskwtest", "statslinearcorrelationtest", "statslinearregression", "statsmulticorrelationtest", "statsnpmctest", "statsnpnominalsrtest", "statsquantiles", "statsrankcorrelationtest", "statsresample", "statssample", "statsscheffetest", "statsshapirowilktest", "statssigntest", "statssrtest", "statsttest", "statstukeytest", "statsvariancestest", "statswatsonusquaredtest", "statswatsonwilliamstest", "statswheelerwatsontest", "statswilcoxonranktest", "statswrcorrelationtest", "stft", "string", "structfill", "structget", "structput", "sumdimension", "sumseries", "tabcontrol", "tag", "text2bezier", "textbox", "texthistogram", "threadgroupputdf", "threadstart", "tickwavesfromaxis", "tile", "tilewindows", "titlebox", "tocommandline", "toolsgrid", "triangulate3d", "unwrap", "unzipfile", "urlrequest", "valdisplay", "variable", "wavemeanstdv", "wavestats", "wavetracking", "wavetransform", "wfprintf", "wignertransform", "windowfunction", "xlloadwave"] + end + end +end diff --git a/tasks/builtins/igorpro.rake b/tasks/builtins/igorpro.rake new file mode 100644 index 0000000000..d6af722115 --- /dev/null +++ b/tasks/builtins/igorpro.rake @@ -0,0 +1,73 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +require 'nokogiri' +require_relative "../task_helper" +require 'pry' + +IGOR_PRO_KEYWORDS_FILE = "./lib/rouge/lexers/igorpro/builtins.rb" + +namespace :builtins do + task :igorpro do + IgorProBuiltins.process(IGOR_PRO_KEYWORDS_FILE) + end +end + +class IgorProBuiltins < BuiltinsGenerator + def fetch + URI.open('https://docs.wavemetrics.com/igorpro/commands') + end + + def parse + doc = Nokogiri.HTML(@input) + + operations = [] + functions = [] + + nodes = doc.xpath('//span[starts-with(@class, "commandType")]').each do |type| + root = type.parent + + name = root.xpath('span[starts-with(@class, "commandName")]') + + raise "something went wrong, check igorpro.rake" unless name.size == 1 + + name = name[0] + + case type.text + when "operation" + operations << name.text.downcase + when "function" + functions << name.text.downcase + end + end + + operations.sort! + operations.uniq! + + functions.sort! + functions.uniq! + + # ensure disjoint + operations -= functions + + { operations: operations, functions: functions } + end + + def generate + yield "# -*- coding: utf-8 -*- #" + yield "# frozen_string_literal: true" + yield "" + yield "# DO NOT EDIT" + yield "# This file is automatically generated by `rake builtins:igorpro`." + yield "# See tasks/builtins/igorpro.rake for more info." + yield "" + yield "module Rouge" + yield " module Lexers" + yield " class IgorPro" + yield " FUNCTIONS = Set#{@keywords[:functions].inspect}" + yield " OPERATIONS = Set#{@keywords[:operations].inspect}" + yield " end" + yield " end" + yield "end" + end +end diff --git a/tasks/task_helper.rb b/tasks/task_helper.rb index 7acd35893f..ced02c56b5 100644 --- a/tasks/task_helper.rb +++ b/tasks/task_helper.rb @@ -18,6 +18,7 @@ def generate end def write(fname) + FileUtils.mkdir_p(File.dirname(fname)) File.open(fname, 'w') do |file| generate do |line| file.puts line