Feature #983

changes to handling expressions

Added by Hirundo almost 10 years ago. Updated almost 10 years ago.

Status:ClosedStart date:2010-06-02
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

I propose some changes to the way expressions and such are handled

- Replace occurrences of basestring with a wrapper class 'Identifier'. I have some code lying around that mostly works, but it needs proper testing to make sure all corner cases are handled properly.
- Make reduce_expr a method of the expression classes. (expr.reduce(...) instead of reduce_expr(expr, ...)) A common base class Expr might help.
- Add a parameter to expr.reduce() that specifies whether to parse the expression to ActionD (default) or varaction2.
- Implement comparisions (using either act2 operator 0x12 or action9)
- Use the global constants in all places.
- Implement the ternary operator.
- Make a quoted string a type of expression. Intermixing numbers and strings is IMO a logical error, not a syntactic one. Operators on strings should fail gracefully, but IMO concatenating literal strings should be possible. This allows using e.g. BASE_PATH + "some.png", with BASE_PATH being replaced by the gcc preprocessor.

I'm putting this stuff on my todo list, but I don't know how much time I'll have to actually work on it.

History

#1 Updated by yexo almost 10 years ago

Hirundo wrote:

I propose some changes to the way expressions and such are handled

- Replace occurrences of basestring with a wrapper class 'Identifier'. I have some code lying around that mostly works, but it needs proper testing to make sure all corner cases are handled properly.

Done, right?

- Make reduce_expr a method of the expression classes. (expr.reduce(...) instead of reduce_expr(expr, ...)) A common base class Expr might help.

Good idea, the current function reduce_expr is very bloated already and I expect it'll only grow.

- Implement comparisions (using either act2 operator 0x12 or action9)

See #985 for this, shouldn't block closing this task as we have another one for it.

- Use the global constants in all places.

In which places is it not yet used? Are all of the current "global constants" really that global? Several of the constants there are only valid for one property. Maybe we should try and keep the list of "global constants" as small as possible and move the other constants to more local places

- Implement the ternary operator.
- Make a quoted string a type of expression. Intermixing numbers and strings is IMO a logical error, not a syntactic one. Operators on strings should fail gracefully, but IMO concatenating literal strings should be possible. This allows using e.g. BASE_PATH + "some.png", with BASE_PATH being replaced by the gcc preprocessor.

First part is done I think, concatenating literal strings should imo wait for the reduce_expr -> expression_object.reduce change.

#2 Updated by yexo almost 10 years ago

Should this issue remain open? As far as I can see all problems are solved.

#3 Updated by yexo almost 10 years ago

  • Status changed from New to Closed

Also available in: Atom PDF