Modify

Ticket #2860 (closed Bugs: fixed)

Opened 5 years ago

Last modified 5 years ago

misdetected unexpected character

Reported by: jgresula@… Owned by: danieljames
Milestone: Boost 1.39.0 Component: quickbook
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

Quickbook incorrectly reports an unexpected character when processing the following

[python] print "\xfapln\xeck"

warning: in column:9, unexpected character: " warning: in column:22, unexpected character: "

Attachments

Change History

comment:1 Changed 5 years ago by jgresula@…

fixed formatting:

[python]
``
print "\xfapln\xeck"
``
warning: in column:9, unexpected character: " 
warning: in column:22, unexpected character: " 

comment:2 Changed 5 years ago by danieljames

  • Owner changed from djowel to danieljames
  • Status changed from new to assigned
  • Component changed from quickbook to spirit

I think this is a bug in spirit's c_escape_ch_p. I'll look into it.

comment:3 Changed 5 years ago by danieljames

  • Component changed from spirit to quickbook

Sorry, my mistake. It's a bug in quickbook, it's using a C character escape parser for python and the syntax is different. Although I think it should be fairly liberal about how it parses either language, so I think I might change both to accept a string like that.

comment:4 Changed 5 years ago by danieljames

(In [51949]) Use our own escape character parser.

We're currently using the spirit escaped character parser. This is a strict C parser and causes parse errors for code that we probably should accept, such as any hexadecimal encoded characters with a value greater than the maximum value of the current platform's 'char'. This is \x7F on some platforms so it rejects '\x80' upwards. As well as rejecting characters that might be valid, it also means that quickbook will act differently on different platforms.

In python strings, '\xaaa' is equivalent to '\xaa' + 'a', but the spirit parser interprets this as a character with value '0xaaa'. So we probably should accept these.

I also think we should be liberal about what we accept. IMO it isn't our job to enforce correct C++/python, just to create a reasonable rendering of our input. So rather than write a parser which understands the various types of escapes, I just wrote one that ignores any character following a backslash.

Refs #2860.

comment:5 Changed 5 years ago by danieljames

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [52064]) Fix bug handling python and C++ strings.

Fixes #2860.

Merged revisions 51949 via svnmerge from  https://svn.boost.org/svn/boost/trunk

........

r51949 | danieljames | 2009-03-24 08:34:09 +0000 (Tue, 24 Mar 2009) | 21 lines

Use our own escape character parser.

We're currently using the spirit escaped character parser. This is a strict C parser and causes parse errors for code that we probably should accept, such as any hexadecimal encoded characters with a value greater than the maximum value of the current platform's 'char'. This is \x7F on some platforms so it rejects '\x80' upwards. As well as rejecting characters that might be valid, it also means that quickbook will act differently on different platforms.

In python strings, '\xaaa' is equivalent to '\xaa' + 'a', but the spirit parser interprets this as a character with value '0xaaa'. So we probably should accept these.

I also think we should be liberal about what we accept. IMO it isn't our job to enforce correct C++/python, just to create a reasonable rendering of our input. So rather than write a parser which understands the various types of escapes, I just wrote one that ignores any character following a backslash.

Refs #2860.

........

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.