Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop grep fix #198

Closed
wants to merge 6 commits into from
Closed

Develop grep fix #198

wants to merge 6 commits into from

Conversation

mgage
Copy link
Sponsor Member

@mgage mgage commented Apr 17, 2015

  1. Replaced \1 by $1 in grep strings. This quiets the warnings that
    newer versions of perl emit when they see the old style grep strings.
  2. Cleaned up the unit test code for the "Units.pm" module. Make it use the Units.pm file that is actually being used by WW instead of using a copy.

@goehle
Copy link
Member

goehle commented Apr 20, 2015

When I test this by submitting an essay answer with some math (e.g. x+y) I get the error

Use of uninitialized value $1 in regexp compilation at line 2037 of [PG]/macros/PGbasicmacros.pl

I'm not sure $1 works in matches.

@goehle
Copy link
Member

goehle commented Apr 20, 2015

Ignore the comment I deleted. LaTeX style math strings are not interpolated by EV3P_parser.

As far as I can tell you can't use $1 in a match since it gets bound to character groups from previous matches. In this case you use \1 to match backreferences.

http://stackoverflow.com/questions/1068840/what-is-the-difference-between-1-and-1-in-a-perl-regex

@@ -2032,7 +2032,7 @@ sub EV3P_parser {
my $start = ''; my %end = ('\('=>'\)','\['=>'\]');
my @parts = split(/(``.*?``\*?|`.+?`\*?|(?:\\[()\[\]]))/s,$string);
foreach my $part (@parts) {
if ($part =~ m/^(``?)(.*)\1(\*?)$/s) {
if ($part =~ m/^(``?)(.*)$1(\*?)$/s) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Geoff is correct, this should not have been changed. The \1 is used here to make sure the end quotes are the same as the beginning quotes. $1 doesn't work in this situation.

@mgage
Copy link
Sponsor Member Author

mgage commented Apr 20, 2015

I'm also puzzled as to how the new merges of development into the develop_grep_fix branch seem to have appeared. I think I'll close this pull request also and resubmit it.

@mgage mgage closed this Apr 20, 2015
@mgage mgage deleted the develop_grep_fix branch April 20, 2015 15:05
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.

None yet

3 participants