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

Two string comparisons in same expression fails #67

Closed
goodwithgit opened this issue Aug 30, 2013 · 1 comment
Closed

Two string comparisons in same expression fails #67

goodwithgit opened this issue Aug 30, 2013 · 1 comment
Assignees
Labels

Comments

@goodwithgit
Copy link

I have an object defined thus:

define Value {
    id : null,
    v : null,
    constructor : function (id, value) {
        this.id = id;
        this.v = value;
     }
}

I'm asserting a fact like this:

s.assert(new Value("xyz", "abc"));

Then looking for it in a when clause like this:

v4 : Value v4.id =~ /xyz/ && v4.v =~ /abc/;

The above fails to trigger the rule. The following does trigger the rule:

 v4 : Value v4.id =~ /xyz/ && v4.v ==  'abc';

For some reason, two string comparisons in the same rule don't want to play nice.

@ghost ghost assigned doug-martin Sep 1, 2013
@doug-martin
Copy link
Contributor

After some investigation there is an issue with parsing regexps in the constraint grammar which does a greedy match on the first regexp. Im working on fixing the parser for the regexp and will have a fix soon.

doug-martin added a commit to doug-martin/nools that referenced this issue Sep 4, 2013
* Added ability to `import` other nools files to create composible rules files [noolsjs#58](noolsjs#58)
* When using `global` to require other files you can now require other files relative to the nools file
* Added uglify-js as a dependency instead of devDependency noolsjs#71
* Fixed issue noolsjs#61 where transpile would not properly escape `"` character.
* Fixed issue noolsjs#66 and noolsjs#67 where regular expression matching was too greedy.
* Fixed issue noolsjs#62 where constraints with a `"` character would produce invalid javascript when `transpiling`.
* Fixed issue noolsjs#69 where rules names with a `'` character in a rule would produce invalid javascript when `transpiling`.
@doug-martin doug-martin mentioned this issue Sep 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants