-
Notifications
You must be signed in to change notification settings - Fork 10
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
Unquoted argument parsing issue #18
Comments
I'm not sure what you mean by lost here. Could you give a snippet, its parse result (using |
For example, when parsing the following (note that all arguments are valid syntax according to CMake documentation and used in real projects):
the output tree looks like this:
The problem is that the text immediately concatenated to a variable_ref node, e.g., Another issue with the unquoted argument parsing (according to the documentation) is that the character |
so you want them to be named nodes instead of anonymous nodes? I remember having difficulties trying to do it, that's why I hide those nodes since it's good enough for me. Could you share why you want to get that information? |
Yes, I'd like to have them as name nodes. I am trying to verify the existence of CMake scripts in the code base when an |
they are not really lost, they are just not explicitly named. You have do the interpretation yourself, looking at your output <tree type="argument" pos="96" length="27">
<tree type="unquoted_argument" pos="96" length="27">
<tree type="variable_ref" pos="96" length="11">
<tree type="normal_var" pos="96" length="11">
<tree type="$" pos="96" length="1" label="$"/>
<tree type="{" pos="97" length="1" label="{"/>
<tree type="variable" pos="98" length="8" label="ARCH_DIR"/>
<tree type="}" pos="106" length="1" label="}"/>
</tree>
</tree>
<tree type="variable_ref" pos="108" length="7">
<tree type="normal_var" pos="108" length="7">
<tree type="$" pos="108" length="1" label="$"/>
<tree type="{" pos="109" length="1" label="{"/>
<tree type="variable" pos="110" length="4" label="ARCH"/>
<tree type="}" pos="114" length="1" label="}"/>
</tree>
</tree>
</tree>
</tree> you can collect the content from position 96 and take 27 tokens, do more processing if they are refered to in the nested nodes, otherwise you can assume they are normal text. Like I said, I couldn't figure out how to do this easily using just |
and thank you for reporting the errorneous exclusion of single quote in unquoted arguments |
Hi,
I've noticed that for unquoted arguments such as in the following code snippet (which is quite a common use case)
single_argument_command(var_name_${varA}_is_compound)
The unquoted text payload is lost ("var_name_" and "_is_compound").
I've tried unhiding the _unquoted_text but it parses each letter as a node. Another approach is to define some external rules.
Do you think there is a cleaner solution to this?
The text was updated successfully, but these errors were encountered: