My highlight file doesn't work properly


#1

I created a bison/yacc language highlight files:

scopeName: 'source.bison'
fileTypes: [
  'y'
]
name: 'Bison'
patterns: [
    # top include
    {
        begin: '^%\\{'
        contentName: 'source.cpp'
        end: '%\\}$'
        patterns: [
            {
                include: 'source.cpp'
            }
        ]
    }
    ...
    ...
]

and my test bison file is:

%{
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;

#include "node.h"

// stuff from flex that bison needs to know about:
extern "C" int yylex();
extern "C" int yyparse();
extern "C" FILE *yyin;

void yyerror(const char *s);
%}
...
...

In the editor it looks like this (left half):

It seems that atom ignore each " before C, so it thinks all the rest chars is string and give them green color.

But when I copy the code into a test.cpp, it looks like what it should be (right half of the picture).

I’m very confused, what I should do to fix this error?

Thanks everyone.


#2

To support~~AutumnsWind~