bugGNU Enscript - Bugs: bug #26774, sh.st - hash/pound within a string...

 
 

bug #26774: sh.st - hash/pound within a string mishandled

Submitted by:  None
Submitted on:  Wed 10 Jun 2009 03:46:31 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 11 Jun 2009 02:19:21 PM UTC, comment #4:

Ok, I think I have a working solution. I got rid of the separate sh_string state I created and instead mimicked what Andy Eskilsson did in his python state:

Then I have sh_string_end set to a regular expression.

This correctly highlights nested single and double quotes, as well as hash/pound symbols inside quotes. See the attached state file for more details.

(file #18250)

Josh Zenker <jzenk>
Wed 10 Jun 2009 05:14:04 PM UTC, comment #3:

Sorry, I'm still getting the hang of this markup. Let's try that again.

Josh Zenker <jzenk>
Wed 10 Jun 2009 05:11:48 PM UTC, comment #2:

Ah, no. My changes cause problems with lines like these:
Everything after the single quote returns to the plain, non-string style.

Josh Zenker <jzenk>
Wed 10 Jun 2009 04:00:52 PM UTC, comment #1:

That sed script was meant to be:
s/^\s*#*\s*PORT=[1-9][0-9]*/PORT=1691/

Josh Zenker <jzenk>
Wed 10 Jun 2009 03:46:31 PM UTC, original submission:

Lines like the following are improperly parsed by enscript 1.6.4:

sed 's/^\s#\sPORT=[1-9][0-9]/PORT=1691/' $SYSEDGE_INIT~ | uniq > $SYSEDGE_INIT

Everything after the hash/pound in the regex gets pretty-printed as though it were a comment. On my system, I copied c_string.st to a new state, which I called sh_string.st:

Then I changed sh.st to call sh_string instead of c_string:

This seems to be an imperfect solution, but it works for the time being.

JZ

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jzenk (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 11 Jun 2009 02:19:21 PM UTCjzenkAttached File-=>Added sh.st, #18250

    Back to the top


    Powered by Savane 3.1-cleanup