Commit Graph

9 Commits

Author SHA1 Message Date
Jasper St. Pierre d5983b587e InputConfigDialog: Don't show "..." for complicated expressions
Just show the actual expression. We need to do a bit of mangling
here as wx has no way to turn off mnemonics parsing, so do that
as well.
2013-06-29 18:28:14 -04:00
Jasper St. Pierre 11fdd5a4ec ExpressionParser: Search for control names first
Otherwise, valid control names like "Cursor X+" would be incorrectly
tokenized as "`Cursor` `X` +", causing the parser to first abort trying to
find a control named `Cursor` rather than aborting with invalid syntax on
the bad binop.

We could also do this by resolving devices lazily, but since simple
control name bindings are going to be 90% of usecases, just look for these
first.
2013-06-27 10:51:19 -04:00
Jasper St. Pierre f53eefb491 ExpressionParser: Add support for simple barewords control names
If an expression can't be parsed normally, we then look to see if it's a
simple device name. This keeps backwards compatibility with simple input
ocnfigurations, where people just used the Detect button.
2013-06-26 20:19:23 -04:00
Jasper St. Pierre 03fdebac09 ExpressionParser: Don't crash when we can't find a device 2013-06-26 16:54:48 -04:00
Jasper St. Pierre 89e84163c2 ExpressionParser: Fix delimiter scanning
We need to make sure we eat the delimiter, otherwise we'll notice
the colon / backtick and think it's either a new control or part
of the control name
2013-06-25 01:44:28 -04:00
Jasper St. Pierre c5c86d17dc InputConfigDiag: Use "..." for complicated expressions
The full expression is quite often too big for a simple button
label, so encourage people to use the full editor to edit it.
2013-06-25 00:58:31 -04:00
Jasper St. Pierre a42388d061 ExpressionParser: Support bare words for simple control names
Using backticks for all control names can get a bit grating,
so support "A & B" instead of requiring "`A` & `B`".
2013-06-25 00:58:30 -04:00
Jasper St. Pierre d2753cce66 ExpressionParser: Add support for the add operator
Use "+" instead of "^" this time.
2013-06-25 00:58:30 -04:00
Jasper St. Pierre 6246f6e815 InputCommon: Add a new ExpressionParser to replace the old hack language
This contains a new, hand-written expression parser to replace the old
hack language based on string munging. The new approach is a simple
AST-based evaluation approach, instead of the "list of operations"
infix-based hack that there was before.

The new language for configuration has support for parentheses, and
counts "!" as a unary operator instead of the binary "NOT OR" operator
it was before. A simple example:

  (X & Y) | !B

Explicit device references, and complex device names ("Right Y+") are
handled with backticks and colons:

  (`SDL/0/6 axis joystick:Right X+` & `DInput/0/Keyboard Mouse:A`)

The basic editor UI that inserts tokens has not been updated to reflect
the new language.
2013-06-25 00:58:30 -04:00