Allow both "maggiore o uguale" and "maggiore uguale" for >=.

Fixes #49.
This commit is contained in:
Stefano Sanfilippo 2020-02-23 09:01:37 +01:00
parent 39c9e3f08c
commit 6c86720a1d
2 changed files with 5 additions and 4 deletions

View File

@ -66,7 +66,7 @@ A typical Makefile-based build workflow would be:
$ make all install
If your tools are installed in non-standard locations
(e.g. Bison Brew on Mac OS X), you can alter the search path with:
(e.g. Homebrew on Mac OS X), you can alter the search path with:
$ PATH=/path/to/ragel cmake ..
@ -170,7 +170,8 @@ They are directly mapped on usual operators as follows:
| maggiore uguale a/di | `>=` |
| minore uguale a/di | `<=` |
So `2 più 4` means `2 + 4`.
So `2 più 4` means `2 + 4`. `maggiore o uguale` is admitted as alternate
form of the >= operator, same for `minore o uguale`.
When evaluating binary expressions whose operands have different types,
the type of the result will be the less restrictive between the two.

View File

@ -44,8 +44,8 @@ initial := |*
"con scappellamento a" => { advanceColumn(); fgoto shift; };
"minore " di => { SET_TOKEN(OP_LT); fbreak; };
"maggiore " di => { SET_TOKEN(OP_GT); fbreak; };
"minore o uguale " ("a"|di) => { SET_TOKEN(OP_LE); fbreak; };
"maggiore o uguale " ("a"|di) => { SET_TOKEN(OP_GE); fbreak; };
"minore " "o "? "uguale " ("a"|di) => { SET_TOKEN(OP_LE); fbreak; };
"maggiore " "o "? "uguale " ("a"|di) => { SET_TOKEN(OP_GE); fbreak; };
"vaffanzum" => { SET_TOKEN(RETURN); fbreak; };
"voglio" => { SET_TOKEN(VARDECL); fbreak; };