67 Commits

Author SHA1 Message Date
Salvo 'LtWorf' Tomaselli
31a59e1de0
Fix error reporting in the parser 2020-06-18 17:14:30 +02:00
Salvo 'LtWorf' Tomaselli
0df6a263e5
Check it after removing nesting 2020-06-18 17:14:12 +02:00
Salvo 'LtWorf' Tomaselli
e5f7b1745c
Add new error about empty expressions. 2020-06-18 17:14:04 +02:00
Salvo 'LtWorf' Tomaselli
7cb6d4941f
More parse details 2020-06-18 17:13:45 +02:00
Salvo 'LtWorf' Tomaselli
3056dafbff
Reuse code for optimizations 2020-06-18 17:12:57 +02:00
Salvo 'LtWorf' Tomaselli
8fd2db12b5
Reuse code to generate the projection python code 2020-06-18 17:10:34 +02:00
Salvo 'LtWorf' Tomaselli
b3b5afec63
Some convenience methods 2020-06-09 15:56:16 +02:00
Salvo 'LtWorf' Tomaselli
72c4746578
Add function to convert the rename property to a python dict
Probably less error prone, and I can remove code duplication.
2020-06-09 12:05:36 +02:00
Salvo 'LtWorf' Tomaselli
3e524278e8
Remove unused 2020-06-09 10:51:40 +02:00
Salvo 'LtWorf' Tomaselli
6c677452e8
Remove old things 2020-06-09 10:14:19 +02:00
Salvo 'LtWorf' Tomaselli
b508149583
Major refactory of the parser
It uses subclasses rather than a kind variable.

This is way more typesafe.
2020-06-09 01:37:19 +02:00
Salvo 'LtWorf' Tomaselli
7a88dc9076
Replace == None with is 2017-07-02 12:50:48 +02:00
Salvo 'LtWorf' Tomaselli
f459f0635a
Add missing returns
The conditions were only checking valid values, now exceptions are thrown if
none of the conditions match.

Also correct the type of _find_matching_parenthesis.
2017-07-02 12:47:46 +02:00
Salvo 'LtWorf' Tomaselli
12f4459682
More type information
Add type information, change some imports and some style.
2017-06-24 13:01:22 +02:00
Salvo 'LtWorf' Tomaselli
2d9bbf39f0
make mypy happy 2017-06-24 11:31:07 +02:00
Salvo 'LtWorf' Tomaselli
6caf8bc741
replaced verbose loop with comprehension 2017-04-24 00:41:52 +02:00
Salvo 'LtWorf' Tomaselli
722b164d56 Fix Python code generator to correctly escape strings
A string that contained escape symbols was not correctly escaped
when generating the Python code for the selection.

This could cause selection operations to fail to compile.
2016-04-23 15:19:32 +02:00
Salvo 'LtWorf' Tomaselli
1b049e13f0 Better handling of parenthesis inside string literals
When scanning for the matching parenthesis, string literals
were not taken into account, which would inevitably lead to
errors if one wanted to do a selection on a string containing
a parenthesis.

Now it uses a state-machine to skip the ones that are located
inside literals.
2016-04-09 11:37:28 +02:00
Salvo 'LtWorf' Tomaselli
6bc219c635 Avoid proliferation of parenthesis
The str() function of the parse tree now emits expressions
with much less parenthesis.

This should allow optimized queries to be more readable.
2016-04-09 11:11:25 +02:00
Salvo 'LtWorf' Tomaselli
72318bb0e8 Updated copyright notices
With the last year of modification of the file in question.
2016-03-31 21:45:59 +02:00
Salvo 'LtWorf' Tomaselli
0dd2ef2f1d Style 2016-01-03 09:28:45 +01:00
Salvo 'LtWorf' Tomaselli
cd6bd42a2b Use normal strings in intermediate steps
This uses the CallableString object only in the final step and not
during all the intermediate ones.

Since str is a native object, it is faster to use than a normal
object.

This is a very marginal optimization that will not yield any
gains :)
2015-11-20 15:50:09 +01:00
Salvo 'LtWorf' Tomaselli
3012a08ff3 Removed unused variable 2015-11-11 17:01:52 +01:00
Salvo 'LtWorf' Tomaselli
f7ac34b761 Fix exception
The reported exception will look uglier but will work for any kind of
weird tokenization that occurred.
2015-09-10 10:13:00 +02:00
Salvo 'LtWorf' Tomaselli
20ebf45271 Parser cleanup
The new method works fine to parse also unary operators.

