UDL - parser for journal file "' 0:<" delimeters



  • Hi all,

    Is there a way to incorporate Regex in the UDL or some method to get the UDL to recognize “’ 0:<” as a delimer? We have these ‘journal’ files in Revit that are hard to read and I thought I might be able to borrow the ULD to read the language being generated. Reading about Lexi’s and my PY skills are weak. Any suggestions to coding examples or resources or direct answers are welcome : )

    File below XML export based on what I was starting:
    XML:

    <NotepadPlus>
        <UserLang name="RevitJournal" ext="txt" udlVersion="2.1">
            <Settings>
                <Global caseIgnored="yes" allowFoldOfComments="yes" foldCompact="no" forcePureLC="2" decimalSeparator="2" />
                <Prefix Keywords1="no" Keywords2="no" Keywords3="yes" Keywords4="no" Keywords5="yes" Keywords6="no" Keywords7="no" Keywords8="yes" />
            </Settings>
            <KeywordLists>
                <Keywords name="Comments">00 01 02 03 04</Keywords>
                <Keywords name="Numbers, prefix1">:</Keywords>
                <Keywords name="Numbers, prefix2"></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">: |</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"></Keywords>
                <Keywords name="Folders in code2, middle"></Keywords>
                <Keywords name="Folders in code2, close"></Keywords>
                <Keywords name="Folders in comment, open"></Keywords>
                <Keywords name="Folders in comment, middle"></Keywords>
                <Keywords name="Folders in comment, close"></Keywords>
                <Keywords name="Keywords1">JRN</Keywords>
                <Keywords name="Keywords2">Directive Dim set  </Keywords>
                <Keywords name="Keywords3">CrsJournalScript Build Branch Release Options loadOptions TYPE USAGE Behavior &quot;Family Dialog Bar&quot; Expiration &quot;GUI Resource Usage&quot; WM_ &quot;this journal&quot;</Keywords>
                <Keywords name="Keywords4">subvak DBG_WARN WARN</Keywords>
                <Keywords name="Keywords5">&quot;Autodesk Revit &quot;</Keywords>
                <Keywords name="Keywords6"></Keywords>
                <Keywords name="Keywords7"></Keywords>
                <Keywords name="Keywords8">Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec 2020 2021  </Keywords>
                <Keywords name="Delimiters">00&quot; 01 02&quot; 03&apos;C 04 05((EOL)) 06&apos;H 07 08((EOL)) 09&apos;E 100:&lt; 11((EOL)) 12&apos; 13 14((EOL)) 15 16 17 18 19 20 21 22 23</Keywords>
            </KeywordLists>
            <Styles>
                <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="LINE COMMENTS" fgColor="00FF00" bgColor="000000" fontStyle="0" nesting="0" />
                <WordsStyle name="NUMBERS" fgColor="FFFF80" bgColor="000000" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS1" fgColor="FFFFFF" bgColor="000000" fontStyle="1" nesting="0" />
                <WordsStyle name="KEYWORDS2" fgColor="C0C0C0" bgColor="000000" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS3" fgColor="00FFFF" bgColor="000000" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS4" fgColor="FFFF80" bgColor="FF0000" fontStyle="1" nesting="0" />
                <WordsStyle name="KEYWORDS5" fgColor="00FFFF" bgColor="000000" fontStyle="3" nesting="0" />
                <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS8" fgColor="FFFF80" bgColor="000000" fontStyle="5" nesting="0" />
                <WordsStyle name="OPERATORS" fgColor="FFFFFF" bgColor="000000" fontStyle="1" nesting="0" />
                <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS1" fgColor="FFFFFF" bgColor="000000" fontStyle="2" nesting="0" />
                <WordsStyle name="DELIMITERS2" fgColor="00FF00" bgColor="000000" fontStyle="0" nesting="17038336" />
                <WordsStyle name="DELIMITERS3" fgColor="46A3FF" bgColor="000000" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS4" fgColor="C0C0C0" bgColor="000000" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS5" fgColor="FF8080" bgColor="000000" fontStyle="0" nesting="261120" />
                <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontStyle="0" nesting="0" />
            </Styles>
        </UserLang>
    </NotepadPlus>
    
    

    FILE sample:

    ' 0:< Initial VM: Avail 134213261 MB, Used 16 MB, Peak 16; RAM: Avail 51992 MB, Used 57 MB, Peak 16 
    ' 0:< GUI Resource Usage GDI: Avail 9999, Used 1, User: Used 1 
    'C 15-Jun-2021 17:37:08.042;  started recording journal file 
    ' Build: 20210420_1515(x64)
    ' Branch: RELEASE_2020
    ' Release: 2020.2.4
    Dim Jrn subvak
    Set Jrn = CrsJournalScript
    'C 15-Jun-2021 17:37:08.055;  ->desktop InitApplication 
    'C 15-Jun-2021 17:37:08.068;  <-desktop InitApplication 
    'C 15-Jun-2021 17:37:08.068;  ->desktop InitNativeInstance 
    ' 0:< Options::loadOptions: m_strDataLibraryLocations=KTGY Library=\\corp.ktgy.com\global\Resources\Technology\Revit\Ktgy-2020, KTGY Detail Library=\\corp.ktgy.com\global\Resources\Technology\Revit\Ktgy-2020\Detail-Item, C_Lib=..\..\..\ProgramData\Autodesk\RVT 2020 (defaultLib==\Library) 
    ' 0:< Options::loadOptions: Systems Analysis Workflows=K_Annual Building Energy Simulation 2=\\corp.ktgy.com\global\Resources\Technology\Revit\000-Nrel\Openstudio cli for revit 2020\Workflows\Annual Building Energy Simulation.osw, K_HVAC Systems Loads and Sizing 2=\\corp.ktgy.com\global\Resources\Technology\Revit\000-Nrel\Openstudio cli for revit 2020\Workflows\HVAC Systems Loads and Sizing.osw, Annual Building Energy Simulation=..\..\NREL\OpenStudio CLI For Revit 2020\workflows\Annual Building Energy Simulation.osw, HVAC Systems Loads and Sizing=..\..\NREL\OpenStudio CLI For Revit 2020\workflows\HVAC Systems Loads and Sizing.osw 
    ' 0:< ::0:: Delta VM: Avail -36 -> 134213225 MB, Used +3 -> 20 MB, Peak +4 -> 20 MB; RAM: Avail -13 -> 51979 MB, Used +12 -> 69 MB, Peak +12 -> 69 MB 
    ' 0:< GUI Resource Usage GDI: Avail 9991, Used 9, User: Used 22 
    'C 15-Jun-2021 17:37:08.227;   0:< License initialization complete 
    ' 0:< License version: 2.6.3.37 
    ' 0:< ::0:: Delta VM: Avail -184 -> 134213042 MB, Used +32 -> 52 MB, Peak +34 -> 55 MB; RAM: Avail -56 -> 51923 MB, Used +51 -> 120 MB, Peak +51 -> 120 MB 
    ' 0:< GUI Resource Usage GDI: Avail 9991, Used 9, User: Used 48 
    ' 0:< SystemSettings: 
    ' 0:<                   12=multiCoreCharacteristic 
    ' 0:<                 true=isDotNetInstalled 
    ' 0:<    4.8.03752(528040)=dotNetInstalledVersionString 
    ' 0:<                false=isProcessUserModeExceptionPolicyDisabledForCallbackFilter 
    ' 0:< ::0:: Delta VM: Avail -6 -> 134213037 MB, Used +6 -> 58 MB, Peak +3 -> 58 MB; RAM: Avail -41 -> 51882 MB, Used +12 -> 132 MB, Peak +12 -> 132 MB 
    ' 0:< GUI Resource Usage GDI: Avail 9984, Used 16, User: Used 52 
    'C 15-Jun-2021 17:37:09.445;  RevitLynx registered 4159 templates (0 duplicate typeids) 
    ' 0:< ::0:: Delta VM: Avail -687 -> 134212351 MB, Used +24 -> 83 MB, Peak +24 -> 83 MB; RAM: Avail -36 -> 51847 MB, Used +35 -> 168 MB, Peak +35 -> 168 MB 
    ' 0:< GUI Resource Usage GDI: Avail 9982, Used 18, User: Used 67 
    ' 0:< CefSharp has been initialized successfully! 
    ' 0:< ::0:: Delta VM: Avail -16 -> 134212335 MB, Used +2 -> 85 MB, Peak +2 -> 85 MB; RAM: Avail -7 -> 51840 MB, Used +5 -> 173 MB, Peak +5 -> 173 MB 
    ' 0:< GUI Resource Usage GDI: Avail 9982, Used 18, User: Used 78 
    'C 15-Jun-2021 17:37:09.882;  DBG_WARN: Pathname of WorksetConfig should not be empty. Something is wrong with Revit.ini!: line 244 of d:\ship\2020_px64\source\revit\desktopmfc\mfc\arecentfilelist.cpp. 
    'C 15-Jun-2021 17:37:09.989;   0:< manage licensing 
    'C 15-Jun-2021 17:37:12.469;   0:< LicenseUpd(1)  
    ' 0:< ::0:: Delta VM: Avail -3 -> 134212332 MB, Used +1 -> 87 MB, Peak +1 -> 87 MB; RAM: Avail +13 -> 51854 MB, Used +6 -> 179 MB, Peak +6 -> 179 MB 
    ' 0:< GUI Resource Usage GDI: Avail 9981, Used 19, User: Used 80 
    'C 15-Jun-2021 17:37:12.469;   0:< Delayed start 
    ' 0:< License mode: User 
    ' 0:< Status: Your license will expire in 960 days. 
    ' 0:< Type: USER 
    ' 0:< Usage: USER 
    ' 0:< Behavior: USER 
    ' 0:< Expiration: Wednesday, January 31, 2024 
    ' 0:< ::0:: Delta VM: Avail -202 -> 134212131 MB, Used +43 -> 130 MB, Peak +43 -> 130 MB; RAM: Avail -21 -> 51833 MB, Used +39 -> 218 MB, Peak +39 -> 219 MB 
    ' 0:< GUI Resource Usage GDI: Avail 9947, Used 53, User: Used 88 
    ' 0:< Setting WPF rendering mode to HardwareAccelerated 
    ' 0:< Family Dialog Bar : WM_WINDOWPOSCHANGING: cx-0, cy-0, x-10000, y-10000 
    ' 0:< Family Dialog Bar : WM_WINDOWPOSCHANGING: cx-20, cy-64, x-0, y-0 
    ' 0:< Family Dialog Bar : WM_WINDOWPOSCHANGING: cx-0, cy-0, x-0, y-0 
    ' 0:< ::0:: Delta VM: Avail -86 -> 134212045 MB, Used +42 -> 173 MB, Peak +42 -> 173 MB; RAM: Avail -46 -> 51787 MB, Used +57 -> 276 MB, Peak +57 -> 276 MB 
    ' 0:< GUI Resource Usage GDI: Avail 9880, Used 120, User: Used 144 
    ' 0:< Autodesk Revit 2020 
    ' 0:< 64-bit load point = C:\Program Files\Autodesk\Revit 2020 
    ' 0:< this journal = C:\Users\ron.allen\AppData\Local\Autodesk\Revit\Autodesk Revit 2020\Journals\journal.0001.txt 
    ' 0:< ::0:: Delta VM: Avail -12 -> 134212034 MB, Used +0 -> 174 MB, Peak +0 -> 174 MB; RAM: Avail -5 -> 51783 MB, Used +5 -> 282 MB, Peak +5 -> 282 MB 
    ' 0:< GUI Resource Usage GDI: Avail 9880, Used 120, User: Used 145 
    'C 15-Jun-2021 17:37:15.049;  Journal Init 
    'C 15-Jun-2021 17:37:15.049;   0:< Log Summary 
    ' 0:< .Count 
    ' 0:< ...DBG_SOMETHING = 1 
    ' 0:< ...DBG_WARNING = 1 
    ' 0:< ...PendingMessages = 4 
    ' 0:< .JSON 
    ' 0:< ...DeepCopyOps = 31 
    ' 0:< ...References = 35 
    ' 0:< .Marshalling 
    ' 0:< ...CompactCaching = 1 (Enabled) 
    ' 0:< .ThreadPool 
    ' 0:< ...ActivePoolSize = 51 
    ' 0:< ...ConfiguredPoolSize = automatic 
    ' 0:< ...ParallelCores = 12 
    ' 0:< ...RequestedPoolSize = automatic 
    ' 0:< .Tuning 
    ' 0:< ...ElemTable = 1 (Serial except when multithreaded) 
    'C 15-Jun-2021 17:37:15.049;  BC: 1,0,0 
    'H 15-Jun-2021 17:37:15.049;   0:< 
    Jrn.Directive "CategoryDisciplineFilter"  _
            , 9
    <<SNIP>>
    


  • @Ron-Allen said in UDL - parser for journal file "' 0:<" delimeters:

    Is there a way to incorporate Regex in the UDL

    Not as part of the UDL. You can add extra highlighting to any lexer (including User Defined Language (UDL)) using regexes via the PythonScript plugin and the script EnhanceAnyLexer.py that @Ekopalypse shares in his github repo – you don’t actually have to be good at Python, since the script is written for you; you just have to be able to follow the instructions in that file, and define the regex for each “special situation” you want to highlight.

    However, you don’t actually need that script to accomplish what you want.

    or some method to get the UDL to recognize “’ 0:<” as a delimer?

    96cbb223-1b31-4049-bf7b-7cf765e5a6fe-image.png

    0:< works as a delimiter for me standalone. If it’s not working in your UDL, it might be because you have conflicting definitions, or because you aren’t allowing the nesting to work right, so some other definition is taking priority.

    When I import your UDL that you posted, I don’t see 0:< in any of the delimiter slots. But I do see that ' to EOL is defined as your delimiter5, but it doesn’t allow anything nested. Since your example data always has 0:< on the same line (following) the ', the single-quote will take priority and not allow 0:< to be interpreted.

    When I take your UDL and example data, and define delimiter6 as open=0:< / close=((EOL)) with yellow background (to make it obvious), and leave delimiter5 (the ') not nesting delimiter6 as you have it, the 0:< does not get highlighted:
    4c9c7e02-741f-49ff-8954-3670352d8d27-image.png

    But if I change delimiter5 to allow delimiter6 to nest inside, I get lots of yellow background on the 0:< lines, proving that 0:< does work:
    98999c6c-86c1-46c7-a074-04d3dd65dc02-image.png

    So I think you just need to work on your nesting


    unrequested advice: you have the : in both operators1 and operators2: that’s redundant. The difference between those boxes is that operators2 requires separators; operators1 does not require separators, but it does allow separators. Thus, you should just have the : in operators1 for it to be recognized as an operator.



  • @Ron-Allen said in UDL - parser for journal file "' 0:<" delimeters:

    recognize “’ 0:<”

    Sorry, I just realized that I misread. With the quotes around the delimiter rather than using markdown’s ` to wrap it (so that `' 0:<` is rendered as ' 0:<), I didn’t notice the apostrophe nestled against the smart quotes.

    I don’t know of a way to get a space in the delimiter; I don’t think that wrapping it in quotes is going to work, unlike with your multi-word keywords. But you probably could just use my examples above as a “trick”, so just allow 0:< to nest inside of the line starting with '. It won’t be exactly what you want, but it might be close enough (ie, the ' won’t be highlighted with the 0:<, but the rest will be.)


Log in to reply