Skip to content

Fixes a few characters in strings#62

Merged
bbdaniels merged 3 commits into
reprun-46from
reprun-46-strings
Jul 9, 2024
Merged

Fixes a few characters in strings#62
bbdaniels merged 3 commits into
reprun-46from
reprun-46-strings

Conversation

@ankritisingh
Copy link
Copy Markdown
Contributor

@ankritisingh ankritisingh commented Jul 8, 2024

After testing, found out that the characters (, ), [, and ] cause the error "{ required" when included in commented-out code.

Also, proposed a solution to " and I think it fixes most of the cases. I tested the following and it works:

/*******************************************************************************
Name of  file: main.do
testing first instance of "quote
*******************************************************************************/

/* the do-file tests the "second instance of quote
error " */

// test brackets [ 
	sysuse auto, clear
	

* testing open paranthesis (
	bys mpg:  /// sorting by mpg	
	gen dup = cond(_N==1,0,_n)
	
// testing third instance of quote "here	
	drop if dup > 1

But it does not work if quote is on the next line of the comment without any space:

/* the do-file tests the "second instance of quote
error" */

// test brackets [ 
	sysuse auto, clear

It causes the error "too few quotes"

@ankritisingh ankritisingh requested a review from bbdaniels July 8, 2024 21:44
@bbdaniels
Copy link
Copy Markdown
Contributor

This doesn't work for ". The problem isn't that we can't remove it, it's that it breaks functionality, typically in the sub-do-file cases like we have in the test file:

do "`fldr'/B sub1.do"
do `fldr'/B-sub2.do

You will typically find that the first one won't trigger recursive searching because it won't find the do file without the ".

@bbdaniels
Copy link
Copy Markdown
Contributor

@ankritisingh @kbjarkefur fb8b45d implements a reworked version of this functionality which I think solves nearly all the problems. All test files work fine, including the new comments.do test file that has all the evil comments.

What is not working is anything involving comments that would trigger recursive behaviors if they were not comments. See the recursion.do test file -- these are to my knowledge the unsolved cases (this file crashes the command instantly).

@bbdaniels bbdaniels self-assigned this Jul 9, 2024
@bbdaniels bbdaniels merged commit 20991b4 into reprun-46 Jul 9, 2024
@bbdaniels bbdaniels deleted the reprun-46-strings branch July 9, 2024 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants