UDL: Number groups with negatives
-
Hello,
I am currently creating a UDL. The language represents sets of numbers using a
/
separator, such as0.674/1.4695/2.4317
.Highlighting works for groups such as
0.674/1.4695/2.4317
or-0.674/1.4695/2.4317
. However, highlighting stops when-
is in the middle, like0.674/-1.4695/2.4317
. Does anyone know why this is the case? Thank you!<NotepadPlus> <UserLang name="Battlefield 2 (Dark)" ext="con tweak inc" udlVersion="2.1"> <Settings> <Global caseIgnored="yes" allowFoldOfComments="yes" foldCompact="no" forcePureLC="2" decimalSeparator="0" /> <Prefix Keywords1="yes" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="yes" Keywords7="no" Keywords8="no" /> </Settings> <KeywordLists> <Keywords name="Comments">00rem 01 02 03beginrem 04endrem</Keywords> <Keywords name="Numbers, prefix1"></Keywords> <Keywords name="Numbers, prefix2">0 1 2 3 4 5 6 7 8 9 CRD_NONE CRD_UNIFORM CRD_NORMAL CRD_EXPONENTIAL</Keywords> <Keywords name="Numbers, extras1">/ - .</Keywords> <Keywords name="Numbers, extras2"></Keywords> <Keywords name="Numbers, suffix1"></Keywords> <Keywords name="Numbers, suffix2"></Keywords> <Keywords name="Numbers, range"></Keywords> <Keywords name="Operators1">-> <= >= < > == !=</Keywords> <Keywords name="Operators2">AND EQUAL OR NOT</Keywords> <Keywords name="Folders in code1, open"></Keywords> <Keywords name="Folders in code1, middle"></Keywords> <Keywords name="Folders in code1, close"></Keywords> <Keywords name="Folders in code2, open">if</Keywords> <Keywords name="Folders in code2, middle">elseIf else</Keywords> <Keywords name="Folders in code2, close">endIf</Keywords> <Keywords name="Folders in comment, open">---BeginComp:DefaultPenetrateComp ---BeginComp:DefaultRicochetComp ---BeginComp:DefaultProjSoundComp ---BeginComp:DefaultDetonationComp ---BeginComp:DefaultCollisionComp ---BeginComp:DefaultZoomComp ---BeginComp:DefaultAnimationComp ---BeginComp:DefaultSoundComp ---BeginComp:SimpleDeviationComp BeginComp:WeaponBasedRecoilComp ---BeginComp:DefaultAmmoComp ---BeginComp:SingleFireComp ---BeginComp:WeaponHud ---BeginComp:VehicleHud ---BeginComp:Armor ---BeginComp:Radio ---BeginComp:WarningHud ---BeginComp:ToggleCameraComp ---BeginComp:WeaponBasedRecoilComp ---BeginComp:MultiFireArmTargetComp ---BeginComp:LPTargetComp ---BeginComp:WindAffector ---BeginComp:MultiFireComp ---BeginComp:SoldierBasedRecoilComp ---BeginComp:SoldierDeviationComp ---BeginComp:Ik</Keywords> <Keywords name="Folders in comment, middle"></Keywords> <Keywords name="Folders in comment, close">---EndComp</Keywords> <Keywords name="Keywords1">admin. ai. aiPathfinding. aiSettings. aiStrategy. aiStrategicArea. AIStrategicArea. aiTemplate. aiTemplatePlugIn. animationBundle. animationManager. animationSystem. animationTrigger. animationValueHolder. AudioSettings. bf2Engine. BitStream. buffermanager. chat. CollisionCheck. collisionLog. CollisionManager. CombatArea. CombatAreaManager. commander. commanderInterface. commanderMenu. config. console. ControlMap. debug. debugCounterManager. decalManager. demo. Editor. envmapManager. fileChangeManager. fileManager. game. gameLogic. GameLogic. gameServerSettings. GeneralSettings. GeometryTemplate. GlobalSettings. heightmap. heightmapcluster. hemiMapManager. hudBuilder. hudItems. hudManager. ingameHelp. InputDevices. itemSelection. LevelSettings. levelsList. lightManager. Lightmanager. lightmapGeneration. LightmapSettings. LightSettings. localplayer. localProfile. mapList. MapList. Material. materialManager. memory. minimap. nametags. network. networkableInfo. Object. object. objectDrawer. objectManager. ObjectSpawnerDef. objectTemplate. ObjectTemplate. Overgrowth. OvergrowthType. Particles. particleSystemManager. physics. player. portal. profile. profiler. pythonHost. radio. radioInterface. radioVehicleInterface. ragDoll. rainManager. raStats. Renderer. renderer. reservedSlots. resourceManager. scoreboard. scoreManager. SettingsManager. shadermanager. shadowManager. skinnedMeshRenderer. skyDome. Skydome. Sound. sound. spawnManager. squad. squadInterface. squadLeader. squadLeaderInterface. squadManager. squadMenu. staticMeshRenderer. sv. swiffHost. terrain. terrainCuller. texturemanager. triggerManager. Undergrowth. undergrowthEditable. UndergrowthEditable. undergrowthEditableMaterial. undergrowthEditableType. Vars. vars. VideoSettings. voip. weatherManager. windManager.</Keywords> <Keywords name="Keywords2">var AirPlayerInputControlMap AnimatedBundle Armament Armor BottomLeftAnimate BottomLeftStatic BottomRightAnimate BottomRightStatic BundledMesh Camera ControlInfo ControlPoint SeekClosestTargetComp RotationalBundleDefaultAmmoComp DefaultAnimationComp DefaultAnimationComp DefaultZoomCompSound DefaultCollisionComp DefaultDetonationComp DefaultFollowComp defaultGameControlMap DefaultPenetrateComp defaultPlayerInputControlMap DefaultProjSoundComp DefaultRicochetComp DefaultSoundComp DefaultZoomComp EffectBundle EnvMap ExplosivesFireComp ForwardTrigger GenericFireArm GenericProjectile Global GrapplingHookRope GrapplingHookRopeContainer HandFireArmsInfo HelicopterPlayerInputControlMap Heightmap HeighmapCluster HookLink IdleTrigger InfantryPlayerInputControlMap IngameHud LadderContainer LandPlayerInputControlMap MessageTrigger Mobile MovementTrigger ObjectSpawner Physical PlayerControlObject PoseTrigger RandomTrigger ReplenishingAmmoComp RopeLink SeaPlayerInputControlMap SimpleObject SingleFireComp SoldierBasedRecoilComp SoldierDeviationComp Sound Spawnpoint StaticMesh StickyCollisionComp StrategicObject SupplyObject SwitchMessageTrigger SpawnPoint Terrain TerrainEditable ThrownAnimationComp ThrownFireComp TopLayer Trigger Triggerable TriggerableTarget TurnTrigger Unit VehicleHud WeaponHud ZiplineContainer ZiplineRope RotationalBundle Bundle Engine Spring GuiIndex Ik SimpleDeviationComp ToggleCameraComp WeaponBasedRecoilComp DefaultAmmoComp MultiFireComp MultiFireArmTargetComp LPTargetComp WindAffector Wing LandingGear</Keywords> <Keywords name="Keywords3">include run</Keywords> <Keywords name="Keywords4">PIYaw PIThrottle Mesh SpringInfo BasicInfo PIMouseLookY PIMouseLookX vehicle Medium RotationalPoint Point MTYVehicle RadialDir PIAltFire TSHeatSeeking PIFlareFire ControlPointInfo TTHeat</Keywords> <Keywords name="Keywords5"></Keywords> <Keywords name="Keywords6">v_ c_</Keywords> <Keywords name="Keywords7"></Keywords> <Keywords name="Keywords8"></Keywords> <Keywords name="Delimiters">00" 01 02" 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords> </KeywordLists> <Styles> <WordsStyle name="DEFAULT" fgColor="C8C8C8" bgColor="1A1A1A" colorStyle="1" fontStyle="0" fontSize="" nesting="0" /> <WordsStyle name="COMMENTS" fgColor="608B4E" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="LINE COMMENTS" fgColor="608B4E" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="NUMBERS" fgColor="B5CEA8" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS1" fgColor="4E9CD6" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS2" fgColor="80FF80" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS3" fgColor="FF0000" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS4" fgColor="FF8000" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS5" fgColor="FF8000" bgColor="1E1E1E" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS6" fgColor="FF8000" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="1E1E1E" fontStyle="0" nesting="0" /> <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="1E1E1E" fontStyle="0" nesting="0" /> <WordsStyle name="OPERATORS" fgColor="FF8080" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN CODE1" fgColor="4E9CD6" bgColor="1E1E1E" colorStyle="1" fontStyle="1" nesting="0" /> <WordsStyle name="FOLDER IN CODE2" fgColor="FF80C0" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="FOLDER IN COMMENT" fgColor="608B4E" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS1" fgColor="D69D85" bgColor="1E1E1E" colorStyle="1" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="1E1E1E" fontStyle="0" nesting="50593791" /> <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="1E1E1E" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="1E1E1E" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="1E1E1E" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="1E1E1E" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="1E1E1E" fontStyle="0" nesting="0" /> <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="1E1E1E" fontStyle="0" nesting="0" /> </Styles> </UserLang> </NotepadPlus>
-
@papadanku said in UDL: Number groups with negatives:
The language represents sets of numbers using a / separator
That doesn’t necessarily mean that
/
needs to be considered part of the number.
In that situation, I would define/
as an operator, not part of Number: Extras 1. And, in fact, I would then remove the/ - .
completely from Extras 1, because.
and-
are already considered part of a number. And remove the digits from Prefix 2.That renders your three examples reasonably, IMO:
If you absolutely have to have the
/
between the numbers in the same color as the numbers and a different color than your other operators, I would then bring in the plugin EnhanceAnyLexer, where you could define a regex to color the / in that special circumstance for your UDL – something like0xA8CEB5 = (?<=\d)/(?=[\d-])
should work: -
@PeterJones Looks like that solved the issue, thank you!