Commit graph

12 commits

Author SHA1 Message Date
271ea32dcd algo.ShuntingYard.tokenize(): Support double quotes
tokenize() only sorts single quoted strings into QUOTED, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-06-27 09:46:12 +02:00
29f57ec187 algo.ShuntingYard: Add operator()
Signed-off-by: Jan Lindemann <jan@janware.com>
2025-06-09 09:16:48 +02:00
27813efc04 Fix bogus type errors dug up by mypy
Signed-off-by: Jan Lindemann <jan@janware.com>
2024-06-02 12:05:44 +02:00
952bf4a4e1 Fix Python errors reported by mypy
This commit fixes Python errors and warnings reported by static type checking
with mypy.

Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-10 14:17:15 +02:00
faa85f7c69 Flip some more switches from pathon 2 to 3 (untested!)
This commit flips some more switches from Python 2 to Python 3 in makefiles and
Python code. Build runs through, but it's still likely to break things.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-02 14:28:47 +02:00
6dd594d47b Fix multiple Python 3 compatibility issues
Changes in Python 3 that made the code choke:

  o basestring is merged into str
  o print() needs parentesis
  o Class inheritance syntax changed
  o Abstract baseclass (ABCMeta) syntax changed
  o map.iteritems() is replaced by map.items()
  o Inconsistent use of tabs and spaces are no longer tolerated

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-10 16:38:59 +01:00
421ff284cb ShuntingYard.py: Improve tokenize() quote handling
Quoted arguments were not grouped into one token, firstly, because the
parser didn't pay any attention to them, and secondly, because the data
structure carrying the postfixed string converted it back to being a
string, not a list, in column 2 of the result table.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-08-03 10:00:29 +02:00
36aac73b5d Add Object.py and log.py
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-30 18:51:19 +02:00
751afbe93d ShuntingYard: Decrease logging
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-27 17:53:55 +02:00
da6c32255e Make jwutils.algo.Operator a class
This was a namedtuple before, but I couldn't figure out how to ex-/import it
over module boundaries, so I've made it a class.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-27 16:51:48 +02:00
1259b16837 Re-implement ShuntingYard.infix_to_postfix()
The previous implementation had no concept of associativity.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-27 15:18:17 +02:00
81ca793a6e Add algo.ShuntingYard
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-27 09:14:45 +02:00