Comment in schemedef

Discussion Forums discussion Comment in schemedef

This topic contains 0 voices and has 5 replies.

Viewing 6 posts - 1 through 6 (of 6 total)
Author Posts
Author Posts
February 17, 2006 at 9:33 am #25

wvdirks
Member

I’m experimenting with making my own schemedef, using the vhdl as a template. The language (Consistent Changes http://www.sil.org/computing/catalog/show_software.asp?id=4) uses ” c ” to initiate a comment in the code. The spaces around the c are important. The preceeding space isn’t necessary if it’s at the beginning of a line. The language doesn’t support continued comments. An end of line terminates the comment. In the schemedef file I changed:

<comments>

<line start=”–” continuation=”" />

</comments>

to be:

<comments>

<line start=” c ” />

</comments>

but it doesn’t work. If I take out the space then anything starting with “c” is matched. The space after the c is needed. Any ideas how I can make it work?

I have many more questions about schemedef but I’ll start with this one. :)

Thanks.

February 17, 2006 at 10:48 am #14844

wvdirks
Member

I should add that if start=” c ” then it only works if there’s two spaces between it and the previous character. It also works if the last character is a )

If I change start=”c ” then it doesn’t work at all.

February 17, 2006 at 11:02 am #14845

simon
Key Master

Currently comment delimiters can be up to two characters long. Therefore, if your comment line is defined as:

<comments>

<line start="c " />

</comments>

then that should work, although obviously it may well match words that end in c? Have a go and let me know if it doesn’t work. It shouldn’t be too hard to increase the comment delimiter length to three.

February 17, 2006 at 11:03 am #14846

simon
Key Master

Doh, missed your reply. It doesn’t work at all if it starts in c? Hmm. I’ll have a go later.

February 17, 2006 at 11:06 am #14847

simon
Key Master

Ah, it looks like the lexer is looking for characters that might be part of a word before looking for comment delimiters. Currently, what you’re looking for won’t work because of this and the two character issue.

The three character thing will be the easiest fix, trying to work out whether an alphanumeric character is a word or a comment is a bit more complex.

February 17, 2006 at 1:34 pm #14848

wvdirks
Member

Hey, thanks Simon.

For some reason I get the best results when it’s set to ” c “. It just doesn’t match when it’s at the beginning of a line or if the previous char is alphanumeric.

Next… single and double quote strings

PN2 is so cool.

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.