Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: [type] Input line too long  (Read 6436 times)

0 Members and 1 Guest are viewing this topic.

Lemonilla

    Topic Starter


    Apprentice

  • "Too sweet"
  • Thanked: 70
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
[type] Input line too long
« on: November 20, 2014, 05:22:01 PM »
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>
Quote from: patio
God Bless the DOS Helpers...
Quote
If it compiles, send the files.

foxidrive



    Specialist
  • Thanked: 268
  • Experience: Experienced
  • OS: Windows 8
Re: [type] Input line too long
« Reply #1 on: November 21, 2014, 05:35:53 PM »
Does that single line generate an error with type?

Code: [Select]
type template.tmLanguage

Lemonilla

    Topic Starter


    Apprentice

  • "Too sweet"
  • Thanked: 70
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Re: [type] Input line too long
« Reply #2 on: November 23, 2014, 12:57:25 PM »
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
Quote from: patio
God Bless the DOS Helpers...
Quote
If it compiles, send the files.

Geek-9pm


    Mastermind
  • Geek After Dark
  • Thanked: 1026
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: [type] Input line too long
« Reply #3 on: November 23, 2014, 03:11:29 PM »
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.
« Last Edit: November 23, 2014, 03:38:21 PM by Geek-9pm »

dbenham



    Greenhorn

    Thanked: 3
    • Experience: Expert
    • OS: Windows 7
    Re: [type] Input line too long
    « Reply #4 on: November 23, 2014, 06:02:47 PM »
    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 Benham
    Dave Benham

    Lemonilla

      Topic Starter


      Apprentice

    • "Too sweet"
    • Thanked: 70
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: [type] Input line too long
    « Reply #5 on: November 23, 2014, 10:47:57 PM »
    Thank you!  I'll take a look at jrepl later.  Have a great day.
    Quote from: patio
    God Bless the DOS Helpers...
    Quote
    If it compiles, send the files.