This commit removes the special case.
2015-09-09 17:31:02 +02:00
Salvo 'LtWorf' Tomaselli
6c8b60cf34 Improve error handling
Provide a better error in case of operator missing
2015-09-09 17:28:12 +02:00
Salvo 'LtWorf' Tomaselli
c30456c43e Fix bug in parser
The excessive stripping would cause "peo ple" to be recognized as
the relation "people" rather than an invalid thing.
2015-09-09 17:23:12 +02:00
Salvo 'LtWorf' Tomaselli
5f3564a398 Fix bug in tokenizer
It would not work with relations named like "l3"
2015-09-09 16:48:17 +02:00
Salvo 'LtWorf' Tomaselli
ab46ad2a54 Typo in comments 2015-09-09 15:22:15 +02:00
Salvo 'LtWorf' Tomaselli
7742afd046 Removed redundant comments
Just pointing the documentation towards the website so that
only one copy of it must be kept up to date.
2015-08-05 20:32:57 +02:00
Salvo 'LtWorf' Tomaselli
be7e6fe12d Classes have now names that begin with uppercase
This is more Pythonic and makes the code more readable.

Backwards compatibility is provided by giving an alias with the
previous name of the class.

It will not be broken until the next major release.
2015-07-14 15:39:35 +02:00
Salvo 'LtWorf' Tomaselli
73dd14d9dd Style 2015-07-14 11:01:35 +02:00
Salvo 'LtWorf' Tomaselli
98ac364dc7 Removed encoding string
Not needed in Python 3
2015-07-14 10:43:13 +02:00
Salvo 'LtWorf' Tomaselli
9a570b4386 Use regexp constant
The regexp used was not even the same one…
2015-07-14 10:39:38 +02:00
Salvo 'LtWorf' Tomaselli
33d9545d66 Improved docstring 2015-07-14 10:38:14 +02:00
Salvo 'LtWorf' Tomaselli
9416a9fef9 Removed useless unicode marker from strings
We are using Python3 now, so that is not needed
2015-07-09 23:43:54 +02:00
Salvo 'LtWorf' Tomaselli
4f85a545bf parse function returns a callable string
The python string returned by the parser are now directly callable.

They accept an optional parameter for the context.
2015-07-09 23:35:45 +02:00
Salvo 'LtWorf' Tomaselli
a033cb769a Make header inherit from tupl
Rather than having a header class that contains a list of header,
change it to directly be an immutable tuple.

This simplifies the code because header can now be compared and
indexed like any other tuple.

Code had to be changed all over the place to cope with this new
datatype.
2015-06-06 15:22:11 +02:00
Salvo 'LtWorf' Tomaselli
8cb08ad030 Change relational language to use math symbols
The symbols previously used were a Canadian script, and were looking
good enough, but they might not be installed in every machine.

Besides, all this is to workaround a Qt5 bug that prevents from
rendering those symbols at times.
2015-05-31 19:01:03 +02:00
Salvo 'LtWorf' Tomaselli
991b0d9942 Converted command line interface to Python3 2015-02-19 12:56:21 +01:00
Salvo 'LtWorf' Tomaselli
a355762fc4 Switch core module to Python3
The core module (the relational algebra, not the interface) is now
using Python3

Tests are passing, so it should be ok.
2015-02-19 12:42:41 +01:00
Salvo 'LtWorf' Tomaselli
c8d9e57a50 Get rid of the last remains of galileo 2013-12-27 00:47:48 +01:00
Salvo 'LtWorf' Tomaselli
556eecc118 Changed about and README to not point to galileo anymore 2013-12-27 00:31:43 +01:00
Salvo 'LtWorf' Tomaselli
5433f14b66 Generates tokenizer exception if the value is not unicode 2013-02-10 14:24:52 +01:00
Salvo 'LtWorf' Tomaselli
2e0cbf94a7 - Can convert the expressions into python code objects as well
- Can test that the code objects work as expected too.
2013-02-10 14:11:26 +01:00
LtWorf
0986da8db7 - parser gives more indicative errors
- changed two "range" into xrange


git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@340 014f5005-505e-4b48-8d0a-63407b615a7c
2011-11-01 19:29:55 +00:00
LtWorf
48bde3ea84 - Improved tokenizer
- GUI shows unicode errors (i really can't wait for debian to have pyqt in python 3)



git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@339 014f5005-505e-4b48-8d0a-63407b615a7c
2011-11-01 18:47:03 +00:00
LtWorf
cdd771462d - command line interface using new API
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@333 014f5005-505e-4b48-8d0a-63407b615a7c
2011-10-17 21:26:01 +00:00
LtWorf
9344304f68 - More fixes for unicode...
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@330 014f5005-505e-4b48-8d0a-63407b615a7c
2011-10-15 22:00:17 +00:00
LtWorf
17452f1e0b - migrating to unicode
git-svn-id: http://galileo.dmi.unict.it/svn/relational/trunk@329 014f5005-505e-4b48-8d0a-63407b615a7c
2011-10-15 21:45:33 +00:00