octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Block comments


From: John W. Eaton
Subject: Re: Block comments
Date: Mon, 5 Jun 2006 14:06:41 -0400

On  5-Jun-2006, William Poetra Yoga Hadisoeseno wrote:

| I think we should only match for "^%{$" and "^%}$", because in Matlab,
| a block comment starter and ender is only valid if the two characters
| %{ or %} are the only characters on the line. So for example this one
| doesn't start a block comment:
| 
|   myvar = 1; %{ this is not a block comment
|   %} and this line should generate a warning

What about whitespace (TAB or SPC)?

| Since I don't have access to Matlab here, I can't verify it
| personally. So should we "extend" the syntax of block comments, so
| that it doesn't need to appear by itself on a line?

No, I don't think that is necessary.

| If we don't extend
| the syntax, we don't have to worry about column numbers (since it
| matches only when we begin a line and ends with a newline --> %}\n).

OK.

| > The only catch here is that there are a few places where comments are
| > already matched with regular expressions like "%.*\n", so those would
| > have to be modified as well.
| 
| OK, I'll take a look. Some functions also deal with '\r'. What is it
| for? Is it for compatibility with Matlab scripts with the DOS/Windows
| encoding?

In a perfect world, we would only have to look for LF ("\n") and all
CR or CRLF pairs would be converted by the system.  But unfortunately,
there are problems with people transferring files with CRLF pairs to
systems that don't do translation, and I think that telling users to
translate their files is not a popular solution.  So yes, we generally
have to match both.

| Uh, could you please briefly explain the start states

Sorry, I don't have time to explain how to use the tools.

| and the column
| numbers? I took a look at the flex info manual, and I haven't really
| understood it. About the column numbers (the global variable
| current_input_column, right?), yes, I saw those, but some functions
| don't update it (and input_line_number, too). Why?

I think the line and column number variables are entirely part of
Octave and we don't use any flex-specific features to keep track of
them.  Precisely what functions don't update these variables when you
think they should?

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]