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

Add contains, startsWith, and endsWith to the operators supported in a relationship. #145

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

motlin
Copy link
Collaborator

@motlin motlin commented Mar 19, 2018

This pull request doesn't work yet. I'm sharing it for early feedback. I'll add comments inline to point out where I need help.

|
<STARTS_WITH> {jjtThis.setStartsWith(true); jjtThis.setString("startsWith");}
|
<ENDS_WITH> {jjtThis.setEndsWith(true); jjtThis.setString("endsWith");}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The contributing guide says to use spaces, not tabs. My editor is configured to use spaces, but you can see the previous lines must be using tabs.

Copy link
Contributor

Choose a reason for hiding this comment

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

np, so long as it doesn't confuse javacc

{
return false;
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here I copy/pasted previous methods, so I apparently copied tab characters.

Copy link
Contributor

Choose a reason for hiding this comment

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

np

jjtree.closeNodeScope(jjtn000, true);
jjtc000 = false;
jjtn000.setEndsWith(true); jjtn000.setString("endsWith");
break;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The files in generator/queryparser look like they were one time generated by javacc and then mostly edited by hand, except for this file which looks entirely generated. I had some trouble running javacc. I guess it doesn't run with every invocation of the build. I also don't think it was set up to run from ant since before the introduction of libboot.

I renamed the javacc jar to not include a version number and ran code generation. It doesn't overwrite existing files. I cleared out this directory, regenerated all code, and restored code that looks like it was written by hand. Is there a better way?

The problem I'm seeing is that all relationships are failing to parse with null pointer exceptions. When I log relationship strings, I see that existing relationships are failing to parse, not just new ones I'm adding for tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

(It'd be good to have a working target for running javacc, but it should not run all the time)

I don't think you did anything procedurally wrong.
javacc has the advantage that it generates a fully independent parser, but the code is pretty opaque. I would suggest taking the simplest relationship that fails and debugging it through.

"<DIGIT>",
};

}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just noticed this. javacc generates code with line endings that don't necessarily match what's in git, and I think I have my git client set up to preserve the original's line endings. I'll fix this, but I figured I'd ask if there's a better way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe it makes sense to add this suggestion to contributing.md

$ git config core.autocrlf false

public static final String[] lexStateNames = {
"DEFAULT",
};
static final long[] jjtoToken = {
0x7dfffffc1L,
0x3effffffc1L,
};
static final long[] jjtoSkip = {
0x3eL,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All this is auto-generated so I'm assuming it's ok but I'm missing something.

@motlin motlin force-pushed the master branch 2 times, most recently from 814edaf to 60d14a3 Compare October 14, 2018 18:38
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