f

#### modify-syntax-entry for 1 char comment start and 2 char comment delimiters

I am trying to hack up a mode for editing Siemens PLM NX Knowledge
Fusion code. It has short comments:

# this is a comment

#+
this is a
multi-line
comment
#-

I want to get both types to appear in the comment face under font-
lock, but cannot figure out how.
;; the following 2 lines work for the simple to end of line
(modify-syntax-entry ?# "<" dfa-mode-syntax-table)
(modify-syntax-entry ?\n ">" dfa-mode-syntax-table)

;; the following 4 work for multi-line, but not single line
(modify-syntax-entry ?# ". 157" dfa-mode-syntax-table)
(modify-syntax-entry ?+ ". 6" dfa-mode-syntax-table)
(modify-syntax-entry ?- ". 8" dfa-mode-syntax-table)
(modify-syntax-entry ?\n ">" dfa-mode-syntax-table)

I have tried all kinds of combinations of <>12345678, but have not
found the right combination for both types of comments. Is it possible
or is the single character comment start incompatible with the 2
character start/end?

Thanks.

 0
Ric
7/20/2010 8:18:44 PM
comp.emacs.xemacs 2750 articles. 0 followers.

1 Replies
9274 Views

Similar Articles

[PageSpeed] 21

OK, nevermind. I was able to get the font-lock to work as I want it by
using:

(modify-syntax-entry ?# ". 157" dfa-mode-syntax-table)
(modify-syntax-entry ?+ ". 6" dfa-mode-syntax-table)
(modify-syntax-entry ?- ". 8" dfa-mode-syntax-table)
(modify-syntax-entry ?\n ">" dfa-mode-syntax-table)

and as part of the font-lock-keywords:

'("#.*" . font-lock-comment-face)

On Jul 20, 4:18=A0pm, Ric <richotchk...@yahoo.com> wrote:
> I am trying to hack up a mode for editing Siemens PLM NX Knowledge
> Fusion code. It has short comments:
>
> # this is a comment
>
>
> #+
> =A0 this is a
> =A0 multi-line
> =A0 comment
> #-
>
> I want to get both types to appear in the comment face under font-
> lock, but cannot figure out how.
> =A0 ;; the following 2 lines work for the simple to end of line
> =A0 (modify-syntax-entry ?# "<" dfa-mode-syntax-table)
> =A0 (modify-syntax-entry ?\n ">" dfa-mode-syntax-table)
>
> =A0 ;; the following 4 work for multi-line, but not single line
> =A0 (modify-syntax-entry ?# ". 157" dfa-mode-syntax-table)
> =A0 (modify-syntax-entry ?+ ". 6" dfa-mode-syntax-table)
> =A0 (modify-syntax-entry ?- ". 8" dfa-mode-syntax-table)
> =A0 (modify-syntax-entry ?\n ">" dfa-mode-syntax-table)
>
> I have tried all kinds of combinations of <>12345678, but have not
> found the right combination for both types of comments. Is it possible
> or is the single character comment start incompatible with the 2
> character start/end?
>
> Thanks.


 0
Ric
7/22/2010 3:25:00 PM

Similar Artilces:

Char* to Char*
What is the best way to copy a Char* to a Char*? "Jake Thompson" <readytoride39@hotmail.com> writes: > What is the best way to copy a Char* to a Char*? That depends on what you mean. There is no standard type Char; I presume you mean char. To copy the value of a char* object to another one, just assign it. To copy a string, use strcpy() (but first make sure that the target has enough room). If you're copying character arrays that aren't strings, use memcpy() (or memmove() if they might overlap). -- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://w...

Char to char*?
Hi, How is it possible to convert a char to char* in C? I'm trying to append a char to the end of a char* using the strcat function.. the following however is not working: char* s1, *s2; char* result; .... .... result = strcat(s1, (const char*)s2[3]); // application crashes here What am I doing wrong? thanks Sona Sona <sona.gardner@nospam.com> writes: > How is it possible to convert a char to char* in C? I'm trying to > append a char to the end of a char* using the strcat function.. the > following however is not working: > > char* s1, *s2; > char* re...

char* and char[]
Hello all, I am a newbie to C, so please bear with me :) I need to create an array in a function (a local variable) with size of 1MB. Since local variables get stored on the stack, at run-time, I get an error. I tried using mallac() function. This function only works when I am allocating memory to a char* and not a char[]. I wish to manipulate the string in my function, but I've heard that when using char*, the value is not meant to be altered. Where as if I use char[], I can change the value as many times as I like (which I want to). Could someone please tell me how to properly alloc...

char[] and char*
A strange problem here - /*******************************************/ /* file foo.cc */ extern char test[] = "helloworld"; /*********************************************/ /* file bar.cc */ #include <iostream> extern char* test; /* this line will be commented later. */ // extern char test[]; /* this line will be uncommented later. */ int main() { std::cout << test << std:: endl; } /**********************************************/ This code compiles without any problem but on running it gives segmentation fault. Why so? I remember reading that "there ...

to comment or not to comment
Has anyone any idea how much comments affect matlab performance? I presume that once a file gets compiled, upon the first execution, that comments should have no impact. If so, why would some people find comment stripping routines useful? Just some thoughts, Mirko ...

Over-comment would comment me out
Hi, If I comment the same statement twice then the uncommented statement below the overly-commented statement also gets commented. Recently I lost an important piece of data transormation because of this. Does this happen with others? Why Would I comment twice? Simple by mistake/habit. Lets say I have a single-line comment and 5 lines of code below that. I might decide not to run the first 2 lines and by habit select the first 2 lines along with comment and press ctrl + /. Lo! the 3rd line of code changes to green font? (partly habit because in excel VBA one comments the same staement twic...

char* and char
Hi, whats the difference between: char* a = new char; char* b = new char[10]; char c [10]; Regards BN "Ying Yang" <YingYang@hotmail.com> wrote in message news:3f6984ca_1@news.iprimus.com.au... > Hi, > > whats the difference between: > > char* a = new char; > > char* b = new char[10]; 'a' and 'b' are both pointers to a char. That is, they each contain the address in memory of a char. In the case of 'b', there happens to be another 9 chars after the first one, but it is up to the programmer to be aware of that (including usin...

char [ ] and char *
Why is it the this code runs: char str1[] = "Prof. Vally"; cout << ++(*str1) << (*str1)++; But this code crashes: char *str2 = "Prof. Vally"; cout << ++(*str2) << (*str2)++; I use the Dev C++ compiler -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 bintom wrote: > Why is it the this code runs: > > char str1[] = "Prof. Vally"; It stores a copy of "Prof. Vally" in RW array, that's OK > cout << ++(*str1) << (*str1)++; > > > But this code crashes: > ...

sizeof (char)(char)2
This doesn't work with any C compiler that I can find. They all report a syntax error: printf ("%d\n", (int)sizeof (char)(char)2); Now the question is "why?" "sizeof" and "(char)" have identical precedence and right-to-left parsing, so why isn't the above equivalent to printf ("%d\n", (int)sizeof ((char)(char)2)); It should probably be obvious to me, but right now it isn't. M Welinder wrote on 26/07/04 : > This doesn't work with any C compiler that I can find. They all report a > syntax error: > > ...

Re: Over-comment would comment me out #2
On 1/24/06, Richard A. DeVenezia <rdevenezia@wildblue.net> wrote: > > /* > block comment for headers > and > temporariliy commenting out blocks of code > > * step one; > data one; > run; > */ > Another useful trick for temporarily commenting out code blocks which have internal /* */ comments is to surround them with %macro and %mend statements, so they're not actually executed. Otherwise your block comment will prematurely stop at the first internal /* */ comment. %macro skip; data one; /* Here's a comment internal to the code bl...

Casting char to char* #2
How do I cast or promote a char variable to a char* variable? For example, I want to use strcat to append a character to an existing "string". (BTW, I'm not able to use STL string or CString data types...) TIA Michael R. Copeland wrote: > How do I cast or promote a char variable to a char* variable? For > example, I want to use strcat to append a character to an existing > "string". (BTW, I'm not able to use STL string or CString data > types...) TIA And why do you want to do this? Can you provide an example of what you are trying to do? Th...

unsigned char, char, signed char and all that
I've been trying to get clear in my mind what is and what is not guaranteed by the standard with respect to character types and conversions between them. I am "reading" BS ISO/IEC 9899:1999. unsigned char seems fairly clear, an unsigned char is a byte or collection of N bits which use a binary representation to represent non-negative integers from 0 to 2^N-1. Have I missed anything with this interpretation: A signed char contains a sign bit, some padding bits and some value bits. The standard guarantees that signed char and unsigned char occupy the same amount of ...

Special unicode chars to input automatic sized delimiters : request for comments
Hi all, The use of automatic sized delimiters \left( \frac{a}{b} + \frac{c}{d} \right) is painful. It is difficult to spot the relevant text and tex editor are no= t suitable to select the right text portion. With unicode encoded input, can we promote a standard with special opening = and closing chars to get automatic sized delimiters ? The example above bec= omes =E2=9D=AA \frac{a}{b} + \frac{c}{d} =E2=9D=AB =20 with the use of chars stolen to dingbats unicode bloc and the help of the n= ewunicodechar package : \newunicodechar =E2=9D=AA {\left(} \newunicodechar =E2=9D=...

length of 2D Array >> char **myString= (char **) malloc (sizeof (char *)); #2
Hi, does someone know how to get the length of a 2 dimensional string array: here what i need: ---------------------------------------------------------------- char **getList(void){ char **myString= (char **) malloc (sizeof (char *)); for(int i=0;i<10;i++){ myString= (char **) realloc (myString, (i+1) * sizeof (char *)); myString[i] = (char *) malloc (255 * sizeof(char)); strcpy (myString[i],"List Item"); } return myString; } void something(void){ char **dataList = getList(); int length = ????? // IDEA ? for(int i=0;i<length;i++){ ...

Web resources about - modify-syntax-entry for 1 char comment start and 2 char comment delimiters - comp.emacs.xemacs

Resources last updated: 1/31/2016 9:09:24 AM