Menu

Synthax highlighting for Igor Pro SourceCode?

2011-08-26
2012-11-14
  • Der_Ventilator

    Der_Ventilator - 2011-08-26

    Hello,

    can somone generate a synthax highlighter for the scientific programming language Igor Pro?

    There is some prework for Notepad++, but i dont understand this XML stuff:

    http://www.igorexchange.com/project/syntaxcolor

    This linked file should generate and XML-File for Notepad++, but somehow it throws an error "XMLOpenfile" is unknown. Well that is an Igor problem and not one concering you, but still the ipf file contains stuff like

    XMLsetAttr(fileID,base,"","ext","ipf") // Make this apply automatically to all .ipf files opened in the text editor. 
    XMLsetAttr(fileID,base+"/Settings/Global","","caseIgnored","yes") // Case insensitive
    XMLsetAttr(fileID,base+"/Settings/Global","","escapeChar","\") // Escape character
    XMLsetNodeStr(fileID,base+"/KeywordLists/Keywords[1]","","\"00\"00") // Delimiters
    XMLsetNodeStr(fileID,base+"/KeywordLists/Keywords[4]","","! \" # $ & ( : ? , [ ] { } + =") // Operators
    XMLsetNodeStr(fileID,base+"/KeywordLists/Keywords[5]",""," 1 2 0//") // Comment
    XMLsetNodeStr(fileID,base+"/KeywordLists/Keywords[6]","",stringbykey("flow",words)+stringbykey("types",words)) // Words 1
    XMLsetNodeStr(fileID,base+"/KeywordLists/Keywords[7]","",stringbykey("functions",words)) // Words 2
    XMLsetNodeStr(fileID,base+"/KeywordLists/Keywords[8]","",stringbykey("operations",words)) // Words 3
    XMLsetNodeStr(fileID,base+"/KeywordLists/Keywords[9]","",stringbykey("pragmas",words)) // Words 4
    XMLsetAttr(fileID,base+"/Styles/WordsStyle[4]","","fgColor",stringbykey("keyword",colors)) // Keyword 1
    XMLsetAttr(fileID,base+"/Styles/WordsStyle[5]","","fgColor",stringbykey("function",colors)) // Keyword 2
    XMLsetAttr(fileID,base+"/Styles/WordsStyle[6]","","fgColor",stringbykey("operation",colors)) // Keyword 3
    XMLsetAttr(fileID,base+"/Styles/WordsStyle[7]","","fgColor",stringbykey("pound",colors)) // Keyword 4
    XMLsetAttr(fileID,base+"/Styles/WordsStyle[9]","","fgColor",stringbykey("comment",colors)) // Comment Line
    XMLsetAttr(fileID,base+"/Styles/WordsStyle[12]","","fgColor",stringbykey("string",colors)) // Deliminer1

    How to proceed?

     
  • cchris

    cchris - 2011-08-27

    I don't know what this XMLUtils XOP is. The program that executes the script you posted may be expecting an existing file similar to a valid userDefineLang.xml file.
    If providing such a file as input doesn't work, I think I can manually assemble a syntax file from your scrit. Whether it will be complete is an open question, but at least N++ will do something useful with it.
    I'll do that tonight UTC I think, and will upload on http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=User_Defined_Language_Files

    Who is the maintainer supposed to be? Could be me, but I don't know a thing about Igor lol.

    CChris

     
  • cchris

    cchris - 2011-08-28

    I started making a new udl file from your post, but that won't ever work. Obviously there is some sort of file with the word lists for your language, and this is not available. Back to you.

    CChris

     
  • Anonymous

    Anonymous - 2011-12-05

    I just did it and it worked wonderfully.  Here is the step-by-step. Hopefully this will work for you.

    1. Download the "Syntax Highlighter.ipf" file from the link you provided (http://www.igorexchange.com/project/syntaxcolor). Extract all the files from the zip file.
    2. Download the "XMLUtils XOP' from this link: http://www.igorexchange.com/project/XMLutils. Extract all the files from the zip file.
    3. Install the XMLUtils XOP (check out the ReadMe.txt file included in the zip file if you need help with the install). If you are using Windows, just double click on the "XMLutilsInstaller.exe" file.
    4. Open Igor
    5. Open the "Syntax Highlighter.ipf" file in Igor and read the directions in the red comments at the top (the rest is described in the comments, but in case it isn't clear, I wrote the steps out for you.)
    6. Basically: open Notepad++, go to View> User-Defined Dialogue> click Create New…, and name it Igor. Then, close the dialogue and close Notepad++.
    7. In Igor, with the "Syntax Highlighter.ipf" file open, type "SetSyntaxColoring()" without the quotes, into the command line and press enter
    8. This will open up a dialog box where you have to find a file called "userDefineLang.xml" which you created in Notepad++ when you created the new User Defined Language called Igor.  On my computer, the file was located at C:\Users\"my name"\AppData\Roaming\Notepad++. Once you find the file, select it and click Open. This alters the xml file as necessary.
    9. That should do it. Now open up Notepad++ and you should be able to open up a procedure file (*.ipf) and everything is colored as it should be.

    Hope that clears things up.

    MenaM

     
  • Anonymous

    Anonymous - 2011-12-05

    This is the XML file it generated:

    <?xml version="1.0"?>
    <NotepadPlus>
        <UserLang name="Igor" ext="ipf">
            <Settings>
                <Global caseIgnored="yes" escapeChar="\"/>
                <TreatAsSymbol comment="no" commentLine="no"/>
                <Prefix words1="no" words2="no" words3="no" words4="no"/>
            </Settings>
            <KeywordLists>
                <Keywords name="Delimiters">"00"00</Keywords>
                <Keywords name="Folder+"/>
                <Keywords name="Folder-"/>
                <Keywords name="Operators">! " # $ &amp; ( : ? , [ ] { } + =</Keywords>
                <Keywords name="Comment"> 1 2 0//</Keywords>
                <Keywords name="Words1">if else elseif endif for endfor strswitch switch case endswitch do while try catch endtry break continue return variable string constant strconstant NVAR SVAR WAVE STRUCT function end static macro window graph Structure EndStructure EndMacro FuncFit Proc Picture Menu SubMenu Prompt DoPrompt </Keywords>
                <Keywords name="Words2">abs acos acosh AiryA AiryAD AiryB AiryBD alog area areaXY asin asinh atan atan2 atanh AxisValFromPixel Besseli Besselj Besselk Bessely bessi bessj bessk bessy beta betai BinarySearch BinarySearchInterp binomial binomialln binomialNoise cabs CaptureHistoryStart ceil cequal char2num chebyshev chebyshevU CheckName cmplx cmpstr conj ContourZ cos cosh cot coth CountObjects CountObjectsDFR cpowi CreationDate csc DataFolderExists DataFolderRefsEqual DataFolderRefStatus date2secs datetime DateToJulian Dawson DDEExecute DDEInitiate DDEPokeString DDEPokeWave DDERequestWave DDEStatus DDETerminate defined deltax digamma DimDelta DimOffset DimSize e ei enoise equalWaves erf erfc erfcw exists exp expInt expNoise factorial fakedata faverage faverageXY FindDimLabel FindListItem floor FontSizeHeight FontSizeStringWidth FresnelCos FresnelSin gamma gammaInc gammaNoise gammln gammp gammq Gauss Gauss1D Gauss2D gcd GetDefaultFontSize GetDefaultFontStyle GetKeyState GetRTError gnoise GrepString hcsr hermite hermiteGauss HyperG0F1 HyperG1F1 HyperG2F1 HyperGNoise HyperGPFQ i IgorVersion ilim imag Inf Integrate1D interp Interp2D Interp3D inverseERF inverseERFC ItemsInList j jlim Laguerre LaguerreA LaguerreGauss leftx LegendreA limit ln log logNormalNoise lorentzianNoise magsqr MandelbrotPoint MarcumQ MatrixDet MatrixDot MatrixRank MatrixTrace max mean min mod ModDate NaN norm NumberByKey numpnts numtype NumVarOrDefault NVAR_Exists p p2rect ParamIsDefault pcsr Pi PixelFromAxisVal pnt2x poissonNoise poly poly2D PolygonArea q qcsr r r2polar real rightx round s sawtooth ScreenResolution sec SelectNumber sign sin sinc sinh 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 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 stringCRC stringmatch strlen strsearch StudentA StudentT sum SVAR_Exists t TagVal tan tanh ThreadGroupCreate ThreadGroupRelease ThreadGroupWait ThreadProcessorCount ThreadReturnValue ticks trunc Variance vcsr WaveCRC WaveDims WaveExists WaveMax WaveMin WaveRefsEqual WaveType WhichListItem WinType WNoise x x2pnt xcsr y z zcsr ZernikeR AddListItem AnnotationInfo AnnotationList AxisInfo AxisList CaptureHistory ChildWindowList CleanupName ContourInfo ContourNameList ControlNameList CsrInfo CsrWave CsrXWave CTabList DataFolderDir date DDERequestString FetchURL FontList FuncRefInfo FunctionInfo FunctionList FunctionPath GetDataFolder GetDefaultFont GetDimLabel GetErrMessage GetFormula GetIndependentModuleName GetIndexedObjName GetIndexedObjNameDFR GetRTErrMessage GetRTStackInfo GetScrapText GetUserData GetWavesDataFolder GrepList GuideInfo GuideNameList Hash IgorInfo ImageInfo ImageNameList IndependentModuleList IndexedDir IndexedFile JulianToDate LayoutInfo ListMatch LowerStr MacroList NameOfWave note num2char num2istr num2str OperationList PadString ParseFilePath PathList PICTInfo PICTList PossiblyQuoteName ProcedureText RemoveByKey RemoveEnding RemoveFromList RemoveListItem ReplaceNumberByKey ReplaceString ReplaceStringByKey Secs2Date Secs2Time SelectString SortList SpecialCharacterInfo SpecialCharacterList SpecialDirPath StringByKey StringFromList StringList StrVarOrDefault TableInfo TextFile ThreadGroupGetDF time TraceFromPixel TraceInfo TraceNameList UniqueName UnPadString UpperStr URLDecode URLEncode VariableList WaveInfo WaveList WaveName WaveUnits WinList WinName WinRecreation XWaveName ContourNameToWaveRef CsrWaveRef CsrXWaveRef ImageNameToWaveRef NewFreeWave TagWaveRef TraceNameToWaveRef WaveRefIndexed XWaveRefFromTrace GetDataFolderDFR GetWavesDataFolderDFR NewFreeDataFolder ThreadGroupGetDFR </Keywords>
                <Keywords name="Words3">Abort AddFIFOData AddFIFOVectData AddMovieAudio AddMovieFrame APMath Append AppendImage AppendLayoutObject AppendMatrixContour AppendText AppendToGraph AppendToLayout AppendToTable AppendXYZContour AutoPositionWindow BackgroundInfo Beep BoundingBall BrowseURL BuildMenu Button cd Chart CheckBox CheckDisplayed ChooseColor Close CloseMovie CloseProc ColorScale ColorTab2Wave Concatenate ControlBar ControlInfo ControlUpdate ConvexHull Convolve CopyFile CopyFolder CopyScales Correlate CreateAliasShortcut Cross CtrlBackground CtrlFIFO CtrlNamedBackground Cursor CurveFit CustomControl CWT Debugger DebuggerOptions DefaultFont DefaultGuiControls DefaultGuiFont DefineGuide DelayUpdate DeleteFile DeleteFolder DeletePoints Differentiate dir Display DisplayHelpTopic DisplayProcedure DoAlert DoIgorMenu DoUpdate DoWindow DoXOPIdle DrawAction DrawArc DrawBezier DrawLine DrawOval DrawPICT DrawPoly DrawRect DrawRRect DrawText DSPDetrend DSPPeriodogram Duplicate DuplicateDataFolder DWT EdgeStats Edit ErrorBars Execute ExecuteScriptText ExperimentModified Extract FastGaussTransform FastOp FBinRead FBinWrite FFT FIFO2Wave FIFOStatus FilterFIR FilterIIR FindLevel FindLevels FindPeak FindPointsInPoly FindRoots FindSequence FindValue FPClustering fprintf FReadLine FSetPos FStatus FTPCreateDirectory FTPDelete FTPDownload FTPUpload FuncFit FuncFitMD GetAxis GetFileFolderInfo GetLastUserMenuInfo GetMarquee GetSelection GetWindow GraphNormal GraphWaveDraw GraphWaveEdit Grep GroupBox Hanning HideIgorMenus HideInfo HideProcedures HideTools HilbertTransform Histogram IFFT ImageAnalyzeParticles ImageBlend ImageBoundaryToMask ImageEdgeDetection ImageFileInfo ImageFilter ImageFocus ImageGenerateROIMask ImageHistModification ImageHistogram ImageInterpolate ImageLineProfile ImageLoad ImageMorphology ImageRegistration ImageRemoveBackground ImageRestore ImageRotate ImageSave ImageSeedFill ImageSnake ImageStats ImageThreshold ImageTransform ImageUnwrapPhase ImageWindow IndexSort InsertPoints Integrate IntegrateODE Interp3DPath Interpolate3D KillBackground KillControl KillDataFolder KillFIFO KillFreeAxis KillPath KillPICTs KillStrings KillVariables KillWaves KillWindow KMeans Label Layout Legend LinearFeedbackShiftRegister ListBox LoadData LoadPackagePreferences LoadPICT LoadWave Loess LombPeriodogram Make MakeIndex MarkPerfTestTime MatrixConvolve MatrixCorr MatrixEigenV MatrixFilter MatrixGaussJ MatrixInverse MatrixLinearSolve MatrixLinearSolveTD MatrixLLS MatrixLUBkSub MatrixLUD MatrixMultiply MatrixOP MatrixSchur MatrixSolve MatrixSVBkSub MatrixSVD MatrixTranspose MeasureStyledText Modify ModifyContour ModifyControl ModifyControlList ModifyFreeAxis ModifyGraph ModifyImage ModifyLayout ModifyPanel ModifyTable ModifyWaterfall MoveDataFolder MoveFile MoveFolder MoveString MoveSubwindow MoveVariable MoveWave MoveWindow NeuralNetworkRun NeuralNetworkTrain NewDataFolder NewFIFO NewFIFOChan NewFreeAxis NewImage NewLayout NewMovie NewNotebook NewPanel NewPath NewWaterfall Note Notebook NotebookAction Open OpenNotebook Optimize ParseOperationTemplate PathInfo PauseForUser PauseUpdate PCA PlayMovie PlayMovieAction PlaySnd PlaySound PopupContextualMenu PopupMenu Preferences PrimeFactors Print printf PrintGraphs PrintLayout PrintNotebook PrintSettings PrintTable Project PulseStats PutScrapText pwd Quit RatioFromNumber Redimension Remove RemoveContour RemoveFromGraph RemoveFromLayout RemoveFromTable RemoveImage RemoveLayoutObjects RemovePath Rename RenameDataFolder RenamePath RenamePICT RenameWindow ReorderImages ReorderTraces ReplaceText ReplaceWave Resample ResumeUpdate Reverse Rotate Save SaveData SaveExperiment SaveGraphCopy SaveNotebook SavePackagePreferences SavePICT SaveTableCopy SetActiveSubwindow SetAxis SetBackground SetDashPattern SetDataFolder SetDimLabel SetDrawEnv SetDrawLayer SetFileFolderInfo SetFormula SetIgorHook SetIgorMenuMode SetIgorOption SetMarquee SetProcessSleep SetRandomSeed SetScale SetVariable SetWaveLock SetWindow ShowIgorMenus ShowInfo ShowTools Silent Sleep Slider Smooth SmoothCustom Sort SoundInRecord SoundInSet SoundInStartChart SoundInStatus SoundInStopChart SphericalInterpolate SphericalTriangulate SplitString sprintf sscanf Stack StackWindows StatsAngularDistanceTest StatsANOVA1Test StatsANOVA2NRTest StatsANOVA2RMTest StatsANOVA2Test StatsChiTest StatsCircularCorrelationTest StatsCircularMeans StatsCircularMoments StatsCircularTwoSampleTest StatsCochranTest StatsContingencyTable StatsDIPTest StatsDunnettTest StatsFriedmanTest StatsFTest StatsHodgesAjneTest StatsJBTest StatsKendallTauTest StatsKSTest StatsKWTest StatsLinearCorrelationTest StatsLinearRegression StatsMultiCorrelationTest StatsNPMCTest StatsNPNominalSRTest StatsQuantiles StatsRankCorrelationTest StatsResample StatsSample StatsScheffeTest StatsSignTest StatsSRTest StatsTTest StatsTukeyTest StatsVariancesTest StatsWatsonUSquaredTest StatsWatsonWilliamsTest StatsWheelerWatsonTest StatsWilcoxonRankTest StatsWRCorrelationTest String StructGet StructPut TabControl Tag TextBox ThreadGroupPutDF Tile TileWindows TitleBox ToCommandLine ToolsGrid Triangulate3d Unwrap ValDisplay Variable WaveMeanStdv WaveStats WaveTransform wfprintf WignerTransform WindowFunction </Keywords>
                <Keywords name="Words4">#include #pragma </Keywords>
            </KeywordLists>
            <Styles>
                <WordsStyle name="DEFAULT" styleID="11" fgColor="000000" bgColor="FFFFFF" fontName="Arial" fontStyle="0"/>
                <WordsStyle name="FOLDEROPEN" styleID="12" fgColor="000000" bgColor="FFFFFF" fontName="Arial" fontStyle="0"/>
                <WordsStyle name="FOLDERCLOSE" styleID="13" fgColor="000000" bgColor="FFFFFF" fontName="Arial" fontStyle="0"/>
                <WordsStyle name="KEYWORD1" styleID="5" fgColor="0000ff" bgColor="FFFFFF" fontName="" fontStyle="0"/>
                <WordsStyle name="KEYWORD2" styleID="6" fgColor="c34e00" bgColor="FFFFFF" fontName="" fontStyle="0"/>
                <WordsStyle name="KEYWORD3" styleID="7" fgColor="007575" bgColor="FFFFFF" fontName="" fontStyle="0"/>
                <WordsStyle name="KEYWORD4" styleID="8" fgColor="cc00a3" bgColor="FFFFFF" fontName="" fontStyle="0"/>
                <WordsStyle name="COMMENT" styleID="1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
                <WordsStyle name="COMMENT LINE" styleID="2" fgColor="ff0000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
                <WordsStyle name="NUMBER" styleID="4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
                <WordsStyle name="OPERATOR" styleID="10" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
                <WordsStyle name="DELIMINER1" styleID="14" fgColor="009c00" bgColor="FFFFFF" fontName="" fontStyle="0"/>
                <WordsStyle name="DELIMINER2" styleID="15" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
                <WordsStyle name="DELIMINER3" styleID="16" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0"/>
            </Styles>
        </UserLang>
    </NotepadPlus>
    

    -MenaM

     
MongoDB Logo MongoDB