|
Answer» I'm getting a funny error that I thought was due to my abnormally long string, but when I started debugging I'm getting an error when using the 'TYPE' command. Has anyone ever had issues with this before?
Code: (buildExternal.bat) [Select]::echo off setlocal EnableDelayedExpansion echo %path% | repl ";" "\r\n" xi >path.txt if exist external.txt del external.txt for /f "delims=" %%A in (path.txt) do ( cd /d "%%A" 2>nul for %%X in (exe) do ( dir /b *.%%X >>%~pd0\external.txt 2>nul ) ) cd /d %~pd0 del path.txt set list= for /f "delims=" %%A in (external.txt) do set "list=%%~nA(%%~xA)?_!list!"
set list
echo"!list:_=|!"
set list=%list:(=-% set list=%list:)=+%
set list
type template.tmLanguage :: | repl "_" "%list:_=|%" | repl "-" "\x28" x | repl "+" "\x29" x ">Batch File.tmLanguage"
Code: (Output) [Select]... <key>name</key> <string>Batch File</string> <key>scopeName</key> <string>source.dosbatch</string> <key>fileTypes</key> <array> <string>bat</string> </array> </dict> </plist>The input line is too long. was unexpected at this time.
T:\> T:\>
Code: (template.tmLanguage) [Select]<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-
1.0.dtd"> <plist version="1.0"> <dict> <key>uuid</key> <string>E07EC438-7B75-4437-8AA1-DA94C1E6EACC</string> <key>patterns</key> <array> <dict> <key>name</key> <string>keyword.command.dosbatch</string> <key>match</key> <string>^[]|_</string> </dict> <dict> <key>name</key> <string>keyword.control.statement.dosbatch</string> <key>match</key> <string>([%][%]([A-Z]|[a-z])|\%([^\%]*?)\%|%[~][fdpnxsatz]********[0-9]|%[0-9]|\!([^\!]
*?)\!)</string> </dict> <dict> <key>name</key> <string>keyword.control.conditional.if.dosbatch</string> <key>match</key> <string>(if((not)?defined|exist)?)</string> </dict> <dict> <key>name</key> <string>keyword.control.conditional.dosbatch</string> <key>match</key> <string>(GTR|GEQ|EQU|LEQ|LSS|NEQ|\=\=)$</string> </dict> <dict> <key>name</key> <string>keyword.control.repeat.dosbatch</string> <key>match</key> <string></string> </dict> <dict> <key>name</key> <string>keyword.operator.dosbatch</string> <key>match</key> <string>[+|-|*|/]\=$|[=]$</string> </dict> <dict> <key>captures</key> <dict> <key>1</key> <dict> <key>name</key> <string>keyword.command.rem.dosbatch</string> </dict> </dict> <key>name</key> <string>comment.line.rem.dosbatch</string> <key>match</key> <string></string> </dict> <dict> <key>name</key> <string>comment.line.colons.dosbatch</string> <key>match</key> <string>^\s*:\s*:.*$|^REM*$|^(?:^|\s)^((?i)rem)^(?:$|\s.*$)</string> </dict> <dict> <key>begin</key> <string>"""\n\n\n"""\s."</string> <key>endCaptures</key> <dict> <key>0</key> <dict> <key>name</key> <string>punctuation.definition.string.end.shell</string> </dict> </dict> <key>beginCaptures</key> <dict> <key>0</key> <dict> <key>name</key> <string>punctuation.definition.string.begin.shell</string> </dict> </dict> <key>name</key> <string>string.quoted.double.dosbatch</string> <key>match</key> <string>\"([^\"]*?)\"</string> </dict> <dict> <key>name</key> <string>keyword.operator.pipe.dosbatch</string> <key>match</key> <string>[|]|[\^|]</string> </dict> <dict> <key>name</key> <string>keyword.operator.redirect.shell</string> <key>match</key> <string></string> </dict> </array> <key>name</key> <string>Batch File</string> <key>scopeName</key> <string>source.dosbatch</string> <key>fileTypes</key> <array> <string>bat</string> </array> </dict> </plist> Does that single line generate an error with type?
Code: [Select]type template.tmLanguage Sorry of the delayed responce. That threw no error, but when you add the repl it does. I've done some narrowing down to repl "+" "\x29" x in type "Batch File.tmLanguage" | repl "___" "|" | repl "-" "\x28" x | repl "+" "\x29" x. I'm not sure why its doing it, but now it throws:
Code: (error) [Select]C:\cmdPlugins\repl.bat(282, 1) Microsoft JScript runtime error: Unexpected quant ifier
C:\cmdPlugins\repl.bat(305, 37) (null): The pipe is being closed.
C:\cmdPlugins\repl.bat(305, 37) (null): The pipe is being closed.
The process tried to write to a nonexistent pipe. Which I believe is due to the use of ), but I can't figure out how to get around it.
Code: (full) [Select]echo off setlocal EnableDelayedExpansion echo %path% | repl ";" "\r\n" xi >path.txt if exist external.txt del external.txt for /f "delims=" %%A in (path.txt) do ( cd /d "%%A" 2>nul for %%X in (exe) do ( dir /b *.%%X >>%~pd0\external.txt 2>nul ) ) cd /d %~pd0 del path.txt type beginTemplate.txt >"Batch File.tmLanguage"
for /f "delims=" %%A in (external.txt) do echo.___%%~nA-%%~xA+?>>"Batch File.tmLanguage" type template.tmLanguage >>"Batch File.tmLanguage"
type "Batch File.tmLanguage" | repl "___" "|" | repl "-" "\x28" x | repl "+" "\x29" x Input line too long is an error with programs or utilities that limit the line to about 250 chars. ONE c fix to reduce an expression into segments that can be parsed separately. http://www.digizol.com/2006/12/input-line-is-too-long-windows-command.html In the above limik example the length limit was much, much HIGHER and still the OP went beyond. He WOULD have to just cut the path shorter.Here is the line with the problem:
Code: [Select]type "Batch File.tmLanguage" | repl "___" "|" | repl "-" "\x28" x | repl "+" "\x29" x >"Batch File.tmLanguage"
The problem is + is a regex meta-character (quantifier). It must either be escaped:
Code: [Select]type "Batch File.tmLanguage" | repl "___" "|" | repl "-" "\x28" x | repl "\+" "\x29" x >"Batch File.tmLanguage"
Or use the L (literal) option:
Code: [Select]type "Batch File.tmLanguage" | repl "___" "|" | repl "-" "\x28" x | repl "+" "\x29" xl >"Batch File.tmLanguage"
Note that parentheses in your Replace arguments are not a problem as long as they are quoted. You could simply use "(" and ")" instead of "\x28" and "\x29".
I have ceased development of REPL.BAT in favor of JREPL.BAT.
You can easily do all three replacements with a single JREPL call:
Code: [Select]call jrepl "___ - +" "| ( )" /l /t " " /f "template.tmLanguage" /o "Batch File.tmLanguage"
Dave BenhamThank you! I'll take a look at jrepl later. Have a great day.
|