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

Bug in _TreeFindNodeWild with syntax such as .*** and :*** #417

Closed
tfredian opened this issue Mar 17, 2016 · 2 comments
Closed

Bug in _TreeFindNodeWild with syntax such as .*** and :*** #417

tfredian opened this issue Mar 17, 2016 · 2 comments
Assignees
Labels
bug An unexpected problem or unintended behavior

Comments

@tfredian
Copy link
Contributor

This bug may have been in MDSplus for a very long time but nobody used this search syntax before. That syntax started occurring mainly because of the way TreeNode.getNodeWild was implemented.

When the triple asterisk syntax is preceded by a period or colon, _TreeFindnodeWild seems to pass over some of the nodes multiple times sometimes causing the routine to return many more nodes than it should and in some cases infinitely recursing until the process runs out of memory.

@tfredian tfredian added the bug An unexpected problem or unintended behavior label Mar 17, 2016
@kgerickson kgerickson self-assigned this Sep 21, 2017
@joshStillerman
Copy link
Contributor

The syntax is described at:
http://www.mdsplus.org/index.php/Documentation:Users:Tree_syntax

Keith, can you write a parser for it ? I have an idea of how to make the search code much more simple.
-Josh

@joshStillerman
Copy link
Contributor

joshStillerman commented Mar 12, 2018

Given that some wildcard searches are broken, and there is ambiguity in the syntax for **** I propose we make the following syntax decisions:

[[treename::]tagname{.|:}]

Four single character punctuations

  1. '.' the child
  2. ':' the member
  3. '^' the parent
  4. '~' wildcard both member and child

and these can be tripled to mad breadth first searches

  1. '...' all children
  2. ':::' all members
  3. '~~~' all members and children
  4. '^^^' all parent

four of these is a syntax error

a special case would first translate *** to ~~~
(four of these is also a syntax error)

Some examples

a.b*.c  - a child named c of a child starting with b of a member or child called a 
a.b*:c - a member named c of a child starting with b of a member or child called a
a.b*~c -a member or child named c of a child starting with b of a member or child called a
a.b...c  - a child called c someplace under the child hierarchy under a.b
a.b:::c - a member called c someplace under the member hierarchy under a.b
a.b~~~c - a child or member called c someplace under the child/member hierarchy under a.b
a.b*~~~ 
etc...

joshStillerman added a commit that referenced this issue Apr 3, 2018
Given that some wildcard searches are broken, and there is ambiguity in the syntax for **** this change makes the following syntax changes:

[[treename::]tagname{.|:}]

Four single character punctuations

'.' the child
':' the member
'^' the parent
'~' wildcard both member and child

and these can be tripled to make breadth first searches

'...' all children
':::' all members
'~~~' all members and children
'^^^' all parent
four of these is a syntax error

a special case would first translate *** to ~~~
(four of these is also a syntax error)
however ****  becomes ~~~* which is OK.

Some examples

a.b*.c  - a child named c of a child starting with b of a member or child called a
a.b*:c - a member named c of a child starting with b of a member or child called a
a.b*~c -a member or child named c of a child starting with b of a member or child called a
a.b...c  - a child called c someplace under the child hierarchy under a.b
a.b:::c - a member called c someplace under the member hierarchy under a.b
a.b\~\~\~c - a child or member called c someplace under the child/member hierarchy under a.b
a.b*\~\~\~
etc...

Fixes issue #417

The new algorithm consists of:
* use flex to scan (parse) the wildcard specification.  Bison was not needed since the syntax is so simple.
* find all the nodes on the initial call and place them in a list in memory. returning the 1st element
* return elements from the list of found nodes until there are no more.
joshStillerman added a commit that referenced this issue Apr 3, 2018
Given that some wildcard searches are broken, and there is ambiguity in the syntax for **** this change makes the following syntax changes:

[[treename::]tagname{.|:}]

Four single character punctuations

'.' the child
':' the member
'^' the parent
'~' wildcard both member and child

and these can be tripled to make breadth first searches

'...' all children
':::' all members
'~~~' all members and children
'^^^' all parent
four of these is a syntax error

a special case would first translate *** to ~~~
(four of these is also a syntax error)
however ****  becomes ~~~* which is OK.

Some examples

a.b*.c  - a child named c of a child starting with b of a member or child called a
a.b*:c - a member named c of a child starting with b of a member or child called a
a.b*~c -a member or child named c of a child starting with b of a member or child called a
a.b...c  - a child called c someplace under the child hierarchy under a.b
a.b:::c - a member called c someplace under the member hierarchy under a.b
a.b~~~c - a child or member called c someplace under the child/member hierarchy under a.b
a.b*~~~
etc...

Fixes issue #417

The new algorithm consists of:
* use flex to scan (parse) the wildcard specification.  Bison was not needed since the syntax is so simple.
* find all the nodes on the initial call and place them in a list in memory. returning the 1st element
* return elements from the list of found nodes until there are no more.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants