diff --git a/README.md b/README.md index 25d7747..bb7d2b7 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/lexer.rl b/src/lexer.rl index 0263a41..aaf3a27 100644 --- a/src/lexer.rl +++ b/src/lexer.rl @@ -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; };