Changeset 505 for trunk


Ignore:
Timestamp:
Dec 6, 2007, 3:57:39 AM (14 years ago)
Author:
Peter Johansson
Message:

Fixes #270 - Changing the rule of what is code. Rather than requiring a line of code to contain a alhanumerical character, a line of code is required to contain a visible character (outside comment blocks).

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/readme.txt

    r495 r505  
    3333comment blocks are identified by a start code (e.g. '/*' in a C file)
    3434and a stop code (e.g. '*/' in a C file). If a line contains
    35 alphanumeric characters being outside comment blocks, the line is
     35visible characters being outside comment blocks, the line is
    3636considered to be ''code''. Otherwise, if the line contains
    3737alphanumeric characters inside a comment block, the line is considered
    3838to be a line of ''comment''. Otherwise the line is considered to be
    39 `other`. At the time being the following comment identifiers are
     39''other''. At the time being the following comment identifiers are
    4040used:
    4141
  • trunk/lib/Parser.cc

    r439 r505  
    130130        // A line of code or comment must contain at least one
    131131        // alphanumerical character.
    132         if (isalnum(*iter)) {
    133           if (!mode) {
    134             lt=code;
    135           }
    136           else if (lt!=code) {
    137             lt=comment;
    138           }
    139         }
     132        if (!mode && isgraph(*iter))
     133          lt=code;
     134        else if (mode && lt!=code && isalnum(*iter))
     135          lt=comment;
    140136      }
    141137      if (mode && codon[mode-1].second==std::string("\n"))
Note: See TracChangeset for help on using the changeset viewer.