dev Tool: autoformat scripts

dev Tool: autoformat scripts

Autoindent and remove unnessecary spaces, line breaks and tabs

May produce bugs! (can’t test everything.) Use with care.

http://www.pierrox.net/android/applications/lightning_launcher/wiki/doku.php?id=script_autoformat

http://www.pierrox.net/android/applications/lightning_launcher/wiki/doku.php?id=script_autoformat
]]>
(Next Post) »

4 Commentsto dev Tool: autoformat scripts

  1. Anonymous says:

    < ![CDATA[

    Cool!



    Bugs:


    Comments (which don’t necessarily end in line break) ‘eat’ the next line. The same with lines that don’t end with “;” (JavaScript allow it, even though it’s better to write it)


    If you have “this is a ‘string;’ inside a string” your code will split it in two lines because it thinks the middle is not in the string(you should save the beginning symbol ” or ‘ and check when it comes again. And remember also that “fgh \” ; hsh” is a single string )



    I think you should leave line breaks (when you find a \n just set the newLine to true)



    Oh, a question: what is the purpose of


    (t[a-1].toLowerCase()==t[a-1].toUpperCase()||t[a+1].toLowerCase()==t[a+1].toUpperCase())


    (You are checking if it’s a space next to a letter right? But why? )

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Referring to your last Question: You don’t need a space in javascript, unless it’s between two letters, so I remove every other space. (except spaces in strings.)


    I totally forgot about comments, I’ll have to fix that.



    I know there is some stuff wrong with strings, and I’ll think about line breaks again…


    I initially wanted to recreate the line breaks to fix some other things, like a script with no line breaks, or an if with a single following command (not in {})

    ]]>

  3. Anonymous says:

    < ![CDATA[

    – updated –



    Comments, strings, backslashes and some other stuff I noticed should work now correct.



    TrianguloY You’re right, it’s nearly impossible to detect every needed line break, so line breaks stay now as they are

    ]]>

  4. Anonymous says:

    < ![CDATA[

    There are still bugs. For example the string “\\\”” will break the noCode structure…

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *