typedb / typedb-console

TypeDB Console: CLI for TypeDB and TypeDB Cluster
https://typedb.com
Mozilla Public License 2.0
7 stars 16 forks source link

Comments in script used by --script argument starting the console #170

Closed FrankUrbach closed 3 years ago

FrankUrbach commented 3 years ago

In previous versions it was possible to comment scripts. This isn't possible in version 2.3.0

lolski commented 3 years ago

Can you elaborate with an example as well as the error when you tried to do so?

FrankUrbach commented 3 years ago

eg. :

To bring this in the database you have to do: typeql console --script=social_network.tql

create the database

database create social_network transaction social_network schema write source social_network_schema.tql commit transaction social_network data write source social_network_data.tql commit

If you do so, the execution of this file will be terminated.

haikalpribadi commented 3 years ago

I'm sorry, I don't think I understand this issue yet, @FrankUrbach. Can you explain a bit more rigorously? and if you can format your answers properly so we know what is a normal sentence, what is code, what is comment, that would be hugely helpful!

FrankUrbach commented 3 years ago

Hi @haikalpribadi If you leave the first line as a comment, the file want work as a script file which can used as a command line argument. Only if you remove the first line ( the comment) the script will work as expected. For the clearance:

If you put line 1 to 9 in a script file and use the command line tool: typed console --script=scriptfile.tql it won't work.

Cheers, Frank

flyingsilverfin commented 3 years ago

@alexjpwalker maybe you can check out why we can't write comments in the script mode?

haikalpribadi commented 3 years ago

Thanks, @FrankUrbach, I understand now. @flyingsilverfin @alexjpwalker I think we may be parsing the text wrong. The TypeQL Grammar does recognise (and ignore) comments in the TypeQL strings.