dll - How to create a formating and indentaion code in C# -


How to start the form with a program to format C and their derivative code in the NAT-style formatted code so that I Input program This can identify the program and identify other things correctly.

This is a very complex task because programming languages ​​have complex grammar if you do not just format C # But C and C ++ too, this too is more complex - possibly impossible because there can be a syntax in a language which is not valid (or some thing means) in another < / P>

If you want to do it for C #, then you need C # parser to do some free software If you have a parsed tree, you have to walk on the tree and gradually it will be used to produce the output.

  • Some c # parser may have this functionality already in the formatted properly.

    Regarding the ambiguity of grammar: Consider the following line of code:

      Method (a  (d +1)) ; # Will have the correct formatting in C:  
      method (a  (d + 1)); // "A and LT; T1, T2" gt; There is a logic in the law  

    In C and C ++, I believe that the correct formatting will be:

      method (a & lt; B, c & gt; (d + 1)); // method has two arguments with binary operators  

    Comments