bugText Extractor TXR - Bugs: bug #34657, Empty input cannot be matched: bug...

 
 

bug #34657: Empty input cannot be matched: bug or feature? Documentation should clarify.

Submitted by:  Kaz Kylheku <kkylheku>
Submitted on:  Wed 26 Oct 2011 12:22:00 AM UTC  
 
Category: NoneSeverity: 2 - Minor
Item Group: DocumentationStatus: Fixed
Privacy: PublicAssigned to: None
Originator Name: Open/Closed: Closed
Component Version: NoneOperating System: None
Fixed Release: NonePlanned Release: None
Architecture: AllABI: All

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 27 Oct 2011 05:01:24 AM UTC, comment #2:

Addressed in commit:

http://git.savannah.gnu.org/cgit/txr.git/commit/?id=b3d18b79eba30505af7423208f939937178d97d7

which is just a documentation update. The existing behavior makes perfect sense.

Kaz Kylheku <kkylheku>
Project Administrator
Wed 26 Oct 2011 12:23:12 AM UTC, comment #1:

The fix is for the user to use :list instead:

@(next :list "")
@a
a=""

The argument to :list is flattened to a one-element list, yielding the expected behavior.

So the :string behavior of not allowing an empty match is arguably a kind of feature. The fail-on-empty behavior could be useful.

I think there is nothing to fix here; just the documentation should make the corner cases clear.

Kaz Kylheku <kkylheku>
Project Administrator
Wed 26 Oct 2011 12:22:00 AM UTC, original submission:

Txr will match input which is not terminated by a newline.

For example:

@(next :string "text")
@a

a="text"

From a tty stream on a Unix-like system, the same behavior can be obtained by typing "text" and then Ctrl-D twice.

However, if the input is empty, then binding fails:

@(next :string "")
@a
false

If a newline is added, everything is well:

@(next :string "n")
@a
a=""

The faiure happens if we given an empty file, or tty input:

$ txr -c '@a'
[Ctrl-D]
false

The thing is, it actually makes sense. If the input is zero characters long, that means the line does not contain any lines. Therefore it is wrong to obtain a match within a line.

However, the behavior may be confusing under @(next :string ""), where the user expects the "" to be an empty line of text and not a virtual file that contains no lines.

Kaz Kylheku <kkylheku>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by kkylheku (Submitted the item)
  •  

    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):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 27 Oct 2011 05:01:24 AM UTCkkylhekuStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1