Tapatalk

How to fix syntax highlighting wordfile for MAXScript?

How to fix syntax highlighting wordfile for MAXScript?

1

    Dec 01, 2017#1

    Hi!

    In the following wordfile for MAXScript I have some issues with text inside commented area.
    You comment stuff between /* and */. However when I have a ' character, for example in the term what's new, things get broken.

    Could anyone help me update the wordfile?

    Thank you.

    Code: Select all

    /L20"MAXScript" Line Comment = -- String Chars = "' File Extensions = ms mcr
    /Delimiters = ~!@%^&*()-+=|\{}[];"' , ?
    /Function String = "%[a-zA-Z]*)"
    /Indent Strings = "("
    /Unindent Strings = ")"
    /C1 KEYWORDS
    about and animate as at
    by
    case catch collect continue coordsys
    do
    else exit
    fn for from function
    global
    if in
    local
    macroscript mapped max material
    name not
    of off on or
    parameters persistent plugin prefix pos pivot parent
    rcmenu return rollout rotation
    set struct scale
    target then throw to tool try transform
    undo utility
    when where while with
    /C2 Globals
    1Button
    MAX
    activeGrid altKey ambientColor ambientColorController animButtonEnabled animButtonState animationRange
    backgroundColor backgroundColorController backgroundImageFileName black blue brown
    ctrlKey cui.commandPanelOpen currentMaterialLibrary currentTime 
    displayGamma displaySafeFrames doDisabled dontcollect
    editorFont editorFontSize editorTabWidth environmentMap escapeEnable
    false fileInGamma fileOutGamma flyOffTime frameRate
    globalTracks gray green gridDist 
    hardwareLockID heapFree heapSize hotspotAngleSeparation
    inputTextColor
    keyboard.Pressed keyboard.altPressed keyboard.controlPressed
    lightLevel lightLevelController lightTintColor lightTintColorController localTime logsystem.quietmode
    mButton maxFileName maxFilePath meditMaterials mesh messageTextColor 
    nodeTM numAtmospherics numEffects numSubObjectLevels
    off ok on orange outputTextColor
    playActiveOnly preferences.constantReferenceSystem preferences.flyOffTime preferences.maximumGBufferLayer
    preferences.spinnerWrap preferences.useLargeVertexDots preferences.useTransformGizmos preferences.useVertexDots
    rButton realTimePlayback red rendOutputFilename renderDisplacements renderEffects renderHeight
    renderPixelAspect renderWidth renderer rootNode
    scanlineRender.antiAliasFilter scanlineRender.antiAliasFilterSize scanlineRender.enablePixelSampler
    sceneMaterials scriptsPath seEnvironmentMap selectionSets shiftKey showEndResult skipRenderedFrames
    sliderTime snapMode.active snapMode.type stackLimit subObjectLevel
    ticksPerFrame timeConfiguration.playActiveOnly timeConfiguration.realTimePlayback timeConfiguration.useTrackBar
    trackViewNodes trackbar.filter trackbar.visible true
    undefined unsupplied 
    videoPostTracks viewPoint viewport.activeViewport viewport.numViews
    white worldAngle worldPoint
    yellow
    /C3 CLASSES & DECLARATIONS
    #2D #2_5D #3D #TMOnly #all #allEdges #allkeys #angle #angleTab #animatedTracks #arrow #asterisk #backcull #baseObjects #bigBox #bitmapTab #blue #boolTab #boolean #boxMode 
    #center #circle #clear #color #colorChannel #colorChannelTab #colorTab #colorVerts #constant #contents #controllerTypes #coverage #create #currentTM #curveX #curveY #curveZ 
    #custom #cycle #default #diamond #display #draft #driverConfig #dualPlanes #fast #filename #filenameTab #fill #flat #float #floatTab #geomAccel #green #grid #hideCameras 
    #hideGeometry #hideHelpers #hideLights #hideShapes #hideSpacewarps #hieracthy #hierarchy #hollowBox #horizontal #hybrid #illum #image #inactive #incNone #incrUpdate 
    #instanceOnly #intTab #integer #left #lighting #line #linear #local #localOnly #loop #maps #mat #matID #material #materialParameters #materialTab #materialsMaps #mats 
    #maxObject #maxObjectTab #mergeDups #missing #modifiedObjects #modify #motion #mtlEditor #noAtts #noRedraw #node #nodeTab #none #normal #noteTracks #nuscale #object #objectID 
    #objects #other #paintDoesBlit #parent #passDecal #percentTab #perspCorrect #pick #pingpong #plusSign #point #point3 #point3Tab #polyEdges #position #positionX #positionY 
    #positionZ #production #prompt #promptDups #radiobtnIndex #radiobtnIndexTab #red #redrawViews #relativeRepeat #render #right #rotation #rotationX #rotationY #rotationZ #scale 
    #scaleX #scaleY #scaleZ #scene #screen #selOnly #select #selectedObjects #selectedTracks #selection #shadeCverts #shaderColor #shaderTransparency #skipDups #smallCircle 
    #smallDiamond #smallHollowBox #smallTriangle #sound #spacewarpBindings #specular #squash #staticValues #step #string #stringTab #summary #swapModel #system #text #texture 
    #texturedBkg #texturemap #texturemapTab #time #timeChange #timeTab #transforms #triStrips #triangle #twoSided #txtCorrect #unClamped #universe #uscale #utility #velocity 
    #vertTicks #vertical #videoPost #view #virtualVpts #visibilityTracks #visibleObjects #weight #wireframe #wireframeStrips #world #worldUnitsTab #worldunits #xMarker #zBuffer 
    Adobe_Photoshop_Plug_In_Filter Adobe_Premiere_Video_Filter
    BombBinding
    ClearSelection Cubic_Morph_Controller
    DOSCommand DeflectorBinding DeleteSplineModifier DisplaceBinidng
    FFD_Binding FLAGS FUNCTIONS Free_point
    GetAllShortcuts GetBoneName GetCommandName GetCount GetDefaultUIColor GetEndTime GravityBinding
    MapScaler Morpher MotorMod 
    NCurve_Sel NSurf_Sel NURBSNode
    PBombMod PDynaFlect PDynaFlectMod POmniFlect POmniFlectMod PathFollowMod PushMod
    RippleBinding
    SDeflectMod SDynaFlect SDynaFlectMod SOmineFlect SOmniFlectMod SimpleOSMToWSMMod SpaceCameraMap SpaceConform SpacePatchDeform SpacePathDeform SpaceSurfDeform 
    Target_point Terrain
    UCurve UDeflectorMod UDynaFlect UDynaFlectMod UOmniFlect UOmniFlectMod 
    Vertex_Colors
    WaveBinding WindBinding
    _point3
    abs acos add addASec addAndWeld addAtmospheric addCam addEaseCurve addEffect addFocalNode addGlow addKnot addLight addLightNode addMSec addModToSelection addModifier
    addMorphTarget addMultiplerCurve addNURBSSet addNewKey addNewNoteKey addNewSpline addNewXRefFile addNewsXRefObject addNoteTrack addPluginRollouts addProperty addQuad
    addRay addRing addRollout addScript addStar addStreak addTrackViewController addTri affect_region allowBlending anchor animateAll animateVertex append appendCurve 
    appendCurveByID appendGizmo appendObject appendSubSelSet appendUCurveByID appendVCurve appendVCurveByID applyEaseCurve applyOffset apropos arbAxis arc asin atan atan2
    attach attachMultiple attachObjects attemptUnresolvedXRefs audioClip audiofloat audiopoint3 audioposition audiorotation audioscale autoEdge averageSelVertCenter
    averageSelVertNormal awning axisTripodLocked
    background bend bevel bevel_profile bezier bezier_color bezier_float bezier_position bezier_rotation bezier_scale bifold billboard bindKnot bindSpaceWarp bitmap blizzard 
    bomb bone boolObj.createBooleanObject box boxGizmo boxPickNode break breakCurve breakSurface broadcastCallback buildTVFaces buildVCFaces button 
    c_ext camPoint camera_map canConvertTo cap_holes capsule casement ceil chamferbox chamfercyl checkForSave checkbox checkbutton circle circlePickNode classOf clear 
    clearAllAppData clearCurSelSet clearEdgeVertices clearFilter clearListener clearNodeSelection clearProdTess clearScreen clearSubSelSets clearUndoBuffer clearViewTess 
    close closeLog closeRolloutFloater closeU closeUtility closeV collapse collapseFace collapseStack colorpicker combobox compass completeRedraw composite cone 
    configureBitmapPaths conformSpaceWarp conformToShape conjugate contains convertTo convertToMesh convertToNURBSCurve convertToNURBSSurface convertToRigid convertToSplineShape 
    coordsys copy copyfile cos cosh count createBooleanObject createFile createInstance createLockKey createMorphObject createOLEObject createPreview createReaction 
    createShapeFromEdges cross crossSection curveLength cycle cylGizmo cylinder 
    damper defaultVCFaces deflector degToRad delete deleteAllChangeHandlers deleteAllXRefs deleteAppData deleteAtmosheric deleteCam deleteCamByName deleteChangeHandler 
    deleteEaseCurve deleteEffect deleteElement deleteElementByName deleteFace deleteFile deleteFocalNode deleteFocalNodeByName deleteGizmo deleteItem deleteKey deleteKeys 
    deleteKnot deleteLight deleteLightByName deleteMesh deleteModifier deleteMorphTarget deleteMultiplierCurve deleteNoteKey deleteNoteKeys deleteNoteTrack deleteObjects 
    deleteProperty deleteReaction deleteSplie deleteTime deleteTrackViewController deleteTrackViewNode deleteVert dependents deselect deselectHiddenEdges deselectHiddenFaces 
    deselectJey deselectKeys deselectNode detach directionalLight disableSceneRedraw disableStatusXYZ disconnect disp_approx displace displace_Mesh displace_NURBS display 
    displayGamma displaySafeFrames displayTempPrompt distance divide donut dot dropdownlist dummy
    edit editAtmosphere editAtmospheric editEffect edit_mesh edit_patch edit_spline edittext elargeUpdateRect ellipse empty enableCoordCenter enableEscape enableORTs 
    enablePixelSampler enableRefCoordSys enableSceneRedraw enableShowEndRes enableStatusXYZ enableSubObjSel enableUndo encryptFile encryptScript enumerateFiles eof evalPos 
    evalTangent evalUTangents evalVTangents exclusionListDlg execute exitrude exp explode explodeGroup exportFile extrudeFace
    face_extrude fencePickNode fetchMaxFile ffdBox ffdCyl ffd_2x2x2 ffd_3x3x3 ffd_4x4x4 ffd_select fileIn fileInGamma fileOutGamma filePos fileProperties fileSaveAsMatLib 
    fileSaveMatLib filenameFromPath fileopenMathLib fillet_chamfer filterString findItem findProperty findString findUnresolvedXrefs fixed flagChanged flagForeground flashNodes 
    flex flipNormal float_expression float_list float_motion_capture floor flush flushLog fogHelper foliage forceCompleteRedraw format fractalNoise freeSceneBitmaps freeSpot 
    freecamera freeze
    gc genClassID gengon geosphere get getActiveCamera getAfterORT getAppData getAtmospheric getBackGroundController getBefore getBipedExportInterface getBkgFrameNum 
    getBkgImageAnim getBkgImageAspect getBkgORType getBkgRangeVal getBkgStartTime getBkgSyncFrame getBoolCutType getBoolOP getCPDisp getCPTM getCV getCVertModel getCamera 
    getChannel getChannelAsMask getCommandPanelTaksMode getConfigFile getCoordCenter getCrossing getCurrentObject getCurrentSelection getCurve getCurveID getCurveStartPoint 
    getDimensions getDir getDirectories getDisplacementMapping getDisplayResult getDriverString getEdge getEdgeSelection getEdgeVis getEffect getEulerMatAngleRatio 
    getEulerQuatAngleRation getF/C5 getFace getFaceMatID getFaceNormal gravity grid
    hedra helix
    inline inlineHelper
    l_ext label lathe lattice line linear_float linear_position linear_rotation linear_scale link_control linked_xform listbox lod lodHelper lookat
    macroScript mapbutton materialByElement materialModifier materialbutton maxVersion melt meshSmooth mesh_select mirror modPanel.addModToSelection moise_point3 motor
    navInfo ngon noiseModifier noise_float noise_positi/C4 normalModifier normalize_spray notetrack
    oiltank omniLight optimize
    parray patch patchDeform pathDeform path_Follow pbomb pcloud pickbutton pivoted plane point point3_expression point3_list point3_motion_capture position_expression 
    position_list position_motion_capture preserve prism progressBar projected protractor proxSensor prs push pyramid
    quadpatch
    radiobuttons railing rcmenu rectangle relax ringwave ripple rotation_list rotation_motion_capture
    scale_expression scale_list scale_motion_capture sdeflector section skew skin sliceModifier slider slidingDoor slidingWindow smooth snow sound spaceBend spaceDisplace 
    spaceFFDBox spaceFFDCyl spaceNoise spaceRipple spaceSkew spaceStretch spaceTaper spaceTwist spaceWave spearator sphere sphereGizmo spherify spindle spinner splineSelect 
    spray spring squeeze star stl_check stretch submenu substitute superspray surface surface_mapper surfdeform
    tape taper targetCamera targetDirectionalLight targetSoit targetobject teapot tesselate text timeSensor timer torus torus_knot touchSensor trim_extend tripatch tube twist
    uDeflector unwrap_UVW utility uvmap uvw_xform
    vertexPaint volumeselect vrml_vrbl
    wave wind
    xform xrefs.addNewXRefObject
    /C6 OPERATORS
    !=
    #
    $
    &
    '
    (
    )
    * *=
    + +=
    ,
    - -- -=
    . .. ...
    // / /=
    :
    ;
    < <= <eol>
    = ==
    > >=
    ? 
    [
    \
    ]
    ^
    {
    }
    /C7 HANDLERS
    buildMesh
    changed close create
    entered
    moved
    open
    picked preApply pressed
    resized
    selected simpleObject
    /C8 PROPERTIES
    controller
    .value .range .text .checked .enabled .time .selected .inTangent .outTangent .inTangentType .outTangentType .x_locked .y_locked .z_locked .constantVelocity .steps
    .optimize .thickness .mapCoords .adaptive .renderable .radius .segs .smooth .mapCoords
    /C9 PARAMETERS
    alias: animatable:
    checked: classID: controller:
    default:
    enabled: errPrompt: extends:
    fieldwidth: filter: framerange:
    handleAt: height: highlightColor:
    id: invisible:
    keyword:
    label:
    map: material:
    name:
    orient: outputwidth:
    pos: prompt:
    range: replaceUI: rolledUp:
    scale: silentErrors: snap: subAnim:
    tabSize: tabSizeVariable: terminators: ticks: tooltip: type:
    ui:
    version: vfb:
    width:
    Update: Managed to solve it. I removed the ' character from the comment row.

    6,685587
    Grand MasterGrand Master
    6,685587

      Dec 01, 2017#2

      The posted wordfile for MAXScript has some serious mistakes as I could quickly see and detected also by the ultimate syntax highlighting tools.

      1. Color group names

      The name of a color group after /C1, /C2, /C3, ... must be specified enclosed in double quotes. For example wrong is /C1 KEYWORDS, correct is /C1"KEYWORDS" or in my opinion even better /C1"Keywords".

      2. Block comments

      I know nothing about MAXScript language syntax. But if /* marks begin of a block comment and */ marks end of a block comment, then the appropriate block comment definition Block Comment On = /* Block Comment Off = */ should be added to first line in wordfile after Line Comment = --.

      3. String highlighting

      Does MAXScript support strings at all?

      If the answer is no, then String Chars = "' in the wordfile in first line should be replaced by Noquote.

      If the answer is yes, then the next question is: Which characters define begin and end of a string?

      If only a straight double quote defines a string, ' should be removed from String Chars = "'.

      If only a straight single quote defines a string, " should be removed from String Chars = "'.

      If a straight single or double quote define a string, String Chars = "' should be kept as is.

      Next question: Defines MAXScript an escape character to specify the string begin/end character within a string like \ in many script languages?

      Yes, then Escape Char = \ should be inserted in first line left to String Chars =.

      Does MAXScript support strings which span over multiple lines?

      Most script languages do not support multi-line strings. If MAXScript is no exception, the keyword DisableMLS should be added to first line after String Chars = definition. Otherwise the keyword EnableMLS could be added to explicitly enable multi-line string highlighting which is the default if first line contains whether DisableMLS nor EnableMLS.

      And last if strings can be defined with " or ' it might be good to highlight strings defined with " different to strings defined with ' by adding one of those two quotes to a color group like a "word", for example:

      Code: Select all

      /C4"Single quoted strings"
      '
      
      4. Function string(s)

      The UltraEdit regular expression %[a-zA-Z]*) searches for lines starting with a letter A-Z case-insensitive and having after 0 or more characters a closing parenthesis and list the entire line in the function list. As I don't know anything about MAXScript syntax, I really don't know if that is a good regular expression search string for the function list.

      However, the regular expression search(es) for function list are executed by UltraEdit always case-insensitive which means [a-zA-Z] is the same as [A-Z] and as [a-z]. So it is enough to use just %[a-z]*) as UltraEdit regular expression search string.

      5. Brace strings

      I think the brace matching features of UltraEdit could be useful for MAXScript too. So I would add to the wordfile:

      Code: Select all

      /Open Brace Strings =  "{" "(" "[" "<"
      /Close Brace Strings = "}" ")" "]" ">"
      6. No color group 4 and 5, but color group 9

      This wordfile contains no color group 4 and 5, but contains color group 9. That is very unusual because UltraEdit for Windows prior v17.00 and UEStudio prior v11.00 support only up to 8 color groups. So it would be a good idea for downwards compatibility with older versions of UE/UES to move the parameters in color group 9 upwards and change /C9 to /C4 or /C5.

      Further the wordfile contains a line with noise_positi/C4 normalModifier. I doubt that /C4 is really correct here. Something is wrong in this line. I have simply removed /C4 in the attached improved wordfile. I'm quite sure that remaining noise_positi is not right, but I don't know what would be right. And there is a line with getF/C5 getFace. I removed getF/C5 completely.

      7. Sorting the words, removing duplicate and invalid words

      I executed the macros SortLanguage, TestForDuplicate and TestForInvalid from syntax tools macro file on this wordfile.

      TestForDuplicate reported:

      Code: Select all

      Sorry! Found following duplicate words:
      
      coordsys -> in /C1
      coordsys -> in /C3
      
      off -> in /C1
      off -> in /C2
      
      on -> in /C1
      on -> in /C2
      
      rcmenu -> in /C1
      rcmenu -> in /C3
      
      utility -> in /C1
      utility -> in /C3
      
      displayGamma -> in /C2
      displayGamma -> in /C3
      
      displaySafeFrames -> in /C2
      displaySafeFrames -> in /C3
      
      fileInGamma -> in /C2
      fileInGamma -> in /C3
      
      fileOutGamma -> in /C2
      fileOutGamma -> in /C3
      
      close -> in /C3
      close -> in /C7
      The duplicate words in the higher color group have been removed by me in attached improved wordfile as those words are never highlighted with the color of higher color group.

      TestForInvalid reported:

      Code: Select all

      Sorry! Found following invalid words:
      
      != <- contains the delimiter:  =
      *= <- contains the delimiter:  =
      += <- contains the delimiter:  =
      -- <- contains the delimiter:  -
      -= <- contains the delimiter:  =
      /= <- contains the delimiter:  =
      <= <- contains the delimiter:  =
      == <- contains the delimiter:  =
      >= <- contains the delimiter:  =
      The invalid "words" – operators consisting of two word delimiters – have been removed by me in attached improved wordfile. This modification has no effect on highlighting those operators. They are nevertheless highlighted with color of color group 6.

      I have coded already also a SortDelimiters macro not yet published to sort the word delimiters although this is not really necessary. I mention that here if you wonder why the /Delimiters = line is also different in attached improved wordfile.
      maxscript_improved_v1.zip (5.63 KiB)   91
      This ZIP file contains the first improved version of maxscript.uew wordfile as described above.
      Best regards from an UC/UE/UES for Windows user from Austria