Posted 20 years ago by Greg Shaffer - Boulder
Avatar
Hi,

I recently started to use the semantic parser. Since you can identify scope for outlining purposes, I'm wondering if I can somehow identify token scope via the same mechanisms. In other words, I don't want to manually parse.

The reason I ask is that I wish to use the same ISemanticParseData for multiple tokens representing the same variable. Under certain cases, it would be useful to know what scope a token resides so I can assign the correct ISemanticParseData.

For example:

if(true)
{
int x = 0;
...
// do something with x
}

if(true)
{
double x = 0.0;
...
// do something with x. X is a double, not an int.
}

In this example, the token "x" has two different definitions in the same document, but under different scopes.

Is there any built-in, easy way to handle this type of stuff?

Thanks,
Greg

Comments (3)

Posted 20 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Right now there's no built-in way to automatically handle that however we're always open to suggestions.


Actipro Software Support

Posted 20 years ago by Greg Shaffer - Boulder
Avatar
I guess it is kind of like a composite design pattern. Maybe there is a solution there...

Or, you could use an id based system. For instance:

The base scope, at the document level, is "1".
Then the first scope encountered within the document level is "1_1".
And the second could be "1_2".
Then the first scope in "1_2" could be "1_2_1".

For example:

Document Scope: "1"

if(true)
{
// this is scope "1_1"
}

if(true)
{
// this is scope "1_2"
if(true)
{
// this is scope "1_2_1"
}
}

So, you could just assign a scope ID to each token, or you could create a scope object that contains the id, along with other tokens and scopes on that scope, and a reference to the parent scope. I guess it is kind of like a tree. Maybe you can somehow tie this into your outlining mechanism?

This would help out tremendously with semantic parsing.

Does that make sense? Do you think it might be useful?

Thanks,
Greg
Posted 20 years ago by Greg Shaffer - Boulder
Avatar
Hmmm...

Maybe I can just count the number of "{" and "}" and use a stack for the different scopes.

-Greg
The latest build of this product (v24.1.1) was released 26 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.