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

Parsing an external json file not working #35

Open
OlinaRuan opened this issue Oct 26, 2014 · 6 comments
Open

Parsing an external json file not working #35

OlinaRuan opened this issue Oct 26, 2014 · 6 comments

Comments

@OlinaRuan
Copy link

When I try to parse an json file, it always complains: "ticktick.sh: line 392: TICKTICK: command not found"

@kristopolous
Copy link
Owner

can you please tell me a bit more about this?

@TheAifam5
Copy link

TheAifam5 commented Dec 9, 2016

JSON:

{
    "configurations": [
        {
            "name": "Linux",
            "includePath": ["/usr/include"],
            "browse" : {
                "limitSymbolsToIncludedHeaders" : true,
                "databaseFilename" : ""
            }
        }
    ]
}

build.sh:

#!/usr/bin/env bash
. ticktick.sh
data=`cat ./.vscode/c_cpp_properties.json`
tickParse $data

Returns ticktick.sh: line 424: TICKTICK: command not found

Callstack:
1 - loading ticktick.sh
2 - _tick_fun_tokenize("/home/[...]/build.sh")
3 - Crash on bash -c "$code" -- $ARGV

Variables:
$ARGV=''
$hasError='declare -- hasError="0"'
$code=<contains build.sh>

@kristopolous
Copy link
Owner

ok I'll try it out

@XLTechie
Copy link
Contributor

@kristopolous I've now run into this same thing.

Script:

sh #!/bin/bash . ticktick.sh tickParse `cat /tmp/test.json` tickVars

Input file:

JSON {"string": "stringy!", "int": 7, "array": [ "first", "second" ]}

Output:

``
ticktick.sh: line 424: TICKTICK: command not found
@ Line 6:
string=

``

Thoughts:

Obviously this is a quote containment issue relating to line 18: echo "TICKTICK PARSING ERROR "$1.
I suspect that output is getting picked up in an eval somewhere.

Two errors:

  1. The quoting is not capturing the whole phrase once it gets to that level (maybe echo "\"...$1\""); and
  2. The eval shouldn't be trying to run something that might be error text. Maybe the grep on line 353 is supposed to be preventing this, but because of the quoting it can't?
  3. Third of two: I'm not sure why $1 in the echo is outside the quotes. That seems dangerous.

@XLTechie
Copy link
Contributor

Okay, so the things I said above are true--that or those error(s) should be fixed, probably before this one since this one shows it/them.
However, the underlying problem here is that for some reason I haven't figured out, tickParse and the function chain it calls, can't handle spaces in the JSON.
If you take the JSON above and remove all spaces, it does not emit the error, or attempt to eval the error message which causes the error.

Maybe there is a problem with one of the regular expressions that __tick_json_tokenize uses? I haven't fully comprehended how that thing is working yet.

This is a very serious bug; I'm creating an issue dedicated to it.

@XLTechie
Copy link
Contributor

Related: #50

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

No branches or pull requests

4 participants