Syntactic Reader (Visual Studio 2013 Extension)

4

When doing the language syntax reading in a Visual Studio extension project I can already read the following:

<span class="myclass"></span>

It is relatively easy to manage read states InTag , AttributeNaming , AttributeValue (I created these states). Make the correct color application for the Colorizer class and everything.

The problem:

Visual Studio through its API sends me the code line by line expecting me to return the read tokens. How do I read a broken line?

<span
      class="myclass"></span> <!-- Meu parser verá erros e textos apenas -->

Is there any way to group these lines together? Does outlining of code help in these cases? How do I use it?

In this case for example, reading a more complex language, how could I create the outlining and indefinite states? THE; In the namespace, B: class name declaration, C: in class, D,: method declaration, E: method name, F: method body, for example.

    
asked by anonymous 21.06.2014 / 23:56

1 answer

1

In your parser , if you are using regular expression to identify tokens and C #, you should enable Multiline when running match tokens according to your default.

I already had to create some parsers and I always had several basic problems, so I found the ANTLR tool.

This tool generates parsers from a grammar. Perhaps in your case it will be easier to write the grammar than you need to identify and make ANTLR generate the parser for you.

The ASP.NET MVC Bundle uses ANTLR to interpret javascript and css and minify them. So this is a reliable and, let's say, "well tested" tool.

    
24.06.2014 / 21:42