Opened 3 months ago

Closed 5 weeks ago

#391 closed defect - wrong answer (fixed)

do not use C as a comment character

Reported by: Gary J. Ferland Owned by: peter
Priority: blocker Milestone: c17.01 release
Component: input parser Version: trunk
Keywords: Cc:

Description

see the extensive discussion on both user groups, and Peter recommended solution

Change History (5)

comment:1 Changed 7 weeks ago by peter

Owner: changed from nobody to peter
Status: newaccepted
Type: defect - convergencedefect - wrong answer

As the description is not very descriptive, this is the problem. Under certain circumstances species labels such as "C 1" could be misinterpreted as a comment. Since we were already discussing limiting the number of comment characters, the following action was decided.

For c17_branch:

  • remove "c " and "C " as a valid comment character, thus preventing the bug.
  • make "#" the comment character for visible comments ("c " used to do that).
  • add "##" as a new comment character for hidden comments.

(here "visible comments" are echoed in the output, while "hidden comments" are not). A script will be created to assist in modifying the comment characters. These changes are intended to be released in c17.01.

For the trunk:

  • do the same as on c17_branch.
  • additionally, remove all comment characters other than "#" and "##".

The script (called ccc.pl) will take input scripts directly to a state that will be valid on the trunk (this is to avoid double work when the next main release comes out).

While investigating this, a number of other (minor) bugs were found in the parser.

A - Init files do not strip comments starting after column 1, so the following line is correctly marked invalid in the main script, but will be happily accepted in an init file:

hden 8

B - The main script accepts '*' as an EOF marker, but the init file does not (it treats it as a regular command). When running Cloudy as a subroutine, passing this to cdRead() will also cause it to be stored as a normal command and treated as a regular comment. I know this is an unlikely usage pattern, but the treatment should still be the same...

C - cdRead() acts as what I call the "preparser" or pass 1 over the input script in order to set several variables that need a value before the regular parser (or pass 2) starts. Lines in init files are not included in this process. This can lead to differences in behavior (or even bugs) when lines are moved from the main script to an init file.

D - Treatment of alternate (MS) EOL sequences is inconsistent. In most places they are not stripped correctly.

E - The code will now pick up on underscores and square brackets in comments if these comments do not start in the first column. One example where this happens is in the blr_n14_p18.in script.

All these bugs will be fixed on the newcomment branch.

comment:2 Changed 6 weeks ago by peter

The first set of changes (implementing the changes appropriate for c17_branch) have been merged to the trunk in r11769 and r11770, and subsequently merged to c17_branch in r11772 and r11773.

comment:3 Changed 6 weeks ago by peter

A minor bug-fix of the StripComment() routine was merged to the trunk in r11778 and to c17_branch in r11779. In r11780, the comment characters , *, %, and ; were deprecated on c17_branch. We now print a NOTE if they occur in the input, stating this fact.

comment:4 Changed 6 weeks ago by peter

Incorrect array dimensions were fixed in r11784 on c17_branch.

comment:5 Changed 5 weeks ago by peter

Resolution: fixed
Status: acceptedclosed

Changes to remove all comment characters other than '#' and '##' were committed to the trunk in r11797. This finalizes fixing this problem.

Note: See TracTickets for help on using tickets.