Skip to main content
Notice removed Canonical answer required by tukan
Bounty Ended with OdatNurd's answer chosen by tukan
Notice added Canonical answer required by tukan
Bounty Started worth 50 reputation by tukan
Improving the question
Source Link
tukan
  • 17.2k
  • 1
  • 22
  • 50

I have Smalltalk sublime-syntax file (YAML) for Sublime Text 3 and I would like to add an highlighting support for embedded C code.

The inline C (which always starts with ^%\{ and ends with %\}$) code among the smalltalk code.

A simple example (not much C but wanted a simple case):

sigABRT
    "return the signal number for SIGABRT - 0 if not supported by OS
     (the numeric value is not the same across unix-systems)"

%{  /* NOCONTEXT */
#ifdef SIGABRT
    RETURN ( __mkSmallInteger(SIGABRT) );
#else
    RETURN ( __mkSmallInteger(0) );
#endif
%}
!

There is new feature embed in Sublime text (with even an example).

I tried to do something like this:

- match: '^%\{'
  embed: scope:source.c
  embed_scope: meta.environment.embedded.c.smalltalk source.c.embedded
  escape: '%\}$'

However, I was unable to correctly incorporate it into my current highlighting file. Could someone help me with that

Does anyone know how to correctly embed one language to another?

I have Smalltalk sublime-syntax file (YAML) for Sublime Text 3 and I would like to add an highlighting support for embedded C code.

The inline C (which always starts with ^%\{ and ends with %\}$) code among the smalltalk code.

A simple example (not much C but wanted a simple case):

sigABRT
    "return the signal number for SIGABRT - 0 if not supported by OS
     (the numeric value is not the same across unix-systems)"

%{  /* NOCONTEXT */
#ifdef SIGABRT
    RETURN ( __mkSmallInteger(SIGABRT) );
#else
    RETURN ( __mkSmallInteger(0) );
#endif
%}
!

There is new feature embed in Sublime text (with even an example).

I tried to do something like this:

- match: '^%\{'
  embed: scope:source.c
  embed_scope: meta.environment.embedded.c.smalltalk source.c.embedded
  escape: '%\}$'

However, I was unable to correctly incorporate it into my current highlighting file. Could someone help me with that?

I have Smalltalk sublime-syntax file (YAML) for Sublime Text 3 and I would like to add an highlighting support for embedded C code.

The inline C (which always starts with ^%\{ and ends with %\}$) code among the smalltalk code.

A simple example (not much C but wanted a simple case):

sigABRT
    "return the signal number for SIGABRT - 0 if not supported by OS
     (the numeric value is not the same across unix-systems)"

%{  /* NOCONTEXT */
#ifdef SIGABRT
    RETURN ( __mkSmallInteger(SIGABRT) );
#else
    RETURN ( __mkSmallInteger(0) );
#endif
%}
!

There is new feature embed in Sublime text (with even an example).

I tried to do something like this:

- match: '^%\{'
  embed: scope:source.c
  embed_scope: meta.environment.embedded.c.smalltalk source.c.embedded
  escape: '%\}$'

However, I was unable to correctly incorporate it into my current highlighting file.

Does anyone know how to correctly embed one language to another?

edited tags
Link
edited tags
Link
improved question
Source Link
tukan
  • 17.2k
  • 1
  • 22
  • 50
Loading
added removed tag
Link
tukan
  • 17.2k
  • 1
  • 22
  • 50
Loading
edited tags
Link
Loading
Source Link
tukan
  • 17.2k
  • 1
  • 22
  • 50
Loading